james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rouaz...@apache.org
Subject [30/50] [abbrv] james-project git commit: MAILET-115 Remove RedirectNotify.setDNSService method
Date Wed, 11 Jan 2017 09:26:18 GMT
MAILET-115 Remove RedirectNotify.setDNSService method


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

Branch: refs/heads/master
Commit: 4c64d471cc9c35dc114719402752fed15875cc5a
Parents: 4e81a89
Author: Antoine Duprat <aduprat@apache.org>
Authored: Tue Nov 22 11:00:01 2016 +0100
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Wed Jan 11 10:03:31 2017 +0700

----------------------------------------------------------------------
 .../org/apache/james/transport/mailets/Bounce.java    | 13 ++++++-------
 .../org/apache/james/transport/mailets/DSNBounce.java | 13 ++++++-------
 .../org/apache/james/transport/mailets/Forward.java   | 14 +++++++-------
 .../james/transport/mailets/NotifyPostmaster.java     | 13 ++++++-------
 .../apache/james/transport/mailets/NotifySender.java  | 13 ++++++-------
 .../org/apache/james/transport/mailets/Redirect.java  | 13 ++++++-------
 .../org/apache/james/transport/mailets/Resend.java    | 13 ++++++-------
 .../transport/mailets/redirect/RedirectNotify.java    |  2 --
 .../apache/james/transport/mailets/BounceTest.java    |  4 +---
 .../apache/james/transport/mailets/DSNBounceTest.java |  3 +--
 .../apache/james/transport/mailets/ForwardTest.java   |  3 +--
 .../james/transport/mailets/NotifyPostmasterTest.java |  3 +--
 .../james/transport/mailets/NotifySenderTest.java     |  3 +--
 .../apache/james/transport/mailets/RedirectTest.java  |  3 +--
 .../apache/james/transport/mailets/ResendTest.java    |  3 +--
 15 files changed, 50 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/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 ad25df2..ef2dbb4 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
@@ -126,7 +126,12 @@ public class Bounce extends GenericMailet implements RedirectNotify {
             "debug", "passThrough", "fakeDomainCheck", "inline", "attachment", "message",
"notice", "sender", "sendingAddress", "prefix", "attachError" };
     private static final List<MailAddress> RECIPIENTS = ImmutableList.of(SpecialAddress.REVERSE_PATH);
     private static final List<InternetAddress> TO = ImmutableList.of(SpecialAddress.REVERSE_PATH.toInternetAddress());
-    private DNSService dns;
+    private final DNSService dns;
+
+    @Inject
+    public Bounce(DNSService dns) {
+        this.dns = dns;
+    }
 
     @Override
     public String getMailetInfo() {
@@ -143,12 +148,6 @@ public class Bounce extends GenericMailet implements RedirectNotify {
         return CONFIGURABLE_PARAMETERS;
     }
 
-    @Inject
-    @Override
-    public void setDNSService(DNSService dns) {
-        this.dns = dns;
-    }
-
     @Override
     public DNSService getDNSService() {
         return dns;

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/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 a88f4ae..69b425c 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
@@ -111,8 +111,13 @@ public class DSNBounce extends GenericMailet implements RedirectNotify
{
     private static final String MACHINE_PATTERN = "[machine]";
     private static final String LINE_BREAK = "\n";
 
+    private final DNSService dns;
     private String messageString = null;
-    private DNSService dns;
+
+    @Inject
+    public DSNBounce(DNSService dns) {
+        this.dns = dns;
+    }
 
     @Override
     public void init() throws MessagingException {
@@ -148,12 +153,6 @@ public class DSNBounce extends GenericMailet implements RedirectNotify
{
         return CONFIGURABLE_PARAMETERS;
     }
 
-    @Inject
-    @Override
-    public void setDNSService(DNSService dns) {
-        this.dns = dns;
-    }
-
     @Override
     public DNSService getDNSService() {
         return dns;

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/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 fda5f23..90c426f 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
@@ -96,7 +96,13 @@ public class Forward extends GenericMailet implements RedirectNotify {
             "debug", "passThrough", "fakeDomainCheck", "forwardto", "forwardTo" };
     private static final List<String> ALLOWED_SPECIALS = ImmutableList.of(
             "postmaster", "sender", "from", "replyTo", "reversePath", "unaltered", "recipients",
"to", "null");
-    private DNSService dns;
+    private final DNSService dns;
+
+    @Inject
+    public Forward(DNSService dns) {
+        this.dns = dns;
+        
+    }
 
     @Override
     public String getMailetInfo() {
@@ -113,12 +119,6 @@ public class Forward extends GenericMailet implements RedirectNotify
{
         return CONFIGURABLE_PARAMETERS;
     }
 
-    @Inject
-    @Override
-    public void setDNSService(DNSService dns) {
-        this.dns = dns;
-    }
-
     @Override
     public DNSService getDNSService() {
         return dns;

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/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 9c1684b..bbb02b8 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
@@ -126,8 +126,13 @@ public class NotifyPostmaster extends GenericMailet implements RedirectNotify
{
             "debug", "passThrough", "fakeDomainCheck", "inline", "attachment", "message",
"notice", "sender", "sendingAddress", "prefix", "attachError", "to" };
     private static final List<String> ALLOWED_SPECIALS = ImmutableList.of("postmaster",
"unaltered");
 
+    private final DNSService dns;
     private Optional<String> to = Optional.absent();
-    private DNSService dns;
+
+    @Inject
+    public NotifyPostmaster(DNSService dns) {
+        this.dns = dns;
+    }
 
     @Override
     public void init(MailetConfig mailetConfig) throws MessagingException {
@@ -150,12 +155,6 @@ public class NotifyPostmaster extends GenericMailet implements RedirectNotify
{
         return CONFIGURABLE_PARAMETERS;
     }
 
-    @Inject
-    @Override
-    public void setDNSService(DNSService dns) {
-        this.dns = dns;
-    }
-
     @Override
     public DNSService getDNSService() {
         return dns;

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/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 c018706..defb204 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
@@ -126,8 +126,13 @@ public class NotifySender extends GenericMailet implements RedirectNotify
{
     private static final List<MailAddress> RECIPIENT_MAIL_ADDRESSES = ImmutableList.of(SpecialAddress.SENDER);
     private static final List<String> ALLOWED_SPECIALS = ImmutableList.of("sender",
"unaltered", "from");
 
+    private final DNSService dns;
     private Optional<String> to = Optional.absent();
-    private DNSService dns;
+
+    @Inject
+    public NotifySender(DNSService dns) {
+        this.dns = dns;
+    }
 
     @Override
     public void init(MailetConfig mailetConfig) throws MessagingException {
@@ -150,12 +155,6 @@ public class NotifySender extends GenericMailet implements RedirectNotify
{
         return CONFIGURABLE_PARAMETERS;
     }
 
-    @Inject
-    @Override
-    public void setDNSService(DNSService dns) {
-        this.dns = dns;
-    }
-
     @Override
     public DNSService getDNSService() {
         return dns;

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/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 e5c25d1..cc252c6 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
@@ -305,7 +305,12 @@ public class Redirect extends GenericMailet implements RedirectNotify
{
             "static", "debug", "passThrough", "fakeDomainCheck", "inline", "attachment",
"message", "recipients", "to", "replyTo", "replyto", "reversePath", "sender", "subject", "prefix",
"attachError", "isReply" };
     private static final List<String> ALLOWED_SPECIALS = ImmutableList.of(
             "postmaster", "sender", "from", "replyTo", "reversePath", "unaltered", "recipients",
"to", "null");
-    private DNSService dns;
+    private final DNSService dns;
+
+    @Inject
+    public Redirect(DNSService dns) {
+        this.dns = dns;
+    }
 
     @Override
     public String getMailetInfo() {
@@ -322,12 +327,6 @@ public class Redirect extends GenericMailet implements RedirectNotify
{
         return CONFIGURABLE_PARAMETERS;
     }
 
-    @Inject
-    @Override
-    public void setDNSService(DNSService dns) {
-        this.dns = dns;
-    }
-
     @Override
     public DNSService getDNSService() {
         return dns;

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/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 c1cfe12..ece3541 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
@@ -298,7 +298,12 @@ public class Resend extends GenericMailet implements RedirectNotify {
 
     private static final String[] CONFIGURABLE_PARAMETERS = new String[] {
             "debug", "passThrough", "fakeDomainCheck", "inline", "attachment", "message",
"recipients", "to", "replyTo", "replyto", "reversePath", "sender", "subject", "prefix", "attachError",
"isReply" };
-    private DNSService dns;
+    private final DNSService dns;
+
+    @Inject
+    public Resend(DNSService dns) {
+        this.dns = dns;
+    }
 
     @Override
     public String getMailetInfo() {
@@ -315,12 +320,6 @@ public class Resend extends GenericMailet implements RedirectNotify {
         return CONFIGURABLE_PARAMETERS;
     }
 
-    @Inject
-    @Override
-    public void setDNSService(DNSService dns) {
-        this.dns = dns;
-    }
-
     @Override
     public DNSService getDNSService() {
         return dns;

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/RedirectNotify.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/RedirectNotify.java
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/RedirectNotify.java
index c72fad5..b354c20 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/RedirectNotify.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/RedirectNotify.java
@@ -143,8 +143,6 @@ public interface RedirectNotify extends Mailet, MailetConfig {
 
     String[] getAllowedInitParameters();
 
-    void setDNSService(DNSService dns);
-
     DNSService getDNSService();
 
     void log(String message);

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/BounceTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/BounceTest.java
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/BounceTest.java
index efd2d65..8f9a0b0 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/BounceTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/BounceTest.java
@@ -31,7 +31,6 @@ import javax.mail.Session;
 import javax.mail.internet.MimeMessage;
 
 import org.apache.james.dnsservice.api.DNSService;
-import org.apache.james.transport.mailets.Bounce;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.MailAddressFixture;
@@ -55,9 +54,8 @@ public class BounceTest {
 
     @Before
     public void setUp() throws Exception {
-        bounce = new Bounce();
         DNSService dnsService = mock(DNSService.class);
-        bounce.setDNSService(dnsService);
+        bounce = new Bounce(dnsService);
         fakeMailContext = FakeMailContext.defaultContext();
 
         when(dnsService.getLocalHost()).thenThrow(new UnknownHostException());

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
index a9a9dcb..d64546e 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
@@ -68,9 +68,8 @@ public class DSNBounceTest {
         timeZone = TimeZone.getDefault();
         TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
 
-        dsnBounce = new DSNBounce();
         DNSService dnsService = mock(DNSService.class);
-        dsnBounce.setDNSService(dnsService);
+        dsnBounce = new DSNBounce(dnsService);
         fakeMailContext = FakeMailContext.defaultContext();
 
         InetAddress localHost = InetAddress.getLocalHost();

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java
index 25d8013..a68fc16 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java
@@ -55,9 +55,8 @@ public class ForwardTest {
 
     @Before
     public void setUp() throws Exception {
-        forward = new Forward();
         DNSService dnsService = mock(DNSService.class);
-        forward.setDNSService(dnsService);
+        forward = new Forward(dnsService);
         postmaster = new MailAddress("postmaster@james.org");
         fakeMailContext = FakeMailContext.builder()
                 .postmaster(postmaster)

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
index e70786a..17ac3d2 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
@@ -55,9 +55,8 @@ public class NotifyPostmasterTest {
 
     @Before
     public void setUp() throws Exception {
-        notifyPostmaster = new NotifyPostmaster();
         DNSService dnsService = mock(DNSService.class);
-        notifyPostmaster.setDNSService(dnsService);
+        notifyPostmaster = new NotifyPostmaster(dnsService);
         postmaster = new MailAddress("postmaster@james.org");
         fakeMailContext = FakeMailContext.builder()
                 .postmaster(postmaster)

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
index 5c19686..d0e17f8 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
@@ -55,9 +55,8 @@ public class NotifySenderTest {
 
     @Before
     public void setUp() throws Exception {
-        notifySender = new NotifySender();
         DNSService dnsService = mock(DNSService.class);
-        notifySender.setDNSService(dnsService);
+        notifySender = new NotifySender(dnsService);
         postmaster = new MailAddress("postmaster@james.org");
         fakeMailContext = FakeMailContext.builder()
                 .postmaster(postmaster)

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java
index eab7081..8a4b3db 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java
@@ -56,9 +56,8 @@ public class RedirectTest {
 
     @Before
     public void setUp() throws Exception {
-        redirect = new Redirect();
         DNSService dnsService = mock(DNSService.class);
-        redirect.setDNSService(dnsService);
+        redirect = new Redirect(dnsService);
         postmaster = new MailAddress("postmaster@james.org");
         fakeMailContext = FakeMailContext.builder()
                 .postmaster(postmaster)

http://git-wip-us.apache.org/repos/asf/james-project/blob/4c64d471/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
index 1aae78b..30fe804 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
@@ -56,9 +56,8 @@ public class ResendTest {
 
     @Before
     public void setUp() throws Exception {
-        resend = new Resend();
         DNSService dnsService = mock(DNSService.class);
-        resend.setDNSService(dnsService);
+        resend = new Resend(dnsService);
         postmaster = new MailAddress("postmaster@james.org");
         fakeMailContext = FakeMailContext.builder()
                 .postmaster(postmaster)


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