Search in sources :

Example 6 with SmtpAgentConfig

use of org.nhindirect.gateway.smtp.config.SmtpAgentConfig in project nhin-d by DirectProject.

the class SmtpAgentConfigModule method configure.

protected void configure() {
    Provider<SmtpAgentConfig> provider = smtpAgentConfigProvider;
    if (provider == null) {
        if (configLocation.getProtocol().equalsIgnoreCase("HTTP") || configLocation.getProtocol().equalsIgnoreCase("HTTPS")) {
            // web services based
            provider = new WSSmtpAgentConfigProvider(configLocation, agentProvider);
        } else {
            // use the default XML configuration
            // convert URL to file location
            File fl = FileUtils.toFile(configLocation);
            provider = new XMLSmtpAgentConfigProvider(fl.getAbsolutePath(), agentProvider);
        }
    }
    bind(SmtpAgentConfig.class).toProvider(provider);
}
Also used : WSSmtpAgentConfigProvider(org.nhindirect.gateway.smtp.provider.WSSmtpAgentConfigProvider) XMLSmtpAgentConfigProvider(org.nhindirect.gateway.smtp.provider.XMLSmtpAgentConfigProvider) File(java.io.File) SmtpAgentConfig(org.nhindirect.gateway.smtp.config.SmtpAgentConfig)

Example 7 with SmtpAgentConfig

use of org.nhindirect.gateway.smtp.config.SmtpAgentConfig in project nhin-d by DirectProject.

the class GatewayState_getSetAttributesTest method testGetSetAttributes_getSetAgentConfig.

public void testGetSetAttributes_getSetAgentConfig() throws Exception {
    GatewayState instance = GatewayState.getInstance();
    instance.setSmptAgentConfig(null);
    assertNull(instance.getSmtpAgentConfig());
    SmtpAgentConfig smtpAgentConfig = mock(SmtpAgentConfig.class);
    instance.setSmptAgentConfig(smtpAgentConfig);
    assertNotNull(instance.getSmtpAgentConfig());
    assertEquals(smtpAgentConfig, instance.getSmtpAgentConfig());
}
Also used : SmtpAgentConfig(org.nhindirect.gateway.smtp.config.SmtpAgentConfig)

Aggregations

SmtpAgentConfig (org.nhindirect.gateway.smtp.config.SmtpAgentConfig)7 XMLSmtpAgentConfigProvider (org.nhindirect.gateway.smtp.provider.XMLSmtpAgentConfigProvider)4 File (java.io.File)2 WSSmtpAgentConfigProvider (org.nhindirect.gateway.smtp.provider.WSSmtpAgentConfigProvider)2 MockNHINDAgent (org.nhindirect.stagent.MockNHINDAgent)2 MockNHINDAgentProvider (org.nhindirect.stagent.provider.MockNHINDAgentProvider)2 Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 MessagingException (javax.mail.MessagingException)1 FileAuditor (org.nhindirect.common.audit.impl.FileAuditor)1 KeyStoreProtectionManager (org.nhindirect.common.crypto.KeyStoreProtectionManager)1 ServiceSecurityManager (org.nhindirect.common.rest.ServiceSecurityManager)1 ServiceException (org.nhindirect.common.rest.exceptions.ServiceException)1 GatewayState (org.nhindirect.gateway.smtp.GatewayState)1 SmtpAgentException (org.nhindirect.gateway.smtp.SmtpAgentException)1 AuditorModule (org.nhindirect.gateway.smtp.module.AuditorModule)1 KeyStoreProtectionConfigProvider (org.nhindirect.gateway.smtp.provider.KeyStoreProtectionConfigProvider)1