Search in sources :

Example 6 with MultiProviderAuditor

use of org.nhindirect.common.audit.impl.MultiProviderAuditor in project nhin-d by DirectProject.

the class MultiProviderAuditorProviderTest method testCreateProviderFromAuditorArray.

@Test
public void testCreateProviderFromAuditorArray() {
    MultiProviderAuditorProvider provider = new MultiProviderAuditorProvider(new Auditor[] { new NoOpAuditor(), new LoggingAuditor() });
    assertNotNull(provider);
    assertNotNull(provider.get());
    assertTrue(provider.get() instanceof MultiProviderAuditor);
}
Also used : MultiProviderAuditorProvider(org.nhindirect.common.audit.provider.MultiProviderAuditorProvider) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Example 7 with MultiProviderAuditor

use of org.nhindirect.common.audit.impl.MultiProviderAuditor 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 8 with MultiProviderAuditor

use of org.nhindirect.common.audit.impl.MultiProviderAuditor in project nhin-d by DirectProject.

the class SPIAuditorProviderTest method testCreateSingleAuditorFromSPI_AssertMutliProviderAuditorCreated.

@Test
public void testCreateSingleAuditorFromSPI_AssertMutliProviderAuditorCreated() throws Exception {
    setupSPIImplementation(LoggingAuditor.class);
    setupSPIImplementation(NoOpAuditor.class);
    SPIAuditorProvider prov = new SPIAuditorProvider();
    assertTrue(prov.isImplementationAvailable());
    assertNotNull(prov.get());
    assertTrue(prov.get() instanceof MultiProviderAuditor);
}
Also used : MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) SPIAuditorProvider(org.nhindirect.common.audit.provider.SPIAuditorProvider) Test(org.junit.Test)

Example 9 with MultiProviderAuditor

use of org.nhindirect.common.audit.impl.MultiProviderAuditor in project nhin-d by DirectProject.

the class SPIAuditorProviderTest method testCreateSingleAuditorFromSPI_NullConstructor_AssertMutliProviderAuditorCreated.

@Test
public void testCreateSingleAuditorFromSPI_NullConstructor_AssertMutliProviderAuditorCreated() throws Exception {
    setupSPIImplementation(LoggingAuditor.class);
    setupSPIImplementation(NoOpAuditor.class);
    SPIAuditorProvider prov = new SPIAuditorProvider(null);
    assertTrue(prov.isImplementationAvailable());
    assertNotNull(prov.get());
    assertTrue(prov.get() instanceof MultiProviderAuditor);
}
Also used : MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) SPIAuditorProvider(org.nhindirect.common.audit.provider.SPIAuditorProvider) Test(org.junit.Test)

Example 10 with MultiProviderAuditor

use of org.nhindirect.common.audit.impl.MultiProviderAuditor in project nhin-d by DirectProject.

the class MultiProviderAuditorTest method testAuditCategoryAndMessage_OneAuditorFails.

@Test
public void testAuditCategoryAndMessage_OneAuditorFails() {
    Auditor auditor = new MultiProviderAuditor(Arrays.asList(new LoggingAuditor(), new ExceptionAuditor()));
    auditor.audit(PRINCIPAL, UNIT_TEST_EVENT);
}
Also used : LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Auditor(org.nhindirect.common.audit.Auditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) MultiProviderAuditor(org.nhindirect.common.audit.impl.MultiProviderAuditor) LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)12 MultiProviderAuditor (org.nhindirect.common.audit.impl.MultiProviderAuditor)12 LoggingAuditor (org.nhindirect.common.audit.impl.LoggingAuditor)9 NoOpAuditor (org.nhindirect.common.audit.impl.NoOpAuditor)9 Auditor (org.nhindirect.common.audit.Auditor)7 SPIAuditorProvider (org.nhindirect.common.audit.provider.SPIAuditorProvider)3 MultiProviderAuditorProvider (org.nhindirect.common.audit.provider.MultiProviderAuditorProvider)2 Provider (com.google.inject.Provider)1 DefaultAuditContext (org.nhindirect.common.audit.DefaultAuditContext)1 LoggingAuditorProvider (org.nhindirect.common.audit.provider.LoggingAuditorProvider)1 NoOpAuditorProvider (org.nhindirect.common.audit.provider.NoOpAuditorProvider)1