use of org.nhindirect.common.audit.impl.MultiProviderAuditor in project nhin-d by DirectProject.
the class AuditorFactoryTest method testCreateAuditor_MultiSPIImplementation_AssertCreatedSPIAuditor.
@Test
public void testCreateAuditor_MultiSPIImplementation_AssertCreatedSPIAuditor() throws Exception {
setupSPIImplementation(NoOpAuditor.class);
setupSPIImplementation(LoggingAuditor.class);
Auditor auditor = AuditorFactory.createAuditor();
assertNotNull(auditor);
assertTrue(auditor instanceof MultiProviderAuditor);
}
use of org.nhindirect.common.audit.impl.MultiProviderAuditor in project nhin-d by DirectProject.
the class SPIAuditorProviderTest method testCreateSingleAuditorFromSPI_NonNullConstructor_AssertMutliProviderAuditorCreated.
@Test
public void testCreateSingleAuditorFromSPI_NonNullConstructor_AssertMutliProviderAuditorCreated() throws Exception {
setupSPIImplementation(LoggingAuditor.class);
setupSPIImplementation(NoOpAuditor.class);
SPIAuditorProvider prov = new SPIAuditorProvider(Auditor.class.getClassLoader());
assertTrue(prov.isImplementationAvailable());
assertNotNull(prov.get());
assertTrue(prov.get() instanceof MultiProviderAuditor);
}
use of org.nhindirect.common.audit.impl.MultiProviderAuditor 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);
}
use of org.nhindirect.common.audit.impl.MultiProviderAuditor 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);
}
use of org.nhindirect.common.audit.impl.MultiProviderAuditor 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);
}
Aggregations