james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rouaz...@apache.org
Subject [01/50] [abbrv] james-project git commit: MAILET-115 Handle static configuration in InitParameters
Date Wed, 11 Jan 2017 09:25:49 GMT
Repository: james-project
Updated Branches:
  refs/heads/master 1602d26db -> ed02e924d


MAILET-115 Handle static configuration in InitParameters


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

Branch: refs/heads/master
Commit: 5e493a18875b4069ae48062d28b264217ac0264c
Parents: 875c39b
Author: Antoine Duprat <aduprat@linagora.com>
Authored: Tue Sep 13 12:20:13 2016 +0200
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Wed Jan 11 10:03:27 2017 +0700

----------------------------------------------------------------------
 .../apache/james/transport/mailets/Bounce.java  |   2 +-
 .../james/transport/mailets/DSNBounce.java      |   2 +-
 .../apache/james/transport/mailets/Forward.java |   2 +-
 .../transport/mailets/NotifyPostmaster.java     |   2 +-
 .../james/transport/mailets/NotifySender.java   |   2 +-
 .../james/transport/mailets/Redirect.java       |   2 +-
 .../apache/james/transport/mailets/Resend.java  |   2 +-
 .../mailets/redirect/AbstractRedirect.java      |  21 +--
 .../mailets/redirect/InitParameters.java        |   2 +
 .../redirect/InitParametersSerializer.java      |  45 +++++
 .../redirect/LoadedOnceInitParameters.java      | 164 +++++++++++++++++++
 .../redirect/NotifyMailetInitParameters.java    |  15 +-
 .../redirect/RedirectMailetInitParameters.java  |  24 ++-
 .../mailets/redirect/AbstractRedirectTest.java  |   2 +-
 .../redirect/LoadedOnceInitParametersTest.java  | 139 ++++++++++++++++
 .../NotifyMailetInitParametersTest.java         |  44 ++++-
 .../RedirectMailetInitParametersTest.java       |  46 +++++-
 17 files changed, 484 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
index bcb794f..89a2aa7 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
@@ -122,7 +122,7 @@ public class Bounce extends AbstractRedirect {
 
     @Override
     protected InitParameters getInitParameters() {
-        return new NotifyMailetInitParameters(this);
+        return NotifyMailetInitParameters.from(this);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
index d6eca17..63316a8 100755
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/DSNBounce.java
@@ -116,7 +116,7 @@ public class DSNBounce extends AbstractRedirect {
 
     @Override
     protected InitParameters getInitParameters() {
-        return new NotifyMailetInitParameters(this);
+        return NotifyMailetInitParameters.from(this);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java
index bca2c43..7dab178 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Forward.java
@@ -95,7 +95,7 @@ public class Forward extends AbstractRedirect {
 
     @Override
     protected InitParameters getInitParameters() {
-        return new RedirectMailetInitParameters(this);
+        return RedirectMailetInitParameters.from(this);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifyPostmaster.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifyPostmaster.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifyPostmaster.java
index a71bede..c74b2f8 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifyPostmaster.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifyPostmaster.java
@@ -131,7 +131,7 @@ public class NotifyPostmaster extends AbstractRedirect {
 
     @Override
     protected InitParameters getInitParameters() {
-        return new NotifyMailetInitParameters(this);
+        return NotifyMailetInitParameters.from(this);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifySender.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifySender.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifySender.java
index d93cc9d..e1857f9 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifySender.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/NotifySender.java
@@ -133,7 +133,7 @@ public class NotifySender extends AbstractRedirect {
 
     @Override
     protected InitParameters getInitParameters() {
-        return new NotifyMailetInitParameters(this);
+        return NotifyMailetInitParameters.from(this);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Redirect.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Redirect.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Redirect.java
index d16cc41..964e54f 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Redirect.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Redirect.java
@@ -301,7 +301,7 @@ public class Redirect extends AbstractRedirect {
 
     @Override
     protected InitParameters getInitParameters() {
-        return new RedirectMailetInitParameters(this);
+        return RedirectMailetInitParameters.from(this);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Resend.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Resend.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Resend.java
index 31f203e..05e784d 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Resend.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Resend.java
@@ -282,7 +282,7 @@ public class Resend extends AbstractRedirect {
 
     @Override
     protected InitParameters getInitParameters() {
-        return new RedirectMailetInitParameters(this);
+        return RedirectMailetInitParameters.from(this);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/AbstractRedirect.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/AbstractRedirect.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/AbstractRedirect.java
index dcdce85..8b740da 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/AbstractRedirect.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/AbstractRedirect.java
@@ -836,24 +836,9 @@ public abstract class AbstractRedirect extends GenericMailet {
         // allowedInitParameters
         checkInitParameters(getAllowedInitParameters());
 
-        if (isStatic()) {
-            passThrough = getPassThrough();
-            fakeDomainCheck = getFakeDomainCheck();
-            attachmentType = getAttachmentType();
-            inLineType = getInLineType();
-            messageText = getMessage();
-            recipients = getRecipients();
-            replyTo = getReplyTo();
-            reversePath = getReversePath();
-            sender = getSender();
-            subject = getSubject();
-            subjectPrefix = getSubjectPrefix();
-            apparentlyTo = getTo();
-            attachError = attachError();
-            isReply = isReply();
-            if (isDebug) {
-                String logBuffer = "static" + ", passThrough=" + passThrough + ", fakeDomainCheck=" + fakeDomainCheck + ", sender=" + sender + ", replyTo=" + replyTo + ", reversePath=" + reversePath + ", message=" + messageText + ", recipients=" + arrayToString(recipients == null ? null : recipients.toArray()) + ", subject=" + subject + ", subjectPrefix=" + subjectPrefix + ", apparentlyTo=" + arrayToString(apparentlyTo) + ", attachError=" + attachError + ", isReply=" + isReply + ", attachmentType=" + attachmentType + ", inLineType=" + inLineType + " ";
-                log(logBuffer);
+        if (getInitParameters().isStatic()) {
+            if (getInitParameters().isDebug()) {
+                log(getInitParameters().asString());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/InitParameters.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/InitParameters.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/InitParameters.java
index 954ba0d..b4bde6e 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/InitParameters.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/InitParameters.java
@@ -52,4 +52,6 @@ public interface InitParameters {
     boolean isDebug();
 
     boolean isStatic();
+
+    String asString();
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/InitParametersSerializer.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/InitParametersSerializer.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/InitParametersSerializer.java
new file mode 100644
index 0000000..2feb6ba
--- /dev/null
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/InitParametersSerializer.java
@@ -0,0 +1,45 @@
+/****************************************************************
+ * 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.transport.mailets.redirect;
+
+import com.google.common.base.MoreObjects;
+
+public class InitParametersSerializer {
+
+    public static String serialize(InitParameters initParameters) {
+        return MoreObjects.toStringHelper(initParameters.getClass())
+                .add("static", initParameters.isStatic())
+                .add("passThrough", initParameters.getPassThrough())
+                .add("fakeDomainCheck", initParameters.getFakeDomainCheck())
+                .add("sender", initParameters.getSender())
+                .add("replyTo", initParameters.getReplyTo())
+                .add("reversePath", initParameters.getReversePath())
+                .add("message", initParameters.getMessage())
+                .add("recipients", initParameters.getRecipients())
+                .add("subject", initParameters.getSubject())
+                .add("subjectPrefix", initParameters.getSubjectPrefix())
+                .add("apparentlyTo", initParameters.getTo())
+                .add("attachError", initParameters.isAttachError())
+                .add("isReply", initParameters.isReply())
+                .add("attachmentType", initParameters.getAttachmentType())
+                .add("inLineType", initParameters.getInLineType())
+                .toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/LoadedOnceInitParameters.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/LoadedOnceInitParameters.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/LoadedOnceInitParameters.java
new file mode 100644
index 0000000..8deb14e
--- /dev/null
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/LoadedOnceInitParameters.java
@@ -0,0 +1,164 @@
+/****************************************************************
+ * 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.transport.mailets.redirect;
+
+public class LoadedOnceInitParameters implements InitParameters {
+
+    public static LoadedOnceInitParameters from(InitParameters initParameters) {
+        return new LoadedOnceInitParameters(true,
+                initParameters.getPassThrough(),
+                initParameters.getFakeDomainCheck(),
+                initParameters.getInLineType(),
+                initParameters.getAttachmentType(),
+                initParameters.getMessage(),
+                initParameters.getSubject(),
+                initParameters.getSubjectPrefix(),
+                initParameters.isAttachError(),
+                initParameters.isReply(),
+                initParameters.getRecipients(),
+                initParameters.getTo(),
+                initParameters.getReversePath(),
+                initParameters.getSender(),
+                initParameters.getReplyTo(),
+                initParameters.isDebug());
+    }
+
+    private final boolean isStatic;
+    private final boolean passThrough;
+    private final boolean fakeDomainCheck;
+    private final TypeCode inline;
+    private final TypeCode attachment;
+    private final String message;
+    private final String subject;
+    private final String prefix;
+    private final boolean attachError;
+    private final boolean isReply;
+    private final String recipients;
+    private final String to;
+    private final String reversePath;
+    private final String sender;
+    private final String replyTo;
+    private final boolean debug;
+
+    private LoadedOnceInitParameters(boolean isStatic, boolean passThrough, boolean fakeDomainCheck, TypeCode inline, TypeCode attachment, String message,
+            String subject, String prefix, boolean attachError, boolean isReply, String recipients, String to, String reversePath, String sender, String replyTo, boolean debug) {
+        this.isStatic = isStatic;
+        this.passThrough = passThrough;
+        this.fakeDomainCheck = fakeDomainCheck;
+        this.inline = inline;
+        this.attachment = attachment;
+        this.message = message;
+        this.subject = subject;
+        this.prefix = prefix;
+        this.attachError = attachError;
+        this.isReply = isReply;
+        this.recipients = recipients;
+        this.to = to;
+        this.reversePath = reversePath;
+        this.sender = sender;
+        this.replyTo = replyTo;
+        this.debug = debug;
+    }
+
+    @Override
+    public boolean getPassThrough() {
+        return passThrough;
+    }
+
+    @Override
+    public boolean getFakeDomainCheck() {
+        return fakeDomainCheck;
+    }
+
+    @Override
+    public TypeCode getInLineType() {
+        return inline;
+    }
+
+    @Override
+    public TypeCode getAttachmentType() {
+        return attachment;
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+    @Override
+    public String getSubject() {
+        return subject;
+    }
+
+    @Override
+    public String getSubjectPrefix() {
+        return prefix;
+    }
+
+    @Override
+    public boolean isAttachError() {
+        return attachError;
+    }
+
+    @Override
+    public boolean isReply() {
+        return isReply;
+    }
+
+    @Override
+    public String getRecipients() {
+        return recipients;
+    }
+
+    @Override
+    public String getTo() {
+        return to;
+    }
+
+    @Override
+    public String getReversePath() {
+        return reversePath;
+    }
+
+    @Override
+    public String getSender() {
+        return sender;
+    }
+
+    @Override
+    public String getReplyTo() {
+        return replyTo;
+    }
+
+    @Override
+    public boolean isDebug() {
+        return debug;
+    }
+
+    @Override
+    public boolean isStatic() {
+        return isStatic;
+    }
+
+    @Override
+    public String asString() {
+        return InitParametersSerializer.serialize(this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParameters.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParameters.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParameters.java
index a4f3341..94948cc 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParameters.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParameters.java
@@ -25,9 +25,17 @@ import com.google.common.base.Strings;
 
 public class NotifyMailetInitParameters implements InitParameters {
 
+    public static InitParameters from(GenericMailet mailet) {
+        NotifyMailetInitParameters initParameters = new NotifyMailetInitParameters(mailet);
+        if (initParameters.isStatic()) {
+            return LoadedOnceInitParameters.from(initParameters);
+        }
+        return initParameters;
+    }
+
     private final GenericMailet mailet;
 
-    public NotifyMailetInitParameters(GenericMailet mailet) {
+    private NotifyMailetInitParameters(GenericMailet mailet) {
         this.mailet = mailet;
     }
 
@@ -123,4 +131,9 @@ public class NotifyMailetInitParameters implements InitParameters {
     public boolean isStatic() {
         return mailet.getInitParameter("static", false);
     }
+
+    @Override
+    public String asString() {
+        return InitParametersSerializer.serialize(this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParameters.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParameters.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParameters.java
index 27d9aac..3bf6b60 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParameters.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParameters.java
@@ -21,13 +21,30 @@ package org.apache.james.transport.mailets.redirect;
 
 import org.apache.mailet.base.GenericMailet;
 
+import com.google.common.base.Optional;
 import com.google.common.base.Strings;
 
 public class RedirectMailetInitParameters implements InitParameters {
 
+    public static InitParameters from(GenericMailet mailet) {
+        RedirectMailetInitParameters initParameters = new RedirectMailetInitParameters(mailet, Optional.<TypeCode> absent(), Optional.<TypeCode> absent());
+        if (initParameters.isStatic()) {
+            return LoadedOnceInitParameters.from(initParameters);
+        }
+        return initParameters;
+    }
+
+    public static InitParameters from(GenericMailet mailet, Optional<TypeCode> defaultAttachmentType, Optional<TypeCode> defaultInLineType) {
+        RedirectMailetInitParameters initParameters = new RedirectMailetInitParameters(mailet, defaultAttachmentType, defaultAttachmentType);
+        if (initParameters.isStatic()) {
+            return LoadedOnceInitParameters.from(initParameters);
+        }
+        return initParameters;
+    }
+
     private final GenericMailet mailet;
 
-    public RedirectMailetInitParameters(GenericMailet mailet) {
+    private RedirectMailetInitParameters(GenericMailet mailet) {
         this.mailet = mailet;
     }
 
@@ -123,4 +140,9 @@ public class RedirectMailetInitParameters implements InitParameters {
     public boolean isStatic() {
         return mailet.getInitParameter("static", false);
     }
+
+    @Override
+    public String asString() {
+        return InitParametersSerializer.serialize(this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AbstractRedirectTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AbstractRedirectTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AbstractRedirectTest.java
index dfbdd64..73a297b 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AbstractRedirectTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AbstractRedirectTest.java
@@ -60,7 +60,7 @@ public class AbstractRedirectTest {
 
         @Override
         protected InitParameters getInitParameters() {
-            return new RedirectMailetInitParameters(this);
+            return RedirectMailetInitParameters.from(this);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/LoadedOnceInitParametersTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/LoadedOnceInitParametersTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/LoadedOnceInitParametersTest.java
new file mode 100644
index 0000000..dc54458
--- /dev/null
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/LoadedOnceInitParametersTest.java
@@ -0,0 +1,139 @@
+/****************************************************************
+ * 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.transport.mailets.redirect;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+public class LoadedOnceInitParametersTest {
+
+    @Test
+    public void fromShouldTakeValueFromInitParameters() {
+        InitParameters expectedParameters = new MyInitParameters();
+
+        InitParameters parameters = LoadedOnceInitParameters.from(expectedParameters);
+
+        assertThat(parameters.getPassThrough()).isEqualTo(expectedParameters.getPassThrough());
+        assertThat(parameters.getFakeDomainCheck()).isEqualTo(expectedParameters.getFakeDomainCheck());
+        assertThat(parameters.getInLineType()).isEqualTo(expectedParameters.getInLineType());
+        assertThat(parameters.getAttachmentType()).isEqualTo(expectedParameters.getAttachmentType());
+        assertThat(parameters.getMessage()).isEqualTo(expectedParameters.getMessage());
+        assertThat(parameters.getSubject()).isEqualTo(expectedParameters.getSubject());
+        assertThat(parameters.getSubjectPrefix()).isEqualTo(expectedParameters.getSubjectPrefix());
+        assertThat(parameters.isAttachError()).isEqualTo(expectedParameters.isAttachError());
+        assertThat(parameters.isReply()).isEqualTo(expectedParameters.isReply());
+        assertThat(parameters.getRecipients()).isEqualTo(expectedParameters.getRecipients());
+        assertThat(parameters.getTo()).isEqualTo(expectedParameters.getTo());
+        assertThat(parameters.getReversePath()).isEqualTo(expectedParameters.getReversePath());
+        assertThat(parameters.getSender()).isEqualTo(expectedParameters.getSender());
+        assertThat(parameters.getReplyTo()).isEqualTo(expectedParameters.getReplyTo());
+        assertThat(parameters.isDebug()).isEqualTo(expectedParameters.isDebug());
+        assertThat(parameters.isStatic()).isEqualTo(expectedParameters.isStatic());
+    }
+
+    private static class MyInitParameters implements InitParameters {
+
+        @Override
+        public boolean getPassThrough() {
+            return true;
+        }
+
+        @Override
+        public boolean getFakeDomainCheck() {
+            return true;
+        }
+
+        @Override
+        public TypeCode getInLineType() {
+            return TypeCode.ALL;
+        }
+
+        @Override
+        public TypeCode getAttachmentType() {
+            return TypeCode.BODY;
+        }
+
+        @Override
+        public String getMessage() {
+            return "message";
+        }
+
+        @Override
+        public String getSubject() {
+            return "subject";
+        }
+
+        @Override
+        public String getSubjectPrefix() {
+            return "prefix";
+        }
+
+        @Override
+        public boolean isAttachError() {
+            return true;
+        }
+
+        @Override
+        public boolean isReply() {
+            return true;
+        }
+
+        @Override
+        public String getRecipients() {
+            return "recipients";
+        }
+
+        @Override
+        public String getTo() {
+            return "to";
+        }
+
+        @Override
+        public String getReversePath() {
+            return "reversePath";
+        }
+
+        @Override
+        public String getSender() {
+            return "sender";
+        }
+
+        @Override
+        public String getReplyTo() {
+            return "replyTo";
+        }
+
+        @Override
+        public boolean isDebug() {
+            return true;
+        }
+
+        @Override
+        public boolean isStatic() {
+            return true;
+        }
+
+        @Override
+        public String asString() {
+            return InitParametersSerializer.serialize(this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java
index e6a41d1..7f3b152 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java
@@ -35,7 +35,6 @@ import org.junit.Test;
 public class NotifyMailetInitParametersTest {
 
     private GenericMailet mailet;
-    private NotifyMailetInitParameters testee;
 
     @Before
     public void setup() {
@@ -45,7 +44,6 @@ public class NotifyMailetInitParametersTest {
             public void service(Mail mail) throws MessagingException {
             }
         };
-        testee = new NotifyMailetInitParameters(mailet);
     }
 
     @Test
@@ -54,6 +52,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("passThrough", "true");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean passThrough = testee.getPassThrough();
         assertThat(passThrough).isTrue();
@@ -65,6 +64,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("passThrough", "false");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean passThrough = testee.getPassThrough();
         assertThat(passThrough).isFalse();
@@ -75,6 +75,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean passThrough = testee.getPassThrough();
         assertThat(passThrough).isTrue();
@@ -86,6 +87,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("fakeDomainCheck", "true");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean fakeDomainCheck = testee.getFakeDomainCheck();
         assertThat(fakeDomainCheck).isTrue();
@@ -97,6 +99,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("fakeDomainCheck", "false");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean fakeDomainCheck = testee.getFakeDomainCheck();
         assertThat(fakeDomainCheck).isFalse();
@@ -107,6 +110,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean fakeDomainCheck = testee.getFakeDomainCheck();
         assertThat(fakeDomainCheck).isFalse();
@@ -118,6 +122,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("inline", "unaltered");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         TypeCode inLineType = testee.getInLineType();
         assertThat(inLineType).isEqualTo(TypeCode.UNALTERED);
@@ -128,6 +133,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         TypeCode inLineType = testee.getInLineType();
         assertThat(inLineType).isEqualTo(TypeCode.NONE);
@@ -139,6 +145,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("attachment", "unaltered");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         TypeCode attachmentType = testee.getAttachmentType();
         assertThat(attachmentType).isEqualTo(TypeCode.UNALTERED);
@@ -149,6 +156,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         TypeCode attachmentType = testee.getAttachmentType();
         assertThat(attachmentType).isEqualTo(TypeCode.MESSAGE);
@@ -160,6 +168,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("notice", "my notice");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String message = testee.getMessage();
         assertThat(message).isEqualTo("my notice");
@@ -171,6 +180,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("message", "my message");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String message = testee.getMessage();
         assertThat(message).isEqualTo("my message");
@@ -181,6 +191,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String message = testee.getMessage();
         assertThat(message).isEqualTo("We were unable to deliver the attached message because of an error in the mail server.");
@@ -191,6 +202,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String subject = testee.getSubject();
         assertThat(subject).isNull();
@@ -202,6 +214,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("prefix", "my prefix");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String prefix = testee.getSubjectPrefix();
         assertThat(prefix).isEqualTo("my prefix");
@@ -212,6 +225,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String prefix = testee.getSubjectPrefix();
         assertThat(prefix).isEqualTo("Re:");
@@ -223,6 +237,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("attachError", "true");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean attachError = testee.isAttachError();
         assertThat(attachError).isTrue();
@@ -234,6 +249,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("attachError", "false");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean attachError = testee.isAttachError();
         assertThat(attachError).isFalse();
@@ -244,6 +260,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean attachError = testee.isAttachError();
         assertThat(attachError).isFalse();
@@ -254,6 +271,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean isReply = testee.isReply();
         assertThat(isReply).isTrue();
@@ -265,6 +283,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("recipients", "user@james.org, user2@james.org");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String recipients = testee.getRecipients();
         assertThat(recipients).isEqualTo("user@james.org, user2@james.org");
@@ -276,6 +295,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("recipients", "");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String recipients = testee.getRecipients();
         assertThat(recipients).isNull();
@@ -286,6 +306,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String recipients = testee.getRecipients();
         assertThat(recipients).isNull();
@@ -297,6 +318,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("to", "user@james.org, user2@james.org");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String to = testee.getTo();
         assertThat(to).isEqualTo("user@james.org, user2@james.org");
@@ -308,6 +330,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("to", "");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String to = testee.getTo();
         assertThat(to).isNull();
@@ -318,6 +341,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String to = testee.getTo();
         assertThat(to).isNull();
@@ -329,6 +353,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("reversePath", "user@james.org, user2@james.org");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String reversePath = testee.getReversePath();
         assertThat(reversePath).isEqualTo("user@james.org, user2@james.org");
@@ -340,6 +365,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("reversePath", "");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String reversePath = testee.getReversePath();
         assertThat(reversePath).isNull();
@@ -350,6 +376,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String reversePath = testee.getReversePath();
         assertThat(reversePath).isNull();
@@ -361,6 +388,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("sender", "user@james.org, user2@james.org");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String sender = testee.getSender();
         assertThat(sender).isEqualTo("user@james.org, user2@james.org");
@@ -372,6 +400,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("sender", "");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String sender = testee.getSender();
         assertThat(sender).isNull();
@@ -382,6 +411,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String sender = testee.getSender();
         assertThat(sender).isNull();
@@ -393,6 +423,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("replyTo", "user@james.org, user2@james.org");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String replyTo = testee.getReplyTo();
         assertThat(replyTo).isEqualTo("user@james.org, user2@james.org");
@@ -404,6 +435,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("replyto", "user@james.org, user2@james.org");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String replyTo = testee.getReplyTo();
         assertThat(replyTo).isEqualTo("user@james.org, user2@james.org");
@@ -415,6 +447,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("replyTo", "");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String replyTo = testee.getReplyTo();
         assertThat(replyTo).isNull();
@@ -425,6 +458,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         String replyTo = testee.getReplyTo();
         assertThat(replyTo).isNull();
@@ -436,6 +470,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("debug", "true");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean debug = testee.isDebug();
         assertThat(debug).isTrue();
@@ -447,6 +482,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("debug", "false");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean debug = testee.isDebug();
         assertThat(debug).isFalse();
@@ -457,6 +493,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean debug = testee.isDebug();
         assertThat(debug).isFalse();
@@ -468,6 +505,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("static", "true");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean isStatic = testee.isStatic();
         assertThat(isStatic).isTrue();
@@ -479,6 +517,7 @@ public class NotifyMailetInitParametersTest {
         properties.put("static", "false");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean isStatic = testee.isStatic();
         assertThat(isStatic).isFalse();
@@ -489,6 +528,7 @@ public class NotifyMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
         boolean isStatic = testee.isStatic();
         assertThat(isStatic).isFalse();

http://git-wip-us.apache.org/repos/asf/james-project/blob/5e493a18/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParametersTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParametersTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParametersTest.java
index 9529147..abf1add 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParametersTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParametersTest.java
@@ -35,7 +35,6 @@ import org.junit.Test;
 public class RedirectMailetInitParametersTest {
 
     private GenericMailet mailet;
-    private RedirectMailetInitParameters testee;
 
     @Before
     public void setup() {
@@ -45,7 +44,6 @@ public class RedirectMailetInitParametersTest {
             public void service(Mail mail) throws MessagingException {
             }
         };
-        testee = new RedirectMailetInitParameters(mailet);
     }
 
     @Test
@@ -54,6 +52,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("passThrough", "true");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean passThrough = testee.getPassThrough();
         assertThat(passThrough).isTrue();
@@ -65,6 +64,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("passThrough", "false");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean passThrough = testee.getPassThrough();
         assertThat(passThrough).isFalse();
@@ -75,6 +75,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean passThrough = testee.getPassThrough();
         assertThat(passThrough).isFalse();
@@ -86,6 +87,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("fakeDomainCheck", "true");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean fakeDomainCheck = testee.getFakeDomainCheck();
         assertThat(fakeDomainCheck).isTrue();
@@ -97,6 +99,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("fakeDomainCheck", "false");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean fakeDomainCheck = testee.getFakeDomainCheck();
         assertThat(fakeDomainCheck).isFalse();
@@ -107,6 +110,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean fakeDomainCheck = testee.getFakeDomainCheck();
         assertThat(fakeDomainCheck).isFalse();
@@ -118,6 +122,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("inline", "none");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         TypeCode inLineType = testee.getInLineType();
         assertThat(inLineType).isEqualTo(TypeCode.NONE);
@@ -128,6 +133,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         TypeCode inLineType = testee.getInLineType();
         assertThat(inLineType).isEqualTo(TypeCode.UNALTERED);
@@ -139,6 +145,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("attachment", "unaltered");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         TypeCode attachmentType = testee.getAttachmentType();
         assertThat(attachmentType).isEqualTo(TypeCode.UNALTERED);
@@ -149,6 +156,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         TypeCode attachmentType = testee.getAttachmentType();
         assertThat(attachmentType).isEqualTo(TypeCode.NONE);
@@ -160,6 +168,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("message", "my message");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String message = testee.getMessage();
         assertThat(message).isEqualTo("my message");
@@ -170,6 +179,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String message = testee.getMessage();
         assertThat(message).isEqualTo("");
@@ -181,6 +191,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("subject", "my subject");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String subject = testee.getSubject();
         assertThat(subject).isEqualTo("my subject");
@@ -191,6 +202,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String subject = testee.getSubject();
         assertThat(subject).isNull();
@@ -202,6 +214,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("prefix", "my prefix");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String prefix = testee.getSubjectPrefix();
         assertThat(prefix).isEqualTo("my prefix");
@@ -212,6 +225,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String prefix = testee.getSubjectPrefix();
         assertThat(prefix).isNull();
@@ -223,6 +237,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("attachError", "true");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean attachError = testee.isAttachError();
         assertThat(attachError).isTrue();
@@ -234,6 +249,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("attachError", "false");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean attachError = testee.isAttachError();
         assertThat(attachError).isFalse();
@@ -244,6 +260,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean attachError = testee.isAttachError();
         assertThat(attachError).isFalse();
@@ -255,6 +272,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("isReply", "true");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean isReply = testee.isReply();
         assertThat(isReply).isTrue();
@@ -266,6 +284,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("isReply", "false");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean isReply = testee.isReply();
         assertThat(isReply).isFalse();
@@ -276,6 +295,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean isReply = testee.isReply();
         assertThat(isReply).isFalse();
@@ -287,6 +307,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("recipients", "user@james.org, user2@james.org");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String recipients = testee.getRecipients();
         assertThat(recipients).isEqualTo("user@james.org, user2@james.org");
@@ -298,6 +319,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("recipients", "");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String recipients = testee.getRecipients();
         assertThat(recipients).isNull();
@@ -308,6 +330,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String recipients = testee.getRecipients();
         assertThat(recipients).isNull();
@@ -319,6 +342,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("to", "user@james.org, user2@james.org");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String to = testee.getTo();
         assertThat(to).isEqualTo("user@james.org, user2@james.org");
@@ -330,6 +354,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("to", "");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String to = testee.getTo();
         assertThat(to).isNull();
@@ -340,6 +365,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String to = testee.getTo();
         assertThat(to).isNull();
@@ -351,6 +377,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("reversePath", "user@james.org, user2@james.org");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String reversePath = testee.getReversePath();
         assertThat(reversePath).isEqualTo("user@james.org, user2@james.org");
@@ -362,6 +389,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("reversePath", "");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String reversePath = testee.getReversePath();
         assertThat(reversePath).isNull();
@@ -372,6 +400,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String reversePath = testee.getReversePath();
         assertThat(reversePath).isNull();
@@ -383,6 +412,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("sender", "user@james.org, user2@james.org");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String sender = testee.getSender();
         assertThat(sender).isEqualTo("user@james.org, user2@james.org");
@@ -394,6 +424,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("sender", "");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String sender = testee.getSender();
         assertThat(sender).isNull();
@@ -404,6 +435,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String sender = testee.getSender();
         assertThat(sender).isNull();
@@ -415,6 +447,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("replyTo", "user@james.org, user2@james.org");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String replyTo = testee.getReplyTo();
         assertThat(replyTo).isEqualTo("user@james.org, user2@james.org");
@@ -426,6 +459,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("replyto", "user@james.org, user2@james.org");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String replyTo = testee.getReplyTo();
         assertThat(replyTo).isEqualTo("user@james.org, user2@james.org");
@@ -437,6 +471,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("replyTo", "");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String replyTo = testee.getReplyTo();
         assertThat(replyTo).isNull();
@@ -447,6 +482,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String replyTo = testee.getReplyTo();
         assertThat(replyTo).isNull();
@@ -458,6 +494,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("debug", "true");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean debug = testee.isDebug();
         assertThat(debug).isTrue();
@@ -469,6 +506,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("debug", "false");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean debug = testee.isDebug();
         assertThat(debug).isFalse();
@@ -479,6 +517,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean debug = testee.isDebug();
         assertThat(debug).isFalse();
@@ -490,6 +529,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("static", "true");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean isStatic = testee.isStatic();
         assertThat(isStatic).isTrue();
@@ -501,6 +541,7 @@ public class RedirectMailetInitParametersTest {
         properties.put("static", "false");
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean isStatic = testee.isStatic();
         assertThat(isStatic).isFalse();
@@ -511,6 +552,7 @@ public class RedirectMailetInitParametersTest {
         Properties properties = new Properties();
         FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
         mailet.init(mailetConfig);
+        InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         boolean isStatic = testee.isStatic();
         assertThat(isStatic).isFalse();


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