use of org.nhindirect.common.audit.provider.SPIAuditorProvider 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.provider.SPIAuditorProvider 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);
}
use of org.nhindirect.common.audit.provider.SPIAuditorProvider in project nhin-d by DirectProject.
the class SPIAuditorProviderTest method testNoSPIAvailable_AssertNullAuditor.
@Test
public void testNoSPIAvailable_AssertNullAuditor() throws Exception {
SPIAuditorProvider prov = new SPIAuditorProvider();
assertFalse(prov.isImplementationAvailable());
assertNull(prov.get());
}
use of org.nhindirect.common.audit.provider.SPIAuditorProvider in project nhin-d by DirectProject.
the class AuditorFactory method createAuditor.
/**
* Creates an {@link Auditor} by searching for configured implementations using Java SPI. If no implementation are found, a default
* instance using the configured logging sub-system is created.
* @return An new auditor instance.
*/
public static synchronized Auditor createAuditor() {
final SPIAuditorProvider spiProv = new SPIAuditorProvider();
final Provider<Auditor> provider = spiProv.isImplementationAvailable() ? spiProv : new LoggingAuditorProvider();
return createAuditor(provider);
}
use of org.nhindirect.common.audit.provider.SPIAuditorProvider 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);
}
Aggregations