use of org.forgerock.openam.audit.configuration.AMAuditServiceConfiguration in project OpenAM by OpenRock.
the class AuditServiceProviderImplTest method shouldNotRegisterHandlersWhenDefaultAuditServiceDisabled.
@Test
public void shouldNotRegisterHandlersWhenDefaultAuditServiceDisabled() throws Exception {
// Given
auditServiceConfig = new AMAuditServiceConfiguration(false);
// When
configListener.globalConfigurationChanged();
// Then
assertThat(provider.getDefaultAuditService().getRegisteredHandler("Mock Handler")).isNull();
}
use of org.forgerock.openam.audit.configuration.AMAuditServiceConfiguration in project OpenAM by OpenRock.
the class AuditEventPublisherImplTest method givenDefaultAuditService.
private void givenDefaultAuditService() throws ServiceUnavailableException, AuditException {
AMAuditServiceConfiguration serviceConfig = new AMAuditServiceConfiguration(true);
AuditServiceBuilder builder = AuditServiceBuilder.newAuditService().withConfiguration(serviceConfig).withAuditEventHandler(mockHandler);
AMAuditService auditService = new DefaultAuditServiceProxy(builder.build(), serviceConfig);
auditService.startup();
when(auditServiceProvider.getDefaultAuditService()).thenReturn(auditService);
}
use of org.forgerock.openam.audit.configuration.AMAuditServiceConfiguration in project OpenAM by OpenRock.
the class AuditEventPublisherImplTest method givenSuppressedFailureAuditService.
private void givenSuppressedFailureAuditService() throws ServiceUnavailableException, AuditException {
AMAuditServiceConfiguration serviceConfig = new AMAuditServiceConfiguration(true);
AuditServiceBuilder builder = AuditServiceBuilder.newAuditService().withConfiguration(serviceConfig).withAuditEventHandler(mockHandler);
AMAuditService auditService = new RealmAuditServiceProxy(builder.build(), mock(AMAuditService.class), serviceConfig);
auditService.startup();
when(auditServiceProvider.getAuditService(FAILURE_SUPPRESSED_REALM)).thenReturn(auditService);
}
use of org.forgerock.openam.audit.configuration.AMAuditServiceConfiguration in project OpenAM by OpenRock.
the class AuditServiceProviderImpl method refreshRealmAuditService.
private void refreshRealmAuditService(String realm) {
AMAuditServiceConfiguration configuration = configProvider.getRealmConfiguration(realm);
AuditServiceBuilder builder = AuditServiceBuilder.newAuditService().withEventTopicsMetaData(eventTopicsMetaData).withConfiguration(configuration);
if (configuration.isAuditEnabled()) {
configureEventHandlers(builder, configProvider.getRealmEventHandlerConfigurations(realm));
}
AMAuditService auditService = auditServices.get(realm);
try {
if (auditService == null) {
auditService = new RealmAuditServiceProxy(builder.build(), defaultAuditService, configuration);
auditService.startup();
auditServices.put(realm, auditService);
} else {
auditService.setDelegate(builder.build(), configuration);
}
} catch (ServiceUnavailableException e) {
debug.error("New Audit Service configuration for realm {} failed.", e, realm);
// remove it so that we can fall back to the default service
auditServices.remove(realm);
}
}
use of org.forgerock.openam.audit.configuration.AMAuditServiceConfiguration in project OpenAM by OpenRock.
the class AuditServiceProviderImpl method createDefaultAuditService.
private DefaultAuditServiceProxy createDefaultAuditService() {
AMAuditServiceConfiguration configuration = new AMAuditServiceConfiguration(false);
configuration.setAvailableAuditEventHandlers(Collections.<String>emptyList());
AuditServiceBuilder builder = AuditServiceBuilder.newAuditService().withEventTopicsMetaData(eventTopicsMetaData).withConfiguration(configuration);
DefaultAuditServiceProxy auditServiceProxy = new DefaultAuditServiceProxy(builder.build(), configuration);
try {
auditServiceProxy.startup();
} catch (ServiceUnavailableException e) {
debug.error("Default Audit Service configuration failed.", e);
}
return auditServiceProxy;
}
Aggregations