Search in sources :

Example 1 with FileAuditor

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

the class SmtpAgentFactory_CreateAgent_Test method testCreateDefaultAgent_XMLConfigurationProvider_AuditorModule.

public void testCreateDefaultAgent_XMLConfigurationProvider_AuditorModule() throws Exception {
    Provider<SmtpAgentConfig> configProvider = new XMLSmtpAgentConfigProvider(TestUtils.getTestConfigFile("ValidConfig.xml"), new MockNHINDAgentProvider(Arrays.asList("mydomain")));
    SmtpAgent agent = SmtpAgentFactory.createAgent(null, configProvider, new MockNHINDAgentProvider(Arrays.asList("mydomain")), Arrays.asList(FileAuditorModule.create("target/AuditFile.txt")));
    assertNotNull(agent);
    assertNotNull(agent.getAgent());
    assertTrue(agent.getAgent() instanceof MockNHINDAgent);
    DefaultSmtpAgent smtpAgent = (DefaultSmtpAgent) agent;
    assertNotNull(smtpAgent.getAuditor());
    assertTrue(smtpAgent.getAuditor() instanceof FileAuditor);
}
Also used : MockNHINDAgent(org.nhindirect.stagent.MockNHINDAgent) XMLSmtpAgentConfigProvider(org.nhindirect.gateway.smtp.provider.XMLSmtpAgentConfigProvider) MockNHINDAgentProvider(org.nhindirect.stagent.provider.MockNHINDAgentProvider) SmtpAgentConfig(org.nhindirect.gateway.smtp.config.SmtpAgentConfig) FileAuditor(org.nhindirect.common.audit.impl.FileAuditor)

Example 2 with FileAuditor

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

the class FileAuditorProviderTest method testCreateProviderFromFile.

@Test
public void testCreateProviderFromFile() {
    FileAuditorProvider provider = new FileAuditorProvider(new File(testFileName));
    assertNotNull(provider.get());
    assertTrue(provider.get() instanceof FileAuditor);
}
Also used : File(java.io.File) FileAuditor(org.nhindirect.common.audit.impl.FileAuditor) Test(org.junit.Test)

Aggregations

FileAuditor (org.nhindirect.common.audit.impl.FileAuditor)2 File (java.io.File)1 Test (org.junit.Test)1 SmtpAgentConfig (org.nhindirect.gateway.smtp.config.SmtpAgentConfig)1 XMLSmtpAgentConfigProvider (org.nhindirect.gateway.smtp.provider.XMLSmtpAgentConfigProvider)1 MockNHINDAgent (org.nhindirect.stagent.MockNHINDAgent)1 MockNHINDAgentProvider (org.nhindirect.stagent.provider.MockNHINDAgentProvider)1