james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [05/14] james-project git commit: JAMES-2555 Make ReIndexing APIs more REST friendly
Date Wed, 05 Dec 2018 09:44:36 GMT
JAMES-2555 Make ReIndexing APIs more REST friendly


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

Branch: refs/heads/master
Commit: 985b9a4a75bfa75c331cba6cbf835c043185dbdb
Parents: 8ab8d8b
Author: Benoit Tellier <btellier@linagora.com>
Authored: Mon Dec 3 10:51:49 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Wed Dec 5 16:33:30 2018 +0700

----------------------------------------------------------------------
 .../WebAdminServerIntegrationTest.java          |  4 +-
 .../routes/MessageIdReindexingRoutes.java       | 11 ++-
 .../james/webadmin/routes/ReindexingRoutes.java | 60 ++++---------
 .../webadmin/routes/ReindexingRoutesTest.java   | 93 ++++++++++++--------
 src/site/markdown/server/manage-webadmin.md     | 16 ++--
 5 files changed, 89 insertions(+), 95 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/985b9a4a/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 482d7d6..61e690b 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
@@ -71,7 +71,7 @@ public class WebAdminServerIntegrationTest {
 
     @ClassRule
     public static DockerCassandraRule cassandra = new DockerCassandraRule();
-    
+
     @Rule
     public CassandraJmapTestRule cassandraJmapTestRule = CassandraJmapTestRule.defaultTestRule();
 
@@ -327,7 +327,7 @@ 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 (mailboxes)\"}"))
             .body(containsString("{\"name\":\"MessageIdReIndexing\"}"));
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/985b9a4a/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 7031d6a..d98206f 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
@@ -19,8 +19,6 @@
 
 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;
@@ -50,11 +48,12 @@ import spark.Response;
 import spark.Service;
 
 @Api(tags = "MessageIdReIndexing")
-@Path("/mailboxIndex")
+@Path("/messages")
 @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;
+    private static final String BASE_PATH = "/messages";
+    private static final String MESSAGE_PATH = BASE_PATH + "/" + MESSAGE_ID_PARAM;
 
     private final TaskManager taskManager;
     private final MessageId.Factory messageIdFactory;
@@ -62,7 +61,7 @@ public class MessageIdReindexingRoutes implements Routes {
     private final JsonTransformer jsonTransformer;
 
     @Inject
-    public MessageIdReindexingRoutes(TaskManager taskManager, MessageId.Factory messageIdFactory,
MessageIdReIndexer reIndexer, JsonTransformer jsonTransformer) {
+    MessageIdReindexingRoutes(TaskManager taskManager, MessageId.Factory messageIdFactory,
MessageIdReIndexer reIndexer, JsonTransformer jsonTransformer) {
         this.taskManager = taskManager;
         this.messageIdFactory = messageIdFactory;
         this.reIndexer = reIndexer;
@@ -80,7 +79,7 @@ public class MessageIdReindexingRoutes implements Routes {
     }
 
     @POST
-    @Path("/messages/{messageId}")
+    @Path("/{messageId}")
     @ApiOperation(value = "Re-indexes one email in the different mailboxes containing it")
     @ApiImplicitParams({
         @ApiImplicitParam(

http://git-wip-us.apache.org/repos/asf/james-project/blob/985b9a4a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/ReindexingRoutes.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/ReindexingRoutes.java
b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/ReindexingRoutes.java
index 28b10cc..8c5a773 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/ReindexingRoutes.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/ReindexingRoutes.java
@@ -39,6 +39,8 @@ import org.apache.james.webadmin.utils.ErrorResponder;
 import org.apache.james.webadmin.utils.JsonTransformer;
 import org.eclipse.jetty.http.HttpStatus;
 
+import com.google.common.base.Strings;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -49,8 +51,8 @@ import spark.Request;
 import spark.Response;
 import spark.Service;
 
-@Api(tags = "ReIndexing")
-@Path("/mailboxIndex")
+@Api(tags = "ReIndexing (mailboxes)")
+@Path("/mailboxes")
 @Produces("application/json")
 public class ReindexingRoutes implements Routes {
     @FunctionalInterface
@@ -58,12 +60,11 @@ public class ReindexingRoutes implements Routes {
         Task generate() throws MailboxException;
     }
 
-    static final String BASE_PATH = "/mailboxIndex";
-    private static final String USER_PARAM = ":user";
+    private static final String BASE_PATH = "/mailboxes";
+    private static final String USER_QUERY_PARAM = "user";
     private static final String MAILBOX_PARAM = ":mailbox";
     private static final String UID_PARAM = ":uid";
-    private static final String USER_PATH = BASE_PATH + "/users/" + USER_PARAM;
-    private static final String MAILBOX_PATH = BASE_PATH + "/mailboxes/" + MAILBOX_PARAM;
+    private static final String MAILBOX_PATH = BASE_PATH + "/" + MAILBOX_PARAM;
     private static final String MESSAGE_PATH = MAILBOX_PATH + "/mails/" + UID_PARAM;
 
     private final TaskManager taskManager;
@@ -72,7 +73,7 @@ public class ReindexingRoutes implements Routes {
     private final JsonTransformer jsonTransformer;
 
     @Inject
-    public ReindexingRoutes(TaskManager taskManager, MailboxId.Factory mailboxIdFactory,
ReIndexer reIndexer, JsonTransformer jsonTransformer) {
+    ReindexingRoutes(TaskManager taskManager, MailboxId.Factory mailboxIdFactory, ReIndexer
reIndexer, JsonTransformer jsonTransformer) {
         this.taskManager = taskManager;
         this.mailboxIdFactory = mailboxIdFactory;
         this.reIndexer = reIndexer;
@@ -87,7 +88,6 @@ public class ReindexingRoutes implements Routes {
     @Override
     public void define(Service service) {
         service.post(BASE_PATH, this::reIndexAll, jsonTransformer);
-        service.post(USER_PATH, this::reIndexUser, jsonTransformer);
         service.post(MAILBOX_PATH, this::reIndexMailbox, jsonTransformer);
         service.post(MESSAGE_PATH, this::reIndexMessage, jsonTransformer);
     }
@@ -103,51 +103,29 @@ public class ReindexingRoutes implements Routes {
             dataType = "String",
             defaultValue = "none",
             example = "?task=reIndex",
-            value = "Compulsory. Only supported value is `reIndex`")
-    })
-    @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 reIndexAll(Request request, Response response) {
-        return wrap(request, response,
-            () -> reIndexer.reIndex());
-    }
-
-    @POST
-    @Path("/users/{user}")
-    @ApiOperation(value = "Re-indexes all the mails of a user")
-    @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 = "user",
-            paramType = "path parameter",
+            paramType = "query parameter",
             dataType = "String",
             defaultValue = "none",
-            example = "benoit@apache.org",
-            value = "Compulsory. Needs to be a valid username")
+            example = "?user=toto%40domain.tld",
+            value = "optional. If present, only mailboxes of that user will be reIndexed.")
     })
     @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 reIndexUser(Request request, Response response) {
-        return wrap(request, response,
-            () -> reIndexer.reIndex(extractUser(request)));
+    private TaskIdDto reIndexAll(Request request, Response response) {
+        if (Strings.isNullOrEmpty(request.queryParams(USER_QUERY_PARAM))) {
+            return wrap(request, response, reIndexer::reIndex);
+        }
+        return wrap(request, response, () -> reIndexer.reIndex(extractUser(request)));
     }
 
     @POST
-    @Path("/mailboxes/{mailboxId}")
+    @Path("/{mailboxId}")
     @ApiOperation(value = "Re-indexes all the mails in a mailbox")
     @ApiImplicitParams({
         @ApiImplicitParam(
@@ -185,7 +163,7 @@ public class ReindexingRoutes implements Routes {
     }
 
     @POST
-    @Path("/mailboxes/{mailboxId}/mails/{uid}")
+    @Path("/{mailboxId}/mails/{uid}")
     @ApiOperation(value = "Re-indexes a single email")
     @ApiImplicitParams({
         @ApiImplicitParam(
@@ -244,7 +222,7 @@ public class ReindexingRoutes implements Routes {
 
     private User extractUser(Request request) {
         try {
-            return User.fromUsername(request.params(USER_PARAM));
+            return User.fromUsername(request.queryParams(USER_QUERY_PARAM));
         } catch (Exception e) {
             throw ErrorResponder.builder()
                 .statusCode(HttpStatus.BAD_REQUEST_400)

http://git-wip-us.apache.org/repos/asf/james-project/blob/985b9a4a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ReindexingRoutesTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ReindexingRoutesTest.java
b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ReindexingRoutesTest.java
index 38d0205..86c2b52 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ReindexingRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/ReindexingRoutesTest.java
@@ -121,7 +121,7 @@ class ReindexingRoutesTest {
             @Test
             void fullReprocessingShouldFailWithNoTask() {
                 when()
-                    .post("/mailboxIndex")
+                    .post("/mailboxes")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -132,7 +132,7 @@ class ReindexingRoutesTest {
             @Test
             void fullReprocessingShouldFailWithBadTask() {
                 when()
-                    .post("/mailboxIndex?task=bad")
+                    .post("/mailboxes?task=bad")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -146,7 +146,7 @@ class ReindexingRoutesTest {
             @Test
             void fullReprocessingShouldNotFailWhenNoMail() {
                 String taskId = with()
-                    .post("/mailboxIndex?task=reIndex")
+                    .post("/mailboxes?task=reIndex")
                     .jsonPath()
                     .get("taskId");
 
@@ -175,7 +175,7 @@ class ReindexingRoutesTest {
                         systemSession);
 
                 String taskId = with()
-                    .post("/mailboxIndex?task=reIndex")
+                    .post("/mailboxes?task=reIndex")
                     .jsonPath()
                     .get("taskId");
 
@@ -207,7 +207,7 @@ class ReindexingRoutesTest {
                         systemSession);
 
                 String taskId = with()
-                    .post("/mailboxIndex?task=reIndex")
+                    .post("/mailboxes?task=reIndex")
                     .jsonPath()
                     .get("taskId");
 
@@ -240,8 +240,10 @@ class ReindexingRoutesTest {
         class Validation {
             @Test
             void userReprocessingShouldFailWithNoTask() {
-                when()
-                    .post("/mailboxIndex/users/" + USERNAME)
+                given()
+                    .queryParam("user", USERNAME)
+                .when()
+                    .post("/mailboxes")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -251,8 +253,11 @@ class ReindexingRoutesTest {
 
             @Test
             void userReprocessingShouldFailWithBadTask() {
-                when()
-                    .post("/mailboxIndex/users/" + USERNAME + "?task=bad")
+                given()
+                    .queryParam("user", USERNAME)
+                    .queryParam("task", "bad")
+                .when()
+                    .post("/mailboxes")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -262,8 +267,11 @@ class ReindexingRoutesTest {
 
             @Test
             void userReprocessingShouldFailWithBadUser() {
-                when()
-                    .post("/mailboxIndex/users/bad@bad@bad?task=reIndex")
+                given()
+                    .queryParam("user", "bad@bad@bad")
+                    .queryParam("task", "reIndex")
+                .when()
+                    .post("/mailboxes")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -276,8 +284,11 @@ class ReindexingRoutesTest {
         class TaskDetails {
             @Test
             void userReprocessingShouldNotFailWhenNoMail() {
-                String taskId = with()
-                    .post("/mailboxIndex/users/" + USERNAME + "?task=reIndex")
+                String taskId = given()
+                    .queryParam("user", USERNAME)
+                    .queryParam("task", "reIndex")
+                .when()
+                    .post("/mailboxes")
                     .jsonPath()
                     .get("taskId");
 
@@ -306,8 +317,11 @@ class ReindexingRoutesTest {
                         MessageManager.AppendCommand.builder().build("header: value\r\n\r\nbody"),
                         systemSession);
 
-                String taskId = with()
-                    .post("/mailboxIndex/users/" + USERNAME + "?task=reIndex")
+                String taskId = given()
+                    .queryParam("user", USERNAME)
+                    .queryParam("task", "reIndex")
+                .when()
+                    .post("/mailboxes")
                     .jsonPath()
                     .get("taskId");
 
@@ -339,8 +353,11 @@ class ReindexingRoutesTest {
                         MessageManager.AppendCommand.builder().build("header: value\r\n\r\nbody"),
                         systemSession);
 
-                String taskId = with()
-                    .post("/mailboxIndex/users/" + USERNAME + "?task=reIndex")
+                String taskId = given()
+                    .queryParam("user", USERNAME)
+                    .queryParam("task", "reIndex")
+                .when()
+                    .post("/mailboxes")
                     .jsonPath()
                     .get("taskId");
 
@@ -378,7 +395,7 @@ class ReindexingRoutesTest {
                 MailboxId mailboxId = mailboxManager.createMailbox(INBOX, systemSession).get();
 
                 when()
-                    .post("/mailboxIndex/mailboxes/" + mailboxId.serialize())
+                    .post("/mailboxes/" + mailboxId.serialize())
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -392,7 +409,7 @@ class ReindexingRoutesTest {
                 MailboxId mailboxId = mailboxManager.createMailbox(INBOX, systemSession).get();
 
                 when()
-                    .post("/mailboxIndex/mailboxes/" + mailboxId.serialize() + "?task=bad")
+                    .post("/mailboxes/" + mailboxId.serialize() + "?task=bad")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -403,7 +420,7 @@ class ReindexingRoutesTest {
             @Test
             void mailboxReprocessingShouldFailWithBadMailboxId() {
                 when()
-                    .post("/mailboxIndex/mailboxes/bad?task=reIndex")
+                    .post("/mailboxes/bad?task=reIndex")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -414,7 +431,7 @@ class ReindexingRoutesTest {
             @Test
             void mailboxReprocessingShouldFailWithNonExistentMailboxId() {
                 when()
-                    .post("/mailboxIndex/mailboxes/36?task=reIndex")
+                    .post("/mailboxes/36?task=reIndex")
                 .then()
                     .statusCode(HttpStatus.NOT_FOUND_404)
                     .body("statusCode", is(404))
@@ -431,7 +448,7 @@ class ReindexingRoutesTest {
                 MailboxId mailboxId = mailboxManager.createMailbox(INBOX, systemSession).get();
 
                 String taskId = when()
-                    .post("/mailboxIndex/mailboxes/" + mailboxId.serialize() + "?task=reIndex")
+                    .post("/mailboxes/" + mailboxId.serialize() + "?task=reIndex")
                     .jsonPath()
                     .get("taskId");
 
@@ -461,7 +478,7 @@ class ReindexingRoutesTest {
                         systemSession);
 
                 String taskId = when()
-                    .post("/mailboxIndex/mailboxes/" + mailboxId.serialize() + "?task=reIndex")
+                    .post("/mailboxes/" + mailboxId.serialize() + "?task=reIndex")
                     .jsonPath()
                     .get("taskId");
 
@@ -494,7 +511,7 @@ class ReindexingRoutesTest {
                         systemSession);
 
                 String taskId = when()
-                    .post("/mailboxIndex/mailboxes/" + mailboxId.serialize() + "?task=reIndex")
+                    .post("/mailboxes/" + mailboxId.serialize() + "?task=reIndex")
                     .jsonPath()
                     .get("taskId");
 
@@ -532,7 +549,7 @@ class ReindexingRoutesTest {
                 MailboxId mailboxId = mailboxManager.createMailbox(INBOX, systemSession).get();
 
                 when()
-                    .post("/mailboxIndex/mailboxes/" + mailboxId.serialize() + "/mails/7")
+                    .post("/mailboxes/" + mailboxId.serialize() + "/mails/7")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -546,7 +563,7 @@ class ReindexingRoutesTest {
                 MailboxId mailboxId = mailboxManager.createMailbox(INBOX, systemSession).get();
 
                 when()
-                    .post("/mailboxIndex/mailboxes/" + mailboxId.serialize() + "/mails/7?task=bad")
+                    .post("/mailboxes/" + mailboxId.serialize() + "/mails/7?task=bad")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -557,7 +574,7 @@ class ReindexingRoutesTest {
             @Test
             void messageReprocessingShouldFailWithBadMailboxId() {
                 when()
-                    .post("/mailboxIndex/mailboxes/bad/mails/7?task=reIndex")
+                    .post("/mailboxes/bad/mails/7?task=reIndex")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -568,7 +585,7 @@ class ReindexingRoutesTest {
             @Test
             void messageReprocessingShouldFailWithNonExistentMailboxId() {
                 when()
-                    .post("/mailboxIndex/mailboxes/36/mails/7?task=reIndex")
+                    .post("/mailboxes/36/mails/7?task=reIndex")
                 .then()
                     .statusCode(HttpStatus.NOT_FOUND_404)
                     .body("statusCode", is(404))
@@ -579,7 +596,7 @@ class ReindexingRoutesTest {
             @Test
             void messageReprocessingShouldFailWithBadUid() {
                 when()
-                    .post("/mailboxIndex/mailboxes/36/mails/bad?task=reIndex")
+                    .post("/mailboxes/36/mails/bad?task=reIndex")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -596,7 +613,7 @@ class ReindexingRoutesTest {
                 MailboxId mailboxId = mailboxManager.createMailbox(INBOX, systemSession).get();
 
                 String taskId = when()
-                    .post("/mailboxIndex/mailboxes/" + mailboxId.serialize() + "/mails/1?task=reIndex")
+                    .post("/mailboxes/" + mailboxId.serialize() + "/mails/1?task=reIndex")
                     .jsonPath()
                     .get("taskId");
 
@@ -625,7 +642,7 @@ class ReindexingRoutesTest {
                         systemSession);
 
                 String taskId = when()
-                    .post("/mailboxIndex/mailboxes/" + mailboxId.serialize() + "/mails/"
+                    .post("/mailboxes/" + mailboxId.serialize() + "/mails/"
                         + composedMessageId.getUid().asLong() + "?task=reIndex")
                     .jsonPath()
                     .get("taskId");
@@ -658,7 +675,7 @@ class ReindexingRoutesTest {
                         systemSession);
 
                 String taskId = when()
-                    .post("/mailboxIndex/mailboxes/" + mailboxId.serialize() + "/mails/"
+                    .post("/mailboxes/" + mailboxId.serialize() + "/mails/"
                         + createdMessage.getUid().asLong() + "?task=reIndex")
                     .jsonPath()
                     .get("taskId");
@@ -691,7 +708,7 @@ class ReindexingRoutesTest {
             @Test
             void messageIdReprocessingShouldFailWithNoTask() {
                 when()
-                    .post("/mailboxIndex/messages/7")
+                    .post("/messages/7")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -702,7 +719,7 @@ class ReindexingRoutesTest {
             @Test
             void messageIdReprocessingShouldFailWithBadTask() {
                 when()
-                    .post("/mailboxIndex/messages/7?task=bad")
+                    .post("/messages/7?task=bad")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -713,7 +730,7 @@ class ReindexingRoutesTest {
             @Test
             void messageIdReprocessingShouldFailWithBadMessageId() {
                 when()
-                    .post("/mailboxIndex/messages/bad?task=reIndex")
+                    .post("/messages/bad?task=reIndex")
                 .then()
                     .statusCode(HttpStatus.BAD_REQUEST_400)
                     .body("statusCode", is(400))
@@ -727,7 +744,7 @@ class ReindexingRoutesTest {
             @Test
             void messageIdReprocessingShouldNotFailWhenUidNotFound() {
                 String taskId = when()
-                    .post("/mailboxIndex/messages/1?task=reIndex")
+                    .post("/messages/1?task=reIndex")
                     .jsonPath()
                     .get("taskId");
 
@@ -755,7 +772,7 @@ class ReindexingRoutesTest {
                         systemSession);
 
                 String taskId = when()
-                    .post("/mailboxIndex/messages/" + composedMessageId.getMessageId().serialize()
+ "?task=reIndex")
+                    .post("/messages/" + composedMessageId.getMessageId().serialize() + "?task=reIndex")
                     .jsonPath()
                     .get("taskId");
 
@@ -786,7 +803,7 @@ class ReindexingRoutesTest {
                         systemSession);
 
                 String taskId = when()
-                    .post("/mailboxIndex/messages/" + composedMessageId.getMessageId().serialize()
+ "?task=reIndex")
+                    .post("/messages/" + composedMessageId.getMessageId().serialize() + "?task=reIndex")
                     .jsonPath()
                     .get("taskId");
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/985b9a4a/src/site/markdown/server/manage-webadmin.md
----------------------------------------------------------------------
diff --git a/src/site/markdown/server/manage-webadmin.md b/src/site/markdown/server/manage-webadmin.md
index e1547f9..2ba0255 100644
--- a/src/site/markdown/server/manage-webadmin.md
+++ b/src/site/markdown/server/manage-webadmin.md
@@ -2117,7 +2117,7 @@ concurrent changes done during the reIndexing might be ignored.
 ### ReIndexing all mails
 
 ```
-curl -XPOST http://ip:port/mailboxIndex?task=reIndex
+curl -XPOST http://ip:port/mailboxes?task=reIndex
 ```
 
 Will schedule a task for reIndexing all the mails stored on this James server.
@@ -2160,10 +2160,10 @@ concurrent changes done during the reIndexing might be ignored.
 ### ReIndexing a user mails
 
 ```
-curl -XPOST http://ip:port/mailboxIndex/users/bob@domain.com?task=reIndex
+curl -XPOST http://ip:port/mailboxes?task=reIndex,user=bob%40domain.com
 ```
 
-Will schedule a task for reIndexing all the mails in "bob@domain.com" mailboxes.
+Will schedule a task for reIndexing all the mails in "bob@domain.com" mailboxes (encoded
above).
 
 The response to that request will be the scheduled `taskId` :
 
@@ -2204,7 +2204,7 @@ concurrent changes done during the reIndexing might be ignored.
 ### ReIndexing a mailbox mails
 
 ```
-curl -XPOST http://ip:port/mailboxIndex/mailboxes/{mailboxId}?task=reIndex
+curl -XPOST http://ip:port/mailboxes/{mailboxId}?task=reIndex
 ```
 
 Will schedule a task for reIndexing all the mails in one mailbox.
@@ -2234,7 +2234,7 @@ The scheduled task will have the following type `mailboxReIndexing`
and the foll
 
 ```
 {
-  "mailboxPath":"#private:bob@domain.com:INBOX",
+  "mailboxId":"{mailboxId}",
   "successfullyReprocessMailCount":18,
   "failedReprocessedMailCount": 1
 }
@@ -2250,7 +2250,7 @@ concurrent changes done during the reIndexing might be ignored.
 ### ReIndexing a single mail
 
 ```
-curl -XPOST http://ip:port/mailboxIndex/mailboxes/{mailboxId}/uid/36?task=reIndex
+curl -XPOST http://ip:port/mailboxes/{mailboxId}/uid/36?task=reIndex
 ```
 
 Will schedule a task for reIndexing a single email.
@@ -2280,7 +2280,7 @@ The scheduled task will have the following type `messageReIndexing`
and the foll
 
 ```
 {
-  "mailboxPath":"#private:bob@domain.com:INBOX",
+  "mailboxId":"{mailboxId}",
   "uid":18
 }
 ```
@@ -2292,7 +2292,7 @@ Warning: Canceling this task should be considered unsafe as it will
leave the cu
 ### ReIndexing a single mail by messageId
 
 ```
-curl -XPOST http://ip:port/mailboxIndex/messages/{messageId}?task=reIndex
+curl -XPOST http://ip:port/messages/{messageId}?task=reIndex
 ```
 
 Will schedule a task for reIndexing a single email in all the mailboxes containing it.


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