use of com.dexels.navajo.events.types.AuditLogEvent in project navajo by Dexels.
the class NavajoEventRegistryTest method testPublishAsynchronousEvent.
@Test
public void testPublishAsynchronousEvent() {
final Object semaphore = new Object();
NavajoEventRegistry instance = NavajoEventRegistry.getInstance();
instance.addListener(AuditLogEvent.class, new NavajoListener() {
@Override
public void onNavajoEvent(NavajoEvent ne) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
logger.error("Error: ", e);
}
message = "Received AuditLogEvent!";
System.err.println(message);
synchronized (semaphore) {
semaphore.notify();
}
}
});
message = null;
instance.publishAsynchronousEvent(new AuditLogEvent("", "", Level.INFO));
// Should still be null....
Assert.assertNull(message);
synchronized (semaphore) {
try {
semaphore.wait(2000);
} catch (InterruptedException e) {
logger.error("Error: ", e);
}
}
// Now it should have a value...
Assert.assertEquals(message, "Received AuditLogEvent!");
}
use of com.dexels.navajo.events.types.AuditLogEvent in project navajo by Dexels.
the class NavajoEventRegistryTest method testPublishEvent.
@Test
public void testPublishEvent() {
NavajoEventRegistry instance = NavajoEventRegistry.getInstance();
instance.addListener(AuditLogEvent.class, new NavajoListener() {
@Override
public void onNavajoEvent(NavajoEvent ne) {
message = "Received AuditLogEvent!";
System.err.println(message);
}
});
instance.publishEvent(new AuditLogEvent("", "", Level.INFO));
Assert.assertEquals(message, "Received AuditLogEvent!");
}
use of com.dexels.navajo.events.types.AuditLogEvent in project navajo by Dexels.
the class AuditLog method store.
@Override
public void store() throws MappableException, UserException {
AuditLogEvent ale = new AuditLogEvent(AUDIT_MESSAGE_USER, getMessage(), getLevel());
ale.setAccessId(accessId);
publishEvent(ale);
}
use of com.dexels.navajo.events.types.AuditLogEvent in project navajo by Dexels.
the class AuditLog method log.
public static final void log(String subsystem, final String message, Throwable t, Level level, String accessId) {
logToSlf(message, t, level);
AuditLogEvent ale = new AuditLogEvent(subsystem.toUpperCase(), message, level);
ale.setAccessId(accessId);
publishEvent(ale);
}
use of com.dexels.navajo.events.types.AuditLogEvent in project navajo by Dexels.
the class AuditLog method log.
public static final void log(final String subsystem, final String message, Level level, String accessId) {
logToSlf(message, subsystem, level);
AuditLogEvent ale = new AuditLogEvent(subsystem.toUpperCase(), message, level);
ale.setAccessId(accessId);
publishEvent(ale);
}
Aggregations