Search in sources :

Example 1 with LoggingAuditorProvider

use of org.nhindirect.common.audit.provider.LoggingAuditorProvider in project nhin-d by DirectProject.

the class AuditorFactoryTest method testCreateAuditor_SingleModule_AssertCreatedAuditor.

@Test
public void testCreateAuditor_SingleModule_AssertCreatedAuditor() throws Exception {
    LoggingAuditorProvider provider = new LoggingAuditorProvider();
    ProviderAuditorModule module = ProviderAuditorModule.create(provider);
    Collection<Module> modules = new ArrayList<Module>();
    modules.add(module);
    Auditor auditor = AuditorFactory.createAuditor(modules);
    assertNotNull(auditor);
    assertTrue(auditor instanceof LoggingAuditor);
}
Also used : LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) LoggingAuditorProvider(org.nhindirect.common.audit.provider.LoggingAuditorProvider) ProviderAuditorModule(org.nhindirect.common.audit.module.ProviderAuditorModule) ArrayList(java.util.ArrayList) Module(com.google.inject.Module) ProviderAuditorModule(org.nhindirect.common.audit.module.ProviderAuditorModule) LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Example 2 with LoggingAuditorProvider

use of org.nhindirect.common.audit.provider.LoggingAuditorProvider in project nhin-d by DirectProject.

the class AuditorFactory method createAuditor.

/**
	 * Creates an {@link Auditor} by searching for configured implementations using Java SPI.  If no implementation are found, a default
	 * instance using the configured logging sub-system is created.
	 * @return An new auditor instance.
	 */
public static synchronized Auditor createAuditor() {
    final SPIAuditorProvider spiProv = new SPIAuditorProvider();
    final Provider<Auditor> provider = spiProv.isImplementationAvailable() ? spiProv : new LoggingAuditorProvider();
    return createAuditor(provider);
}
Also used : LoggingAuditorProvider(org.nhindirect.common.audit.provider.LoggingAuditorProvider) SPIAuditorProvider(org.nhindirect.common.audit.provider.SPIAuditorProvider)

Example 3 with LoggingAuditorProvider

use of org.nhindirect.common.audit.provider.LoggingAuditorProvider in project nhin-d by DirectProject.

the class MultiProviderAuditorProviderTest method testCreateProviderFromAuditorcollection.

@SuppressWarnings("unchecked")
@Test
public void testCreateProviderFromAuditorcollection() {
    Provider<Auditor>[] provs = new Provider[2];
    provs[0] = new NoOpAuditorProvider();
    provs[1] = new LoggingAuditorProvider();
    MultiProviderAuditorProvider provider = new MultiProviderAuditorProvider(provs);
    assertNotNull(provider);
    assertNotNull(provider.get());
    assertTrue(provider.get() instanceof MultiProviderAuditor);
}
Also used : LoggingAuditorProvider(org.nhindirect.common.audit.provider.LoggingAuditorProvider) MultiProviderAuditorProvider(org.nhindirect.common.audit.provider.MultiProviderAuditorProvider) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditorProvider(org.nhindirect.common.audit.provider.NoOpAuditorProvider) LoggingAuditorProvider(org.nhindirect.common.audit.provider.LoggingAuditorProvider) Provider(com.google.inject.Provider) NoOpAuditorProvider(org.nhindirect.common.audit.provider.NoOpAuditorProvider) MultiProviderAuditorProvider(org.nhindirect.common.audit.provider.MultiProviderAuditorProvider) Test(org.junit.Test)

Example 4 with LoggingAuditorProvider

use of org.nhindirect.common.audit.provider.LoggingAuditorProvider in project nhin-d by DirectProject.

the class AuditorFactoryTest method testCreateAuditor_SingleProvider_AssertCreatedAuditor.

@Test
public void testCreateAuditor_SingleProvider_AssertCreatedAuditor() throws Exception {
    LoggingAuditorProvider proviver = new LoggingAuditorProvider();
    Auditor auditor = AuditorFactory.createAuditor(proviver);
    assertNotNull(auditor);
    assertTrue(auditor instanceof LoggingAuditor);
}
Also used : LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) LoggingAuditorProvider(org.nhindirect.common.audit.provider.LoggingAuditorProvider) LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Aggregations

LoggingAuditorProvider (org.nhindirect.common.audit.provider.LoggingAuditorProvider)4 Test (org.junit.Test)3 MultiProviderAuditor (org.nhindirect.common.audit.impl.MultiProviderAuditor)3 LoggingAuditor (org.nhindirect.common.audit.impl.LoggingAuditor)2 NoOpAuditor (org.nhindirect.common.audit.impl.NoOpAuditor)2 Module (com.google.inject.Module)1 Provider (com.google.inject.Provider)1 ArrayList (java.util.ArrayList)1 ProviderAuditorModule (org.nhindirect.common.audit.module.ProviderAuditorModule)1 MultiProviderAuditorProvider (org.nhindirect.common.audit.provider.MultiProviderAuditorProvider)1 NoOpAuditorProvider (org.nhindirect.common.audit.provider.NoOpAuditorProvider)1 SPIAuditorProvider (org.nhindirect.common.audit.provider.SPIAuditorProvider)1