Search in sources :

Example 1 with NoOpAuditor

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

the class MultiProviderAuditorTest method testAuditEvent.

@Test
public void testAuditEvent() {
    Auditor auditor = new MultiProviderAuditor(Arrays.asList(new LoggingAuditor(), new NoOpAuditor()));
    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) NoOpAuditor(org.nhindirect.common.audit.impl.NoOpAuditor) LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Example 2 with NoOpAuditor

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

the class MultiProviderAuditorTest method testAuditCategoryAndMessage_EmptyPrincipal_AssertExeption.

@Test
public void testAuditCategoryAndMessage_EmptyPrincipal_AssertExeption() {
    Auditor auditor = new MultiProviderAuditor(Arrays.asList(new LoggingAuditor(), new NoOpAuditor()));
    boolean exceptionOccured = false;
    try {
        auditor.audit("", UNIT_TEST_EVENT);
    } 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 3 with NoOpAuditor

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

the class MultiProviderAuditorTest method testAudit_NullPrincipal_AssertExeption.

@Test
public void testAudit_NullPrincipal_AssertExeption() {
    Auditor auditor = new MultiProviderAuditor(Arrays.asList(new LoggingAuditor(), new NoOpAuditor()));
    boolean exceptionOccured = false;
    try {
        auditor.audit(null, UNIT_TEST_EVENT);
    } 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 4 with NoOpAuditor

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

use of org.nhindirect.common.audit.impl.NoOpAuditor 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)

Aggregations

Test (org.junit.Test)7 LoggingAuditor (org.nhindirect.common.audit.impl.LoggingAuditor)7 MultiProviderAuditor (org.nhindirect.common.audit.impl.MultiProviderAuditor)7 NoOpAuditor (org.nhindirect.common.audit.impl.NoOpAuditor)7 Auditor (org.nhindirect.common.audit.Auditor)5 DefaultAuditContext (org.nhindirect.common.audit.DefaultAuditContext)1 MultiProviderAuditorProvider (org.nhindirect.common.audit.provider.MultiProviderAuditorProvider)1