james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [3/4] james-project git commit: JAMES-1727 Changing of processor should not imply using the mail queue
Date Thu, 19 May 2016 10:06:10 GMT
JAMES-1727 Changing of processor should not imply using the mail queue


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/eb3bfd07
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/eb3bfd07
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/eb3bfd07

Branch: refs/heads/master
Commit: eb3bfd0727478c54ce1c2d9dc6572f81e1ad7680
Parents: 7d2ef26
Author: Benoit Tellier <btellier@linagora.com>
Authored: Wed Apr 27 14:14:57 2016 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Thu May 19 10:18:21 2016 +0700

----------------------------------------------------------------------
 server/mailet/mailetcontainer-camel/pom.xml                   | 5 +++++
 .../mailetcontainer/impl/camel/CamelCompositeProcessor.java   | 1 +
 .../mailetcontainer/lib/AbstractStateMailetProcessor.java     | 7 ++++++-
 .../mailetcontainer/impl/camel/CamelMailetProcessorTest.java  | 4 ++++
 4 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/eb3bfd07/server/mailet/mailetcontainer-camel/pom.xml
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/pom.xml b/server/mailet/mailetcontainer-camel/pom.xml
index 9c3c9c4..6de3849 100644
--- a/server/mailet/mailetcontainer-camel/pom.xml
+++ b/server/mailet/mailetcontainer-camel/pom.xml
@@ -128,6 +128,11 @@
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/james-project/blob/eb3bfd07/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelCompositeProcessor.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelCompositeProcessor.java
b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelCompositeProcessor.java
index 6844cb4..80c5877 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelCompositeProcessor.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelCompositeProcessor.java
@@ -108,6 +108,7 @@ public class CamelCompositeProcessor extends AbstractStateCompositeProcessor
imp
             processor.setMailetLoader(mailetLoader);
             processor.setMatcherLoader(matcherLoader);
             processor.configure(config);
+            processor.setRootMailProcessor(this);
             processor.init();
             return processor;
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/eb3bfd07/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
index 9e93b16..ab84ba1 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
@@ -62,6 +62,7 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor,
Con
 
     private MailetContext mailetContext;
     private MatcherLoader matcherLoader;
+    private MailProcessor rootMailProcessor;
     private final List<MailetProcessorListener> listeners = Collections.synchronizedList(new
ArrayList<MailetProcessorListener>());
     private JMXStateMailetProcessorListener jmxListener;
     private boolean enableJmx = true;
@@ -75,6 +76,10 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor,
Con
         this.matcherLoader = matcherLoader;
     }
 
+    public void setRootMailProcessor(MailProcessor rootMailProcessor) {
+        this.rootMailProcessor = rootMailProcessor;
+    }
+
     @Inject
     public void setMailetContext(MailetContext mailetContext) {
         this.mailetContext = mailetContext;
@@ -157,7 +162,7 @@ public abstract class AbstractStateMailetProcessor implements MailProcessor,
Con
      * @throws MessagingException
      */
     protected void toProcessor(Mail mail) throws MessagingException {
-        mailetContext.sendMail(mail);
+        rootMailProcessor.service(mail);
     }
 
     protected Logger getLogger() {

http://git-wip-us.apache.org/repos/asf/james-project/blob/eb3bfd07/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessorTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessorTest.java
b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessorTest.java
index 261980b..8afae28 100644
--- a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessorTest.java
+++ b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessorTest.java
@@ -19,8 +19,11 @@
 
 package org.apache.james.mailetcontainer.impl.camel;
 
+import static org.mockito.Mockito.mock;
+
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.james.mailetcontainer.api.MailProcessor;
 import org.apache.james.mailetcontainer.api.mock.MockMailetContext;
 import org.apache.james.mailetcontainer.api.mock.MockMailetLoader;
 import org.apache.james.mailetcontainer.api.mock.MockMatcherLoader;
@@ -45,6 +48,7 @@ public class CamelMailetProcessorTest extends AbstractStateMailetProcessorTest
{
             processor.setMailetContext(new MockMailetContext());
             processor.setMailetLoader(new MockMailetLoader());
             processor.setMatcherLoader(new MockMatcherLoader());
+            processor.setRootMailProcessor(mock(MailProcessor.class));
             processor.configure(configuration);
             processor.init();
             return processor;


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message