Search in sources :

Example 11 with MultiProviderAuditor

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

the class MultiProviderAuditorTest method testAudit_NullEvent_AssertExeption.

@Test
public void testAudit_NullEvent_AssertExeption() {
    Auditor auditor = new MultiProviderAuditor(Arrays.asList(new LoggingAuditor(), new NoOpAuditor()));
    boolean exceptionOccured = false;
    try {
        auditor.audit(PRINCIPAL, null);
    } catch (IllegalArgumentException e) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
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) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Example 12 with MultiProviderAuditor

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

the class MultiProviderAuditorTest method testAuditWithContext.

@Test
public void testAuditWithContext() {
    Auditor auditor = new MultiProviderAuditor(Arrays.asList(new LoggingAuditor(), new NoOpAuditor()));
    Collection<? extends AuditContext> ctx = Arrays.asList(new DefaultAuditContext("name", "value"));
    auditor.audit(PRINCIPAL, UNIT_TEST_EVENT, ctx);
}
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) DefaultAuditContext(org.nhindirect.common.audit.DefaultAuditContext) 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)

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