Search in sources :

Example 1 with ProviderAuditorModule

use of org.nhindirect.common.audit.module.ProviderAuditorModule 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 ProviderAuditorModule

use of org.nhindirect.common.audit.module.ProviderAuditorModule in project nhin-d by DirectProject.

the class AuditorFactory method createAuditor.

/**
	 * Creates an {@link Auditor} using a Guice provider.
	 * @param provider The provider using to create Auditor instances.
	 * @return An new auditor instance.
	 */
public static synchronized Auditor createAuditor(Provider<Auditor> provider) {
    if (provider == null)
        throw new IllegalArgumentException("Provider cannot be null.");
    final ProviderAuditorModule module = ProviderAuditorModule.create(provider);
    final Collection<Module> modules = new ArrayList<Module>();
    modules.add(module);
    return createAuditor(modules);
}
Also used : ProviderAuditorModule(org.nhindirect.common.audit.module.ProviderAuditorModule) ArrayList(java.util.ArrayList) Module(com.google.inject.Module) ProviderAuditorModule(org.nhindirect.common.audit.module.ProviderAuditorModule)

Aggregations

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