You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2020/11/06 02:28:38 UTC

[james-project] branch master updated (500cf5f -> 58efe43)

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

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


    from 500cf5f  JAMES-3438 Add domain create command
     new ab885b0  JAMES-3389 add api to webadmin server for receiving mail over rest interface
     new 244265f  JAMES-3389 pom.xml-s were not committed
     new fd04346  JAMES-3389 pom.xml-s were not committed
     new e09a02f  JAMES-3389 consume message/rfc822
     new 62a10a0  JAMES-3389 remove json api components from receive mail over web module
     new 48fc4a4  JAMES-3389 rename (receive -> transfer)
     new 3f9e537  JAMES-3389 add apache licence headers
     new 01708ca  JAMES-3389 remove duplicate declaration from pom.xml
     new 05528b5  JAMES-3389 check MailQueue contents after using mailtransfer api
     new ea09614  JAMES-3400 Add domain delete command
     new 0ae45ed  JAMES-2771 Add some time between launch of docker images in provisioning
     new 58efe43  JAMES-2771 Add a restart for Zenko/cloudserver docker image with provisioning

The 12 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:
 JenkinsfileStressTests.groovy                      |  21 +++
 pom.xml                                            |   5 +
 server/container/guice/cassandra-guice/pom.xml     |   4 +
 .../org/apache/james/CassandraJamesServerMain.java |   4 +-
 server/container/guice/pom.xml                     |   6 +
 .../pom.xml                                        |  23 +--
 .../modules/server/WebAdminMailOverWebModule.java} |   6 +-
 .../org/apache/james/cli/domain/DomainCommand.java |   3 +-
 ...CreateCommand.java => DomainDeleteCommand.java} |  12 +-
 .../org/apache/james/httpclient/DomainClient.java  |   3 +
 .../org/apache/james/cli/DomainManageTest.java     |  28 ++++
 server/protocols/webadmin/pom.xml                  |   1 +
 .../webadmin/webadmin-mail-over-web}/pom.xml       |  46 +++---
 .../james/webadmin/routes/TransferEmailRoutes.java |  97 ++++++++++++
 .../james/routes/TransferEmailRoutesTest.java      | 141 +++++++++++++++++
 .../message/rfc822/message-without-from.eml        | 169 ++++++++++++++++++++
 .../message/rfc822/message-without-tos.eml         | 169 ++++++++++++++++++++
 .../src/test/resources/message/rfc822/message.eml  | 170 +++++++++++++++++++++
 18 files changed, 864 insertions(+), 44 deletions(-)
 copy server/container/guice/protocols/{webadmin-jmap => webadmin-mail-over-web}/pom.xml (83%)
 copy server/container/guice/protocols/{webadmin-swagger/src/main/java/org/apache/james/modules/server/SwaggerRoutesModule.java => webadmin-mail-over-web/src/main/java/org/apache/james/modules/server/WebAdminMailOverWebModule.java} (88%)
 copy server/protocols/webadmin-cli/src/main/java/org/apache/james/cli/domain/{DomainCreateCommand.java => DomainDeleteCommand.java} (88%)
 copy server/{mailrepository/mailrepository-memory => protocols/webadmin/webadmin-mail-over-web}/pom.xml (73%)
 create mode 100644 server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/TransferEmailRoutes.java
 create mode 100644 server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/TransferEmailRoutesTest.java
 create mode 100644 server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/message/rfc822/message-without-from.eml
 create mode 100644 server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/message/rfc822/message-without-tos.eml
 create mode 100644 server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/message/rfc822/message.eml


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


[james-project] 11/12: JAMES-2771 Add some time between launch of docker images in provisioning

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

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

commit 0ae45ed636294816d1a80cd1fe656d5195271fcf
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Thu Nov 5 10:28:04 2020 +0700

    JAMES-2771 Add some time between launch of docker images in provisioning
---
 JenkinsfileStressTests.groovy | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/JenkinsfileStressTests.groovy b/JenkinsfileStressTests.groovy
index f929bdc..ab9024c 100644
--- a/JenkinsfileStressTests.groovy
+++ b/JenkinsfileStressTests.groovy
@@ -64,11 +64,25 @@ pipeline {
                                 case "reference":
                                     sh "cd /srv && sudo btrfs subvolume snapshot bench-snapshot-s3 bench-running-docker"
                                     sh 'docker run -d --name=cassandra -p 9042:9042 -v /srv/bench-running-docker/cassandra:/var/lib/cassandra cassandra:3.11.3'
+
+                                    sh 'sleep 10'
+
                                     sh 'docker run -d --name=elasticsearch -p 9200:9200 -v /srv/bench-running-docker/elasticsearch:/usr/share/elasticsearch/data  --env "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.3.2'
+
+                                    sh 'sleep 10'
+
                                     sh 'docker run -d --name=tika apache/tika:1.24'
+
+                                    sh 'sleep 10'
+
                                     sh 'docker run -d --name=s3 --env "REMOTE_MANAGEMENT_DISABLE=1" --env "SCALITY_ACCESS_KEY_ID=accessKey1" --env "SCALITY_SECRET_ACCESS_KEY=secretKey1" -v /srv/bench-running-docker/s3/localData:/usr/src/app/localData -v /srv/bench-running-docker/s3/localMetadata:/usr/src/app/localMetadata zenko/cloudserver:8.2.6'
+
+                                    sh 'sleep 10'
+
                                     sh 'docker run -d --name=rabbitmq -p 15672:15672 -p 5672:5672 rabbitmq:3.8.1-management'
 
+                                    sh 'sleep 10'
+
                                     sh 'docker run -d --hostname HOSTNAME -p 25:25 -p 1080:80 -p 8000:8000 -p 110:110 -p 143:143 -p 465:465 -p 587:587 -p 993:993 --link cassandra:cassandra --link rabbitmq:rabbitmq --link elasticsearch:elasticsearch --link tika:tika --link s3:s3.docker.test --name james_run -t james_run'
                                     break
                                 case "s3-local":


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


[james-project] 10/12: JAMES-3400 Add domain delete command

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

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

commit ea096141a089b41207e3e89c4445220c67d34f79
Author: quanth <hq...@linagora.com>
AuthorDate: Mon Nov 2 17:24:10 2020 +0700

    JAMES-3400 Add domain delete command
---
 .../org/apache/james/cli/domain/DomainCommand.java |  3 +-
 ...DomainCommand.java => DomainDeleteCommand.java} | 45 +++++++++++++---------
 .../org/apache/james/httpclient/DomainClient.java  |  3 ++
 .../org/apache/james/cli/DomainManageTest.java     | 28 ++++++++++++++
 4 files changed, 59 insertions(+), 20 deletions(-)

diff --git a/server/protocols/webadmin-cli/src/main/java/org/apache/james/cli/domain/DomainCommand.java b/server/protocols/webadmin-cli/src/main/java/org/apache/james/cli/domain/DomainCommand.java
index 89f2ab76..9d990af 100644
--- a/server/protocols/webadmin-cli/src/main/java/org/apache/james/cli/domain/DomainCommand.java
+++ b/server/protocols/webadmin-cli/src/main/java/org/apache/james/cli/domain/DomainCommand.java
@@ -31,7 +31,8 @@ import picocli.CommandLine;
         description = "Manage Domains",
         subcommands = {
             DomainListCommand.class,
-            DomainCreateCommand.class
+            DomainCreateCommand.class,
+            DomainDeleteCommand.class
         })
 public class DomainCommand implements Callable<Integer> {
 
diff --git a/server/protocols/webadmin-cli/src/main/java/org/apache/james/cli/domain/DomainCommand.java b/server/protocols/webadmin-cli/src/main/java/org/apache/james/cli/domain/DomainDeleteCommand.java
similarity index 60%
copy from server/protocols/webadmin-cli/src/main/java/org/apache/james/cli/domain/DomainCommand.java
copy to server/protocols/webadmin-cli/src/main/java/org/apache/james/cli/domain/DomainDeleteCommand.java
index 89f2ab76..11853fd 100644
--- a/server/protocols/webadmin-cli/src/main/java/org/apache/james/cli/domain/DomainCommand.java
+++ b/server/protocols/webadmin-cli/src/main/java/org/apache/james/cli/domain/DomainDeleteCommand.java
@@ -19,35 +19,42 @@
 
 package org.apache.james.cli.domain;
 
-import java.io.PrintStream;
 import java.util.concurrent.Callable;
 
 import org.apache.james.cli.WebAdminCli;
+import org.apache.james.httpclient.DomainClient;
 
+import feign.Feign;
+import feign.Response;
 import picocli.CommandLine;
 
 @CommandLine.Command(
-        name = "domain",
-        description = "Manage Domains",
-        subcommands = {
-            DomainListCommand.class,
-            DomainCreateCommand.class
-        })
-public class DomainCommand implements Callable<Integer> {
-
-    protected final WebAdminCli webAdminCli;
-    protected final PrintStream out;
-    protected final PrintStream err;
-
-    public DomainCommand(PrintStream out, WebAdminCli webAdminCli, PrintStream err) {
-        this.out = out;
-        this.webAdminCli = webAdminCli;
-        this.err = err;
-    }
+    name = "delete",
+    description = "Delete a domain")
+public class DomainDeleteCommand implements Callable<Integer> {
+
+    public static final int DELETED_CODE = 204;
+
+    @CommandLine.ParentCommand DomainCommand domainCommand;
+
+    @CommandLine.Parameters
+    String domainName;
 
     @Override
     public Integer call() {
-        return WebAdminCli.CLI_FINISHED_SUCCEED;
+        try {
+            DomainClient domainClient = Feign.builder()
+                .target(DomainClient.class, domainCommand.webAdminCli.jamesUrl + "/domains");
+            Response rs = domainClient.deleteADomain(domainName);
+            if (rs.status() == DELETED_CODE) {
+                return WebAdminCli.CLI_FINISHED_SUCCEED;
+            } else {
+                return WebAdminCli.CLI_FINISHED_FAILED;
+            }
+        } catch (Exception e) {
+            e.printStackTrace(domainCommand.err);
+            return WebAdminCli.CLI_FINISHED_FAILED;
+        }
     }
 
 }
\ No newline at end of file
diff --git a/server/protocols/webadmin-cli/src/main/java/org/apache/james/httpclient/DomainClient.java b/server/protocols/webadmin-cli/src/main/java/org/apache/james/httpclient/DomainClient.java
index 7b52da9..1d03221 100644
--- a/server/protocols/webadmin-cli/src/main/java/org/apache/james/httpclient/DomainClient.java
+++ b/server/protocols/webadmin-cli/src/main/java/org/apache/james/httpclient/DomainClient.java
@@ -33,4 +33,7 @@ public interface DomainClient {
     @RequestLine("PUT /{domainToBeCreated}")
     Response createADomain(@Param("domainToBeCreated") String domainName);
 
+    @RequestLine("DELETE /{domainToBeDeleted}")
+    Response deleteADomain(@Param("domainToBeDeleted") String domainName);
+
 }
diff --git a/server/protocols/webadmin-cli/src/test/java/org/apache/james/cli/DomainManageTest.java b/server/protocols/webadmin-cli/src/test/java/org/apache/james/cli/DomainManageTest.java
index 6e2cec1..5a5720a 100644
--- a/server/protocols/webadmin-cli/src/test/java/org/apache/james/cli/DomainManageTest.java
+++ b/server/protocols/webadmin-cli/src/test/java/org/apache/james/cli/DomainManageTest.java
@@ -93,4 +93,32 @@ public class DomainManageTest {
         assertThat(exitCode3).isEqualTo(1);
         assertThat(outputStreamCaptor.toString().trim().toCharArray()).containsOnly("localhost".toCharArray());
     }
+
+    @Test
+    void domainDeleteCommandWithValidDomainShouldSucceed(GuiceJamesServer server) {
+        Port port = server.getProbe(WebAdminGuiceProbe.class).getWebAdminPort();
+
+        WebAdminCli.executeFluent(new PrintStream(outputStreamCaptor), new PrintStream(errorStreamCaptor),
+            "--url", "http://127.0.0.1:" + port.getValue(), "domain", "create", "linagora.com");
+
+        int exitCode = WebAdminCli.executeFluent(new PrintStream(outputStreamCaptor), new PrintStream(errorStreamCaptor),
+            "--url", "http://127.0.0.1:" + port.getValue(), "domain", "delete", "linagora.com");
+
+        WebAdminCli.executeFluent(new PrintStream(outputStreamCaptor), new PrintStream(errorStreamCaptor),
+            "--url", "http://127.0.0.1:" + port.getValue(), "domain", "list");
+
+        assertThat(exitCode).isEqualTo(0);
+        assertThat(outputStreamCaptor.toString().contains("linagora.com")).isFalse();
+    }
+
+    @Test
+    void domainDeleteCommandWithDefaultDomainShouldFail(GuiceJamesServer server) {
+        Port port = server.getProbe(WebAdminGuiceProbe.class).getWebAdminPort();
+
+        int exitCode = WebAdminCli.executeFluent(new PrintStream(outputStreamCaptor), new PrintStream(errorStreamCaptor),
+            "--url", "http://127.0.0.1:" + port.getValue(), "domain", "delete", "localhost");
+
+        assertThat(exitCode).isEqualTo(1);
+    }
+
 }


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


[james-project] 08/12: JAMES-3389 remove duplicate declaration from pom.xml

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

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

commit 01708cac0be473f2d7101dcf2a075ec31e3edcba
Author: Andreas Valdma <an...@nortal.com>
AuthorDate: Wed Nov 4 17:24:26 2020 +0200

    JAMES-3389 remove duplicate declaration from pom.xml
---
 server/protocols/webadmin/webadmin-mail-over-web/pom.xml | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/server/protocols/webadmin/webadmin-mail-over-web/pom.xml b/server/protocols/webadmin/webadmin-mail-over-web/pom.xml
index c0f784d..27e6dd5 100644
--- a/server/protocols/webadmin/webadmin-mail-over-web/pom.xml
+++ b/server/protocols/webadmin/webadmin-mail-over-web/pom.xml
@@ -72,12 +72,6 @@
             <scope>test</scope>
         </dependency>
 
-        <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>james-server-webadmin-core</artifactId>
-            <type>test-jar</type>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
 </project>
\ No newline at end of file


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


[james-project] 07/12: JAMES-3389 add apache licence headers

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

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

commit 3f9e537e366db1d24c80cc2def87162ebd791af4
Author: Andreas Valdma <an...@nortal.com>
AuthorDate: Wed Nov 4 12:57:02 2020 +0200

    JAMES-3389 add apache licence headers
---
 server/container/guice/pom.xml                     | 35 ----------------------
 .../modules/server/WebAdminMailOverWebModule.java  | 19 ++++++++++++
 .../james/webadmin/routes/TransferEmailRoutes.java | 19 ++++++++++++
 .../james/routes/TransferEmailRoutesTest.java      | 19 ++++++++++++
 4 files changed, 57 insertions(+), 35 deletions(-)

diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 867488c..392a3fe 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -204,41 +204,6 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-guice-webadmin-mailbox</artifactId>
                 <version>${project.version}</version>
             </dependency>
diff --git a/server/container/guice/protocols/webadmin-mail-over-web/src/main/java/org/apache/james/modules/server/WebAdminMailOverWebModule.java b/server/container/guice/protocols/webadmin-mail-over-web/src/main/java/org/apache/james/modules/server/WebAdminMailOverWebModule.java
index 352a16f..e5f9b7f 100644
--- a/server/container/guice/protocols/webadmin-mail-over-web/src/main/java/org/apache/james/modules/server/WebAdminMailOverWebModule.java
+++ b/server/container/guice/protocols/webadmin-mail-over-web/src/main/java/org/apache/james/modules/server/WebAdminMailOverWebModule.java
@@ -1,3 +1,22 @@
+/****************************************************************
+ * 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.modules.server;
 
 import org.apache.james.webadmin.Routes;
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/TransferEmailRoutes.java b/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/TransferEmailRoutes.java
index b81cc04..ae5bd40 100644
--- a/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/TransferEmailRoutes.java
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/TransferEmailRoutes.java
@@ -1,3 +1,22 @@
+/****************************************************************
+ * 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.webadmin.routes;
 
 import java.io.ByteArrayInputStream;
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/TransferEmailRoutesTest.java b/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/TransferEmailRoutesTest.java
index 0c634a8..169f9cc 100644
--- a/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/TransferEmailRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/TransferEmailRoutesTest.java
@@ -1,3 +1,22 @@
+/****************************************************************
+ * 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.routes;
 
 import static io.restassured.RestAssured.given;


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


[james-project] 12/12: JAMES-2771 Add a restart for Zenko/cloudserver docker image with provisioning

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

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

commit 58efe43c28210ce9c285b3d18575d43ef7e437f2
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Thu Nov 5 15:39:47 2020 +0700

    JAMES-2771 Add a restart for Zenko/cloudserver docker image with provisioning
    
    Sometimes Zenko fails at starting correctly with provisioning.
    There is a timeout when it tries to connect to metadata service.
    Maybe too much metadata to charge? It seems a restart helps with this for now
---
 JenkinsfileStressTests.groovy | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/JenkinsfileStressTests.groovy b/JenkinsfileStressTests.groovy
index ab9024c..b8aafdb 100644
--- a/JenkinsfileStressTests.groovy
+++ b/JenkinsfileStressTests.groovy
@@ -119,6 +119,13 @@ pipeline {
                                     sh "docker exec james_run ${jamesCliWithOptions} adduser user${n}@open-paas.org secret"
                                 }
                             }
+                            if (params.PROFILE == "reference") {
+                                // Sometimes Zenko fails at starting correctly with provisioning.
+                                // There is a timeout when it tries to connect to metadata service.
+                                // Maybe too much metadata to charge? It seems a restart helps with this for now
+                                sh "docker restart s3"
+                                sh 'sleep 5'
+                            }
                         }
                     }
                 }


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


[james-project] 01/12: JAMES-3389 add api to webadmin server for receiving mail over rest interface

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

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

commit ab885b0a87982d424ddce45d6e4c3deb233fe8b9
Author: andreas <an...@nortal.com>
AuthorDate: Fri Oct 23 08:40:44 2020 +0300

    JAMES-3389 add api to webadmin server for receiving mail over rest interface
---
 pom.xml                                            |   5 +
 server/container/guice/cassandra-guice/pom.xml     |   4 +
 .../org/apache/james/CassandraJamesServerMain.java |   4 +-
 server/container/guice/pom.xml                     |   6 +
 .../modules/server/WebAdminMailOverWebModule.java  |  16 ++
 server/protocols/webadmin/pom.xml                  |   1 +
 .../james/webadmin/request/BodyPartProps.java      |  89 ++++++++++
 .../apache/james/webadmin/request/MailProps.java   | 189 +++++++++++++++++++++
 .../webadmin/routes/ReceiveMailOverWebRoutes.java  |  86 ++++++++++
 .../org/apache/james/request/MailPropsTest.java    | 131 ++++++++++++++
 .../james/routes/ReceiveMailOverWebRoutesTest.java | 104 ++++++++++++
 .../src/test/resources/json/mail.json              |  13 ++
 .../src/test/resources/json/withoutFrom.json       |  12 ++
 .../src/test/resources/json/withoutTos.json        |  12 ++
 14 files changed, 671 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 236b695..73f03cb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1862,6 +1862,11 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-webadmin-mail-over-web</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-webadmin-mailbox</artifactId>
                 <version>${project.version}</version>
             </dependency>
diff --git a/server/container/guice/cassandra-guice/pom.xml b/server/container/guice/cassandra-guice/pom.xml
index 8e23442..97b1455 100644
--- a/server/container/guice/cassandra-guice/pom.xml
+++ b/server/container/guice/cassandra-guice/pom.xml
@@ -238,6 +238,10 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>james-server-guice-webadmin-mailbox</artifactId>
         </dependency>
         <dependency>
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
index 83d444b..412c209 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
@@ -67,6 +67,7 @@ import org.apache.james.modules.server.MessagesRoutesModule;
 import org.apache.james.modules.server.SieveRoutesModule;
 import org.apache.james.modules.server.SwaggerRoutesModule;
 import org.apache.james.modules.server.TaskManagerModule;
+import org.apache.james.modules.server.WebAdminMailOverWebModule;
 import org.apache.james.modules.server.WebAdminReIndexingTaskSerializationModule;
 import org.apache.james.modules.server.WebAdminServerModule;
 import org.apache.james.modules.spamassassin.SpamAssassinListenerModule;
@@ -98,7 +99,8 @@ public class CassandraJamesServerMain implements JamesServerMain {
         new SwaggerRoutesModule(),
         new WebAdminServerModule(),
         new WebAdminReIndexingTaskSerializationModule(),
-        new MessagesRoutesModule());
+        new MessagesRoutesModule(),
+        new WebAdminMailOverWebModule());
 
     public static final Module PROTOCOLS = Modules.combine(
         new CassandraJmapModule(),
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 882574f..392a3fe 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -75,6 +75,7 @@
         <module>protocols/webadmin-mailrepository</module>
         <module>protocols/webadmin-rabbitmq-mailqueue</module>
         <module>protocols/webadmin-swagger</module>
+        <module>protocols/webadmin-mail-over-web</module>
         <module>rabbitmq</module>
         <module>testing</module>
         <module>sieve-file</module>
@@ -198,6 +199,11 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-guice-webadmin-mailbox</artifactId>
                 <version>${project.version}</version>
             </dependency>
diff --git a/server/container/guice/protocols/webadmin-mail-over-web/src/main/java/org/apache/james/modules/server/WebAdminMailOverWebModule.java b/server/container/guice/protocols/webadmin-mail-over-web/src/main/java/org/apache/james/modules/server/WebAdminMailOverWebModule.java
new file mode 100644
index 0000000..7c376ec
--- /dev/null
+++ b/server/container/guice/protocols/webadmin-mail-over-web/src/main/java/org/apache/james/modules/server/WebAdminMailOverWebModule.java
@@ -0,0 +1,16 @@
+package org.apache.james.modules.server;
+
+import org.apache.james.webadmin.Routes;
+import org.apache.james.webadmin.routes.ReceiveMailOverWebRoutes;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.Multibinder;
+
+public class WebAdminMailOverWebModule extends AbstractModule {
+
+    @Override
+    protected void configure() {
+        Multibinder<Routes> routesMultibinder = Multibinder.newSetBinder(binder(), Routes.class);
+        routesMultibinder.addBinding().to(ReceiveMailOverWebRoutes.class);
+    }
+}
diff --git a/server/protocols/webadmin/pom.xml b/server/protocols/webadmin/pom.xml
index 54a0609..9622d12 100644
--- a/server/protocols/webadmin/pom.xml
+++ b/server/protocols/webadmin/pom.xml
@@ -45,6 +45,7 @@
         <module>webadmin-mailrepository</module>
         <module>webadmin-rabbitmq</module>
         <module>webadmin-swagger</module>
+        <module>webadmin-mail-over-web</module>
     </modules>
 
 </project>
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/request/BodyPartProps.java b/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/request/BodyPartProps.java
new file mode 100644
index 0000000..95aa874
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/request/BodyPartProps.java
@@ -0,0 +1,89 @@
+package org.apache.james.webadmin.request;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class BodyPartProps {
+
+    @JsonCreator
+    public BodyPartProps(
+            @JsonProperty("type") String type,
+            @JsonProperty("filename") String filename,
+            @JsonProperty("content") String content,
+            @JsonProperty("encoding") String encoding,
+            @JsonProperty("disposition") String disposition,
+            @JsonProperty("headers") Map<String, String> headers) {
+
+        Optional.ofNullable(type).ifPresent(this::setType);
+        this.filename = filename;
+        Optional.ofNullable(content).ifPresent(this::setContent);
+        this.encoding = encoding;
+        this.disposition = disposition;
+        Optional.ofNullable(headers).ifPresent(this::setHeaders);
+    }
+
+    private String type = "text/plain";
+
+    private String filename;
+
+    private String content;
+
+    private String encoding;
+
+    private String disposition;
+
+    private Map<String, String> headers = new HashMap<>();
+
+    public String getType() {
+        return this.type;
+    }
+
+    public void setType(final String type) {
+        this.type = type;
+    }
+
+    public String getFilename() {
+        return this.filename;
+    }
+
+    public void setFilename(final String filename) {
+        this.filename = filename;
+    }
+
+    public String getContent() {
+        return this.content;
+    }
+
+    public void setContent(final String content) {
+        this.content = content;
+    }
+
+    public String getEncoding() {
+        return this.encoding;
+    }
+
+    public void setEncoding(final String encoding) {
+        this.encoding = encoding;
+    }
+
+    public String getDisposition() {
+        return this.disposition;
+    }
+
+    public void setDisposition(final String disposition) {
+        this.disposition = disposition;
+    }
+
+    public Map<String, String> getHeaders() {
+        return this.headers;
+    }
+
+    public void setHeaders(final Map<String, String> headers) {
+        this.headers = headers;
+    }
+
+}
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/request/MailProps.java b/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/request/MailProps.java
new file mode 100644
index 0000000..339aa84
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/request/MailProps.java
@@ -0,0 +1,189 @@
+package org.apache.james.webadmin.request;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.function.Predicate;
+
+import javax.activation.DataHandler;
+import javax.mail.Header;
+import javax.mail.MessagingException;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.PreencodedMimeBodyPart;
+import javax.mail.util.ByteArrayDataSource;
+
+import org.apache.james.core.builder.MimeMessageBuilder;
+import org.apache.james.server.core.MailImpl;
+import org.apache.james.server.core.MimeMessageCopyOnWriteProxy;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.github.fge.lambdas.Throwing;
+import com.google.common.annotations.VisibleForTesting;
+
+public class MailProps {
+
+    private String name = UUID.randomUUID().toString();
+
+    private String from;
+
+    private List<String> tos;
+
+    private List<String> ccs;
+
+    private List<String> bccs;
+
+    private String subject;
+
+    private List<BodyPartProps> mailBodyPartProps = new ArrayList<>();
+
+    private Map<String, String> headers = new HashMap<>();
+
+    public MailProps(
+            @JsonProperty("name") String name,
+            @JsonProperty("from") String from,
+            @JsonProperty("to") List<String> tos,
+            @JsonProperty("cc") List<String> ccs,
+            @JsonProperty("bcc") List<String> bccs,
+            @JsonProperty("subject") String subject,
+            @JsonProperty("bodyParts") List<BodyPartProps> bodyPartProps,
+            @JsonProperty("headers") Map<String, String> headers) {
+        Optional.ofNullable(name).ifPresent(this::setName);
+        Optional.ofNullable(from).ifPresentOrElse(this::setFrom, () -> {
+            throw new RuntimeException("Mail missing from");
+        });
+        Optional.ofNullable(tos).filter(Predicate.not(List::isEmpty)).ifPresentOrElse(this::setTos, () -> {
+            throw new RuntimeException("Mail missing to addresses");
+        });
+        this.ccs = Optional.ofNullable(ccs).orElse(new ArrayList<>());
+        this.bccs = Optional.ofNullable(bccs).orElse(new ArrayList<>());
+        this.subject = subject;
+        Optional.ofNullable(bodyPartProps).ifPresent(this::setMailBodyPartProps);
+        Optional.ofNullable(headers).ifPresent(this::setHeaders);
+    }
+
+    public MailImpl asMailImpl() throws MessagingException, IOException {
+
+        try {
+
+            MimeMessage build = getMimeMessage();
+
+            return MailImpl.fromMimeMessage(name, new MimeMessageCopyOnWriteProxy(build));
+        } catch (AddressException e) {
+            throw new RuntimeException("There is a problem with one mail address: " + e.getRef());
+        }
+    }
+
+    public MimeMessage getMimeMessage() throws MessagingException, IOException {
+        MimeMessageBuilder.MultipartBuilder multipartBuilder = MimeMessageBuilder.multipartBuilder();
+
+        for (BodyPartProps mailBodyPartProps : this.mailBodyPartProps) {
+
+            PreencodedMimeBodyPart preencodedMimeBodyPart = new PreencodedMimeBodyPart(Optional.ofNullable(mailBodyPartProps.getEncoding()).orElse("7bit"));
+
+            Optional.ofNullable(mailBodyPartProps.getDisposition()).ifPresent(Throwing.consumer(preencodedMimeBodyPart::setDisposition));
+
+            Optional.ofNullable(mailBodyPartProps.getFilename()).ifPresent(Throwing.consumer(preencodedMimeBodyPart::setFileName));
+
+            preencodedMimeBodyPart.setDataHandler(
+                    new DataHandler(
+                            new ByteArrayDataSource(
+                                    mailBodyPartProps.getContent(),
+                                    mailBodyPartProps.getType()
+                            )
+                    )
+            );
+
+            Optional.ofNullable(mailBodyPartProps.getHeaders())
+                    .ifPresent(headers -> {
+                        headers.entrySet().stream().forEach(Throwing.consumer(e -> preencodedMimeBodyPart.addHeader(e.getKey(), e.getValue())));
+                    });
+
+            multipartBuilder.addBody(
+                    preencodedMimeBodyPart
+            );
+
+        }
+
+        MimeMessage build = MimeMessageBuilder.mimeMessageBuilder()
+                .setContent(
+                        multipartBuilder
+                )
+                .addFrom(from)
+                .setSubject(subject)
+                .addCcRecipient(ccs.stream().toArray(String[]::new))
+                .addBccRecipient(bccs.stream().toArray(String[]::new))
+                .addToRecipient(tos.stream().toArray(String[]::new))
+                .addHeaders(headers.entrySet().stream().map(e -> new Header(e.getKey(), e.getValue())).toArray(MimeMessageBuilder.Header[]::new))
+                .build();
+        return build;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public String getFrom() {
+        return this.from;
+    }
+
+    public void setFrom(final String from) {
+        this.from = from;
+    }
+
+    public List<String> getTos() {
+        return this.tos;
+    }
+
+    public void setTos(final List<String> tos) {
+        this.tos = tos;
+    }
+
+    public List<String> getCcs() {
+        return this.ccs;
+    }
+
+    public void setCcs(final List<String> ccs) {
+        this.ccs = ccs;
+    }
+
+    public List<String> getBccs() {
+        return this.bccs;
+    }
+
+    public void setBccs(final List<String> bccs) {
+        this.bccs = bccs;
+    }
+
+    public String getSubject() {
+        return this.subject;
+    }
+
+    public void setSubject(final String subject) {
+        this.subject = subject;
+    }
+
+    public List<BodyPartProps> getMailBodyPartProps() {
+        return this.mailBodyPartProps;
+    }
+
+    public void setMailBodyPartProps(final List<BodyPartProps> mailBodyPartProps) {
+        this.mailBodyPartProps = mailBodyPartProps;
+    }
+
+    public Map<String, String> getHeaders() {
+        return this.headers;
+    }
+
+    public void setHeaders(final Map<String, String> headers) {
+        this.headers = headers;
+    }
+}
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/ReceiveMailOverWebRoutes.java b/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/ReceiveMailOverWebRoutes.java
new file mode 100644
index 0000000..6d82869
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/ReceiveMailOverWebRoutes.java
@@ -0,0 +1,86 @@
+package org.apache.james.webadmin.routes;
+
+import javax.inject.Inject;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.apache.james.queue.api.MailQueue;
+import org.apache.james.queue.api.MailQueueFactory;
+import org.apache.james.server.core.MailImpl;
+import org.apache.james.webadmin.Routes;
+import org.apache.james.webadmin.request.MailProps;
+import org.apache.james.webadmin.utils.ErrorResponder;
+import org.apache.james.webadmin.utils.JsonExtractor;
+import org.eclipse.jetty.http.HttpStatus;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import spark.Service;
+
+@Api(tags = "OverWebMailReceiver")
+@Path(ReceiveMailOverWebRoutes.BASE_URL)
+@Produces("application/json")
+public class ReceiveMailOverWebRoutes implements Routes {
+
+    private final JsonExtractor<MailProps> mailPropsJsonExtractor;
+
+    public static final String BASE_URL = "/receiveMail";
+
+    private MailQueue queue;
+
+    @Override
+    public String getBasePath() {
+        return BASE_URL;
+    }
+
+    @Inject
+    public ReceiveMailOverWebRoutes(MailQueueFactory<?> queueFactory) {
+        queue = queueFactory.createQueue(MailQueueFactory.SPOOL);
+        this.mailPropsJsonExtractor = new JsonExtractor<>(MailProps.class);
+    }
+
+    @Override
+    public void define(Service service) {
+        defineReceiveMailFromWebService(service);
+    }
+
+    @POST
+    @Path("/receiveMail")
+    @ApiOperation(value = "Deleting an user")
+    @ApiImplicitParams({
+            @ApiImplicitParam(required = true, dataType = "string", name = "username", paramType = "path")
+    })
+    @ApiResponses(value = {
+            @ApiResponse(code = HttpStatus.NO_CONTENT_204, message = "OK. User is removed."),
+            @ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "Invalid input user."),
+            @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500,
+                    message = "Internal server error - Something went bad on the server side.")
+    })
+    public void defineReceiveMailFromWebService(Service service) {
+        service.post(BASE_URL, (request, response) -> {
+            try {
+                //Parse the json object to org.apache.james.webadmin.request.MailProps and build the MailImpl object
+                MailImpl mail = mailPropsJsonExtractor.parse(request.body()).asMailImpl();
+                //Send to queue api for mail processing
+                queue.enQueue(mail);
+                response.body("ENQUEUED");
+                response.status(204);
+            } catch (Exception e) {
+                ErrorResponder.builder()
+                        .cause(e)
+                        .statusCode(500)
+                        .type(ErrorResponder.ErrorType.SERVER_ERROR)
+                        .message("The mail will not be sent: " + e.getMessage())
+                        .haltError();
+            }
+
+            return response.body();
+        });
+    }
+
+}
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/request/MailPropsTest.java b/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/request/MailPropsTest.java
new file mode 100644
index 0000000..1968a60
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/request/MailPropsTest.java
@@ -0,0 +1,131 @@
+package org.apache.james.request;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import javax.mail.internet.MimeMessage;
+
+import org.apache.james.core.MailAddress;
+import org.apache.james.server.core.MailImpl;
+import org.apache.james.server.core.MimeMessageCopyOnWriteProxy;
+import org.apache.james.webadmin.request.BodyPartProps;
+import org.apache.james.webadmin.request.MailProps;
+import org.apache.mailet.Matcher;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class MailPropsTest {
+
+    @Test
+    public void mailImplemantationHascorrectFieldsWhenBuiltFromMailProps() throws Exception{
+        MailProps mailProps = new MailProps(
+                "test",
+                "valid@address",
+                Arrays.asList("valid1@address"),
+                Arrays.asList("valid2@address"),
+                Arrays.asList("valid3@address"),
+                "test-subject",
+                null,
+                null
+        );
+
+        MailImpl mail = mailProps.asMailImpl();
+
+        assertThat(mail.getName(), Matchers.equalTo("test"));
+        assertThat(mail.getSender().asPrettyString(), Matchers.equalTo("<va...@address>"));
+        assertThat(mail.getRecipients(), Matchers.contains(new MailAddress("valid1@address"), new MailAddress("valid2@address"), new MailAddress("valid3@address")));
+        assertThat(mail.getMessage().getHeader("Subject"), Matchers.array(Matchers.equalTo("test-subject")));
+        assertThat(mail.getMessage().getHeader("Content-Type"), Matchers.array(Matchers.equalTo("text/plain; charset=us-ascii")));
+    }
+
+    @Test
+    public void mailImplemantationHascorrectFieldsWhenBuiltFromMailPropsWithBodyParts() throws Exception{
+        MailProps mailProps = new MailProps(
+                "test",
+                "valid@address",
+                Arrays.asList("valid1@address"),
+                Arrays.asList("valid2@address"),
+                Arrays.asList("valid3@address"),
+                "test-subject",
+                Arrays.asList(new BodyPartProps("text/plain", null, "test-text", null, null, null)),
+                null
+        );
+
+        MailImpl mail = mailProps.asMailImpl();
+
+        assertThat(mail.getName(), Matchers.equalTo("test"));
+        assertThat(mail.getSender().asPrettyString(), Matchers.equalTo("<va...@address>"));
+        assertThat(mail.getRecipients(), Matchers.contains(new MailAddress("valid1@address"), new MailAddress("valid2@address"), new MailAddress("valid3@address")));
+        assertThat(mail.getMessage().getHeader("Subject"), Matchers.array(Matchers.equalTo("test-subject")));
+        assertThat(mail.getMessage().getHeader("Content-Type"), Matchers.array(Matchers.containsString("multipart/mixed;")));
+    }
+
+    @Test
+    public void constructionFailsWhenFromIsNotSet() throws Exception{
+        Assertions.assertThrows(RuntimeException.class, () -> {
+            MailProps mailProps = new MailProps(
+                    "test",
+                    null,
+                    Arrays.asList("valid1@address"),
+                    Arrays.asList("valid2@address"),
+                    Arrays.asList("valid3@address"),
+                    "test-subject",
+                    Arrays.asList(new BodyPartProps("text/plain", null, "test-text", null, null, null)),
+                    null
+            );
+        }, "Mail missing from");
+    }
+
+    @Test
+    public void constructionFailsWhenToIsNotSet() throws Exception{
+        Assertions.assertThrows(RuntimeException.class, () -> {
+            MailProps mailProps = new MailProps(
+                    "test",
+                    "address@valid",
+                    null,
+                    Arrays.asList("valid2@address"),
+                    Arrays.asList("valid3@address"),
+                    "test-subject",
+                    Arrays.asList(new BodyPartProps("text/plain", null, "test-text", null, null, null)),
+                    null
+            );
+        }, "Mail missing to addresses");
+    }
+
+    @Test
+    public void constructionFailsWhenToIsEmptyList() throws Exception{
+        Assertions.assertThrows(RuntimeException.class, () -> {
+            MailProps mailProps = new MailProps(
+                    "test",
+                    "address@valid",
+                    new ArrayList<>(),
+                    Arrays.asList("valid2@address"),
+                    Arrays.asList("valid3@address"),
+                    "test-subject",
+                    Arrays.asList(new BodyPartProps("text/plain", null, "test-text", null, null, null)),
+                    null
+            );
+        }, "Mail missing to addresses");
+    }
+
+    @Test
+    public void buildingMailImplFailsWhenNotUsingValidMailaddresses() throws Exception{
+        Assertions.assertThrows(RuntimeException.class, () -> {
+            MailProps mailProps = new MailProps(
+                    "test",
+                    "address?ยค#",
+                    Arrays.asList("valid1@address"),
+                    Arrays.asList("valid2@address"),
+                    Arrays.asList("valid3@address"),
+                    "test-subject",
+                    Arrays.asList(new BodyPartProps("text/plain", null, "test-text", null, null, null)),
+                    null
+            );
+            mailProps.asMailImpl();
+        });
+    }
+
+}
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/ReceiveMailOverWebRoutesTest.java b/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/ReceiveMailOverWebRoutesTest.java
new file mode 100644
index 0000000..f533753
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/ReceiveMailOverWebRoutesTest.java
@@ -0,0 +1,104 @@
+package org.apache.james.routes;
+
+import static io.restassured.RestAssured.given;
+import static io.restassured.RestAssured.when;
+import static io.restassured.config.EncoderConfig.encoderConfig;
+import static io.restassured.config.RestAssuredConfig.newConfig;
+
+import java.nio.charset.StandardCharsets;
+
+import org.apache.james.queue.api.MailQueueFactory;
+import org.apache.james.queue.api.RawMailQueueItemDecoratorFactory;
+import org.apache.james.queue.memory.MemoryMailQueueFactory;
+import org.apache.james.util.ClassLoaderUtils;
+import org.apache.james.webadmin.WebAdminServer;
+import org.apache.james.webadmin.WebAdminUtils;
+import org.apache.james.webadmin.routes.ReceiveMailOverWebRoutes;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import io.restassured.RestAssured;
+import io.restassured.builder.RequestSpecBuilder;
+import io.restassured.http.ContentType;
+import io.restassured.specification.RequestSpecification;
+
+public class ReceiveMailOverWebRoutesTest {
+
+    private WebAdminServer webAdminServer;
+
+    private WebAdminServer createServer() {
+        MemoryMailQueueFactory memoryMailQueueFactory = new MemoryMailQueueFactory(new RawMailQueueItemDecoratorFactory());
+        return WebAdminUtils.createWebAdminServer(new ReceiveMailOverWebRoutes(memoryMailQueueFactory)).start();
+    }
+
+    @BeforeEach
+    void setup() {
+        webAdminServer = createServer();
+        RestAssured.requestSpecification = buildRequestSpecification(webAdminServer);
+        RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
+    }
+
+    @AfterEach
+    void tearDown() {
+        webAdminServer.destroy();
+    }
+
+    RequestSpecification buildRequestSpecification(WebAdminServer server) {
+        return new RequestSpecBuilder()
+                .setContentType(ContentType.JSON)
+                .setAccept(ContentType.JSON)
+                .setBasePath(ReceiveMailOverWebRoutes.BASE_URL)
+                .setPort(server.getPort().getValue())
+                .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.UTF_8)))
+                .build();
+    }
+
+    @Test
+    public void whenFromIsMissingInRequestThenRequestFails() {
+        given()
+                .body(ClassLoaderUtils.getSystemResourceAsString("json/withoutFrom.json"))
+                .when()
+                .post()
+                .then()
+                .assertThat()
+                .statusCode(500)
+                .body("message", Matchers.containsString("Mail missing from"));
+    }
+
+    @Test
+    public void whenToIsMissingInRequestThenRequestFails() {
+        given()
+                .body(ClassLoaderUtils.getSystemResourceAsString("json/withoutTos.json"))
+                .when()
+                .post()
+                .then()
+                .assertThat()
+                .statusCode(500)
+                .body("message", Matchers.containsString("Mail missing to addresses"));
+    }
+
+    @Test
+    public void statusCode204ReturnedWhenSendingMailWithAllRequiredFields() {
+        given()
+                .body(ClassLoaderUtils.getSystemResourceAsString("json/mail.json"))
+                .when()
+                .post()
+                .then()
+                .assertThat()
+                .statusCode(204);
+    }
+
+    @Test
+    public void requestFailsOnEmptyBody() {
+        given()
+                .body("{}")
+                .when()
+                .post()
+                .then()
+                .assertThat()
+                .statusCode(500)
+                .body("message", Matchers.containsString("The mail will not be sent"));
+    }
+}
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/json/mail.json b/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/json/mail.json
new file mode 100644
index 0000000..9a2ac42
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/json/mail.json
@@ -0,0 +1,13 @@
+{
+  "from": "john@james",
+  "to": ["shelly@james"],
+  "subject": "Subject",
+  "ccs": ["yoko@james"],
+  "bccs": ["thomas@james"],
+  "bodyParts": [
+    {
+      "content": "Some text",
+      "type": "text/plain"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/json/withoutFrom.json b/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/json/withoutFrom.json
new file mode 100644
index 0000000..75c42bc
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/json/withoutFrom.json
@@ -0,0 +1,12 @@
+{
+  "to": ["shelly@james"],
+  "subject": "Subject",
+  "ccs": ["yoko@james"],
+  "bccs": ["thomas@james"],
+  "bodyParts": [
+    {
+      "content": "Some text",
+      "type": "text/plain"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/json/withoutTos.json b/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/json/withoutTos.json
new file mode 100644
index 0000000..8a893e4
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/json/withoutTos.json
@@ -0,0 +1,12 @@
+{
+  "from": "shelly@james",
+  "subject": "Subject",
+  "ccs": ["yoko@james"],
+  "bccs": ["thomas@james"],
+  "bodyParts": [
+    {
+      "content": "Some text",
+      "type": "text/plain"
+    }
+  ]
+}
\ No newline at end of file


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


[james-project] 02/12: JAMES-3389 pom.xml-s were not committed

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

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

commit 244265fe1b08614a80dcd00caf5345fbd4af6b39
Author: Andreas Valdma <an...@nortal.com>
AuthorDate: Wed Oct 28 08:47:55 2020 +0200

    JAMES-3389 pom.xml-s were not committed
---
 server/container/guice/pom.xml                     |  5 ++
 .../guice/protocols/webadmin-mail-over-web/pom.xml | 53 ++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 392a3fe..e7737ff 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -204,6 +204,11 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-guice-webadmin-mailbox</artifactId>
                 <version>${project.version}</version>
             </dependency>
diff --git a/server/container/guice/protocols/webadmin-mail-over-web/pom.xml b/server/container/guice/protocols/webadmin-mail-over-web/pom.xml
new file mode 100644
index 0000000..25278ea
--- /dev/null
+++ b/server/container/guice/protocols/webadmin-mail-over-web/pom.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.james</groupId>
+        <artifactId>james-server-guice</artifactId>
+        <version>3.6.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
+    <packaging>jar</packaging>
+
+    <name>Apache James :: Server :: Web Admin :: Mail Over Web Service</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-queue-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-webadmin-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-webadmin-mail-over-web</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file


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


[james-project] 09/12: JAMES-3389 check MailQueue contents after using mailtransfer api

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

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

commit 05528b585798b1aaf56c54b5837c6140c8a364c9
Author: Andreas Valdma <an...@nortal.com>
AuthorDate: Wed Nov 4 17:25:03 2020 +0200

    JAMES-3389 check MailQueue contents after using mailtransfer api
---
 .../james/routes/TransferEmailRoutesTest.java      | 38 ++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/TransferEmailRoutesTest.java b/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/TransferEmailRoutesTest.java
index 169f9cc..ea71371 100644
--- a/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/TransferEmailRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/TransferEmailRoutesTest.java
@@ -24,29 +24,44 @@ import static io.restassured.config.EncoderConfig.encoderConfig;
 import static io.restassured.config.RestAssuredConfig.newConfig;
 
 import java.nio.charset.StandardCharsets;
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.TemporalUnit;
 
+import org.apache.james.queue.api.MailQueue;
+import org.apache.james.queue.api.MailQueueFactory;
 import org.apache.james.queue.api.RawMailQueueItemDecoratorFactory;
 import org.apache.james.queue.memory.MemoryMailQueueFactory;
+import org.apache.james.server.core.MailImpl;
 import org.apache.james.util.ClassLoaderUtils;
 import org.apache.james.webadmin.WebAdminServer;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.apache.james.webadmin.routes.TransferEmailRoutes;
+import org.apache.mailet.Mail;
+import org.assertj.core.api.SoftAssertions;
 import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
+import com.github.fge.lambdas.Throwing;
 import io.restassured.RestAssured;
 import io.restassured.builder.RequestSpecBuilder;
 import io.restassured.http.ContentType;
 import io.restassured.specification.RequestSpecification;
+import reactor.core.publisher.Flux;
 
 public class TransferEmailRoutesTest {
 
     private WebAdminServer webAdminServer;
 
+    private MailQueue mailQueue;
+
     private WebAdminServer createServer() {
-        MemoryMailQueueFactory memoryMailQueueFactory = new MemoryMailQueueFactory(new RawMailQueueItemDecoratorFactory());
-        return WebAdminUtils.createWebAdminServer(new TransferEmailRoutes(memoryMailQueueFactory)).start();
+        MailQueueFactory mailQueueFactory = new MemoryMailQueueFactory(new RawMailQueueItemDecoratorFactory());
+        WebAdminServer webAdminServer = WebAdminUtils.createWebAdminServer(new TransferEmailRoutes(mailQueueFactory)).start();
+        mailQueue = ((MailQueue) mailQueueFactory.getQueue(MailQueueFactory.SPOOL).get());
+        return webAdminServer;
     }
 
     @BeforeEach
@@ -81,6 +96,11 @@ public class TransferEmailRoutesTest {
                 .then()
                 .assertThat()
                 .statusCode(500);
+
+        Assertions.assertThrows(IllegalStateException.class,
+                () -> {
+                    MailQueue.MailQueueItem mailQueueItem = ((Flux<MailQueue.MailQueueItem>) mailQueue.deQueue()).blockFirst(Duration.of(100, ChronoUnit.MILLIS));
+                });
     }
 
     @Test
@@ -92,6 +112,15 @@ public class TransferEmailRoutesTest {
                 .then()
                 .assertThat()
                 .statusCode(201);
+
+        MailQueue.MailQueueItem mailQueueItem = ((Flux<MailQueue.MailQueueItem>) mailQueue.deQueue()).blockFirst(Duration.of(100, ChronoUnit.MILLIS));
+        Mail mail = mailQueueItem.getMail();
+
+        SoftAssertions.assertSoftly(softly -> {
+            softly.assertThat(Throwing.supplier(() -> mail.getMessage().getMessageID()).get()).isEqualTo("<20...@acm.org>");
+            softly.assertThat(Throwing.supplier(() -> mail.getSender().asPrettyString()).get()).isEqualTo("<ml...@acm.org>");
+            softly.assertThat(Throwing.supplier(() -> mail.getMessage().getHeader("X-Mailer")).get()[0]).isEqualTo("http://www.phpclasses.org/mimemessage $Revision: 1.63 $ (mail)");
+        });
     }
 
     @Test
@@ -103,5 +132,10 @@ public class TransferEmailRoutesTest {
                 .then()
                 .assertThat()
                 .statusCode(500);
+
+        Assertions.assertThrows(IllegalStateException.class,
+                () -> {
+                    MailQueue.MailQueueItem mailQueueItem = ((Flux<MailQueue.MailQueueItem>) mailQueue.deQueue()).blockFirst(Duration.of(100, ChronoUnit.MILLIS));
+                });
     }
 }


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


[james-project] 03/12: JAMES-3389 pom.xml-s were not committed

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

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

commit fd04346152fb0df307d97d3efe89d8c9b1ed82b1
Author: Andreas Valdma <an...@nortal.com>
AuthorDate: Wed Oct 28 09:08:38 2020 +0200

    JAMES-3389 pom.xml-s were not committed
---
 server/container/guice/pom.xml                     | 15 ++++
 .../webadmin/webadmin-mail-over-web/pom.xml        | 83 ++++++++++++++++++++++
 2 files changed, 98 insertions(+)

diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index e7737ff..2d4cdbe 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -209,6 +209,21 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-guice-webadmin-mailbox</artifactId>
                 <version>${project.version}</version>
             </dependency>
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/pom.xml b/server/protocols/webadmin/webadmin-mail-over-web/pom.xml
new file mode 100644
index 0000000..c0f784d
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-mail-over-web/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.james</groupId>
+        <artifactId>james-server</artifactId>
+        <version>3.6.0-SNAPSHOT</version>
+        <relativePath>../../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>james-server-webadmin-mail-over-web</artifactId>
+    <packaging>jar</packaging>
+
+    <name>Apache James :: Server :: Web Admin :: Mail Over Web Service</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-queue-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-webadmin-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-webadmin-core</artifactId>
+            <scope>test</scope>
+            <type>test-jar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.james</groupId>
+            <artifactId>james-server-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.james</groupId>
+            <artifactId>james-server-queue-memory</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>testing-base</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>io.rest-assured</groupId>
+            <artifactId>rest-assured</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>metrics-tests</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-webadmin-core</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file


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


[james-project] 04/12: JAMES-3389 consume message/rfc822

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

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

commit e09a02fb6896dcb9b6f22e3874f659c61a8eaa83
Author: Andreas Valdma <an...@nortal.com>
AuthorDate: Wed Nov 4 11:10:35 2020 +0200

    JAMES-3389 consume message/rfc822
---
 server/container/guice/pom.xml                     |  15 ++
 .../webadmin/routes/ReceiveMailOverWebRoutes.java  |  42 +++--
 .../james/routes/ReceiveMailOverWebRoutesTest.java |  27 +---
 .../message/rfc822/message-without-from.eml        | 169 ++++++++++++++++++++
 .../message/rfc822/message-without-tos.eml         | 169 ++++++++++++++++++++
 .../src/test/resources/message/rfc822/message.eml  | 170 +++++++++++++++++++++
 6 files changed, 548 insertions(+), 44 deletions(-)

diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 2d4cdbe..867488c 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -224,6 +224,21 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-guice-webadmin-mail-over-web</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-guice-webadmin-mailbox</artifactId>
                 <version>${project.version}</version>
             </dependency>
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/ReceiveMailOverWebRoutes.java b/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/ReceiveMailOverWebRoutes.java
index 6d82869..b8e5a9c 100644
--- a/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/ReceiveMailOverWebRoutes.java
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/ReceiveMailOverWebRoutes.java
@@ -1,6 +1,11 @@
 package org.apache.james.webadmin.routes;
 
+import java.io.ByteArrayInputStream;
+import java.util.UUID;
+
 import javax.inject.Inject;
+import javax.mail.Session;
+import javax.mail.internet.MimeMessage;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
@@ -9,7 +14,6 @@ import org.apache.james.queue.api.MailQueue;
 import org.apache.james.queue.api.MailQueueFactory;
 import org.apache.james.server.core.MailImpl;
 import org.apache.james.webadmin.Routes;
-import org.apache.james.webadmin.request.MailProps;
 import org.apache.james.webadmin.utils.ErrorResponder;
 import org.apache.james.webadmin.utils.JsonExtractor;
 import org.eclipse.jetty.http.HttpStatus;
@@ -27,9 +31,7 @@ import spark.Service;
 @Produces("application/json")
 public class ReceiveMailOverWebRoutes implements Routes {
 
-    private final JsonExtractor<MailProps> mailPropsJsonExtractor;
-
-    public static final String BASE_URL = "/receiveMail";
+    public static final String BASE_URL = "/mail-transfer-service";
 
     private MailQueue queue;
 
@@ -41,7 +43,6 @@ public class ReceiveMailOverWebRoutes implements Routes {
     @Inject
     public ReceiveMailOverWebRoutes(MailQueueFactory<?> queueFactory) {
         queue = queueFactory.createQueue(MailQueueFactory.SPOOL);
-        this.mailPropsJsonExtractor = new JsonExtractor<>(MailProps.class);
     }
 
     @Override
@@ -50,34 +51,27 @@ public class ReceiveMailOverWebRoutes implements Routes {
     }
 
     @POST
-    @Path("/receiveMail")
-    @ApiOperation(value = "Deleting an user")
+    @Path("/mail-transfer-service")
+    @ApiOperation(value = "Receiving a message/rfc822 over REST interface")
     @ApiImplicitParams({
             @ApiImplicitParam(required = true, dataType = "string", name = "username", paramType = "path")
     })
     @ApiResponses(value = {
-            @ApiResponse(code = HttpStatus.NO_CONTENT_204, message = "OK. User is removed."),
-            @ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "Invalid input user."),
+            @ApiResponse(code = HttpStatus.CREATED_201, message = ""),
+            @ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "Could not ceate mail from supplied body"),
             @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500,
                     message = "Internal server error - Something went bad on the server side.")
     })
     public void defineReceiveMailFromWebService(Service service) {
         service.post(BASE_URL, (request, response) -> {
-            try {
-                //Parse the json object to org.apache.james.webadmin.request.MailProps and build the MailImpl object
-                MailImpl mail = mailPropsJsonExtractor.parse(request.body()).asMailImpl();
-                //Send to queue api for mail processing
-                queue.enQueue(mail);
-                response.body("ENQUEUED");
-                response.status(204);
-            } catch (Exception e) {
-                ErrorResponder.builder()
-                        .cause(e)
-                        .statusCode(500)
-                        .type(ErrorResponder.ErrorType.SERVER_ERROR)
-                        .message("The mail will not be sent: " + e.getMessage())
-                        .haltError();
-            }
+            //parse MimeMessage from request body
+            MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(System.getProperties()), new ByteArrayInputStream(request.bodyAsBytes()));
+            //create MailImpl object from MimeMessage
+            MailImpl mail = MailImpl.fromMimeMessage(UUID.randomUUID().toString(), mimeMessage);
+            //Send to queue api for mail processing
+            queue.enQueue(mail);
+            response.body("");
+            response.status(201);
 
             return response.body();
         });
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/ReceiveMailOverWebRoutesTest.java b/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/ReceiveMailOverWebRoutesTest.java
index f533753..10e9c7e 100644
--- a/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/ReceiveMailOverWebRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/ReceiveMailOverWebRoutesTest.java
@@ -55,50 +55,37 @@ public class ReceiveMailOverWebRoutesTest {
                 .build();
     }
 
-    @Test
-    public void whenFromIsMissingInRequestThenRequestFails() {
-        given()
-                .body(ClassLoaderUtils.getSystemResourceAsString("json/withoutFrom.json"))
-                .when()
-                .post()
-                .then()
-                .assertThat()
-                .statusCode(500)
-                .body("message", Matchers.containsString("Mail missing from"));
-    }
 
     @Test
     public void whenToIsMissingInRequestThenRequestFails() {
         given()
-                .body(ClassLoaderUtils.getSystemResourceAsString("json/withoutTos.json"))
+                .body(ClassLoaderUtils.getSystemResourceAsString("message/rfc822/message-without-tos.eml"))
                 .when()
                 .post()
                 .then()
                 .assertThat()
-                .statusCode(500)
-                .body("message", Matchers.containsString("Mail missing to addresses"));
+                .statusCode(500);
     }
 
     @Test
-    public void statusCode204ReturnedWhenSendingMailWithAllRequiredFields() {
+    public void statusCode201ReturnedWhenSendingMailWithAllRequiredFields() {
         given()
-                .body(ClassLoaderUtils.getSystemResourceAsString("json/mail.json"))
+                .body(ClassLoaderUtils.getSystemResourceAsString("message/rfc822/message.eml"))
                 .when()
                 .post()
                 .then()
                 .assertThat()
-                .statusCode(204);
+                .statusCode(201);
     }
 
     @Test
     public void requestFailsOnEmptyBody() {
         given()
-                .body("{}")
+                .body("")
                 .when()
                 .post()
                 .then()
                 .assertThat()
-                .statusCode(500)
-                .body("message", Matchers.containsString("The mail will not be sent"));
+                .statusCode(500);
     }
 }
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/message/rfc822/message-without-from.eml b/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/message/rfc822/message-without-from.eml
new file mode 100644
index 0000000..f0c2cca
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/message/rfc822/message-without-from.eml
@@ -0,0 +1,169 @@
+Return-Path: <ml...@acm.org>
+To: Manuel Lemos <ml...@linux.local>
+Subject: Testing Error
+Reply-To: mlemos <ml...@acm.org>
+Sender: mlemos@acm.org
+X-Mailer: http://www.phpclasses.org/mimemessage $Revision: 1.63 $ (mail)
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="652b8c4dcb00cdcdda1e16af36781caf"
+Message-ID: <20...@acm.org>
+Date: Sat, 30 Apr 2005 19:28:29 -0300
+
+
+--652b8c4dcb00cdcdda1e16af36781caf
+Content-Type: multipart/related; boundary="6a82fb459dcaacd40ab3404529e808dc"
+
+
+--6a82fb459dcaacd40ab3404529e808dc
+Content-Type: multipart/alternative; boundary="69c1683a3ee16ef7cf16edd700694a2f"
+
+
+--69c1683a3ee16ef7cf16edd700694a2f
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+This is an HTML message. Please use an HTML capable mail program to read
+this message.
+
+--69c1683a3ee16ef7cf16edd700694a2f
+Content-Type: text/html; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+<html>
+<head>
+<title>Testing Manuel Lemos' MIME E-mail composing and sending PHP class: H=
+TML message</title>
+<style type=3D"text/css"><!--
+body { color: black ; font-family: arial, helvetica, sans-serif ; backgroun=
+d-color: #A3C5CC }
+A:link, A:visited, A:active { text-decoration: underline }
+--></style>
+</head>
+<body>
+<table background=3D"cid:4c837ed463ad29c820668e835a270e8a.gif" width=3D"100=
+%">
+<tr>
+<td>
+<center><h1>Testing Manuel Lemos' MIME E-mail composing and sending PHP cla=
+ss: HTML message</h1></center>
+<hr>
+<P>Hello Manuel,<br><br>
+This message is just to let you know that the <a href=3D"http://www.phpclas=
+ses.org/mimemessage">MIME E-mail message composing and sending PHP class</a=
+> is working as expected.<br><br>
+<center><h2>Here is an image embedded in a message as a separate part:</h2>=
+</center>
+<center><img src=3D"cid:ae0357e57f04b8347f7621662cb63855.gif"></center>Than=
+k you,<br>
+mlemos</p>
+</td>
+</tr>
+</table>
+</body>
+</html>
+--69c1683a3ee16ef7cf16edd700694a2f--
+
+--6a82fb459dcaacd40ab3404529e808dc
+Content-Type: image/gif; name="logo.gif"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline; filename="logo.gif"
+Content-ID: <ae0357e57f04b8347f7621662cb63855.gif>
+
+R0lGODlhlgAjAPMJAAAAAAAA/y8vLz8/P19fX19f339/f4+Pj4+Pz7+/v///////////////////
+/////yH5BAEAAAkALAAAAACWACMAQwT+MMlJq7046827/2AoHYChGAChAkBylgKgKClFyEl6xDMg
+qLFBj3C5uXKplVAxIOxkA8BhdFCpDlMK1urMTrZWbAV8tVS5YsxtxmZHBVOSCcW9zaXyNhslVcto
+RBp5NQYxLAYGLi8oSwoJBlE+BiSNj5E/PDQsmy4pAJWQLAKJY5+hXhZ2d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EUbQRgO737AxChjmyANxuEFHSGi7hFCV
+4jxLst2N8sRJYU+SHiAKjlmCgz2IffbLI5aaQR71hnkxq1ZfHSfKata6YDCJDMAQwY7wOgzhjxgj
+VFQnKB5uX4mr9qJ79pann+VcfcSzsSCd2mw5scqRRvlQ6TgcUelYhu75iPE4JejrsJOFQAG01277
+7bjnrvvuvPfu++/ABy887hfc6OPxyCevPDdAVoDA89BHL/301Fdv/fXYZ6/99tx3Pz0FEQAAOw==
+
+--6a82fb459dcaacd40ab3404529e808dc
+Content-Type: image/gif; name="background.gif"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline; filename="background.gif"
+Content-ID: <4c837ed463ad29c820668e835a270e8a.gif>
+
+R0lGODlh+wHCAPMAAKPFzKLEy6HDyqHCyaDByJ/Ax56/xp2+xZ28xJy7w5u6wpq5wZm4wJm3v5i2
+vpe1vSwAAAAA+wHCAEME/hDISau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru987//AoHBILBqP
+yKRyyWw6n9CodEqtWq+gwSHReHgfjobY8X00FIc019tIHAYS7dqcQCDm3vC4fD4QAhUBBFsMZF8O
+hnkLCAYFW11tb1iTlJWWOXJdZZtmC24Eg3hgYntfbXainJ2fgBSZbG5wFAG0E6+RoAZ3CbwJCgya
+p3cMbAyevQcFAgMGCcRmxr1uyszOxQq+wF4MdcPFx7zJApfk5eYhr3SSGemRsu3dc+4iAqELhZwO
+0X6hkHUHCBRoGtUg0RkEAAUeKhhGAcICBQIODIPooIEBzCTmKcjGYSNd/go3VvQo65zJkyhTqlzJ
+sqXLlzBjypxJs6bNmzhz6tzJs6fPn0CDCh1KtKjRo0iTKl3KtKnTp1CXBhhAwECaq1gPNCIwANDU
+qmkMcG311apWULmyZt3alcPXAma1FgAlgCxVq2LbRt3LF0Y7hwWoEjLEDZUmff8AOjMkTB5gwYu3
+JbhIQUDEZw+4+aE1aNc0R2vcDYjoDBgpBoUDj95yzzRqbH7qgW4t5vUnAfVAoj7NwOOf1QloN7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A4bNYwNR1nPsn2K6J4PKdYbKXYbSM3
+bSQVeWdybWwIa9Rmi0b3FwUEKAcUU+MGTr4AivP2hGSgbqDIbjDobssIb1IlbzSEbslob894gGUY
+jYkxeyf3GABnhAK3jeTDYxE0J5uRcEtjdYUnaoMXHStGGxlnNxs4cYgARRt3Y8UobB5XVhhXjyTR
+e0jnbfoURkGzDh+wcquACmqFUDD3iiw0LZFmczhmWTknkZ9FdK5IDH0GdArWGaB4kUXHewEpbSZH
+kLX2AVA3dVPHamgjNQ8XZG0Ddl2XLF9HOmF3RPmTKGV3IGdXdWl3k2zXiPBVd3nXV3PHOkRpgk5A
+lYlgg2F8Fw3WlnZW9HiCB2Q0Y3ic8k2Kl5V4JQhUiXgWFgqUh1e9h3mcpy2epxdm+XnjQ1EiMHoQ
+pVtogiWuV3urBxGod4Xnw41huJfjKHvtg3t8GYKEWZiGeZiImZiKuZiM2ZiO+ZiQGZmSOZmUWZmW
+eZmYmZmauZmc2ZlCEQEAOw==
+
+--6a82fb459dcaacd40ab3404529e808dc--
+
+--652b8c4dcb00cdcdda1e16af36781caf
+Content-Type: text/plain; name="attachment.txt"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="attachment.txt"
+
+VGhpcyBpcyBqdXN0IGEgcGxhaW4gdGV4dCBhdHRhY2htZW50IGZpbGUgbmFtZWQgYXR0YWNobWVu
+dC50eHQgLg==
+
+--652b8c4dcb00cdcdda1e16af36781caf--
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/message/rfc822/message-without-tos.eml b/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/message/rfc822/message-without-tos.eml
new file mode 100644
index 0000000..5afcf6b
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/message/rfc822/message-without-tos.eml
@@ -0,0 +1,169 @@
+Return-Path: <ml...@acm.org>
+Subject: Testing Error
+From: mlemos <ml...@acm.org>
+Reply-To: mlemos <ml...@acm.org>
+Sender: mlemos@acm.org
+X-Mailer: http://www.phpclasses.org/mimemessage $Revision: 1.63 $ (mail)
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="652b8c4dcb00cdcdda1e16af36781caf"
+Message-ID: <20...@acm.org>
+Date: Sat, 30 Apr 2005 19:28:29 -0300
+
+
+--652b8c4dcb00cdcdda1e16af36781caf
+Content-Type: multipart/related; boundary="6a82fb459dcaacd40ab3404529e808dc"
+
+
+--6a82fb459dcaacd40ab3404529e808dc
+Content-Type: multipart/alternative; boundary="69c1683a3ee16ef7cf16edd700694a2f"
+
+
+--69c1683a3ee16ef7cf16edd700694a2f
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+This is an HTML message. Please use an HTML capable mail program to read
+this message.
+
+--69c1683a3ee16ef7cf16edd700694a2f
+Content-Type: text/html; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+<html>
+<head>
+<title>Testing Manuel Lemos' MIME E-mail composing and sending PHP class: H=
+TML message</title>
+<style type=3D"text/css"><!--
+body { color: black ; font-family: arial, helvetica, sans-serif ; backgroun=
+d-color: #A3C5CC }
+A:link, A:visited, A:active { text-decoration: underline }
+--></style>
+</head>
+<body>
+<table background=3D"cid:4c837ed463ad29c820668e835a270e8a.gif" width=3D"100=
+%">
+<tr>
+<td>
+<center><h1>Testing Manuel Lemos' MIME E-mail composing and sending PHP cla=
+ss: HTML message</h1></center>
+<hr>
+<P>Hello Manuel,<br><br>
+This message is just to let you know that the <a href=3D"http://www.phpclas=
+ses.org/mimemessage">MIME E-mail message composing and sending PHP class</a=
+> is working as expected.<br><br>
+<center><h2>Here is an image embedded in a message as a separate part:</h2>=
+</center>
+<center><img src=3D"cid:ae0357e57f04b8347f7621662cb63855.gif"></center>Than=
+k you,<br>
+mlemos</p>
+</td>
+</tr>
+</table>
+</body>
+</html>
+--69c1683a3ee16ef7cf16edd700694a2f--
+
+--6a82fb459dcaacd40ab3404529e808dc
+Content-Type: image/gif; name="logo.gif"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline; filename="logo.gif"
+Content-ID: <ae0357e57f04b8347f7621662cb63855.gif>
+
+R0lGODlhlgAjAPMJAAAAAAAA/y8vLz8/P19fX19f339/f4+Pj4+Pz7+/v///////////////////
+/////yH5BAEAAAkALAAAAACWACMAQwT+MMlJq7046827/2AoHYChGAChAkBylgKgKClFyEl6xDMg
+qLFBj3C5uXKplVAxIOxkA8BhdFCpDlMK1urMTrZWbAV8tVS5YsxtxmZHBVOSCcW9zaXyNhslVcto
+RBp5NQYxLAYGLi8oSwoJBlE+BiSNj5E/PDQsmy4pAJWQLAKJY5+hXhZ2dDYldFWtNSFPiXssXnZR
+k5+1pjpBiDMJUXG/Jo7DI4eKfMSmxsJ9GAUB1NXW19jZ2tvc3d7f4OHi2AgZN5vom1kk6F7s6u/p
+m3Ab7AOIiCxOyZuBIv8AOeTJIaYQjiR/kKTr5GQNE3pYSjCJ9mUXClRUsLxaZGciC0X+OlpoOuQo
+ZKdNJnIoKfnxRUQh6FLG0iLxIoYnJd0JEKISJyAQDodp3EUDC48oDnUY7HFI3wEDRjzycQJVZCQT
+Ol7NK+G0qgtkAcOKHUu2rNmzYTVqRMt2bB49bHompSchqg6HcGeANSMxr8sEa2y2HexnSEUTuWri
+SSbkYh7BgGVAnhB1b2REibESYaRoBgqIMYx59tFM9AvQffVG49P5NMZkMlHKhJPJb0knmSKZ6kSX
+JtbeF3Am7ocok6c7cM7pU5xcXiJJETUz16qPrzEfaFgZpvzn7h86YV5r/1mxXeAUMVyEIpnVUGpN
+RlG2ka9b3lP3pm2l6u7P+l/YLj3+RlEHbz1C0kRxSITQaAcilVBMEzmkkEQO8oSOBNg9SN+AX6hV
+z1pjgJiAhwCRsY8ZIp6xj1ruqCgeGeKNGEZwLnIwzTg45qjjjjz2GEA5hAUp5JBEFmnkkSCoWEcZ
+X8yohZNK1pFGPQS4hx0qNSLJlk9wCQORYu5QiMd7bUzGVyNlRiOHSlpuKdGEItHQ3HZ18beRRyws
+YSY/waDTiHf/tWlWUBAJiMJ1/Z0XXU7N0FnREpKM4NChCgbyRDq9XYpOplaKopN9NMkDnBbG+UMC
+QwLWIeaiglES6AjGARcPHCWoVAiatcTnGTABZoLPaPG1phccPv366mEvWEFSLnj+2QaonECwcJt/
+e1Zw3lJvVMmftBdVNQS3UngLCA85YHIQOy6JO9N4eZW7KJwtOUZmGwOMWqejwVW6RQzaikRHX3yI
+osKhDAq8wmnKSmdMwNidSOof9ZG2DoV0RfTVmLFtGmNk+CoZna0HQnPHS3AhRbIeDpqmR09E0bsu
+soeaw994z+rwQVInvqLenBftYjLOVphLFHhV9qsnez8AEUbQRgO737AxChjmyANxuEFHSGi7hFCV
+4jxLst2N8sRJYU+SHiAKjlmCgz2IffbLI5aaQR71hnkxq1ZfHSfKata6YDCJDMAQwY7wOgzhjxgj
+VFQnKB5uX4mr9qJ79pann+VcfcSzsSCd2mw5scqRRvlQ6TgcUelYhu75iPE4JejrsJOFQAG01277
+7bjnrvvuvPfu++/ABy887hfc6OPxyCevPDdAVoDA89BHL/301Fdv/fXYZ6/99tx3Pz0FEQAAOw==
+
+--6a82fb459dcaacd40ab3404529e808dc
+Content-Type: image/gif; name="background.gif"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline; filename="background.gif"
+Content-ID: <4c837ed463ad29c820668e835a270e8a.gif>
+
+R0lGODlh+wHCAPMAAKPFzKLEy6HDyqHCyaDByJ/Ax56/xp2+xZ28xJy7w5u6wpq5wZm4wJm3v5i2
+vpe1vSwAAAAA+wHCAEME/hDISau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru987//AoHBILBqP
+yKRyyWw6n9CodEqtWq+gwSHReHgfjobY8X00FIc019tIHAYS7dqcQCDm3vC4fD4QAhUBBFsMZF8O
+hnkLCAYFW11tb1iTlJWWOXJdZZtmC24Eg3hgYntfbXainJ2fgBSZbG5wFAG0E6+RoAZ3CbwJCgya
+p3cMbAyevQcFAgMGCcRmxr1uyszOxQq+wF4MdcP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uPN/lARL/FdLRlcZwdUNnTRbGAZt+fcCHCYzGqd0NJZtrsYJFjFGJ2ZQ
+m1A2kcZiD+gXLKNsMMZsTQdiFvg/IJUID7RjldFjhAVkGaM/6lASRfYu8KcuS6aDO4hkOfh7p7Jl
+bBRlVxYSWSZlfVKDXfZltRJmADFmulJmb3BmBJhbb9YZp1RLV9hmwtUWdBZhnYeFCaZ7Rxdv/5Q8
+gKaCvNBrQ0hCZxhjLhgHXEV1PiQIjhBEkDZT6VFSmkFWhbBppMZBljZqVtZpIUGIqCNqevMYlhdf
+qEYKslZ10zZibbgQDkN1IndyTkcLxiFTulZI/muYRsrjbKA4bNYwNR1nPsn2K6J4PKdYbKXYbSM3
+bSQVeWdybWwIa9Rmi0b3FwUEKAcUU+MGTr4AivP2hGSgbqDIbjDobssIb1IlbzSEbslob894gGUY
+jYkxeyf3GABnhAK3jeTDYxE0J5uRcEtjdYUnaoMXHStGGxlnNxs4cYgARRt3Y8UobB5XVhhXjyTR
+e0jnbfoURkGzDh+wcquACmqFUDD3iiw0LZFmczhmWTknkZ9FdK5IDH0GdArWGaB4kUXHewEpbSZH
+kLX2AVA3dVPHamgjNQ8XZG0Ddl2XLF9HOmF3RPmTKGV3IGdXdWl3k2zXiPBVd3nXV3PHOkRpgk5A
+lYlgg2F8Fw3WlnZW9HiCB2Q0Y3ic8k2Kl5V4JQhUiXgWFgqUh1e9h3mcpy2epxdm+XnjQ1EiMHoQ
+pVtogiWuV3urBxGod4Xnw41huJfjKHvtg3t8GYKEWZiGeZiImZiKuZiM2ZiO+ZiQGZmSOZmUWZmW
+eZmYmZmauZmc2ZlCEQEAOw==
+
+--6a82fb459dcaacd40ab3404529e808dc--
+
+--652b8c4dcb00cdcdda1e16af36781caf
+Content-Type: text/plain; name="attachment.txt"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="attachment.txt"
+
+VGhpcyBpcyBqdXN0IGEgcGxhaW4gdGV4dCBhdHRhY2htZW50IGZpbGUgbmFtZWQgYXR0YWNobWVu
+dC50eHQgLg==
+
+--652b8c4dcb00cdcdda1e16af36781caf--
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/message/rfc822/message.eml b/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/message/rfc822/message.eml
new file mode 100644
index 0000000..420e025
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/test/resources/message/rfc822/message.eml
@@ -0,0 +1,170 @@
+Return-Path: <ml...@acm.org>
+To: Manuel Lemos <ml...@linux.local>
+Subject: Testing Testing
+From: mlemos <ml...@acm.org>
+Reply-To: mlemos <ml...@acm.org>
+Sender: mlemos@acm.org
+X-Mailer: http://www.phpclasses.org/mimemessage $Revision: 1.63 $ (mail)
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="652b8c4dcb00cdcdda1e16af36781caf"
+Message-ID: <20...@acm.org>
+Date: Sat, 30 Apr 2005 19:28:29 -0300
+
+
+--652b8c4dcb00cdcdda1e16af36781caf
+Content-Type: multipart/related; boundary="6a82fb459dcaacd40ab3404529e808dc"
+
+
+--6a82fb459dcaacd40ab3404529e808dc
+Content-Type: multipart/alternative; boundary="69c1683a3ee16ef7cf16edd700694a2f"
+
+
+--69c1683a3ee16ef7cf16edd700694a2f
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+This is an HTML message. Please use an HTML capable mail program to read
+this message.
+
+--69c1683a3ee16ef7cf16edd700694a2f
+Content-Type: text/html; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+<html>
+<head>
+<title>Testing Manuel Lemos' MIME E-mail composing and sending PHP class: H=
+TML message</title>
+<style type=3D"text/css"><!--
+body { color: black ; font-family: arial, helvetica, sans-serif ; backgroun=
+d-color: #A3C5CC }
+A:link, A:visited, A:active { text-decoration: underline }
+--></style>
+</head>
+<body>
+<table background=3D"cid:4c837ed463ad29c820668e835a270e8a.gif" width=3D"100=
+%">
+<tr>
+<td>
+<center><h1>Testing Manuel Lemos' MIME E-mail composing and sending PHP cla=
+ss: HTML message</h1></center>
+<hr>
+<P>Hello Manuel,<br><br>
+This message is just to let you know that the <a href=3D"http://www.phpclas=
+ses.org/mimemessage">MIME E-mail message composing and sending PHP class</a=
+> is working as expected.<br><br>
+<center><h2>Here is an image embedded in a message as a separate part:</h2>=
+</center>
+<center><img src=3D"cid:ae0357e57f04b8347f7621662cb63855.gif"></center>Than=
+k you,<br>
+mlemos</p>
+</td>
+</tr>
+</table>
+</body>
+</html>
+--69c1683a3ee16ef7cf16edd700694a2f--
+
+--6a82fb459dcaacd40ab3404529e808dc
+Content-Type: image/gif; name="logo.gif"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline; filename="logo.gif"
+Content-ID: <ae0357e57f04b8347f7621662cb63855.gif>
+
+R0lGODlhlgAjAPMJAAAAAAAA/y8vLz8/P19fX19f339/f4+Pj4+Pz7+/v///////////////////
+/////yH5BAEAAAkALAAAAACWACMAQwT+MMlJq7046827/2AoHYChGAChAkBylgKgKClFyEl6xDMg
+qLFBj3C5uXKplVAxIOxkA8BhdFCpDlMK1urMTrZWbAV8tVS5YsxtxmZHBVOSCcW9zaXyNhslVcto
+RBp5NQYxLAYGLi8oSwoJBlE+BiSNj5E/PDQsmy4pAJWQLAKJY5+hXhZ2dDYldFWtNSFPiXssXnZR
+k5+1pjpBiDMJUXG/Jo7DI4eKfMSmxsJ9GAUB1NXW19jZ2tvc3d7f4OHi2AgZN5vom1kk6F7s6u/p
+m3Ab7AOIiCxOyZuBIv8AOeTJIaYQjiR/kKTr5GQNE3pYSjCJ9mUXClRUsLxaZGciC0X+OlpoOuQo
+ZKdNJnIoKfnxRUQh6FLG0iLxIoYnJd0JEKISJyAQDodp3EUDC48oDnUY7HFI3wEDRjzycQJVZCQT
+Ol7NK+G0qgtkAcOKHUu2rNmzYTVqRMt2bB49bHompSchqg6HcGeANSMxr8sEa2y2HexnSEUTuWri
+SSbkYh7BgGVAnhB1b2REibESYaRoBgqIMYx59tFM9AvQffVG49P5NMZkMlHKhJPJb0knmSKZ6kSX
+JtbeF3Am7ocok6c7cM7pU5xcXiJJETUz16qPrzEfaFgZpvzn7h86YV5r/1mxXeAUMVyEIpnVUGpN
+RlG2ka9b3lP3pm2l6u7P+l/YLj3+RlEHbz1C0kRxSITQaAcilVBMEzmkkEQO8oSOBNg9SN+AX6hV
+z1pjgJiAhwCRsY8ZIp6xj1ruqCgeGeKNGEZwLnIwzTg45qjjjjz2GEA5hAUp5JBEFmnkkSCoWEcZ
+X8yohZNK1pFGPQS4hx0qNSLJlk9wCQORYu5QiMd7bUzGVyNlRiOHSlpuKdGEItHQ3HZ18beRRyws
+YSY/waDTiHf/tWlWUBAJiMJ1/Z0XXU7N0FnREpKM4NChCgbyRDq9XYpOplaKopN9NMkDnBbG+UMC
+QwLWIeaiglES6AjGARcPHCWoVAiatcTnGTABZoLPaPG1phccPv366mEvWEFSLnj+2QaonECwcJt/
+e1Zw3lJvVMmftBdVNQS3UngLCA85YHIQOy6JO9N4eZW7KJwtOUZmGwOMWqejwVW6RQzaikRHX3yI
+osKhDAq8wmnKSmdMwNidSOof9ZG2DoV0RfTVmLFtGmNk+CoZna0HQnPHS3AhRbIeDpqmR09E0bsu
+soeaw994z+rwQVInvqLenBftYjLOVphLFHhV9qsnez8AEUbQRgO737AxChjmyANxuEFHSGi7hFCV
+4jxLst2N8sRJYU+SHiAKjlmCgz2IffbLI5aaQR71hnkxq1ZfHSfKata6YDCJDMAQwY7wOgzhjxgj
+VFQnKB5uX4mr9qJ79pann+VcfcSzsSCd2mw5scqRRvlQ6TgcUelYhu75iPE4JejrsJOFQAG01277
+7bjnrvvuvPfu++/ABy887hfc6OPxyCevPDdAVoDA89BHL/301Fdv/fXYZ6/99tx3Pz0FEQAAOw==
+
+--6a82fb459dcaacd40ab3404529e808dc
+Content-Type: image/gif; name="background.gif"
+Content-Transfer-Encoding: base64
+Content-Disposition: inline; filename="background.gif"
+Content-ID: <4c837ed463ad29c820668e835a270e8a.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3ic8k2Kl5V4JQhUiXgWFgqUh1e9h3mcpy2epxdm+XnjQ1EiMHoQ
+pVtogiWuV3urBxGod4Xnw41huJfjKHvtg3t8GYKEWZiGeZiImZiKuZiM2ZiO+ZiQGZmSOZmUWZmW
+eZmYmZmauZmc2ZlCEQEAOw==
+
+--6a82fb459dcaacd40ab3404529e808dc--
+
+--652b8c4dcb00cdcdda1e16af36781caf
+Content-Type: text/plain; name="attachment.txt"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="attachment.txt"
+
+VGhpcyBpcyBqdXN0IGEgcGxhaW4gdGV4dCBhdHRhY2htZW50IGZpbGUgbmFtZWQgYXR0YWNobWVu
+dC50eHQgLg==
+
+--652b8c4dcb00cdcdda1e16af36781caf--


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


[james-project] 06/12: JAMES-3389 rename (receive -> transfer)

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

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

commit 48fc4a42ec1c2765efc88802fbe3ec453b515f66
Author: Andreas Valdma <an...@nortal.com>
AuthorDate: Wed Nov 4 12:51:36 2020 +0200

    JAMES-3389 rename (receive -> transfer)
---
 .../james/modules/server/WebAdminMailOverWebModule.java       |  4 ++--
 ...ReceiveMailOverWebRoutes.java => TransferEmailRoutes.java} |  8 +++-----
 ...ailOverWebRoutesTest.java => TransferEmailRoutesTest.java} | 11 ++++-------
 3 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/server/container/guice/protocols/webadmin-mail-over-web/src/main/java/org/apache/james/modules/server/WebAdminMailOverWebModule.java b/server/container/guice/protocols/webadmin-mail-over-web/src/main/java/org/apache/james/modules/server/WebAdminMailOverWebModule.java
index 7c376ec..352a16f 100644
--- a/server/container/guice/protocols/webadmin-mail-over-web/src/main/java/org/apache/james/modules/server/WebAdminMailOverWebModule.java
+++ b/server/container/guice/protocols/webadmin-mail-over-web/src/main/java/org/apache/james/modules/server/WebAdminMailOverWebModule.java
@@ -1,7 +1,7 @@
 package org.apache.james.modules.server;
 
 import org.apache.james.webadmin.Routes;
-import org.apache.james.webadmin.routes.ReceiveMailOverWebRoutes;
+import org.apache.james.webadmin.routes.TransferEmailRoutes;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.multibindings.Multibinder;
@@ -11,6 +11,6 @@ public class WebAdminMailOverWebModule extends AbstractModule {
     @Override
     protected void configure() {
         Multibinder<Routes> routesMultibinder = Multibinder.newSetBinder(binder(), Routes.class);
-        routesMultibinder.addBinding().to(ReceiveMailOverWebRoutes.class);
+        routesMultibinder.addBinding().to(TransferEmailRoutes.class);
     }
 }
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/ReceiveMailOverWebRoutes.java b/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/TransferEmailRoutes.java
similarity index 90%
rename from server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/ReceiveMailOverWebRoutes.java
rename to server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/TransferEmailRoutes.java
index b8e5a9c..b81cc04 100644
--- a/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/ReceiveMailOverWebRoutes.java
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/main/java/org/apache/james/webadmin/routes/TransferEmailRoutes.java
@@ -14,8 +14,6 @@ import org.apache.james.queue.api.MailQueue;
 import org.apache.james.queue.api.MailQueueFactory;
 import org.apache.james.server.core.MailImpl;
 import org.apache.james.webadmin.Routes;
-import org.apache.james.webadmin.utils.ErrorResponder;
-import org.apache.james.webadmin.utils.JsonExtractor;
 import org.eclipse.jetty.http.HttpStatus;
 
 import io.swagger.annotations.Api;
@@ -27,9 +25,9 @@ import io.swagger.annotations.ApiResponses;
 import spark.Service;
 
 @Api(tags = "OverWebMailReceiver")
-@Path(ReceiveMailOverWebRoutes.BASE_URL)
+@Path(TransferEmailRoutes.BASE_URL)
 @Produces("application/json")
-public class ReceiveMailOverWebRoutes implements Routes {
+public class TransferEmailRoutes implements Routes {
 
     public static final String BASE_URL = "/mail-transfer-service";
 
@@ -41,7 +39,7 @@ public class ReceiveMailOverWebRoutes implements Routes {
     }
 
     @Inject
-    public ReceiveMailOverWebRoutes(MailQueueFactory<?> queueFactory) {
+    public TransferEmailRoutes(MailQueueFactory<?> queueFactory) {
         queue = queueFactory.createQueue(MailQueueFactory.SPOOL);
     }
 
diff --git a/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/ReceiveMailOverWebRoutesTest.java b/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/TransferEmailRoutesTest.java
similarity index 86%
rename from server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/ReceiveMailOverWebRoutesTest.java
rename to server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/TransferEmailRoutesTest.java
index 10e9c7e..0c634a8 100644
--- a/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/ReceiveMailOverWebRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mail-over-web/src/test/java/org/apache/james/routes/TransferEmailRoutesTest.java
@@ -1,20 +1,17 @@
 package org.apache.james.routes;
 
 import static io.restassured.RestAssured.given;
-import static io.restassured.RestAssured.when;
 import static io.restassured.config.EncoderConfig.encoderConfig;
 import static io.restassured.config.RestAssuredConfig.newConfig;
 
 import java.nio.charset.StandardCharsets;
 
-import org.apache.james.queue.api.MailQueueFactory;
 import org.apache.james.queue.api.RawMailQueueItemDecoratorFactory;
 import org.apache.james.queue.memory.MemoryMailQueueFactory;
 import org.apache.james.util.ClassLoaderUtils;
 import org.apache.james.webadmin.WebAdminServer;
 import org.apache.james.webadmin.WebAdminUtils;
-import org.apache.james.webadmin.routes.ReceiveMailOverWebRoutes;
-import org.hamcrest.Matchers;
+import org.apache.james.webadmin.routes.TransferEmailRoutes;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -24,13 +21,13 @@ import io.restassured.builder.RequestSpecBuilder;
 import io.restassured.http.ContentType;
 import io.restassured.specification.RequestSpecification;
 
-public class ReceiveMailOverWebRoutesTest {
+public class TransferEmailRoutesTest {
 
     private WebAdminServer webAdminServer;
 
     private WebAdminServer createServer() {
         MemoryMailQueueFactory memoryMailQueueFactory = new MemoryMailQueueFactory(new RawMailQueueItemDecoratorFactory());
-        return WebAdminUtils.createWebAdminServer(new ReceiveMailOverWebRoutes(memoryMailQueueFactory)).start();
+        return WebAdminUtils.createWebAdminServer(new TransferEmailRoutes(memoryMailQueueFactory)).start();
     }
 
     @BeforeEach
@@ -49,7 +46,7 @@ public class ReceiveMailOverWebRoutesTest {
         return new RequestSpecBuilder()
                 .setContentType(ContentType.JSON)
                 .setAccept(ContentType.JSON)
-                .setBasePath(ReceiveMailOverWebRoutes.BASE_URL)
+                .setBasePath(TransferEmailRoutes.BASE_URL)
                 .setPort(server.getPort().getValue())
                 .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.UTF_8)))
                 .build();


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