You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ro...@apache.org on 2019/05/07 09:34:53 UTC

[james-project] branch master updated (6681d08 -> c49be34)

This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git.


    from 6681d08  JAMES-2716 howTo documentation for custom listeners
     new 6727dad  JAMES-2754 extract external James configuration
     new 4fbdb51  JAMES-2754 add smtp host system injection
     new 023aef4  fixup! JAMES-2754 add smtp host system injection
     new c49be34  Merge remote-tracking branch 'remk/JAMES-2754-part-1'

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../compilation/java-8/integration_tests.sh        | 12 ++++-
 mpt/impl/imap-mailbox/external-james/pom.xml       |  5 ++
 .../external/james/DeploymentValidation.java       | 12 +++--
 .../external/james/ExternalJamesModule.java        | 14 ++++--
 .../james/JamesDeploymentValidationTest.java       | 12 ++++-
 .../james/host/ExternalJamesConfiguration.java     | 10 ++--
 ...alJamesConfigurationEnvironnementVariables.java | 58 ++++++++++++++++++++++
 ...ystem.java => ExternalJamesImapHostSystem.java} | 14 ++----
 ...Adder.java => ExternalJamesSmtpHostSystem.java} | 20 +++++---
 .../external/james/host/SmtpHostSystem.java        | 10 ++--
 10 files changed, 129 insertions(+), 38 deletions(-)
 copy server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/PortSupplier.java => mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java (87%)
 create mode 100644 mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfigurationEnvironnementVariables.java
 rename mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/{ExternalJamesHostSystem.java => ExternalJamesImapHostSystem.java} (76%)
 copy mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/{ExternalJamesUserAdder.java => ExternalJamesSmtpHostSystem.java} (69%)
 copy server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/SerializableAsXml.java => mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/SmtpHostSystem.java (84%)


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


[james-project] 01/04: JAMES-2754 extract external James configuration

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 6727dada135a6da6e01c1d490ea5da1b7f173a0c
Author: Rémi Kowalski <rk...@linagora.com>
AuthorDate: Thu May 2 14:08:49 2019 +0200

    JAMES-2754 extract external James configuration
---
 .../compilation/java-8/integration_tests.sh        | 12 +++++-
 .../external/james/ExternalJamesModule.java        | 11 +++--
 .../ExternalJamesConfiguration.java}               | 23 +++-------
 ...alJamesConfigurationEnvironnementVariables.java | 50 ++++++++++++++++++++++
 ...ystem.java => ExternalJamesImapHostSystem.java} | 14 ++----
 5 files changed, 77 insertions(+), 33 deletions(-)

diff --git a/dockerfiles/compilation/java-8/integration_tests.sh b/dockerfiles/compilation/java-8/integration_tests.sh
index bfef037..bbe13ed 100755
--- a/dockerfiles/compilation/java-8/integration_tests.sh
+++ b/dockerfiles/compilation/java-8/integration_tests.sh
@@ -5,6 +5,7 @@ printUsage() {
    echo "./integration_tests.sh URL BRANCH JAMES_IP JAMES_IMAP_PORT"
    echo "    JAMES_IP: IP of the James server to be tests"
    echo "    JAMES_IMAP_PORT: Exposed IMAP port of this James server"
+   echo "    JAMES_SMTP_PORT: Exposed SMTP port of this James server"
    echo "    SHA1(optional): Branch to build or master if none"
    exit 1
 }
@@ -26,7 +27,10 @@ do
             JAMES_IMAP_PORT=$2
          fi
          if ! [ -z "$3" ]; then
-            SHA1=$3
+            JAMES_SMTP_PORT=$3
+         fi
+         if ! [ -z "$4" ]; then
+            SHA1=$4
          fi
          ;;
    esac
@@ -42,12 +46,18 @@ if [ -z "$JAMES_IMAP_PORT" ]; then
    printUsage
 fi
 
+if [ -z "JAMES_SMTP_PORT" ]; then
+   echo "You must provide a JAMES_SMTP_PORT"
+   printUsage
+fi
+
 if [ -z "$SHA1" ]; then
    SHA1=master
 fi
 
 export JAMES_ADDRESS=$JAMES_ADDRESS
 export JAMES_IMAP_PORT=$JAMES_IMAP_PORT
+export JAMES_SMTP_PORT=$JAMES_SMTP_PORT
 
 git clone $ORIGIN/.
 git checkout $SHA1
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/ExternalJamesModule.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/ExternalJamesModule.java
index 0d3f7f1..2daf013 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/ExternalJamesModule.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/ExternalJamesModule.java
@@ -23,7 +23,9 @@ import org.apache.james.mpt.api.HostSystem;
 import org.apache.james.mpt.api.ImapHostSystem;
 import org.apache.james.mpt.api.UserAdder;
 import org.apache.james.mpt.host.ExternalHostSystem;
-import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesHostSystem;
+import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesConfiguration;
+import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesConfigurationEnvironnementVariables;
+import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesImapHostSystem;
 import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesUserAdder;
 
 import com.google.inject.AbstractModule;
@@ -32,9 +34,10 @@ public class ExternalJamesModule extends AbstractModule {
 
     @Override
     protected void configure() {
-        bind(ImapHostSystem.class).to(ExternalJamesHostSystem.class);
-        bind(HostSystem.class).to(ExternalJamesHostSystem.class);
-        bind(ExternalHostSystem.class).to(ExternalJamesHostSystem.class);
+        bind(ExternalJamesConfiguration.class).to(ExternalJamesConfigurationEnvironnementVariables.class);
+        bind(ImapHostSystem.class).to(ExternalJamesImapHostSystem.class);
+        bind(HostSystem.class).to(ExternalJamesImapHostSystem.class);
+        bind(ExternalHostSystem.class).to(ExternalJamesImapHostSystem.class);
         bind(UserAdder.class).to(ExternalJamesUserAdder.class);
     }
 
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/ExternalJamesModule.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java
similarity index 58%
copy from mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/ExternalJamesModule.java
copy to mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java
index 0d3f7f1..209218b 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/ExternalJamesModule.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java
@@ -16,26 +16,13 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
+package org.apache.james.mpt.imapmailbox.external.james.host;
 
-package org.apache.james.mpt.imapmailbox.external.james;
+import org.apache.james.util.Port;
 
-import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.api.ImapHostSystem;
-import org.apache.james.mpt.api.UserAdder;
-import org.apache.james.mpt.host.ExternalHostSystem;
-import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesHostSystem;
-import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesUserAdder;
+public interface ExternalJamesConfiguration {
+    String getAddress();
 
-import com.google.inject.AbstractModule;
-
-public class ExternalJamesModule extends AbstractModule {
-
-    @Override
-    protected void configure() {
-        bind(ImapHostSystem.class).to(ExternalJamesHostSystem.class);
-        bind(HostSystem.class).to(ExternalJamesHostSystem.class);
-        bind(ExternalHostSystem.class).to(ExternalJamesHostSystem.class);
-        bind(UserAdder.class).to(ExternalJamesUserAdder.class);
-    }
+    Port getImapPort();
 
 }
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfigurationEnvironnementVariables.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfigurationEnvironnementVariables.java
new file mode 100644
index 0000000..5dde686
--- /dev/null
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfigurationEnvironnementVariables.java
@@ -0,0 +1,50 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.external.james.host;
+
+import org.apache.james.util.Port;
+
+import com.google.common.base.Preconditions;
+
+public class ExternalJamesConfigurationEnvironnementVariables implements ExternalJamesConfiguration {
+
+    private static final String ENV_JAMES_ADDRESS = "JAMES_ADDRESS";
+    private static final String ENV_JAMES_IMAP_PORT = "JAMES_IMAP_PORT";
+
+    private final String address;
+    private final Port imapPort;
+
+    public ExternalJamesConfigurationEnvironnementVariables() {
+        Preconditions.checkState(System.getenv(ENV_JAMES_ADDRESS) != null, "You must have exported an environment variable called JAMES_ADDRESS in order to run these tests. For instance export JAMES_ADDRESS=127.0.0.1");
+        Preconditions.checkState(System.getenv(ENV_JAMES_IMAP_PORT) != null, "You must have exported an environment variable called JAMES_IMAP_PORT in order to run these tests. For instance export JAMES_IMAP_PORT=143");
+        this.address = System.getenv(ENV_JAMES_ADDRESS);
+        this.imapPort = Port.of(Integer.parseInt(System.getenv(ENV_JAMES_IMAP_PORT)));
+    }
+
+    @Override
+    public String getAddress() {
+        return address;
+    }
+
+    @Override
+    public Port getImapPort() {
+        return imapPort;
+    }
+
+}
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesImapHostSystem.java
similarity index 76%
rename from mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java
rename to mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesImapHostSystem.java
index 150a32b..ac75f4c 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesImapHostSystem.java
@@ -35,23 +35,17 @@ import com.google.inject.Inject;
 import com.google.inject.Singleton;
 
 @Singleton
-public class ExternalJamesHostSystem extends ExternalHostSystem {
-    
-    private static final String ENV_JAMES_ADDRESS = "JAMES_ADDRESS";
-    private static final String ENV_JAMES_IMAP_PORT = "JAMES_IMAP_PORT";
+public class ExternalJamesImapHostSystem extends ExternalHostSystem {
+
     private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT);
     
     private static final String SHABANG = "* OK IMAP4rev1 Server ready";
     private final Supplier<InetSocketAddress> addressSupplier;
 
     @Inject
-    private ExternalJamesHostSystem(ExternalJamesUserAdder userAdder) {
+    private ExternalJamesImapHostSystem(ExternalJamesUserAdder userAdder, ExternalJamesConfiguration configuration) {
         super(SUPPORTED_FEATURES, new NullMonitor(), SHABANG, userAdder);
-        Preconditions.checkState(System.getenv(ENV_JAMES_ADDRESS) != null, "You must have exported an environment variable called JAMES_ADDRESS in order to run these tests. For instance export JAMES_ADDRESS=127.0.0.1");
-        Preconditions.checkState(System.getenv(ENV_JAMES_IMAP_PORT) != null,"You must have exported an environment variable called JAMES_IMAP_PORT in order to run these tests. For instance export JAMES_IMAP_PORT=143");
-        this.addressSupplier = () -> new InetSocketAddress(
-            System.getenv(ENV_JAMES_ADDRESS),
-            Integer.parseInt(System.getenv(ENV_JAMES_IMAP_PORT)));
+        this.addressSupplier = () -> new InetSocketAddress(configuration.getAddress(), configuration.getImapPort().getValue());
     }
 
     @Override


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


[james-project] 02/04: JAMES-2754 add smtp host system injection

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 4fbdb515009b69a3de07582152b94fa8ef3ffd40
Author: Rémi Kowalski <rk...@linagora.com>
AuthorDate: Thu May 2 14:24:56 2019 +0200

    JAMES-2754 add smtp host system injection
---
 mpt/impl/imap-mailbox/external-james/pom.xml        |  4 ++++
 .../external/james/DeploymentValidation.java        | 12 ++++++++----
 .../external/james/ExternalJamesModule.java         |  3 +++
 .../james/JamesDeploymentValidationTest.java        | 12 ++++++++++--
 .../james/host/ExternalJamesConfiguration.java      |  2 ++
 ...nalJamesConfigurationEnvironnementVariables.java |  8 ++++++++
 ...ration.java => ExternalJamesSmtpHostSystem.java} | 21 +++++++++++++++++----
 ...lJamesConfiguration.java => SmtpHostSystem.java} |  8 ++++----
 8 files changed, 56 insertions(+), 14 deletions(-)

diff --git a/mpt/impl/imap-mailbox/external-james/pom.xml b/mpt/impl/imap-mailbox/external-james/pom.xml
index 8b2ad6d..10ebda1 100644
--- a/mpt/impl/imap-mailbox/external-james/pom.xml
+++ b/mpt/impl/imap-mailbox/external-james/pom.xml
@@ -41,6 +41,10 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-testing</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>metrics-logger</artifactId>
         </dependency>
         <dependency>
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/DeploymentValidation.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/DeploymentValidation.java
index f949962..f4acc0c 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/DeploymentValidation.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/DeploymentValidation.java
@@ -22,6 +22,8 @@ package org.apache.james.mpt.imapmailbox.external.james;
 import java.util.Locale;
 
 import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesSmtpHostSystem;
+import org.apache.james.mpt.imapmailbox.external.james.host.SmtpHostSystem;
 import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
 import org.junit.Before;
 import org.junit.Test;
@@ -33,7 +35,9 @@ public abstract class DeploymentValidation {
     public static final String PASSWORD = "password";
 
     protected abstract ImapHostSystem createImapHostSystem();
-    
+
+    protected abstract SmtpHostSystem createSmtpHostSystem();
+
     private ImapHostSystem system;
     private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
@@ -41,10 +45,10 @@ public abstract class DeploymentValidation {
     public void setUp() throws Exception {
         system = createImapHostSystem();
         simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
-                .withUser(USER + "@" + DOMAIN, PASSWORD)
-                .withLocale(Locale.US);
+            .withUser(USER + "@" + DOMAIN, PASSWORD)
+            .withLocale(Locale.US);
     }
-    
+
     @Test
     public void validateDeployment() throws Exception {
         simpleScriptedTestProtocol.run("ValidateDeployment");
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/ExternalJamesModule.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/ExternalJamesModule.java
index 2daf013..4b0917f 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/ExternalJamesModule.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/ExternalJamesModule.java
@@ -26,7 +26,9 @@ import org.apache.james.mpt.host.ExternalHostSystem;
 import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesConfiguration;
 import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesConfigurationEnvironnementVariables;
 import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesImapHostSystem;
+import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesSmtpHostSystem;
 import org.apache.james.mpt.imapmailbox.external.james.host.ExternalJamesUserAdder;
+import org.apache.james.mpt.imapmailbox.external.james.host.SmtpHostSystem;
 
 import com.google.inject.AbstractModule;
 
@@ -38,6 +40,7 @@ public class ExternalJamesModule extends AbstractModule {
         bind(ImapHostSystem.class).to(ExternalJamesImapHostSystem.class);
         bind(HostSystem.class).to(ExternalJamesImapHostSystem.class);
         bind(ExternalHostSystem.class).to(ExternalJamesImapHostSystem.class);
+        bind(SmtpHostSystem.class).to(ExternalJamesSmtpHostSystem.class);
         bind(UserAdder.class).to(ExternalJamesUserAdder.class);
     }
 
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/JamesDeploymentValidationTest.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/JamesDeploymentValidationTest.java
index 81394f6..6bc75a9 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/JamesDeploymentValidationTest.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/JamesDeploymentValidationTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.mpt.imapmailbox.external.james;
 
 import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.external.james.host.SmtpHostSystem;
 import org.junit.After;
 import org.junit.Before;
 
@@ -29,12 +30,14 @@ import com.google.inject.Injector;
 public class JamesDeploymentValidationTest extends DeploymentValidation {
 
     private ImapHostSystem system;
+    private SmtpHostSystem smtpHostSystem;
 
     @Override
     @Before
     public void setUp() throws Exception {
         Injector injector = Guice.createInjector(new ExternalJamesModule());
         system = injector.getInstance(ImapHostSystem.class);
+        smtpHostSystem = injector.getInstance(SmtpHostSystem.class);
         system.beforeTest();
         super.setUp();
     }
@@ -43,11 +46,16 @@ public class JamesDeploymentValidationTest extends DeploymentValidation {
     protected ImapHostSystem createImapHostSystem() {
         return system;
     }
-    
+
+    @Override
+    protected SmtpHostSystem createSmtpHostSystem() {
+        return smtpHostSystem;
+    }
+
     @After
     public void tearDown() throws Exception {
         system.afterTest();
     }
 
-    
+
 }
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java
index 209218b..4035615 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java
@@ -25,4 +25,6 @@ public interface ExternalJamesConfiguration {
 
     Port getImapPort();
 
+    Port getSmptPort();
+
 }
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfigurationEnvironnementVariables.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfigurationEnvironnementVariables.java
index 5dde686..20f3b14 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfigurationEnvironnementVariables.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfigurationEnvironnementVariables.java
@@ -26,15 +26,19 @@ public class ExternalJamesConfigurationEnvironnementVariables implements Externa
 
     private static final String ENV_JAMES_ADDRESS = "JAMES_ADDRESS";
     private static final String ENV_JAMES_IMAP_PORT = "JAMES_IMAP_PORT";
+    private static final String ENV_JAMES_SMTP_PORT = "JAMES_SMTP_PORT";
 
     private final String address;
     private final Port imapPort;
+    private final Port smtpPort;
 
     public ExternalJamesConfigurationEnvironnementVariables() {
         Preconditions.checkState(System.getenv(ENV_JAMES_ADDRESS) != null, "You must have exported an environment variable called JAMES_ADDRESS in order to run these tests. For instance export JAMES_ADDRESS=127.0.0.1");
         Preconditions.checkState(System.getenv(ENV_JAMES_IMAP_PORT) != null, "You must have exported an environment variable called JAMES_IMAP_PORT in order to run these tests. For instance export JAMES_IMAP_PORT=143");
+        Preconditions.checkState(System.getenv(ENV_JAMES_SMTP_PORT) != null, "You must have exported an environment variable called JAMES_SMTP_PORT in order to run these tests. For instance export JAMES_IMAP_PORT=143");
         this.address = System.getenv(ENV_JAMES_ADDRESS);
         this.imapPort = Port.of(Integer.parseInt(System.getenv(ENV_JAMES_IMAP_PORT)));
+        this.smtpPort = Port.of(Integer.parseInt(System.getenv(ENV_JAMES_SMTP_PORT)));
     }
 
     @Override
@@ -47,4 +51,8 @@ public class ExternalJamesConfigurationEnvironnementVariables implements Externa
         return imapPort;
     }
 
+    @Override
+    public Port getSmptPort() {
+        return smtpPort;
+    }
 }
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesSmtpHostSystem.java
similarity index 65%
copy from mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java
copy to mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesSmtpHostSystem.java
index 209218b..d4fdda5 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesSmtpHostSystem.java
@@ -18,11 +18,24 @@
  ****************************************************************/
 package org.apache.james.mpt.imapmailbox.external.james.host;
 
-import org.apache.james.util.Port;
+import java.io.IOException;
 
-public interface ExternalJamesConfiguration {
-    String getAddress();
+import org.apache.james.utils.SMTPMessageSender;
 
-    Port getImapPort();
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
 
+@Singleton
+public class ExternalJamesSmtpHostSystem implements SmtpHostSystem{
+
+    private final ExternalJamesConfiguration configuration;
+
+    @Inject
+    private ExternalJamesSmtpHostSystem(ExternalJamesConfiguration externalConfiguration) {
+        this.configuration = externalConfiguration;
+    }
+
+    public SMTPMessageSender connect(SMTPMessageSender smtpMessageSender) throws IOException {
+        return smtpMessageSender.connect(configuration.getAddress(), configuration.getSmptPort());
+    }
 }
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/SmtpHostSystem.java
similarity index 86%
copy from mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java
copy to mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/SmtpHostSystem.java
index 209218b..f75ea16 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfiguration.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/SmtpHostSystem.java
@@ -18,11 +18,11 @@
  ****************************************************************/
 package org.apache.james.mpt.imapmailbox.external.james.host;
 
-import org.apache.james.util.Port;
+import java.io.IOException;
 
-public interface ExternalJamesConfiguration {
-    String getAddress();
+import org.apache.james.utils.SMTPMessageSender;
 
-    Port getImapPort();
+public interface SmtpHostSystem {
 
+    SMTPMessageSender connect(SMTPMessageSender smtpMessageSender) throws IOException;
 }


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


[james-project] 04/04: Merge remote-tracking branch 'remk/JAMES-2754-part-1'

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit c49be346729e3e150d418926eef83caab640faa9
Merge: 6681d08 023aef4
Author: Raphael Ouazana <ra...@linagora.com>
AuthorDate: Tue May 7 11:34:33 2019 +0200

    Merge remote-tracking branch 'remk/JAMES-2754-part-1'

 .../compilation/java-8/integration_tests.sh        | 12 ++++-
 mpt/impl/imap-mailbox/external-james/pom.xml       |  5 ++
 .../external/james/DeploymentValidation.java       | 12 +++--
 .../external/james/ExternalJamesModule.java        | 14 ++++--
 .../james/JamesDeploymentValidationTest.java       | 12 ++++-
 .../ExternalJamesConfiguration.java}               | 35 +++----------
 ...alJamesConfigurationEnvironnementVariables.java | 58 ++++++++++++++++++++++
 ...ystem.java => ExternalJamesImapHostSystem.java} | 14 ++----
 .../ExternalJamesSmtpHostSystem.java}              | 37 +++++---------
 .../SmtpHostSystem.java}                           | 35 ++-----------
 10 files changed, 130 insertions(+), 104 deletions(-)


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


[james-project] 03/04: fixup! JAMES-2754 add smtp host system injection

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 023aef4736fcd60f18d59dbb9d483e6af076c4c7
Author: Rémi Kowalski <rk...@linagora.com>
AuthorDate: Mon May 6 13:42:00 2019 +0200

    fixup! JAMES-2754 add smtp host system injection
---
 mpt/impl/imap-mailbox/external-james/pom.xml                            | 1 +
 .../james/host/ExternalJamesConfigurationEnvironnementVariables.java    | 2 +-
 .../imapmailbox/external/james/host/ExternalJamesSmtpHostSystem.java    | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/mpt/impl/imap-mailbox/external-james/pom.xml b/mpt/impl/imap-mailbox/external-james/pom.xml
index 10ebda1..5663268 100644
--- a/mpt/impl/imap-mailbox/external-james/pom.xml
+++ b/mpt/impl/imap-mailbox/external-james/pom.xml
@@ -42,6 +42,7 @@
         <dependency>
             <groupId>${james.groupId}</groupId>
             <artifactId>james-server-testing</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfigurationEnvironnementVariables.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfigurationEnvironnementVariables.java
index 20f3b14..799746d 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfigurationEnvironnementVariables.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesConfigurationEnvironnementVariables.java
@@ -35,7 +35,7 @@ public class ExternalJamesConfigurationEnvironnementVariables implements Externa
     public ExternalJamesConfigurationEnvironnementVariables() {
         Preconditions.checkState(System.getenv(ENV_JAMES_ADDRESS) != null, "You must have exported an environment variable called JAMES_ADDRESS in order to run these tests. For instance export JAMES_ADDRESS=127.0.0.1");
         Preconditions.checkState(System.getenv(ENV_JAMES_IMAP_PORT) != null, "You must have exported an environment variable called JAMES_IMAP_PORT in order to run these tests. For instance export JAMES_IMAP_PORT=143");
-        Preconditions.checkState(System.getenv(ENV_JAMES_SMTP_PORT) != null, "You must have exported an environment variable called JAMES_SMTP_PORT in order to run these tests. For instance export JAMES_IMAP_PORT=143");
+        Preconditions.checkState(System.getenv(ENV_JAMES_SMTP_PORT) != null, "You must have exported an environment variable called JAMES_SMTP_PORT in order to run these tests. For instance export JAMES_IMAP_PORT=587");
         this.address = System.getenv(ENV_JAMES_ADDRESS);
         this.imapPort = Port.of(Integer.parseInt(System.getenv(ENV_JAMES_IMAP_PORT)));
         this.smtpPort = Port.of(Integer.parseInt(System.getenv(ENV_JAMES_SMTP_PORT)));
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesSmtpHostSystem.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesSmtpHostSystem.java
index d4fdda5..8e6aee0 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesSmtpHostSystem.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesSmtpHostSystem.java
@@ -35,6 +35,7 @@ public class ExternalJamesSmtpHostSystem implements SmtpHostSystem{
         this.configuration = externalConfiguration;
     }
 
+    @Override
     public SMTPMessageSender connect(SMTPMessageSender smtpMessageSender) throws IOException {
         return smtpMessageSender.connect(configuration.getAddress(), configuration.getSmptPort());
     }


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