Skip to content

Commit

Permalink
skip test that will fail if current user is non-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
bhamail committed Jan 24, 2013
1 parent f10c45b commit be0e5b5
Show file tree
Hide file tree
Showing 2 changed files with 465 additions and 453 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,16 @@ public void testReportEvent() {
String applicationEventLog = "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application";
String jnaEventSource = "JNADevEventSource";
String jnaEventSourceRegistryPath = applicationEventLog + "\\" + jnaEventSource;
Advapi32Util.registryCreateKey(WinReg.HKEY_LOCAL_MACHINE, jnaEventSourceRegistryPath);
// ignore test if not able to create key (need to be administrator to do this).
try {
final boolean keyCreated = Advapi32Util.registryCreateKey(WinReg.HKEY_LOCAL_MACHINE, jnaEventSourceRegistryPath);
if (!keyCreated) {
return;
}
} catch (Win32Exception e) {
return;
}

HANDLE h = Advapi32.INSTANCE.RegisterEventSource(null, jnaEventSource);
IntByReference before = new IntByReference();
assertTrue(Advapi32.INSTANCE.GetNumberOfEventLogRecords(h, before));
Expand Down
Loading

0 comments on commit be0e5b5

Please sign in to comment.