use of org.forgerock.audit.events.handlers.AuditEventHandler in project OpenAM by OpenRock.
the class CsvAuditEventHandlerFactoryTest method shouldCreateCsvEventHandler.
@Test
private void shouldCreateCsvEventHandler() throws AuditException {
// Given
Map<String, Set<String>> configAttributes = new HashMap<>();
configAttributes.put("enabled", singleton("true"));
configAttributes.put("topics", singleton("access"));
configAttributes.put("location", singleton(logDirName));
configAttributes.put("bufferingEnabled", singleton("true"));
configAttributes.put("bufferingAutoFlush", singleton("false"));
AuditEventHandlerConfiguration configuration = AuditEventHandlerConfiguration.builder().withName("CSV Handler").withAttributes(configAttributes).withEventTopicsMetaData(eventTopicsMetaData).build();
// When
AuditEventHandler handler = factory.create(configuration);
// Then
assertThat(handler).isInstanceOf(CsvAuditEventHandler.class);
assertThat(handler.getName()).isEqualTo("CSV Handler");
assertThat(handler.getHandledTopics()).containsExactly("access");
assertThat(handler.isEnabled()).isTrue();
}
use of org.forgerock.audit.events.handlers.AuditEventHandler in project OpenAM by OpenRock.
the class CsvAuditEventHandlerFactoryTest method shouldCreateCsvEventHandlerWhenDisabled.
@Test
private void shouldCreateCsvEventHandlerWhenDisabled() throws AuditException {
// Given
Map<String, Set<String>> configAttributes = new HashMap<>();
configAttributes.put("enabled", singleton("false"));
configAttributes.put("topics", singleton("access"));
configAttributes.put("location", singleton(logDirName));
configAttributes.put("bufferingEnabled", singleton("true"));
configAttributes.put("bufferingAutoFlush", singleton("false"));
AuditEventHandlerConfiguration configuration = AuditEventHandlerConfiguration.builder().withName("CSV Handler").withAttributes(configAttributes).withEventTopicsMetaData(eventTopicsMetaData).build();
// When
AuditEventHandler handler = factory.create(configuration);
// Then
assertThat(handler).isInstanceOf(CsvAuditEventHandler.class);
assertThat(handler.getName()).isEqualTo("CSV Handler");
assertThat(handler.getHandledTopics()).containsExactly("access");
assertThat(handler.isEnabled()).isFalse();
}
use of org.forgerock.audit.events.handlers.AuditEventHandler in project OpenAM by OpenRock.
the class JdbcAuditEventHandlerFactoryTest method shouldCreateJdbcEventHandler.
@Test
private void shouldCreateJdbcEventHandler() throws AuditException {
// Given
AuditEventHandlerConfiguration configuration = AuditEventHandlerConfiguration.builder().withName("JDBC Handler").withAttributes(configAttributes).withEventTopicsMetaData(eventTopicsMetaData).build();
// When
AuditEventHandler handler = factory.create(configuration);
// Then
assertThat(handler).isInstanceOf(JdbcAuditEventHandler.class);
assertThat(handler.getName()).isEqualTo("JDBC Handler");
assertThat(handler.getHandledTopics()).containsExactly("access");
assertThat(handler.isEnabled()).isTrue();
}
use of org.forgerock.audit.events.handlers.AuditEventHandler in project OpenAM by OpenRock.
the class SyslogAuditEventHandlerFactoryTest method shouldCreateSyslogEventHandler.
@Test
private void shouldCreateSyslogEventHandler() throws AuditException {
// Given
AuditEventHandlerConfiguration configuration = AuditEventHandlerConfiguration.builder().withName("Syslog Handler").withAttributes(configAttributes).withEventTopicsMetaData(eventTopicsMetaData).build();
// When
AuditEventHandler handler = factory.create(configuration);
// Then
assertThat(handler).isInstanceOf(SyslogAuditEventHandler.class);
assertThat(handler.getName()).isEqualTo("Syslog Handler");
assertThat(handler.getHandledTopics()).containsExactly("access");
assertThat(handler.isEnabled()).isTrue();
}
Aggregations