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

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

commit 7051455daae1d0a573713a714a7f87cb4594af0e
Author: Benoit TELLIER <[email protected]>
AuthorDate: Thu Sep 17 14:43:58 2026 +0200

    [BUILD] Webadmin Integration test: move tests as immutable when possible
---
 ...rTaskSerializationIntegrationImmutableTest.java | 200 +++++++++++++++
 ...dminServerTaskSerializationIntegrationTest.java | 201 +--------------
 .../WebAdminServerIntegrationImmutableTest.java    | 179 +++++++++++++-
 .../integration/WebAdminServerIntegrationTest.java | 272 ---------------------
 4 files changed, 378 insertions(+), 474 deletions(-)

diff --git 
a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQWebAdminServerTaskSerializationIntegrationImmutableTest.java
 
b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQWebAdminServerTaskSerializationIntegrationImmutableTest.java
index 235ab471ac..81e38b17a6 100644
--- 
a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQWebAdminServerTaskSerializationIntegrationImmutableTest.java
+++ 
b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQWebAdminServerTaskSerializationIntegrationImmutableTest.java
@@ -25,6 +25,7 @@ import static 
org.apache.james.JamesServerExtension.Lifecycle.PER_CLASS;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.Matchers.empty;
 import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.nullValue;
 import static org.hamcrest.collection.IsMapWithSize.anEmptyMap;
 
 import org.apache.james.CassandraExtension;
@@ -42,6 +43,7 @@ import org.apache.james.modules.AwsS3BlobStoreExtension;
 import org.apache.james.modules.RabbitMQExtension;
 import org.apache.james.modules.blobstore.BlobStoreConfiguration;
 import org.apache.james.probe.DataProbe;
+import org.apache.james.task.TaskManager;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.vault.VaultConfiguration;
@@ -331,4 +333,202 @@ class 
RabbitMQWebAdminServerTaskSerializationIntegrationImmutableTest {
             .body("additionalInformation.processedTaskCount", is(0))
             .body("additionalInformation.removedTaskCount", is(0));
     }
+
+    @Test
+    void deleteMailsFromMailQueueShouldCompleteWhenSenderIsValid() {
+        String firstMailQueue = with()
+                .basePath(MailQueueRoutes.BASE_URL)
+            .get()
+            .then()
+                .statusCode(HttpStatus.OK_200)
+                .contentType(ContentType.JSON)
+                .extract()
+                .body()
+                .jsonPath()
+                .getString("[0]");
+
+        String taskId = with()
+                .basePath(MailQueueRoutes.BASE_URL)
+                .param("sender", USERNAME)
+            .delete(firstMailQueue + "/mails")
+                .jsonPath()
+                .getString("taskId");
+
+        given()
+                .basePath(TasksRoutes.BASE)
+            .when()
+                .get(taskId + "/await")
+            .then()
+                .body("status", is("completed"))
+                .body("taskId", is(notNullValue()))
+                .body("type", is("delete-mails-from-mail-queue"))
+                .body("additionalInformation.mailQueueName", 
is(notNullValue()))
+                .body("additionalInformation.remainingCount", is(0))
+                .body("additionalInformation.initialCount", is(0))
+                .body("additionalInformation.sender", is(USERNAME))
+                .body("additionalInformation.name", is(nullValue()))
+                .body("additionalInformation.recipient", is(nullValue()))
+        ;
+    }
+
+    @Test
+    void reprocessingAllMailsShouldComplete() {
+        String escapedRepositoryPath = with()
+                .basePath(MailRepositoriesRoutes.MAIL_REPOSITORIES)
+            .get()
+            .then()
+                .statusCode(HttpStatus.OK_200)
+                .contentType(ContentType.JSON)
+                .extract()
+                .body()
+                .jsonPath()
+                .getString("[0].path");
+
+        String taskId = with()
+                .basePath(MailRepositoriesRoutes.MAIL_REPOSITORIES)
+                .param("action", "reprocess")
+            .patch(escapedRepositoryPath + "/mails")
+            .then()
+                .statusCode(HttpStatus.CREATED_201)
+                .extract()
+                .jsonPath()
+                .getString("taskId");
+
+        given()
+            .basePath(TasksRoutes.BASE)
+        .when()
+            .get(taskId + "/await")
+        .then()
+            .body("status", is("completed"))
+            .body("taskId", is(notNullValue()))
+            .body("type", is("reprocessing-all"))
+            .body("additionalInformation.repositoryPath", is(notNullValue()))
+            .body("additionalInformation.targetQueue", is(notNullValue()))
+            .body("additionalInformation.targetProcessor", is(nullValue()))
+            .body("additionalInformation.initialCount", is(0))
+            .body("additionalInformation.remainingCount", is(0));
+    }
+
+    @Test
+    void userReindexingShouldComplete() {
+        String taskId = with()
+                .queryParam("task", "reIndex")
+            .post("users/" + USERNAME + "/mailboxes")
+                .jsonPath()
+                .get("taskId");
+
+        given()
+            .basePath(TasksRoutes.BASE)
+        .when()
+            .get(taskId + "/await")
+        .then()
+            .body("status", is("completed"))
+            .body("taskId", is(Matchers.notNullValue()))
+            .body("type", is("user-reindexing"))
+            .body("additionalInformation.successfullyReprocessedMailCount", 
is(0))
+            .body("additionalInformation.failedReprocessedMailCount", is(0))
+            .body("additionalInformation.username", is(USERNAME))
+            .body("additionalInformation.messageFailures", is(anEmptyMap()));
+    }
+
+    @Test
+    void errorRecoveryIndexationShouldCompleteWhenNoMail() {
+        String taskId = with()
+            .post("/mailboxes?task=reIndex")
+            .jsonPath()
+            .get("taskId");
+
+        with()
+            .basePath(TasksRoutes.BASE)
+            .get(taskId + "/await");
+
+        String fixingTaskId = with()
+            .queryParam("reIndexFailedMessagesOf", taskId)
+            .queryParam("task", "reIndex")
+        .post("/mailboxes")
+        .then()
+            .statusCode(HttpStatus.CREATED_201)
+            .extract()
+            .jsonPath()
+            .get("taskId");
+
+        given()
+            .basePath(TasksRoutes.BASE)
+        .when()
+            .get(fixingTaskId + "/await")
+        .then()
+            .body("status", is("completed"))
+            .body("taskId", is(Matchers.notNullValue()))
+            .body("type", is("error-recovery-indexation"))
+            .body("additionalInformation.successfullyReprocessedMailCount", 
is(0))
+            .body("additionalInformation.failedReprocessedMailCount", is(0))
+            .body("additionalInformation.messageFailures", is(anEmptyMap()));
+    }
+
+    @Test
+    void eventDeadLettersRedeliverShouldComplete() {
+        String taskId = with()
+            .queryParam("action", "reDeliver")
+        .post("/events/deadLetter")
+            .then()
+            .statusCode(HttpStatus.CREATED_201)
+            .extract()
+            .jsonPath()
+            .get("taskId");
+
+        given()
+            .basePath(TasksRoutes.BASE)
+        .when()
+            .get(taskId + "/await")
+        .then()
+            .body("status", is("completed"))
+            .body("taskId", is(Matchers.notNullValue()))
+            .body("type", is("event-dead-letters-redeliver-all"))
+            .body("additionalInformation.successfulRedeliveriesCount", is(0))
+            .body("additionalInformation.failedRedeliveriesCount", is(0));
+
+    }
+
+    @Test
+    void cleanUploadRepositoryShouldComplete() throws Exception {
+        String taskId = given()
+            .queryParam("scope", "expired")
+            .delete("jmap/uploads")
+            .jsonPath()
+            .getString("taskId");
+
+        with()
+            .basePath(TasksRoutes.BASE)
+        .when()
+            .get(taskId + "/await")
+            .then()
+            .body("status", is(TaskManager.Status.COMPLETED.getValue()))
+            .body("taskId", is(taskId))
+            .body("type", is("UploadRepositoryCleanupTask"))
+            .body("additionalInformation.scope", is("expired"));
+    }
+
+    @Test
+    void blobGCTaskShouldComplete() {
+        String taskId = given()
+            .queryParam("scope", "unreferenced")
+            .delete("blobs")
+            .jsonPath()
+            .getString("taskId");
+
+        with()
+            .basePath(TasksRoutes.BASE)
+        .when()
+            .get(taskId + "/await")
+        .then()
+            .body("status", is(TaskManager.Status.COMPLETED.getValue()))
+            .body("taskId", is(taskId))
+            .body("type", is("BlobGCTask"))
+            .body("additionalInformation.referenceSourceCount", is(0))
+            .body("additionalInformation.blobCount", is(0))
+            .body("additionalInformation.gcedBlobCount", is(0))
+            .body("additionalInformation.errorCount", is(0))
+            .body("additionalInformation.bloomFilterExpectedBlobCount", 
is(1000000))
+            .body("additionalInformation.bloomFilterAssociatedProbability", 
is(0.01F));
+    }
 }
diff --git 
a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQWebAdminServerTaskSerializationIntegrationTest.java
 
b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQWebAdminServerTaskSerializationIntegrationTest.java
index e47f6e1826..bebdea9054 100644
--- 
a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQWebAdminServerTaskSerializationIntegrationTest.java
+++ 
b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQWebAdminServerTaskSerializationIntegrationTest.java
@@ -86,7 +86,6 @@ import org.apache.james.vault.VaultConfiguration;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.apache.james.webadmin.data.jmap.RunRulesOnMailboxTask;
 import org.apache.james.webadmin.routes.CassandraMailboxMergingRoutes;
-import org.apache.james.webadmin.routes.MailQueueRoutes;
 import org.apache.james.webadmin.routes.MailRepositoriesRoutes;
 import org.apache.james.webadmin.routes.TasksRoutes;
 import org.apache.james.webadmin.service.ClearMailboxContentTask;
@@ -116,7 +115,7 @@ class 
RabbitMQWebAdminServerTaskSerializationIntegrationTest {
         }
     }
 
-    private static final int TASK_COUNT = 60;
+    private static final int TASK_COUNT = 15;
     private static final int MESSAGES_PER_ORIGIN_MAILBOX = 20;
 
     @RegisterExtension
@@ -327,81 +326,6 @@ class 
RabbitMQWebAdminServerTaskSerializationIntegrationTest {
             .body("additionalInformation.failedMessageCount", is(0));
     }
 
-    @Test
-    void deleteMailsFromMailQueueShouldCompleteWhenSenderIsValid() {
-        String firstMailQueue = with()
-                .basePath(MailQueueRoutes.BASE_URL)
-            .get()
-            .then()
-                .statusCode(HttpStatus.OK_200)
-                .contentType(ContentType.JSON)
-                .extract()
-                .body()
-                .jsonPath()
-                .getString("[0]");
-
-        String taskId = with()
-                .basePath(MailQueueRoutes.BASE_URL)
-                .param("sender", USERNAME)
-            .delete(firstMailQueue + "/mails")
-                .jsonPath()
-                .getString("taskId");
-
-        given()
-                .basePath(TasksRoutes.BASE)
-            .when()
-                .get(taskId + "/await")
-            .then()
-                .body("status", is("completed"))
-                .body("taskId", is(notNullValue()))
-                .body("type", is("delete-mails-from-mail-queue"))
-                .body("additionalInformation.mailQueueName", 
is(notNullValue()))
-                .body("additionalInformation.remainingCount", is(0))
-                .body("additionalInformation.initialCount", is(0))
-                .body("additionalInformation.sender", is(USERNAME))
-                .body("additionalInformation.name", is(nullValue()))
-                .body("additionalInformation.recipient", is(nullValue()))
-        ;
-    }
-
-    @Test
-    void reprocessingAllMailsShouldComplete() {
-        String escapedRepositoryPath = with()
-                .basePath(MailRepositoriesRoutes.MAIL_REPOSITORIES)
-            .get()
-            .then()
-                .statusCode(HttpStatus.OK_200)
-                .contentType(ContentType.JSON)
-                .extract()
-                .body()
-                .jsonPath()
-                .getString("[0].path");
-
-        String taskId = with()
-                .basePath(MailRepositoriesRoutes.MAIL_REPOSITORIES)
-                .param("action", "reprocess")
-            .patch(escapedRepositoryPath + "/mails")
-            .then()
-                .statusCode(HttpStatus.CREATED_201)
-                .extract()
-                .jsonPath()
-                .getString("taskId");
-
-        given()
-            .basePath(TasksRoutes.BASE)
-        .when()
-            .get(taskId + "/await")
-        .then()
-            .body("status", is("completed"))
-            .body("taskId", is(notNullValue()))
-            .body("type", is("reprocessing-all"))
-            .body("additionalInformation.repositoryPath", is(notNullValue()))
-            .body("additionalInformation.targetQueue", is(notNullValue()))
-            .body("additionalInformation.targetProcessor", is(nullValue()))
-            .body("additionalInformation.initialCount", is(0))
-            .body("additionalInformation.remainingCount", is(0));
-    }
-
     @Test
     void reprocessingOneMailShouldCreateATask(GuiceJamesServer 
guiceJamesServer) throws Exception {
         MailRepositoryStore mailRepositoryStore = 
guiceJamesServer.getProbe(MailRepositoryProbeImpl.class).getMailRepositoryStore();
@@ -496,28 +420,6 @@ class 
RabbitMQWebAdminServerTaskSerializationIntegrationTest {
             .body("additionalInformation.messageId", 
is(composedMessageId.getMessageId().serialize()));
     }
 
-    @Test
-    void userReindexingShouldComplete() {
-        String taskId = with()
-                .queryParam("task", "reIndex")
-            .post("users/" + USERNAME + "/mailboxes")
-                .jsonPath()
-                .get("taskId");
-
-        given()
-            .basePath(TasksRoutes.BASE)
-        .when()
-            .get(taskId + "/await")
-        .then()
-            .body("status", is("completed"))
-            .body("taskId", is(Matchers.notNullValue()))
-            .body("type", is("user-reindexing"))
-            .body("additionalInformation.successfullyReprocessedMailCount", 
is(0))
-            .body("additionalInformation.failedReprocessedMailCount", is(0))
-            .body("additionalInformation.username", is(USERNAME))
-            .body("additionalInformation.messageFailures", is(anEmptyMap()));
-    }
-
     @Test
     void deletedMessageVaultRestoreShouldComplete() throws Exception {
         dataProbe.addUser(USERNAME, "password");
@@ -584,64 +486,6 @@ class 
RabbitMQWebAdminServerTaskSerializationIntegrationTest {
             .body("additionalInformation.totalExportedMessages", is(0));
     }
 
-    @Test
-    void errorRecoveryIndexationShouldCompleteWhenNoMail() {
-        String taskId = with()
-            .post("/mailboxes?task=reIndex")
-            .jsonPath()
-            .get("taskId");
-
-        with()
-            .basePath(TasksRoutes.BASE)
-            .get(taskId + "/await");
-
-        String fixingTaskId = with()
-            .queryParam("reIndexFailedMessagesOf", taskId)
-            .queryParam("task", "reIndex")
-        .post("/mailboxes")
-        .then()
-            .statusCode(HttpStatus.CREATED_201)
-            .extract()
-            .jsonPath()
-            .get("taskId");
-
-        given()
-            .basePath(TasksRoutes.BASE)
-        .when()
-            .get(fixingTaskId + "/await")
-        .then()
-            .body("status", is("completed"))
-            .body("taskId", is(Matchers.notNullValue()))
-            .body("type", is("error-recovery-indexation"))
-            .body("additionalInformation.successfullyReprocessedMailCount", 
is(0))
-            .body("additionalInformation.failedReprocessedMailCount", is(0))
-            .body("additionalInformation.messageFailures", is(anEmptyMap()));
-    }
-
-    @Test
-    void eventDeadLettersRedeliverShouldComplete() {
-        String taskId = with()
-            .queryParam("action", "reDeliver")
-        .post("/events/deadLetter")
-            .then()
-            .statusCode(HttpStatus.CREATED_201)
-            .extract()
-            .jsonPath()
-            .get("taskId");
-
-        given()
-            .basePath(TasksRoutes.BASE)
-        .when()
-            .get(taskId + "/await")
-        .then()
-            .body("status", is("completed"))
-            .body("taskId", is(Matchers.notNullValue()))
-            .body("type", is("event-dead-letters-redeliver-all"))
-            .body("additionalInformation.successfulRedeliveriesCount", is(0))
-            .body("additionalInformation.failedRedeliveriesCount", is(0));
-
-    }
-
     @Test
     void eventDeadLettersRedeliverShouldCreateATask(GuiceJamesServer 
guiceJamesServer) {
         Group group = new GenericGroup("a");
@@ -929,49 +773,6 @@ class 
RabbitMQWebAdminServerTaskSerializationIntegrationTest {
                 .containsKeys("taskId", "username"));
     }
 
-    @Test
-    void cleanUploadRepositoryShouldComplete() throws Exception {
-        String taskId = given()
-            .queryParam("scope", "expired")
-            .delete("jmap/uploads")
-            .jsonPath()
-            .getString("taskId");
-
-        with()
-            .basePath(TasksRoutes.BASE)
-        .when()
-            .get(taskId + "/await")
-            .then()
-            .body("status", is(TaskManager.Status.COMPLETED.getValue()))
-            .body("taskId", is(taskId))
-            .body("type", is("UploadRepositoryCleanupTask"))
-            .body("additionalInformation.scope", is("expired"));
-    }
-
-    @Test
-    void blobGCTaskShouldComplete() {
-        String taskId = given()
-            .queryParam("scope", "unreferenced")
-            .delete("blobs")
-            .jsonPath()
-            .getString("taskId");
-
-        with()
-            .basePath(TasksRoutes.BASE)
-        .when()
-            .get(taskId + "/await")
-        .then()
-            .body("status", is(TaskManager.Status.COMPLETED.getValue()))
-            .body("taskId", is(taskId))
-            .body("type", is("BlobGCTask"))
-            .body("additionalInformation.referenceSourceCount", is(0))
-            .body("additionalInformation.blobCount", is(0))
-            .body("additionalInformation.gcedBlobCount", is(0))
-            .body("additionalInformation.errorCount", is(0))
-            .body("additionalInformation.bloomFilterExpectedBlobCount", 
is(1000000))
-            .body("additionalInformation.bloomFilterAssociatedProbability", 
is(0.01F));
-    }
-
     private MailboxAdded createMailboxAdded() {
         String uuid = "6e0dd59d-660e-4d9b-b22f-0354479f47b4";
         return EventFactory.mailboxAdded()
diff --git 
a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationImmutableTest.java
 
b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationImmutableTest.java
index f96f6f1782..6547a40c17 100644
--- 
a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationImmutableTest.java
+++ 
b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationImmutableTest.java
@@ -22,9 +22,16 @@ package org.apache.james.webadmin.integration;
 import static io.restassured.RestAssured.given;
 import static io.restassured.RestAssured.when;
 import static io.restassured.RestAssured.with;
+import static org.apache.james.webadmin.Constants.JSON_CONTENT_TYPE;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.hasSize;
 import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+import java.io.ByteArrayOutputStream;
+import java.util.zip.ZipOutputStream;
 
 import org.apache.james.GuiceJamesServer;
 import org.apache.james.probe.DataProbe;
@@ -44,10 +51,15 @@ import io.restassured.RestAssured;
 public abstract class WebAdminServerIntegrationImmutableTest {
     private static final String DOMAIN = "domain";
     protected static final String USERNAME = "username@" + DOMAIN;
+    private static final String JMAP_USER = "jmap@" + DOMAIN;
+    private static final String EXPORT_USER = "export@" + DOMAIN;
+    private static final String RESTORE_USER = "restore@" + DOMAIN;
+
+    private static DataProbe dataProbe;
 
     @BeforeAll
     static void setUp(GuiceJamesServer guiceJamesServer) throws Exception {
-        DataProbe dataProbe = guiceJamesServer.getProbe(DataProbeImpl.class);
+        dataProbe = guiceJamesServer.getProbe(DataProbeImpl.class);
         dataProbe.addDomain(DOMAIN);
         WebAdminGuiceProbe webAdminGuiceProbe = 
guiceJamesServer.getProbe(WebAdminGuiceProbe.class);
 
@@ -161,4 +173,167 @@ public abstract class 
WebAdminServerIntegrationImmutableTest {
             .body("status", is("completed"))
             .body("type", is("PopulateFilteringProjectionTask"));
     }
-}
\ No newline at end of file
+
+    @Test
+    void getUserDefaultIdentityShouldReturnNotFoundByDefault() {
+        when()
+            .get(String.format("/users/%s/identities?default=true", USERNAME))
+        .then()
+            .statusCode(HttpStatus.NOT_FOUND_404)
+            .contentType(JSON_CONTENT_TYPE)
+            .body("message", is("Default identity can not be found"));
+    }
+
+    @Test
+    void getIdentitiesOfInvalidUserShouldReturnBadRequest() {
+        given()
+            .urlEncodingEnabled(true)
+            .get(String.format("/users/%s/identities?default=true", "John 
Doe"))
+        .then()
+            .statusCode(HttpStatus.BAD_REQUEST_400);
+    }
+
+    @Test
+    void createIdentitiesForInvalidUserShouldReturnBadRequest() {
+        given()
+            .urlEncodingEnabled(true)
+            .body("{\n" +
+                "  \"name\": \"create name 1\",\n" +
+                "  \"email\": \"[email protected]\",\n" +
+                "  \"textSignature\": \"create textSignature1\",\n" +
+                "  \"htmlSignature\": \"create htmlSignature1\",\n" +
+                "  \"sortOrder\": 99,\n" +
+                "  \"bcc\": [\n" +
+                "    {\n" +
+                "      \"name\": \"create bcc 1\",\n" +
+                "      \"email\": \"[email protected]\"\n" +
+                "    }\n" +
+                "  ],\n" +
+                "  \"replyTo\": [\n" +
+                "    {\n" +
+                "      \"name\": \"create replyTo 1\",\n" +
+                "      \"email\": \"[email protected]\"\n" +
+                "    }\n" +
+                "  ]\n" +
+                "}")
+            .post(String.format("/users/%s/identities", "John Doe"))
+        .then()
+            .statusCode(HttpStatus.BAD_REQUEST_400);
+    }
+
+    @Test
+    void updateIdentitiesForInvalidUserShouldReturnBadRequest() {
+        given()
+            .urlEncodingEnabled(true)
+            .body("{\n" +
+                "  \"name\": \"create name 1\",\n" +
+                "  \"email\": \"[email protected]\",\n" +
+                "  \"textSignature\": \"create textSignature1\",\n" +
+                "  \"htmlSignature\": \"create htmlSignature1\",\n" +
+                "  \"sortOrder\": 99,\n" +
+                "  \"bcc\": [\n" +
+                "    {\n" +
+                "      \"name\": \"create bcc 1\",\n" +
+                "      \"email\": \"[email protected]\"\n" +
+                "    }\n" +
+                "  ],\n" +
+                "  \"replyTo\": [\n" +
+                "    {\n" +
+                "      \"name\": \"create replyTo 1\",\n" +
+                "      \"email\": \"[email protected]\"\n" +
+                "    }\n" +
+                "  ]\n" +
+                "}")
+            
.put(String.format("/users/%s/identities/b1c924a3-5b86-44fa-a036-77825ec0e3e6", 
"John Doe"))
+        .then()
+            .statusCode(HttpStatus.BAD_REQUEST_400);
+    }
+
+    @Test
+    void jmapUserTasksShouldBeExposed() throws Exception {
+        dataProbe.addUser(JMAP_USER, "anyPassword");
+
+        String taskId = with()
+            .queryParam("task", "recomputeFastViewProjectionItems")
+            .post("/users/" + JMAP_USER + "/mailboxes")
+            .jsonPath()
+            .get("taskId");
+
+        given()
+            .basePath(TasksRoutes.BASE)
+        .when()
+            .get(taskId + "/await")
+        .then()
+            .body("status", is("completed"))
+            .body("type", is("RecomputeUserFastViewProjectionItemsTask"));
+    }
+
+    @Test
+    void mailboxesExportTasksShouldBeExposed() throws Exception {
+        dataProbe.addUser(EXPORT_USER, "anyPassword");
+
+        String taskId = with()
+            .queryParam("task", "export")
+            .post("/users/" + EXPORT_USER + "/mailboxes")
+            .jsonPath()
+            .get("taskId");
+
+        given()
+            .basePath(TasksRoutes.BASE)
+        .when()
+            .get(taskId + "/await")
+        .then()
+            .body("status", is("completed"))
+            .body("type", is("MailboxesExportTask"));
+    }
+
+    @Test
+    void mailboxesRestoreTasksShouldBeExposed() throws Exception {
+        dataProbe.addUser(RESTORE_USER, "anyPassword");
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (ZipOutputStream zos = new ZipOutputStream(baos)) {
+            // empty zip
+        }
+        byte[] emptyZip = baos.toByteArray();
+
+        String taskId = with()
+            .queryParam("task", "restore")
+            .body(emptyZip)
+            .post("/users/" + RESTORE_USER + "/mailboxes")
+            .jsonPath()
+            .get("taskId");
+
+        given()
+            .basePath(TasksRoutes.BASE)
+        .when()
+            .get(taskId + "/await")
+        .then()
+            .body("status", is("completed"))
+            .body("type", is("MailboxesRestoreTask"));
+    }
+
+    @Test
+    void createMissParentsTasksShouldBeExposed() {
+        String taskId = with()
+            .queryParam("task", "createMissingParents")
+            .post("/mailboxes")
+            .jsonPath()
+            .get("taskId");
+
+        given()
+            .basePath(TasksRoutes.BASE)
+            .when()
+            .get(taskId + "/await")
+            .then()
+            .body("status", is("completed"))
+            .body("type", is("CreateMissingParentsTask"))
+            .body("additionalInformation.created", hasSize(0))
+            .body("additionalInformation.totalCreated", is(0))
+            .body("additionalInformation.failures", empty())
+            .body("additionalInformation.totalFailure", is(0))
+            .body("startedDate", is(notNullValue()))
+            .body("submitDate", is(notNullValue()))
+            .body("completedDate", is(notNullValue()));
+    }
+}
diff --git 
a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
 
b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
index 144db2c2dd..f222fbde98 100644
--- 
a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
+++ 
b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
@@ -26,17 +26,12 @@ 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.both;
-import static org.hamcrest.Matchers.containsInAnyOrder;
-import static org.hamcrest.Matchers.empty;
 import static org.hamcrest.Matchers.hasEntry;
 import static org.hamcrest.Matchers.hasItems;
 import static org.hamcrest.Matchers.hasSize;
 import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
 
-import java.io.ByteArrayOutputStream;
 import java.util.List;
-import java.util.zip.ZipOutputStream;
 
 import org.apache.james.GuiceJamesServer;
 import org.apache.james.modules.MailboxProbeImpl;
@@ -49,9 +44,6 @@ import org.apache.james.webadmin.routes.AliasRoutes;
 import org.apache.james.webadmin.routes.DomainsRoutes;
 import org.apache.james.webadmin.routes.ForwardRoutes;
 import org.apache.james.webadmin.routes.GroupsRoutes;
-import org.apache.james.webadmin.routes.HealthCheckRoutes;
-import org.apache.james.webadmin.routes.MailQueueRoutes;
-import org.apache.james.webadmin.routes.MailRepositoriesRoutes;
 import org.apache.james.webadmin.routes.TasksRoutes;
 import org.apache.james.webadmin.routes.UserMailboxesRoutes;
 import org.apache.james.webadmin.routes.UserRoutes;
@@ -101,80 +93,6 @@ public abstract class WebAdminServerIntegrationTest {
         assertThat(dataProbe.listDomains()).contains(DOMAIN);
     }
 
-
-    // Immutable
-    @Test
-    void mailQueueRoutesShouldBeExposed() {
-        when()
-            .get(MailQueueRoutes.BASE_URL)
-        .then()
-            .statusCode(HttpStatus.OK_200)
-            .body("", containsInAnyOrder("spool", "outgoing"));
-    }
-
-
-    // Immutable
-    @Test
-    void metricsRoutesShouldBeExposed() {
-        String body = when()
-                .get("/metrics")
-            .then()
-                .statusCode(HttpStatus.OK_200)
-                .extract()
-                .body()
-                .asString();
-
-        assertThat(body).contains("outgoingMails_total 0.0");
-    }
-
-
-    // Immutable
-    @Test
-    void healthCheckShouldReturn200WhenCalledRepeatedly() {
-        given().get(HealthCheckRoutes.HEALTHCHECK);
-        given().get(HealthCheckRoutes.HEALTHCHECK);
-        given().get(HealthCheckRoutes.HEALTHCHECK);
-        given().get(HealthCheckRoutes.HEALTHCHECK);
-        given().get(HealthCheckRoutes.HEALTHCHECK);
-
-        when()
-            .get(HealthCheckRoutes.HEALTHCHECK)
-        .then()
-            .statusCode(HttpStatus.OK_200);
-    }
-
-    // Immutable
-    @Test
-    void mailRepositoriesRoutesShouldBeExposed() {
-        when()
-            .get(MailRepositoriesRoutes.MAIL_REPOSITORIES)
-        .then()
-            .statusCode(HttpStatus.OK_200)
-            .body("repository", containsInAnyOrder(
-                "var/mail/error",
-                "var/mail/relay-denied",
-                "var/mail/address-error",
-                "var/mail/rrt-error"));
-    }
-
-
-    // Immutable
-    @Test
-    void gettingANonExistingMailRepositoryShouldNotCreateIt() {
-        given()
-            .get(MailRepositoriesRoutes.MAIL_REPOSITORIES + 
"file%3A%2F%2Fvar%2Fmail%2Fcustom");
-
-        when()
-            .get(MailRepositoriesRoutes.MAIL_REPOSITORIES)
-        .then()
-            .statusCode(HttpStatus.OK_200)
-            .body("repository", containsInAnyOrder(
-                "var/mail/error",
-                "var/mail/relay-denied",
-                "var/mail/address-error",
-                "var/mail/rrt-error"));
-    }
-
     @Test
     void deleteShouldRemoveTheGivenDomain() throws Exception {
         when()
@@ -318,196 +236,6 @@ public abstract class WebAdminServerIntegrationTest {
         assertThat(members).containsOnly(USERNAME, USERNAME_2);
     }
 
-    @Test
-    void getUserDefaultIdentityShouldReturnNotFoundByDefault() {
-        when()
-            .get(String.format("/users/%s/identities?default=true", USERNAME))
-        .then()
-            .statusCode(HttpStatus.NOT_FOUND_404)
-            .contentType(JSON_CONTENT_TYPE)
-            .body("message", is("Default identity can not be found"));
-    }
-
-    @Test
-    void getIdentitiesOfInvalidUserShouldReturnBadRequest() {
-        given()
-            .urlEncodingEnabled(true)
-            .get(String.format("/users/%s/identities?default=true", "John 
Doe"))
-        .then()
-            .statusCode(HttpStatus.BAD_REQUEST_400);
-    }
-
-    @Test
-    void createIdentitiesForInvalidUserShouldReturnBadRequest() {
-        given()
-            .urlEncodingEnabled(true)
-            .body("{\n" +
-                "  \"name\": \"create name 1\",\n" +
-                "  \"email\": \"[email protected]\",\n" +
-                "  \"textSignature\": \"create textSignature1\",\n" +
-                "  \"htmlSignature\": \"create htmlSignature1\",\n" +
-                "  \"sortOrder\": 99,\n" +
-                "  \"bcc\": [\n" +
-                "    {\n" +
-                "      \"name\": \"create bcc 1\",\n" +
-                "      \"email\": \"[email protected]\"\n" +
-                "    }\n" +
-                "  ],\n" +
-                "  \"replyTo\": [\n" +
-                "    {\n" +
-                "      \"name\": \"create replyTo 1\",\n" +
-                "      \"email\": \"[email protected]\"\n" +
-                "    }\n" +
-                "  ]\n" +
-                "}")
-            .post(String.format("/users/%s/identities", "John Doe"))
-        .then()
-            .statusCode(HttpStatus.BAD_REQUEST_400);
-    }
-
-    @Test
-    void updateIdentitiesForInvalidUserShouldReturnBadRequest() {
-        given()
-            .urlEncodingEnabled(true)
-            .body("{\n" +
-                "  \"name\": \"create name 1\",\n" +
-                "  \"email\": \"[email protected]\",\n" +
-                "  \"textSignature\": \"create textSignature1\",\n" +
-                "  \"htmlSignature\": \"create htmlSignature1\",\n" +
-                "  \"sortOrder\": 99,\n" +
-                "  \"bcc\": [\n" +
-                "    {\n" +
-                "      \"name\": \"create bcc 1\",\n" +
-                "      \"email\": \"[email protected]\"\n" +
-                "    }\n" +
-                "  ],\n" +
-                "  \"replyTo\": [\n" +
-                "    {\n" +
-                "      \"name\": \"create replyTo 1\",\n" +
-                "      \"email\": \"[email protected]\"\n" +
-                "    }\n" +
-                "  ]\n" +
-                "}")
-            
.put(String.format("/users/%s/identities/b1c924a3-5b86-44fa-a036-77825ec0e3e6", 
"John Doe"))
-        .then()
-            .statusCode(HttpStatus.BAD_REQUEST_400);
-    }
-
-    // Immutable
-    @Test
-    void validateHealthChecksShouldReturnOk() {
-        when()
-            .get(HealthCheckRoutes.HEALTHCHECK)
-        .then()
-            .statusCode(HttpStatus.OK_200);
-    }
-
-    // Immutable
-    @Test
-    void jmapTasksShouldBeExposed() {
-        String taskId = with()
-            .queryParam("task", "recomputeFastViewProjectionItems")
-            .post("/mailboxes")
-            .jsonPath()
-            .get("taskId");
-
-        given()
-            .basePath(TasksRoutes.BASE)
-        .when()
-            .get(taskId + "/await")
-        .then()
-            .body("status", is("completed"))
-            .body("type", is("RecomputeAllFastViewProjectionItemsTask"));
-    }
-
-    @Test
-    void jmapUserTasksShouldBeExposed() throws Exception {
-        dataProbe.addUser(USERNAME, "anyPassword");
-
-        String taskId = with()
-            .queryParam("task", "recomputeFastViewProjectionItems")
-            .post("/users/" + USERNAME + "/mailboxes")
-            .jsonPath()
-            .get("taskId");
-
-        given()
-            .basePath(TasksRoutes.BASE)
-        .when()
-            .get(taskId + "/await")
-        .then()
-            .body("status", is("completed"))
-            .body("type", is("RecomputeUserFastViewProjectionItemsTask"));
-    }
-
-    @Test
-    void mailboxesExportTasksShouldBeExposed() throws Exception {
-        dataProbe.addUser(USERNAME, "anyPassword");
-
-        String taskId = with()
-            .queryParam("task", "export")
-            .post("/users/" + USERNAME + "/mailboxes")
-            .jsonPath()
-            .get("taskId");
-
-        given()
-            .basePath(TasksRoutes.BASE)
-        .when()
-            .get(taskId + "/await")
-        .then()
-            .body("status", is("completed"))
-            .body("type", is("MailboxesExportTask"));
-    }
-
-    @Test
-    void mailboxesRestoreTasksShouldBeExposed() throws Exception {
-        dataProbe.addUser(USERNAME, "anyPassword");
-
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (ZipOutputStream zos = new ZipOutputStream(baos)) {
-            // empty zip
-        }
-        byte[] emptyZip = baos.toByteArray();
-
-        String taskId = with()
-            .queryParam("task", "restore")
-            .body(emptyZip)
-            .post("/users/" + USERNAME + "/mailboxes")
-            .jsonPath()
-            .get("taskId");
-
-        given()
-            .basePath(TasksRoutes.BASE)
-        .when()
-            .get(taskId + "/await")
-        .then()
-            .body("status", is("completed"))
-            .body("type", is("MailboxesRestoreTask"));
-    }
-
-    @Test
-    void createMissParentsTasksShouldBeExposed() {
-        String taskId = with()
-            .queryParam("task", "createMissingParents")
-            .post("/mailboxes")
-            .jsonPath()
-            .get("taskId");
-
-        given()
-            .basePath(TasksRoutes.BASE)
-            .when()
-            .get(taskId + "/await")
-            .then()
-            .body("status", is("completed"))
-            .body("type", is("CreateMissingParentsTask"))
-            .body("additionalInformation.created", hasSize(0))
-            .body("additionalInformation.totalCreated", is(0))
-            .body("additionalInformation.failures", empty())
-            .body("additionalInformation.totalFailure", is(0))
-            .body("startedDate", is(notNullValue()))
-            .body("submitDate", is(notNullValue()))
-            .body("completedDate", is(notNullValue()));
-    }
-
     @Test
     void recomputeQuotaTaskShouldBeExposed() throws Exception {
         dataProbe.addUser(USERNAME, "anyPassword");


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

Reply via email to