Migrated Mail Channel Adapter code from 'org.springframework.integration.adapter' to the new 'org.springframework.integration.mail' module.

This commit is contained in:
Mark Fisher
2008-09-22 15:16:47 +00:00
parent f8b3f99d19
commit db7bc0b9ea
49 changed files with 220 additions and 112 deletions

View File

@@ -1,3 +0,0 @@
mail-target=org.springframework.integration.adapter.mail.config.MailTargetParser
polling-mail-source=org.springframework.integration.adapter.mail.config.PollingMailSourceParser
imap-idle-mail-source=org.springframework.integration.adapter.mail.config.SubscribableImapIdleMailSourceParser

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<si:polling-mail-source id="pollingPop3" store-uri="pop3://mailtest:mailtest@ubuntuservervm/INBOX" />
</beans>

View File

@@ -17,5 +17,6 @@
<classpathentry kind="var" path="IVY_CACHE/org.easymock/com.springsource.org.easymock.classextension/2.3.0/com.springsource.org.easymock.classextension-2.3.0.jar" sourcepath="/IVY_CACHE/org.easymock/com.springsource.org.easymock.classextension/2.3.0/com.springsource.org.easymock.classextension-sources-2.3.0.jar"/>
<classpathentry kind="var" path="IVY_CACHE/net.sourceforge.cglib/com.springsource.net.sf.cglib/2.1.3/com.springsource.net.sf.cglib-2.1.3.jar" sourcepath="/IVY_CACHE/net.sourceforge.cglib/com.springsource.net.sf.cglib/2.1.3/com.springsource.net.sf.cglib-sources-2.1.3.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.integration"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.springframework.integration.adapter"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -29,6 +29,7 @@
<dependency org="org.springframework" name="org.springframework.context.support" rev="2.5.5.A" conf="compile->runtime"/>
<dependency org="org.springframework" name="org.springframework.test" rev="2.5.5.A" conf="test->runtime"/>
<dependency org="org.springframework.integration" name="org.springframework.integration" rev="latest.integration" conf="compile->compile"/>
<dependency org="org.springframework.integration" name="org.springframework.integration.adapter" rev="latest.integration" conf="compile->compile"/>
</dependencies>
</ivy-module>

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import java.util.HashMap;
import java.util.Map;
@@ -25,6 +25,7 @@ import javax.mail.internet.MimeMessage;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.integration.adapter.MessageHeaderMapper;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageHeaders;
@@ -32,9 +33,7 @@ import org.springframework.integration.message.MessagingException;
import org.springframework.mail.javamail.MimeMailMessage;
/**
*
* @author Jonas Partner
*
*/
public abstract class AbstractMailHeaderMapper implements MessageHeaderMapper<MimeMessage> {

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import java.util.Properties;
@@ -26,21 +27,21 @@ import javax.mail.URLName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.Lifecycle;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.adapter.mail.monitor.AsyncMonitoringStrategy;
import org.springframework.integration.adapter.mail.monitor.MailTransportUtils;
import org.springframework.integration.adapter.mail.monitor.MonitoringStrategy;
import org.springframework.integration.mail.monitor.AsyncMonitoringStrategy;
import org.springframework.integration.mail.monitor.MailTransportUtils;
import org.springframework.integration.mail.monitor.MonitoringStrategy;
import org.springframework.util.Assert;
/**
* A Connection to a mail folder capable of retrieving mail by utilising the
* given instance of {@link MonitoringStrategy}
* A Connection to a mail folder capable of retrieving mail by utilizing the
* given instance of {@link MonitoringStrategy}.
*
* @author Jonas Partner
*
*/
public class DefaultFolderConnection implements Lifecycle, InitializingBean,
DisposableBean, FolderConnection {

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import org.springframework.integration.message.Message;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import java.util.Map;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,13 +14,12 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import org.springframework.integration.message.MessageHeaders;
/**
* @author Jonas Partner
*
*/
public class DefaultMailMessageHeaderMapper extends AbstractMailHeaderMapper {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import javax.mail.Folder;
import javax.mail.Message;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import org.springframework.integration.message.Message;
import org.springframework.mail.MailMessage;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
/**
* Pre-defined names and prefixes to be used for setting and/or retrieving Mail attributes

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import javax.mail.internet.MimeMessage;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.integration.message.Message;

View File

@@ -14,15 +14,16 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import javax.mail.internet.MimeMessage;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.integration.adapter.mail.monitor.DefaultLocalMailMessageStore;
import org.springframework.integration.adapter.mail.monitor.LocalMailMessageStore;
import org.springframework.integration.adapter.mail.monitor.MonitoringStrategy;
import org.springframework.integration.mail.monitor.DefaultLocalMailMessageStore;
import org.springframework.integration.mail.monitor.LocalMailMessageStore;
import org.springframework.integration.mail.monitor.MonitoringStrategy;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageSource;
import org.springframework.integration.message.PollableSource;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import org.springframework.integration.message.Message;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import javax.mail.Message;
import javax.mail.internet.MimeMessage;
@@ -25,8 +25,8 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.context.Lifecycle;
import org.springframework.core.task.TaskExecutor;
import org.springframework.integration.adapter.mail.monitor.AsyncMonitoringStrategy;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.mail.monitor.AsyncMonitoringStrategy;
import org.springframework.integration.message.MessageSource;
import org.springframework.integration.message.MessageTarget;
import org.springframework.util.Assert;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageMapper;

View File

@@ -0,0 +1,34 @@
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.mail.config;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
/**
* Namespace handler for the 'mail' namespace.
*
* @author Mark Fisher
*/
public class MailNamespaceHandler extends NamespaceHandlerSupport {
public void init() {
this.registerBeanDefinitionParser("mail-target", new MailTargetParser());
this.registerBeanDefinitionParser("polling-mail-source", new PollingMailSourceParser());
this.registerBeanDefinitionParser("imap-idle-mail-source", new SubscribableImapIdleMailSourceParser());
}
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.config;
package org.springframework.integration.mail.config;
import org.w3c.dom.Element;
@@ -22,7 +22,7 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.adapter.mail.MailTarget;
import org.springframework.integration.mail.MailTarget;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.util.StringUtils;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,24 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.config;
package org.springframework.integration.mail.config;
import org.w3c.dom.Element;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.adapter.mail.DefaultFolderConnection;
import org.springframework.integration.adapter.mail.PollingMailSource;
import org.springframework.integration.adapter.mail.monitor.MonitoringStrategy;
import org.springframework.integration.adapter.mail.monitor.PollingMonitoringStrategy;
import org.springframework.integration.adapter.mail.monitor.Pop3PollingMonitoringStrategy;
import org.springframework.integration.mail.DefaultFolderConnection;
import org.springframework.integration.mail.PollingMailSource;
import org.springframework.integration.mail.monitor.MonitoringStrategy;
import org.springframework.integration.mail.monitor.PollingMonitoringStrategy;
import org.springframework.integration.mail.monitor.Pop3PollingMonitoringStrategy;
import org.springframework.util.StringUtils;
import org.w3c.dom.Element;
/**
*
* @author Jonas Partner
*
*/
public class PollingMailSourceParser extends AbstractSingleBeanDefinitionParser {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,22 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.config;
package org.springframework.integration.mail.config;
import org.w3c.dom.Element;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.adapter.mail.DefaultFolderConnection;
import org.springframework.integration.adapter.mail.SubscribableMailSource;
import org.springframework.integration.adapter.mail.monitor.ImapIdleMonitoringStrategy;
import org.springframework.integration.mail.DefaultFolderConnection;
import org.springframework.integration.mail.SubscribableMailSource;
import org.springframework.integration.mail.monitor.ImapIdleMonitoringStrategy;
import org.springframework.util.StringUtils;
import org.w3c.dom.Element;
/**
*
* @author Jonas Partner
*
*/
public class SubscribableImapIdleMailSourceParser extends
AbstractSingleBeanDefinitionParser {

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.springframework.org/schema/integration/mail"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:tool="http://www.springframework.org/schema/tool"
targetNamespace="http://www.springframework.org/schema/integration/mail"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/schema/beans"/>
<xsd:import namespace="http://www.springframework.org/schema/tool"/>
<xsd:annotation>
<xsd:documentation><![CDATA[
Defines the configuration elements for Spring Integration's Mail Channel Adapters.
]]></xsd:documentation>
</xsd:annotation>
<xsd:element name="mail-target">
<xsd:complexType>
<xsd:annotation>
<xsd:documentation>
Defines a mail-sending target.
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="mail-sender" type="xsd:string"/>
<xsd:attribute name="header-generator" type="xsd:string"/>
<xsd:attribute name="host" type="xsd:string"/>
<xsd:attribute name="username" type="xsd:string"/>
<xsd:attribute name="password" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="polling-mail-source">
<xsd:complexType>
<xsd:annotation>
<xsd:documentation>
Defines a polling mail source.
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="id" type="xsd:string" use="required"/>
<xsd:attribute name="store-uri" type="xsd:string" use="required"/>
<xsd:attribute name="mail-convertor" type="xsd:string" use="optional"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="imap-idle-mail-source">
<xsd:complexType>
<xsd:annotation>
<xsd:documentation>
Defines a polling mail source.
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="id" type="xsd:string" use="required"/>
<xsd:attribute name="store-uri" type="xsd:string" use="required"/>
<xsd:attribute name="task-executor" type="xsd:string" use="required"/>
<xsd:attribute name="mail-convertor" type="xsd:string" use="optional"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.monitor;
package org.springframework.integration.mail.monitor;
import javax.mail.FetchProfile;
import javax.mail.Flags;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.monitor;
package org.springframework.integration.mail.monitor;
import javax.mail.Folder;
import javax.mail.MessagingException;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.monitor;
package org.springframework.integration.mail.monitor;
import java.util.concurrent.ConcurrentLinkedQueue;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.monitor;
package org.springframework.integration.mail.monitor;
import javax.mail.Folder;
import javax.mail.Message;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.monitor;
package org.springframework.integration.mail.monitor;
import javax.mail.Message;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.monitor;
package org.springframework.integration.mail.monitor;
/**

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.monitor;
package org.springframework.integration.mail.monitor;
import java.net.URI;
import java.net.URISyntaxException;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.monitor;
package org.springframework.integration.mail.monitor;
import javax.mail.Folder;
import javax.mail.Message;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.monitor;
package org.springframework.integration.mail.monitor;
/**

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.monitor;
package org.springframework.integration.mail.monitor;
import javax.mail.Folder;
import javax.mail.Message;

View File

@@ -0,0 +1 @@
http\://www.springframework.org/schema/integration/mail=org.springframework.integration.mail.config.MailNamespaceHandler

View File

@@ -0,0 +1 @@
http\://www.springframework.org/schema/integration/mail/spring-integration-mail-1.0.xsd=org/springframework/integration/mail/config/spring-integration-mail-1.0.xsd

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -32,6 +32,8 @@ import javax.mail.internet.MimeMessage;
import org.easymock.classextension.EasyMock;
import org.junit.Test;
import org.springframework.integration.mail.DefaultMailMessageHeaderMapper;
import org.springframework.integration.mail.MailHeaders;
import org.springframework.integration.message.MessageHeaders;
import org.springframework.util.ObjectUtils;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
@@ -31,7 +31,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.adapter.mail.MailTarget;
import org.springframework.integration.mail.MailTarget;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.StringMessage;
import org.springframework.mail.SimpleMailMessage;
@@ -42,7 +42,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* @author Marius Bogoevici
*/
@RunWith(value = SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:/org/springframework/integration/adapter/mail/mailTarget.xml"})
@ContextConfiguration(locations = {"classpath:/org/springframework/integration/mail/mailTarget.xml"})
public class MailTargetContextTests {
@Autowired

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
@@ -31,6 +31,9 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.integration.mail.MailHeaders;
import org.springframework.integration.mail.MailTarget;
import org.springframework.integration.mail.StaticMailHeaderGenerator;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.MessageBuilder;
import org.springframework.integration.message.StringMessage;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import org.springframework.mail.SimpleMailMessage;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import static org.junit.Assert.*;
@@ -23,6 +23,10 @@ import javax.mail.internet.MimeMessage;
import org.easymock.classextension.EasyMock;
import org.junit.Test;
import org.springframework.integration.mail.FolderConnection;
import org.springframework.integration.mail.MailMessageConverter;
import org.springframework.integration.mail.PollingMailSource;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import java.io.InputStream;
import java.util.ArrayList;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail;
package org.springframework.integration.mail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -28,6 +28,9 @@ import org.junit.Before;
import org.junit.Test;
import org.springframework.core.task.TaskExecutor;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.mail.FolderConnection;
import org.springframework.integration.mail.MailMessageConverter;
import org.springframework.integration.mail.SubscribableMailSource;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.config;
package org.springframework.integration.mail.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -24,8 +24,8 @@ import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.adapter.mail.MailHeaderGenerator;
import org.springframework.integration.adapter.mail.MailTarget;
import org.springframework.integration.mail.MailHeaderGenerator;
import org.springframework.integration.mail.MailTarget;
import org.springframework.integration.message.Message;
import org.springframework.mail.MailMessage;
import org.springframework.mail.MailSender;

View File

@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.adapter.mail.config;
package org.springframework.integration.mail.config;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.adapter.mail.PollingMailSource;
import org.springframework.integration.mail.PollingMailSource;
public class PollingMailSourceParserTests {

View File

@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xmlns:mail="http://www.springframework.org/schema/integration/mail"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
http://www.springframework.org/schema/integration/mail
http://www.springframework.org/schema/integration/mail/spring-integration-mail-1.0.xsd">
<si:mail-target id="targetWithMailSenderReference" mail-sender="mailSender"/>
<mail:mail-target id="targetWithMailSenderReference" mail-sender="mailSender"/>
<si:mail-target id="targetWithHostProperty"
<mail:mail-target id="targetWithHostProperty"
host="somehost" username="someuser" password="somepassword"/>
<bean id="mailSender" class="org.springframework.integration.adapter.mail.StubJavaMailSender">
<bean id="mailSender" class="org.springframework.integration.mail.StubJavaMailSender">
<constructor-arg>
<bean class="javax.mail.internet.MimeMessage">
<constructor-arg type="javax.mail.Session"><null/></constructor-arg>
@@ -20,11 +20,11 @@
</constructor-arg>
</bean>
<si:mail-target id="targetWithHeaderGeneratorReference"
<mail:mail-target id="targetWithHeaderGeneratorReference"
mail-sender="mailSender"
header-generator="testHeaderGenerator"/>
<bean id="testHeaderGenerator"
class="org.springframework.integration.adapter.mail.config.MailTargetParserTests$TestHeaderGenerator"/>
class="org.springframework.integration.mail.config.MailTargetParserTests$TestHeaderGenerator"/>
</beans>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration/mail"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration/mail
http://www.springframework.org/schema/integration/mail/spring-integration-mail-1.0.xsd">
<polling-mail-source id="pollingPop3" store-uri="pop3://mailtest:mailtest@ubuntuservervm/INBOX" />
</beans:beans>

View File

@@ -3,11 +3,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.5.xsd">
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<bean id="javaMailSender" class="org.springframework.integration.adapter.mail.StubJavaMailSender">
<bean id="javaMailSender" class="org.springframework.integration.mail.StubJavaMailSender">
<constructor-arg>
<bean class="javax.mail.internet.MimeMessage">
<constructor-arg type="javax.mail.Session"><null/></constructor-arg>
@@ -15,27 +15,27 @@
</constructor-arg>
</bean>
<bean id="mailTarget" class="org.springframework.integration.adapter.mail.MailTarget">
<bean id="mailTarget" class="org.springframework.integration.mail.MailTarget">
<constructor-arg ref="javaMailSender"/>
<property name="headerGenerator">
<bean class="org.springframework.integration.adapter.mail.StaticMailHeaderGenerator">
<bean class="org.springframework.integration.mail.StaticMailHeaderGenerator">
<property name="subject">
<util:constant static-field="org.springframework.integration.adapter.mail.MailTestsHelper.SUBJECT"/>
<util:constant static-field="org.springframework.integration.mail.MailTestsHelper.SUBJECT"/>
</property>
<property name="to">
<util:constant static-field="org.springframework.integration.adapter.mail.MailTestsHelper.TO"/>
<util:constant static-field="org.springframework.integration.mail.MailTestsHelper.TO"/>
</property>
<property name="cc">
<util:constant static-field="org.springframework.integration.adapter.mail.MailTestsHelper.CC"/>
<util:constant static-field="org.springframework.integration.mail.MailTestsHelper.CC"/>
</property>
<property name="bcc">
<util:constant static-field="org.springframework.integration.adapter.mail.MailTestsHelper.BCC"/>
<util:constant static-field="org.springframework.integration.mail.MailTestsHelper.BCC"/>
</property>
<property name="from">
<util:constant static-field="org.springframework.integration.adapter.mail.MailTestsHelper.FROM"/>
<util:constant static-field="org.springframework.integration.mail.MailTestsHelper.FROM"/>
</property>
<property name="replyTo">
<util:constant static-field="org.springframework.integration.adapter.mail.MailTestsHelper.REPLY_TO"/>
<util:constant static-field="org.springframework.integration.mail.MailTestsHelper.REPLY_TO"/>
</property>
</bean>
</property>