james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [11/12] james-project git commit: JAMES-2555 MessageIdReindexing routes: swagger documentation
Date Tue, 23 Oct 2018 01:44:42 GMT
JAMES-2555 MessageIdReindexing routes: swagger documentation


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

Branch: refs/heads/master
Commit: 52314f35495d7e8ba4d23e7c2022fffe712adc7c
Parents: 44ee643
Author: Benoit Tellier <btellier@linagora.com>
Authored: Mon Oct 15 11:44:17 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Tue Oct 23 08:43:46 2018 +0700

----------------------------------------------------------------------
 .../WebAdminServerIntegrationTest.java          |  3 +-
 .../routes/MessageIdReindexingRoutes.java       | 37 ++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/52314f35/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 20e0a71..482d7d6 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
@@ -327,7 +327,8 @@ public class WebAdminServerIntegrationTest {
             .body(containsString("\"tags\":[\"MailQueues\"]"))
             .body(containsString("\"tags\":[\"Address Forwards\"]"))
             .body(containsString("\"tags\":[\"Address Groups\"]"))
-            .body(containsString("{\"name\":\"ReIndexing\"}"));
+            .body(containsString("{\"name\":\"ReIndexing\"}"))
+            .body(containsString("{\"name\":\"MessageIdReIndexing\"}"));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/52314f35/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/MessageIdReindexingRoutes.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/MessageIdReindexingRoutes.java
b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/MessageIdReindexingRoutes.java
index 1e73945..7031d6a 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/MessageIdReindexingRoutes.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/MessageIdReindexingRoutes.java
@@ -22,6 +22,9 @@ package org.apache.james.webadmin.routes;
 import static org.apache.james.webadmin.routes.ReindexingRoutes.BASE_PATH;
 
 import javax.inject.Inject;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
 
 import org.apache.james.mailbox.indexer.MessageIdReIndexer;
 import org.apache.james.mailbox.model.MessageId;
@@ -36,10 +39,19 @@ import org.eclipse.jetty.http.HttpStatus;
 
 import com.github.fge.lambdas.supplier.ThrowingSupplier;
 
+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.Request;
 import spark.Response;
 import spark.Service;
 
+@Api(tags = "MessageIdReIndexing")
+@Path("/mailboxIndex")
+@Produces("application/json")
 public class MessageIdReindexingRoutes implements Routes {
     private static final String MESSAGE_ID_PARAM = ":messageId";
     private static final String MESSAGE_PATH = BASE_PATH + "/messages/" + MESSAGE_ID_PARAM;
@@ -67,6 +79,31 @@ public class MessageIdReindexingRoutes implements Routes {
         service.post(MESSAGE_PATH, this::reIndexMessage, jsonTransformer);
     }
 
+    @POST
+    @Path("/messages/{messageId}")
+    @ApiOperation(value = "Re-indexes one email in the different mailboxes containing it")
+    @ApiImplicitParams({
+        @ApiImplicitParam(
+            required = true,
+            name = "task",
+            paramType = "query parameter",
+            dataType = "String",
+            defaultValue = "none",
+            example = "?task=reIndex",
+            value = "Compulsory. Only supported value is `reIndex`"),
+        @ApiImplicitParam(
+            required = true,
+            name = "messageId",
+            paramType = "path parameter",
+            dataType = "String",
+            defaultValue = "none",
+            value = "Compulsory. Needs to be a valid messageId (format depends on the mailbox
implementation)")
+    })
+    @ApiResponses(value = {
+        @ApiResponse(code = HttpStatus.CREATED_201, message = "Task is created", response
= TaskIdDto.class),
+        @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "Internal server
error - Something went bad on the server side."),
+        @ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "Bad request - details
in the returned error message")
+    })
     private TaskIdDto reIndexMessage(Request request, Response response) {
         return wrap(request, response, () -> reIndexer.reIndex(extractMessageId(request)));
     }


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


Mime
View raw message