james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [6/7] james-project git commit: JAMES-1717 Ensure Vacation mailet in transport processor
Date Fri, 20 May 2016 11:53:28 GMT
JAMES-1717 Ensure Vacation mailet in transport processor


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

Branch: refs/heads/master
Commit: 57ad3d49dce2f15bb6df55a67c545adac0a20bfb
Parents: 3ecc0cc
Author: Benoit Tellier <btellier@linagora.com>
Authored: Thu Apr 28 17:42:02 2016 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Fri May 20 18:52:11 2016 +0700

----------------------------------------------------------------------
 .../guice/destination/conf/mailetcontainer.xml  |   1 +
 .../src/test/resources/mailetcontainer.xml      |   1 +
 .../src/test/resources/mailetcontainer.xml      |   1 +
 server/container/guice/guice-common/pom.xml     |   6 +
 .../java/org/apache/james/jmap/JMAPModule.java  |  74 ++++++------
 .../server/CamelMailetContainerModule.java      |  41 ++++++-
 .../james/jmap/MailetPreconditionTest.java      | 115 +++++++++++++++++++
 .../src/test/resources/mailetcontainer.xml      |   1 +
 .../impl/camel/CamelMailetProcessor.java        |   8 ++
 .../src/test/resources/mailetcontainer.xml      |   1 +
 .../src/test/resources/mailetcontainer.xml      |   1 +
 .../james/jmap/mailet/VacationMailet.java       |   2 +-
 12 files changed, 207 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/57ad3d49/dockerfiles/run/guice/destination/conf/mailetcontainer.xml
----------------------------------------------------------------------
diff --git a/dockerfiles/run/guice/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/destination/conf/mailetcontainer.xml
index e057612..25195ea 100644
--- a/dockerfiles/run/guice/destination/conf/mailetcontainer.xml
+++ b/dockerfiles/run/guice/destination/conf/mailetcontainer.xml
@@ -84,6 +84,7 @@
                 <name>bcc</name>
             </mailet>
             <mailet match="All" class="RecipientRewriteTable" />
+            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
             <mailet match="RecipientIsLocal" class="LocalDelivery"/>
             <!--
             <mailet match="HostIsLocal" class="ToProcessor">

http://git-wip-us.apache.org/repos/asf/james-project/blob/57ad3d49/mpt/impl/smtp/cassandra/src/test/resources/mailetcontainer.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/resources/mailetcontainer.xml b/mpt/impl/smtp/cassandra/src/test/resources/mailetcontainer.xml
index c51a7fb..699ca91 100644
--- a/mpt/impl/smtp/cassandra/src/test/resources/mailetcontainer.xml
+++ b/mpt/impl/smtp/cassandra/src/test/resources/mailetcontainer.xml
@@ -67,6 +67,7 @@
             <mailet match="All" class="RemoveMimeHeader">
                 <name>bcc</name>
             </mailet>
+            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
             <mailet match="All" class="RecipientRewriteTable" />
             <!-- <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>

http://git-wip-us.apache.org/repos/asf/james-project/blob/57ad3d49/server/container/guice/cassandra-guice/src/test/resources/mailetcontainer.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/resources/mailetcontainer.xml
b/server/container/guice/cassandra-guice/src/test/resources/mailetcontainer.xml
index 426cab8..b265f93 100644
--- a/server/container/guice/cassandra-guice/src/test/resources/mailetcontainer.xml
+++ b/server/container/guice/cassandra-guice/src/test/resources/mailetcontainer.xml
@@ -55,6 +55,7 @@
                 <name>bcc</name>
             </mailet>
             <mailet match="All" class="RecipientRewriteTable" />
+            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
             <mailet match="RecipientIsLocal" class="LocalDelivery"/>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>

http://git-wip-us.apache.org/repos/asf/james-project/blob/57ad3d49/server/container/guice/guice-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/pom.xml b/server/container/guice/guice-common/pom.xml
index ed86fb0..97d9b6c 100644
--- a/server/container/guice/guice-common/pom.xml
+++ b/server/container/guice/guice-common/pom.xml
@@ -261,6 +261,12 @@
                     <scope>test</scope>
                 </dependency>
                 <dependency>
+                    <groupId>org.apache.james</groupId>
+                    <artifactId>apache-mailet-base</artifactId>
+                    <scope>test</scope>
+                    <type>test-jar</type>
+                </dependency>
+                <dependency>
                     <groupId>org.slf4j</groupId>
                     <artifactId>slf4j-api</artifactId>
                 </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/57ad3d49/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
index 72d49fc..54c0839 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
@@ -24,19 +24,22 @@ import java.util.List;
 import java.util.Optional;
 
 import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.commons.io.FileUtils;
 import org.apache.james.filesystem.api.FileSystem;
+import org.apache.james.jmap.mailet.VacationMailet;
 import org.apache.james.jmap.methods.RequestHandler;
 import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailetcontainer.impl.MatcherMailetPair;
+import org.apache.james.modules.server.CamelMailetContainerModule;
+import org.apache.james.transport.mailets.RemoveMimeHeader;
+import org.apache.james.transport.matchers.All;
+import org.apache.james.transport.matchers.RecipientIsLocal;
 import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.ConfigurationProvider;
 
 import com.github.fge.lambdas.Throwing;
 import com.google.common.base.Preconditions;
-import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 import com.google.inject.AbstractModule;
 import com.google.inject.Inject;
@@ -52,8 +55,11 @@ public class JMAPModule extends AbstractModule {
         install(new JMAPCommonModule());
         install(new MethodsModule());
         bind(RequestHandler.class).in(Singleton.class);
-        Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(MailetConfigurationPrecondition.class);
         Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(MoveCapabilityPrecondition.class);
+
+        Multibinder<CamelMailetContainerModule.TransportProcessorCheck> transportProcessorChecks
= Multibinder.newSetBinder(binder(), CamelMailetContainerModule.TransportProcessorCheck.class);
+        transportProcessorChecks.addBinding().to(VacationMailetCheck.class);
+        transportProcessorChecks.addBinding().to(BccMailetCheck.class);
     }
 
     @Provides
@@ -77,34 +83,19 @@ public class JMAPModule extends AbstractModule {
     }
 
     @Singleton
-    public static class MailetConfigurationPrecondition implements ConfigurationPerformer
{
+    public static class MoveCapabilityPrecondition implements ConfigurationPerformer {
 
-        private final ConfigurationProvider configurationProvider;
+        private final MailboxManager mailboxManager;
 
         @Inject
-        public MailetConfigurationPrecondition(ConfigurationProvider configurationProvider)
{
-            this.configurationProvider = configurationProvider;
+        public MoveCapabilityPrecondition(MailboxManager mailboxManager) {
+            this.mailboxManager = mailboxManager;
         }
 
         @Override
         public void initModule() {
-            try {
-                Optional<HierarchicalConfiguration> removeMimeHeaderMailet = configurationProvider.getConfiguration("mailetcontainer")
-                    .configurationAt("processors")
-                    .configurationsAt("processor")
-                    .stream()
-                    .filter(processor -> processor.getString("[@state]").equals("transport"))
-                    .flatMap(transport -> transport.configurationsAt("mailet").stream())
-                    .filter(mailet -> mailet.getString("[@class]").equals("RemoveMimeHeader"))
-                    .filter(mailet -> mailet.getString("[@match]").equals("All"))
-                    .filter(mailet -> mailet.getProperty("name").equals("bcc"))
-                    .findAny();
-                if (!removeMimeHeaderMailet.isPresent()) {
-                    throw new ConfigurationException("Missing RemoveMimeHeader in mailets
configuration (mailetcontainer -> processors -> transport). Should be configured to
remove Bcc header");
-                }
-            } catch (ConfigurationException e) {
-                Throwables.propagate(e);
-            }
+            Preconditions.checkArgument(mailboxManager.getSupportedCapabilities().contains(MailboxManager.Capabilities.Move),
+                    "MOVE support in MailboxManager is required by JMAP Module");
         }
 
         @Override
@@ -113,25 +104,28 @@ public class JMAPModule extends AbstractModule {
         }
     }
 
-    @Singleton
-    public static class MoveCapabilityPrecondition implements ConfigurationPerformer {
-
-        private final MailboxManager mailboxManager;
-
-        @Inject
-        public MoveCapabilityPrecondition(MailboxManager mailboxManager) {
-            this.mailboxManager = mailboxManager;
-        }
-
+    public static class VacationMailetCheck implements CamelMailetContainerModule.TransportProcessorCheck
{
         @Override
-        public void initModule() {
-            Preconditions.checkArgument(mailboxManager.getSupportedCapabilities().contains(MailboxManager.Capabilities.Move),
-                    "MOVE support in MailboxManager is required by JMAP Module");
+        public void check(List<MatcherMailetPair> pairs) throws ConfigurationException
{
+            Preconditions.checkNotNull(pairs);
+            pairs.stream()
+                .filter(pair -> pair.getMailet().getClass().equals(VacationMailet.class))
+                .filter(pair -> pair.getMatcher().getClass().equals(RecipientIsLocal.class))
+                .findAny()
+                .orElseThrow(() -> new ConfigurationException("Missing " + VacationMailet.class.getName()
+ " in mailets configuration (mailetcontainer -> processors -> transport)"));
         }
+    }
 
+    public static class BccMailetCheck implements CamelMailetContainerModule.TransportProcessorCheck
{
         @Override
-        public List<Class<? extends Configurable>> forClasses() {
-            return ImmutableList.of();
+        public void check(List<MatcherMailetPair> pairs) throws ConfigurationException
{
+            Preconditions.checkNotNull(pairs);
+            pairs.stream()
+                .filter(pair -> pair.getMailet().getClass().equals(RemoveMimeHeader.class))
+                .filter(pair -> pair.getMatcher().getClass().equals(All.class))
+                .filter(pair -> pair.getMailet().getMailetConfig().getInitParameter("name").equals("bcc"))
+                .findAny()
+                .orElseThrow(() -> new ConfigurationException("Missing RemoveMimeHeader
in mailets configuration (mailetcontainer -> processors -> transport). Should be configured
to remove Bcc header"));
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/57ad3d49/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
index de270d4..0240adf 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
@@ -20,8 +20,11 @@
 package org.apache.james.modules.server;
 
 import java.util.List;
+import java.util.Optional;
+import java.util.Set;
 
 import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.lifecycle.api.Configurable;
@@ -31,8 +34,10 @@ import org.apache.james.mailetcontainer.api.MatcherLoader;
 import org.apache.james.mailetcontainer.api.jmx.MailSpoolerMBean;
 import org.apache.james.mailetcontainer.impl.JamesMailSpooler;
 import org.apache.james.mailetcontainer.impl.JamesMailetContext;
+import org.apache.james.mailetcontainer.impl.MatcherMailetPair;
 import org.apache.james.mailetcontainer.impl.camel.CamelCompositeProcessor;
 import org.apache.james.queue.api.MailQueueFactory;
+import org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.utils.ConfigurationPerformer;
 import org.apache.james.utils.ConfigurationProvider;
@@ -93,16 +98,22 @@ public class CamelMailetContainerModule extends AbstractModule {
         private final CamelCompositeProcessor camelCompositeProcessor;
         private final JamesMailSpooler jamesMailSpooler;
         private final JamesMailetContext mailetContext;
+        private final MailQueueFactory mailQueueFactory;
+        private Set<TransportProcessorCheck> transportProcessorCheckSet;
 
         @Inject
         public MailetModuleConfigurationPerformer(ConfigurationProvider configurationProvider,
-                CamelCompositeProcessor camelCompositeProcessor, 
-                JamesMailSpooler jamesMailSpooler, 
-                JamesMailetContext mailetContext) {
+                                                CamelCompositeProcessor camelCompositeProcessor,
+                                                JamesMailSpooler jamesMailSpooler,
+                                                JamesMailetContext mailetContext,
+                                                MailQueueFactory mailQueueFactory,
+                                                Set<TransportProcessorCheck> transportProcessorCheckSet)
{
             this.configurationProvider = configurationProvider;
             this.camelCompositeProcessor = camelCompositeProcessor;
             this.jamesMailSpooler = jamesMailSpooler;
             this.mailetContext = mailetContext;
+            this.mailQueueFactory = mailQueueFactory;
+            this.transportProcessorCheckSet = transportProcessorCheckSet;
         }
 
         @Override
@@ -112,13 +123,30 @@ public class CamelMailetContainerModule extends AbstractModule {
                 camelCompositeProcessor.setCamelContext(new DefaultCamelContext());
                 camelCompositeProcessor.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("processors"));
                 camelCompositeProcessor.init();
+                checkProcessors();
+                jamesMailSpooler.setMailProcessor(camelCompositeProcessor);
                 jamesMailSpooler.setLog(SPOOLER_LOGGER);
                 jamesMailSpooler.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("spooler"));
                 jamesMailSpooler.init();
                 mailetContext.setLog(MAILET_LOGGER);
                 mailetContext.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("context"));
+                mailetContext.retrieveRootMailQueue(mailQueueFactory);
             } catch (Exception e) {
-                Throwables.propagate(e);
+                throw Throwables.propagate(e);
+            }
+
+        }
+
+        private void checkProcessors() throws ConfigurationException {
+            MailProcessor mailProcessor = Optional.ofNullable(camelCompositeProcessor.getProcessor("transport"))
+                .orElseThrow(() -> new RuntimeException("JMAP needs a transport processor"));
+            if (mailProcessor instanceof CamelMailetProcessor) {
+                List<MatcherMailetPair> matcherMailetPairs = ((CamelMailetProcessor)
mailProcessor).getPairs();
+                for (TransportProcessorCheck check : transportProcessorCheckSet) {
+                    check.check(matcherMailetPairs);
+                }
+            } else {
+                throw new RuntimeException("Can not perform checks as transport processor
is not an instance of " + MailProcessor.class);
             }
         }
 
@@ -127,4 +155,9 @@ public class CamelMailetContainerModule extends AbstractModule {
             return ImmutableList.of(CamelCompositeProcessor.class, JamesMailSpooler.class,
JamesMailetContext.class);
         }
     }
+
+    @FunctionalInterface
+    public interface TransportProcessorCheck {
+        void check(List<MatcherMailetPair> pairs) throws ConfigurationException;
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/57ad3d49/server/container/guice/guice-common/src/test/java/org/apache/james/jmap/MailetPreconditionTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/test/java/org/apache/james/jmap/MailetPreconditionTest.java
b/server/container/guice/guice-common/src/test/java/org/apache/james/jmap/MailetPreconditionTest.java
new file mode 100644
index 0000000..5b70b2f
--- /dev/null
+++ b/server/container/guice/guice-common/src/test/java/org/apache/james/jmap/MailetPreconditionTest.java
@@ -0,0 +1,115 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you 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.apache.james.jmap;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.jmap.mailet.VacationMailet;
+import org.apache.james.mailetcontainer.impl.MatcherMailetPair;
+import org.apache.james.transport.mailets.Null;
+import org.apache.james.transport.mailets.RemoveMimeHeader;
+import org.apache.james.transport.matchers.All;
+import org.apache.james.transport.matchers.RecipientIsLocal;
+import org.apache.mailet.MailetContext;
+import org.apache.mailet.base.test.FakeMailetConfig;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+
+public class MailetPreconditionTest {
+
+    private static final MailetContext MAILET_CONTEXT = null;
+    private static final String WRONG_NAME = "wrong";
+    private static final String BCC = "bcc";
+
+    @Test(expected = ConfigurationException.class)
+    public void vacationMailetCheckShouldThrowOnEmptyList() throws Exception {
+        new JMAPModule.VacationMailetCheck().check(Lists.newArrayList());
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void vacationMailetCheckShouldThrowOnNullList() throws Exception {
+        new JMAPModule.VacationMailetCheck().check(null);
+    }
+
+    @Test(expected = ConfigurationException.class)
+    public void vacationMailetCheckShouldThrowOnWrongMatcher() throws Exception {
+        List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new
All(), new VacationMailet(null, null, null)));
+        new JMAPModule.VacationMailetCheck().check(pairs);
+    }
+
+    @Test(expected = ConfigurationException.class)
+    public void vacationMailetCheckShouldThrowOnWrongMailet() throws Exception {
+        List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new
RecipientIsLocal(), new Null()));
+        new JMAPModule.VacationMailetCheck().check(pairs);
+    }
+
+    @Test
+    public void vacationMailetCheckShouldNotThrowIfValidPairPresent() throws Exception {
+        List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new
RecipientIsLocal(), new VacationMailet(null, null, null)));
+        new JMAPModule.VacationMailetCheck().check(pairs);
+    }
+
+    @Test(expected = ConfigurationException.class)
+    public void bccMailetCheckShouldThrowOnEmptyList() throws Exception {
+        new JMAPModule.BccMailetCheck().check(Lists.newArrayList());
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void bccMailetCheckShouldThrowOnNullList() throws Exception {
+        new JMAPModule.BccMailetCheck().check(null);
+    }
+
+    @Test(expected = ConfigurationException.class)
+    public void bccMailetCheckShouldThrowOnWrongMatcher() throws Exception {
+        List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new
RecipientIsLocal(),  new RemoveMimeHeader()));
+        new JMAPModule.VacationMailetCheck().check(pairs);
+    }
+
+    @Test(expected = ConfigurationException.class)
+    public void bccMailetCheckShouldThrowOnWrongMailet() throws Exception {
+        List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new
All(), new Null()));
+        new JMAPModule.VacationMailetCheck().check(pairs);
+    }
+
+    @Test(expected = ConfigurationException.class)
+    public void bccMailetCheckShouldThrowOnWrongMailetName() throws Exception {
+        Properties properties = new Properties();
+        properties.setProperty("name", WRONG_NAME);
+        RemoveMimeHeader removeMimeHeader = new RemoveMimeHeader();
+        removeMimeHeader.init(new FakeMailetConfig(WRONG_NAME, MAILET_CONTEXT, properties));
+
+        List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new
All(), removeMimeHeader));
+        new JMAPModule.VacationMailetCheck().check(pairs);
+    }
+
+    @Test(expected = ConfigurationException.class)
+    public void bccMailetCheckShouldNotThrowOnValidPair() throws Exception {
+        Properties properties = new Properties();
+        properties.setProperty("name", BCC);
+        RemoveMimeHeader removeMimeHeader = new RemoveMimeHeader();
+        removeMimeHeader.init(new FakeMailetConfig(BCC, MAILET_CONTEXT, properties));
+
+        List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new
All(), removeMimeHeader));
+        new JMAPModule.VacationMailetCheck().check(pairs);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/57ad3d49/server/container/guice/memory-guice/src/test/resources/mailetcontainer.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/src/test/resources/mailetcontainer.xml b/server/container/guice/memory-guice/src/test/resources/mailetcontainer.xml
index 426cab8..b265f93 100644
--- a/server/container/guice/memory-guice/src/test/resources/mailetcontainer.xml
+++ b/server/container/guice/memory-guice/src/test/resources/mailetcontainer.xml
@@ -55,6 +55,7 @@
                 <name>bcc</name>
             </mailet>
             <mailet match="All" class="RecipientRewriteTable" />
+            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
             <mailet match="RecipientIsLocal" class="LocalDelivery"/>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>

http://git-wip-us.apache.org/repos/asf/james-project/blob/57ad3d49/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessor.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessor.java
b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessor.java
index 6479a6a..414d184 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessor.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/camel/CamelMailetProcessor.java
@@ -42,6 +42,8 @@ import org.apache.mailet.MailetConfig;
 import org.apache.mailet.Matcher;
 import org.slf4j.Logger;
 
+import com.google.common.collect.ImmutableList;
+
 /**
  * {@link org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor} implementation
which use Camel DSL for
  * the {@link Matcher} / {@link Mailet} routing
@@ -53,6 +55,7 @@ public class CamelMailetProcessor extends AbstractStateMailetProcessor implement
     private ProducerTemplate producerTemplate;
 
     private final UseLatestAggregationStrategy aggr = new UseLatestAggregationStrategy();
+    private List<MatcherMailetPair> pairs;
 
     /**
      * @see
@@ -81,6 +84,10 @@ public class CamelMailetProcessor extends AbstractStateMailetProcessor
implement
         this.context = context;
     }
 
+    public List<MatcherMailetPair> getPairs() {
+        return ImmutableList.copyOf(pairs);
+    }
+
     /**
      * Return the endpoint for the processorname.
      * 
@@ -109,6 +116,7 @@ public class CamelMailetProcessor extends AbstractStateMailetProcessor
implement
      */
     protected void setupRouting(List<MatcherMailetPair> pairs) throws MessagingException
{
         try {
+            this.pairs = pairs;
             context.addRoutes(new MailetContainerRouteBuilder(pairs));
         } catch (Exception e) {
             throw new MessagingException("Unable to setup routing for MailetMatcherPairs",
e);

http://git-wip-us.apache.org/repos/asf/james-project/blob/57ad3d49/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/resources/mailetcontainer.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/resources/mailetcontainer.xml
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/resources/mailetcontainer.xml
index 258f264..0bef357 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/resources/mailetcontainer.xml
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/resources/mailetcontainer.xml
@@ -53,6 +53,7 @@
             <mailet match="All" class="RemoveMimeHeader">
                 <name>bcc</name>
             </mailet>
+            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
             <mailet match="RecipientIsLocal" class="LocalDelivery"/>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>

http://git-wip-us.apache.org/repos/asf/james-project/blob/57ad3d49/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/resources/mailetcontainer.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/resources/mailetcontainer.xml
b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/resources/mailetcontainer.xml
index 258f264..0bef357 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/resources/mailetcontainer.xml
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/resources/mailetcontainer.xml
@@ -53,6 +53,7 @@
             <mailet match="All" class="RemoveMimeHeader">
                 <name>bcc</name>
             </mailet>
+            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
             <mailet match="RecipientIsLocal" class="LocalDelivery"/>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>

http://git-wip-us.apache.org/repos/asf/james-project/blob/57ad3d49/server/protocols/jmap/src/main/java/org/apache/james/jmap/mailet/VacationMailet.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/mailet/VacationMailet.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/mailet/VacationMailet.java
index 8e9d181..620d5ff 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/mailet/VacationMailet.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/mailet/VacationMailet.java
@@ -45,7 +45,7 @@ public class VacationMailet extends GenericMailet {
     private final AutomaticallySentMailDetector automaticallySentMailDetector;
 
     @Inject
-    VacationMailet(VacationRepository vacationRepository, ZonedDateTimeProvider zonedDateTimeProvider,
AutomaticallySentMailDetector automaticallySentMailDetector) {
+    public VacationMailet(VacationRepository vacationRepository, ZonedDateTimeProvider zonedDateTimeProvider,
AutomaticallySentMailDetector automaticallySentMailDetector) {
         this.vacationRepository = vacationRepository;
         this.zonedDateTimeProvider = zonedDateTimeProvider;
         this.automaticallySentMailDetector = automaticallySentMailDetector;


---------------------------------------------------------------------
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