Search in sources :

Example 1 with LoggingAuditor

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

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

the class AuditorFactoryTest method testCreateAuditor_NoSPI_AssertCreatedDefaultAuditor.

@Test
public void testCreateAuditor_NoSPI_AssertCreatedDefaultAuditor() {
    Auditor auditor = AuditorFactory.createAuditor();
    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) LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Example 3 with LoggingAuditor

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

the class SPIAuditorProviderTest method testCreateSingleAuditorFromSPI_AssertAuditorInstanceOf.

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

Example 4 with LoggingAuditor

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

the class LoggingAuditorTest method testAuditEvent.

@Test
public void testAuditEvent() {
    LoggingAuditor auditor = new LoggingAuditor();
    auditor.audit(PRINCIPAL, UNIT_TEST_EVENT);
}
Also used : LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Example 5 with LoggingAuditor

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

the class LoggingAuditorTest method testAudit_NullEvent_AssertExeption.

@Test
public void testAudit_NullEvent_AssertExeption() {
    LoggingAuditor auditor = new LoggingAuditor();
    boolean exceptionOccured = false;
    try {
        auditor.audit(PRINCIPAL, null);
    } catch (IllegalArgumentException e) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : LoggingAuditor(org.nhindirect.common.audit.impl.LoggingAuditor) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)16 LoggingAuditor (org.nhindirect.common.audit.impl.LoggingAuditor)16 MultiProviderAuditor (org.nhindirect.common.audit.impl.MultiProviderAuditor)10 NoOpAuditor (org.nhindirect.common.audit.impl.NoOpAuditor)10 Auditor (org.nhindirect.common.audit.Auditor)6 DefaultAuditContext (org.nhindirect.common.audit.DefaultAuditContext)2 LoggingAuditorProvider (org.nhindirect.common.audit.provider.LoggingAuditorProvider)2 Module (com.google.inject.Module)1 ArrayList (java.util.ArrayList)1 ProviderAuditorModule (org.nhindirect.common.audit.module.ProviderAuditorModule)1 MultiProviderAuditorProvider (org.nhindirect.common.audit.provider.MultiProviderAuditorProvider)1 SPIAuditorProvider (org.nhindirect.common.audit.provider.SPIAuditorProvider)1