JAMES-2293 Guice products should expose webadmin routes

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

Branch: refs/heads/master
Commit: 1ab371ec9daa96c0e76dbdda96bff5247f72bdae
Parents: f2d8f04
Author: benwa <[email protected]>
Authored: Mon Jan 22 14:18:22 2018 +0700
Committer: benwa <[email protected]>
Committed: Thu Jan 25 11:39:06 2018 +0700

----------------------------------------------------------------------
 pom.xml                                         |  5 ++
 server/container/guice/cassandra-guice/pom.xml  |  4 ++
 .../apache/james/CassandraJamesServerMain.java  |  2 +
 server/container/guice/jpa-guice/pom.xml        |  4 ++
 .../org/apache/james/JPAJamesServerMain.java    |  2 +
 server/container/guice/jpa-smtp/pom.xml         |  4 ++
 .../org/apache/james/JPAJamesServerMain.java    |  2 +
 server/container/guice/memory-guice/pom.xml     |  4 ++
 .../org/apache/james/MemoryJamesServerMain.java |  2 +
 server/container/guice/pom.xml                  |  6 ++
 .../protocols/webadmin-mailrepository/pom.xml   | 71 ++++++++++++++++++++
 .../server/MailRepositoriesRoutesModule.java    | 34 ++++++++++
 .../WebAdminServerIntegrationTest.java          | 17 +++++
 13 files changed, 157 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3b888f0..e8fbafc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1420,6 +1420,11 @@
             </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
+                <artifactId>james-server-webadmin-mailrepository</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
                 <artifactId>james-server-webadmin-swagger</artifactId>
                 <version>${project.version}</version>
             </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/server/container/guice/cassandra-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/pom.xml 
b/server/container/guice/cassandra-guice/pom.xml
index db90008..fc3bd28 100644
--- a/server/container/guice/cassandra-guice/pom.xml
+++ b/server/container/guice/cassandra-guice/pom.xml
@@ -170,6 +170,10 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
+            <artifactId>james-server-guice-webadmin-mailrepository</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
             <artifactId>james-server-guice-webadmin-swagger</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
----------------------------------------------------------------------
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 8a81e4c..2d4784a 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
@@ -42,6 +42,7 @@ import org.apache.james.modules.server.CassandraRoutesModule;
 import org.apache.james.modules.server.DataRoutesModules;
 import org.apache.james.modules.server.ElasticSearchMetricReporterModule;
 import org.apache.james.modules.server.JMXServerModule;
+import org.apache.james.modules.server.MailRepositoriesRoutesModule;
 import org.apache.james.modules.server.MailboxRoutesModule;
 import org.apache.james.modules.server.SwaggerRoutesModule;
 import org.apache.james.modules.server.WebAdminServerModule;
@@ -55,6 +56,7 @@ public class CassandraJamesServerMain {
         new CassandraRoutesModule(),
         new DataRoutesModules(),
         new MailboxRoutesModule(),
+        new MailRepositoriesRoutesModule(),
         new SwaggerRoutesModule(),
         new WebAdminServerModule());
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/server/container/guice/jpa-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/pom.xml 
b/server/container/guice/jpa-guice/pom.xml
index d61ec25..1cd7261 100644
--- a/server/container/guice/jpa-guice/pom.xml
+++ b/server/container/guice/jpa-guice/pom.xml
@@ -113,6 +113,10 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
+            <artifactId>james-server-guice-webadmin-mailrepository</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
             <artifactId>james-server-guice-webadmin-swagger</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
 
b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
index 141df5f..d3e3e15 100644
--- 
a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
+++ 
b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
@@ -36,6 +36,7 @@ import org.apache.james.modules.server.DataRoutesModules;
 import 
org.apache.james.modules.server.DefaultProcessorsConfigurationProviderModule;
 import org.apache.james.modules.server.ElasticSearchMetricReporterModule;
 import org.apache.james.modules.server.JMXServerModule;
+import org.apache.james.modules.server.MailRepositoriesRoutesModule;
 import org.apache.james.modules.server.MailboxRoutesModule;
 import org.apache.james.modules.server.NoJwtModule;
 import org.apache.james.modules.server.RawPostDequeueDecoratorModule;
@@ -51,6 +52,7 @@ public class JPAJamesServerMain {
         new WebAdminServerModule(),
         new DataRoutesModules(),
         new MailboxRoutesModule(),
+        new MailRepositoriesRoutesModule(),
         new SwaggerRoutesModule());
 
     public static final Module PROTOCOLS = Modules.combine(

http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/server/container/guice/jpa-smtp/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/pom.xml 
b/server/container/guice/jpa-smtp/pom.xml
index b69c6a8..1a43a4d 100644
--- a/server/container/guice/jpa-smtp/pom.xml
+++ b/server/container/guice/jpa-smtp/pom.xml
@@ -78,6 +78,10 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
+            <artifactId>james-server-guice-webadmin-mailrepository</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
             <artifactId>james-server-jpa-common-guice</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
 
b/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
index 0c36736..45f3fba 100644
--- 
a/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
+++ 
b/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
@@ -28,6 +28,7 @@ import org.apache.james.modules.server.ActiveMQQueueModule;
 import org.apache.james.modules.server.DataRoutesModules;
 import 
org.apache.james.modules.server.DefaultProcessorsConfigurationProviderModule;
 import org.apache.james.modules.server.ElasticSearchMetricReporterModule;
+import org.apache.james.modules.server.MailRepositoriesRoutesModule;
 import org.apache.james.modules.server.NoJwtModule;
 import org.apache.james.modules.server.RawPostDequeueDecoratorModule;
 import org.apache.james.modules.server.WebAdminServerModule;
@@ -43,6 +44,7 @@ public class JPAJamesServerMain {
         new SMTPServerModule(),
         new WebAdminServerModule(),
         new DataRoutesModules(),
+        new MailRepositoriesRoutesModule(),
         new NoJwtModule(),
         new DefaultProcessorsConfigurationProviderModule());
     

http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/server/container/guice/memory-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/pom.xml 
b/server/container/guice/memory-guice/pom.xml
index 0436ea4..c9658e2 100644
--- a/server/container/guice/memory-guice/pom.xml
+++ b/server/container/guice/memory-guice/pom.xml
@@ -112,6 +112,10 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
+            <artifactId>james-server-guice-webadmin-mailrepository</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
             <artifactId>james-server-guice-webadmin-swagger</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
 
b/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
index 720b762..0e6108e 100644
--- 
a/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
+++ 
b/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
@@ -34,6 +34,7 @@ import org.apache.james.modules.protocols.SMTPServerModule;
 import org.apache.james.modules.server.CamelMailetContainerModule;
 import org.apache.james.modules.server.DataRoutesModules;
 import org.apache.james.modules.server.JMXServerModule;
+import org.apache.james.modules.server.MailRepositoriesRoutesModule;
 import org.apache.james.modules.server.MailboxRoutesModule;
 import org.apache.james.modules.server.MemoryMailQueueModule;
 import org.apache.james.modules.server.RawPostDequeueDecoratorModule;
@@ -49,6 +50,7 @@ public class MemoryJamesServerMain {
         new WebAdminServerModule(),
         new DataRoutesModules(),
         new MailboxRoutesModule(),
+        new MailRepositoriesRoutesModule(),
         new SwaggerRoutesModule());
 
     public static final Module PROTOCOLS = Modules.combine(

http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/server/container/guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 07380bf..ad8784d 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -57,6 +57,7 @@
         <module>protocols/webadmin-cassandra</module>
         <module>protocols/webadmin-data</module>
         <module>protocols/webadmin-mailbox</module>
+        <module>protocols/webadmin-mailrepository</module>
         <module>protocols/webadmin-swagger</module>
     </modules>
 
@@ -145,6 +146,11 @@
             </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
+                
<artifactId>james-server-guice-webadmin-mailrepository</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
                 <artifactId>james-server-guice-webadmin-swagger</artifactId>
                 <version>${project.version}</version>
             </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/server/container/guice/protocols/webadmin-mailrepository/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/webadmin-mailrepository/pom.xml 
b/server/container/guice/protocols/webadmin-mailrepository/pom.xml
new file mode 100644
index 0000000..457a72a
--- /dev/null
+++ b/server/container/guice/protocols/webadmin-mailrepository/pom.xml
@@ -0,0 +1,71 @@
+<?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";>
+
+    <modelVersion>4.0.0</modelVersion>
+    
+    <parent>
+        <artifactId>james-server-guice</artifactId>
+        <groupId>org.apache.james</groupId>
+        <version>3.1.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>james-server-guice-webadmin-mailrepository</artifactId>
+
+    <name>Apache James :: Server :: Guice :: Webadmin :: MailRepository</name>
+    <description>Webadmin mailrepository modules for Guice implementation of 
James server</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>james-server-guice-configuration</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>james-server-webadmin-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>james-server-webadmin-mailrepository</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject.extensions</groupId>
+            <artifactId>guice-multibindings</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/server/container/guice/protocols/webadmin-mailrepository/src/main/java/org/apache/james/modules/server/MailRepositoriesRoutesModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/protocols/webadmin-mailrepository/src/main/java/org/apache/james/modules/server/MailRepositoriesRoutesModule.java
 
b/server/container/guice/protocols/webadmin-mailrepository/src/main/java/org/apache/james/modules/server/MailRepositoriesRoutesModule.java
new file mode 100644
index 0000000..a4a4706
--- /dev/null
+++ 
b/server/container/guice/protocols/webadmin-mailrepository/src/main/java/org/apache/james/modules/server/MailRepositoriesRoutesModule.java
@@ -0,0 +1,34 @@
+/****************************************************************
+ * 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;
+import org.apache.james.webadmin.routes.MailRepositoriesRoutes;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.Multibinder;
+
+public class MailRepositoriesRoutesModule extends AbstractModule {
+    @Override
+    protected void configure() {
+        Multibinder<Routes> routesMultibinder = 
Multibinder.newSetBinder(binder(), Routes.class);
+        routesMultibinder.addBinding().to(MailRepositoriesRoutes.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/1ab371ec/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
index 7a14390..9ce9443 100644
--- 
a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
+++ 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
@@ -26,6 +26,7 @@ import static 
com.jayway.restassured.config.RestAssuredConfig.newConfig;
 import static org.apache.james.webadmin.Constants.JSON_CONTENT_TYPE;
 import static org.apache.james.webadmin.Constants.SEPARATOR;
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.containsInAnyOrder;
 import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.is;
 
@@ -41,6 +42,7 @@ import org.apache.james.probe.DataProbe;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.routes.DomainsRoutes;
+import org.apache.james.webadmin.routes.MailRepositoriesRoutes;
 import org.apache.james.webadmin.routes.UserMailboxesRoutes;
 import org.apache.james.webadmin.routes.UserRoutes;
 import org.apache.james.webadmin.swagger.routes.SwaggerRoutes;
@@ -111,6 +113,21 @@ public class WebAdminServerIntegrationTest {
     }
 
     @Test
+    public void mailRepositoriesRoutesShouldBeExposed() throws Exception {
+        given()
+            .port(webAdminGuiceProbe.getWebAdminPort())
+        .when()
+            .get(MailRepositoriesRoutes.MAIL_REPOSITORIES)
+        .then()
+            .statusCode(HttpStatus.OK_200)
+            .body("repository", containsInAnyOrder(
+                "file://var/mail/error/",
+                "file://var/mail/relay-denied/",
+                "file://var/mail/spam/",
+                "file://var/mail/address-error/"));
+    }
+
+    @Test
     public void deleteShouldRemoveTheGivenDomain() throws Exception {
         dataProbe.addDomain(DOMAIN);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to