INT-1712 fixed the way MailOutboundChannelAdapterParser sets the javaMailProperties

This commit is contained in:
Oleg Zhurakousky
2010-12-22 15:42:14 -05:00
parent aef94f10df
commit b4d56160ec
4 changed files with 38 additions and 1 deletions

View File

@@ -54,5 +54,17 @@ public class MailOutboundChannelAdapterParserTests {
MailSender mailSender = (MailSender) fieldAccessor.getPropertyValue("mailSender");
assertNotNull(mailSender);
}
@Test
public void adapterWithJavaMailProperties() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"MailOutboundWithJavamailProperties-context.xml", this.getClass());
Object adapter = context.getBean("adapterWithHostProperty.adapter");
MailSendingMessageHandler handler = (MailSendingMessageHandler)
new DirectFieldAccessor(adapter).getPropertyValue("handler");
DirectFieldAccessor fieldAccessor = new DirectFieldAccessor(handler);
MailSender mailSender = (MailSender) fieldAccessor.getPropertyValue("mailSender");
assertNotNull(mailSender);
}
}

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/integration/mail http://www.springframework.org/schema/integration/mail/spring-integration-mail-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"
xmlns:int-mail="http://www.springframework.org/schema/integration/mail"
xmlns:util="http://www.springframework.org/schema/util">
<int-mail:outbound-channel-adapter
id="adapterWithHostProperty" host="somehost" username="someuser"
password="somepassword" java-mail-properties="javaMailProperties"/>
<util:properties id="javaMailProperties">
<prop key="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
<prop key="mail.imap.socketFactory.fallback">false</prop>
<prop key="mail.store.protocol">imaps</prop>
<prop key="mail.transport.protocol">smtps</prop>
<prop key="mail.smtps.auth">true</prop>
<prop key="mail.smtp.starttls.enable">true</prop>
<prop key="mail.debug">false</prop>
</util:properties>
</beans>