You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by hq...@apache.org on 2026/09/18 07:13:23 UTC

(james-project) branch master updated (0428a28c13 -> e3957d0e1a)

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

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


    from 0428a28c13 [BUILD] S3: Reuse driver accross tests
     new 7051455daa [BUILD] Webadmin Integration test: move tests as immutable when possible
     new 021fd37262 [BUILD] Webadmin integration tests: improve PG lifecycle
     new 9316b63a2b [BUILD] Webadmin integration tests: polling for vault tests
     new e3957d0e1a [BUILD] Fix typo

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ...rTaskSerializationIntegrationImmutableTest.java | 200 +++++++++++++++
 ...dminServerTaskSerializationIntegrationTest.java | 201 +--------------
 .../postgres-webadmin-integration-test/pom.xml     |   4 +
 ...PostgresDeletedMessageVaultIntegrationTest.java |  18 ++
 .../WebAdminServerIntegrationImmutableTest.java    | 179 +++++++++++++-
 .../integration/WebAdminServerIntegrationTest.java | 272 ---------------------
 .../vault/DeletedMessageVaultIntegrationTest.java  |  18 +-
 7 files changed, 413 insertions(+), 479 deletions(-)


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


(james-project) 01/04: [BUILD] Webadmin Integration test: move tests as immutable when possible

Posted by hq...@apache.org.
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 <bt...@linagora.com>
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\": \"bob@domain.tld\",\n" +
+                "  \"textSignature\": \"create textSignature1\",\n" +
+                "  \"htmlSignature\": \"create htmlSignature1\",\n" +
+                "  \"sortOrder\": 99,\n" +
+                "  \"bcc\": [\n" +
+                "    {\n" +
+                "      \"name\": \"create bcc 1\",\n" +
+                "      \"email\": \"create_boss_bcc_1@domain.tld\"\n" +
+                "    }\n" +
+                "  ],\n" +
+                "  \"replyTo\": [\n" +
+                "    {\n" +
+                "      \"name\": \"create replyTo 1\",\n" +
+                "      \"email\": \"create_boss1@domain.tld\"\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\": \"bob@domain.tld\",\n" +
+                "  \"textSignature\": \"create textSignature1\",\n" +
+                "  \"htmlSignature\": \"create htmlSignature1\",\n" +
+                "  \"sortOrder\": 99,\n" +
+                "  \"bcc\": [\n" +
+                "    {\n" +
+                "      \"name\": \"create bcc 1\",\n" +
+                "      \"email\": \"create_boss_bcc_1@domain.tld\"\n" +
+                "    }\n" +
+                "  ],\n" +
+                "  \"replyTo\": [\n" +
+                "    {\n" +
+                "      \"name\": \"create replyTo 1\",\n" +
+                "      \"email\": \"create_boss1@domain.tld\"\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\": \"bob@domain.tld\",\n" +
-                "  \"textSignature\": \"create textSignature1\",\n" +
-                "  \"htmlSignature\": \"create htmlSignature1\",\n" +
-                "  \"sortOrder\": 99,\n" +
-                "  \"bcc\": [\n" +
-                "    {\n" +
-                "      \"name\": \"create bcc 1\",\n" +
-                "      \"email\": \"create_boss_bcc_1@domain.tld\"\n" +
-                "    }\n" +
-                "  ],\n" +
-                "  \"replyTo\": [\n" +
-                "    {\n" +
-                "      \"name\": \"create replyTo 1\",\n" +
-                "      \"email\": \"create_boss1@domain.tld\"\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\": \"bob@domain.tld\",\n" +
-                "  \"textSignature\": \"create textSignature1\",\n" +
-                "  \"htmlSignature\": \"create htmlSignature1\",\n" +
-                "  \"sortOrder\": 99,\n" +
-                "  \"bcc\": [\n" +
-                "    {\n" +
-                "      \"name\": \"create bcc 1\",\n" +
-                "      \"email\": \"create_boss_bcc_1@domain.tld\"\n" +
-                "    }\n" +
-                "  ],\n" +
-                "  \"replyTo\": [\n" +
-                "    {\n" +
-                "      \"name\": \"create replyTo 1\",\n" +
-                "      \"email\": \"create_boss1@domain.tld\"\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: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


(james-project) 03/04: [BUILD] Webadmin integration tests: polling for vault tests

Posted by hq...@apache.org.
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 9316b63a2b15e14128de9db3d1f81c5939ed5e29
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Thu Sep 17 14:46:35 2026 +0200

    [BUILD] Webadmin integration tests: polling for vault tests
---
 .../vault/DeletedMessageVaultIntegrationTest.java      | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/vault/DeletedMessageVaultIntegrationTest.java b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/vault/DeletedMessageVaultIntegrationTest.java
index 3e85e7f949..6a0907357a 100644
--- a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/vault/DeletedMessageVaultIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/vault/DeletedMessageVaultIntegrationTest.java
@@ -43,7 +43,6 @@ import static org.apache.james.webadmin.integration.vault.DeletedMessagesVaultRe
 import static org.apache.james.webadmin.integration.vault.DeletedMessagesVaultRequests.purgeVault;
 import static org.apache.james.webadmin.integration.vault.DeletedMessagesVaultRequests.restoreMessagesForUserWithQuery;
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.awaitility.Durations.FIVE_SECONDS;
 import static org.awaitility.Durations.TWO_MINUTES;
 import static org.hamcrest.Matchers.notNullValue;
 
@@ -80,6 +79,7 @@ import org.apache.james.webadmin.WebAdminUtils;
 import org.apache.james.webadmin.integration.probe.DeletedMessageVaultProbe;
 import org.awaitility.Awaitility;
 import org.awaitility.core.ConditionFactory;
+import org.awaitility.core.ConditionTimeoutException;
 import org.hamcrest.Matchers;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
@@ -133,6 +133,11 @@ public abstract class DeletedMessageVaultIntegrationTest {
     private static final String PASSWORD = "password";
     private static final String BOB_PASSWORD = "bobPassword";
     private static final ConditionFactory WAIT_TWO_MINUTES = calmlyAwait.atMost(TWO_MINUTES);
+    private static final ConditionFactory VAULT_GRACE_PERIOD = Awaitility.with()
+        .pollDelay(Duration.ZERO)
+        .pollInterval(Duration.ofMillis(500))
+        .await()
+        .atMost(Duration.ofSeconds(5));
     private static final String SUBJECT = "This mail will be restored from the vault!!";
     private static final String MAILBOX_NAME = "toBeDeleted";
     private static final String OWNER_ONLY_MAILBOX_NAME = "ownerOnly";
@@ -154,6 +159,7 @@ public abstract class DeletedMessageVaultIntegrationTest {
     private MailboxId otherMailboxId;
     private MailboxId ownerOnlyMailboxId;
     private MailboxProbeImpl mailboxProbe;
+    private GuiceJamesServer jmapServer;
 
     private UserCredential homerCredential;
     private UserCredential bartCredential;
@@ -161,6 +167,7 @@ public abstract class DeletedMessageVaultIntegrationTest {
 
     @BeforeEach
     void setup(GuiceJamesServer jmapServer) throws Throwable {
+        this.jmapServer = jmapServer;
         mailboxProbe = jmapServer.getProbe(MailboxProbeImpl.class);
         DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class);
 
@@ -341,7 +348,7 @@ public abstract class DeletedMessageVaultIntegrationTest {
         restoreMessagesForUserWithQuery(webAdminApi, HOMER, query);
 
 
-        Thread.sleep(FIVE_SECONDS.toMillis());
+        Thread.sleep(Duration.ofSeconds(2).toMillis());
 
         // No additional had been restored for Bart as the vault is empty
         assertThat(listMessageIdsForAccount(homerCredential).size())
@@ -1206,12 +1213,13 @@ public abstract class DeletedMessageVaultIntegrationTest {
     }
 
     private void homerDeletesMessages(List<String> idsToDestroy) {
+        int vaultSizeBefore = listMessagesOfHomerFromVault(jmapServer).size();
         deleteMessages(homerCredential, idsToDestroy);
         // Grace period for the vault
         try {
-            Thread.sleep(1000);
-        } catch (InterruptedException e) {
-            throw new RuntimeException(e);
+            VAULT_GRACE_PERIOD.until(() -> listMessagesOfHomerFromVault(jmapServer).size() >= vaultSizeBefore + idsToDestroy.size());
+        } catch (ConditionTimeoutException e) {
+            // Grace period elapsed, callers assert the expected vault content
         }
     }
 


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


(james-project) 04/04: [BUILD] Fix typo

Posted by hq...@apache.org.
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 e3957d0e1a4f50d88fee03698ce427e9e8d7c84d
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Thu Sep 17 16:17:43 2026 +0200

    [BUILD] Fix typo
---
 .../vault/RabbitMQPostgresDeletedMessageVaultIntegrationTest.java        | 1 +
 1 file changed, 1 insertion(+)

diff --git a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/vault/RabbitMQPostgresDeletedMessageVaultIntegrationTest.java b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/vault/RabbitMQPostgresDeletedMessageVaultIntegrationTest.java
index 9256f56b1b..3603f82a51 100644
--- a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/vault/RabbitMQPostgresDeletedMessageVaultIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/vault/RabbitMQPostgresDeletedMessageVaultIntegrationTest.java
@@ -52,6 +52,7 @@ class RabbitMQPostgresDeletedMessageVaultIntegrationTest extends DeletedMessageV
                 .orElse(ConditionEvaluationResult.enabled("Basic vault test"));
         }
     }
+
     @RegisterExtension
     static RabbitMQExtension rabbitMQExtension = new RabbitMQExtension();
 


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


(james-project) 02/04: [BUILD] Webadmin integration tests: improve PG lifecycle

Posted by hq...@apache.org.
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 021fd372629ade2a277e1e7ead00fa2c78d84ada
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Thu Sep 17 14:45:19 2026 +0200

    [BUILD] Webadmin integration tests: improve PG lifecycle
---
 .../postgres-webadmin-integration-test/pom.xml          |  4 ++++
 ...bitMQPostgresDeletedMessageVaultIntegrationTest.java | 17 +++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/pom.xml b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/pom.xml
index 7adc5557bb..c39f288fbd 100644
--- a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/pom.xml
+++ b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/pom.xml
@@ -111,7 +111,11 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
+                    <argLine>-Djava.library.path=
+                        -javaagent:"${settings.localRepository}"/org/jacoco/org.jacoco.agent/${jacoco-maven-plugin.version}/org.jacoco.agent-${jacoco-maven-plugin.version}-runtime.jar=destfile=${basedir}/target/jacoco.exec
+                        -Xms1024m -Xmx4096m</argLine>
                     <reuseForks>true</reuseForks>
+                    <forkCount>2</forkCount>
                     <forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
                 </configuration>
             </plugin>
diff --git a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/vault/RabbitMQPostgresDeletedMessageVaultIntegrationTest.java b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/vault/RabbitMQPostgresDeletedMessageVaultIntegrationTest.java
index 11cd50c202..9256f56b1b 100644
--- a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/vault/RabbitMQPostgresDeletedMessageVaultIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/vault/RabbitMQPostgresDeletedMessageVaultIntegrationTest.java
@@ -32,9 +32,26 @@ import org.apache.james.modules.TestJMAPServerModule;
 import org.apache.james.modules.blobstore.BlobStoreConfiguration;
 import org.apache.james.vault.VaultConfiguration;
 import org.apache.james.webadmin.integration.probe.DeletedMessageVaultProbeModule;
+import org.junit.jupiter.api.extension.ConditionEvaluationResult;
+import org.junit.jupiter.api.extension.ExecutionCondition;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.ExtensionContext;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
+// The full contract is covered by PostgresDeletedMessageVaultIntegrationTest: only check the vault works with the RabbitMQ event bus
+@ExtendWith(RabbitMQPostgresDeletedMessageVaultIntegrationTest.BasicTestOnly.class)
 class RabbitMQPostgresDeletedMessageVaultIntegrationTest extends DeletedMessageVaultIntegrationTest {
+    static class BasicTestOnly implements ExecutionCondition {
+        private static final String BASIC_TEST = "vaultEndpointShouldRestoreJmapDeletedEmail";
+
+        @Override
+        public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
+            return context.getTestMethod()
+                .filter(method -> !method.getName().equals(BASIC_TEST))
+                .map(method -> ConditionEvaluationResult.disabled("Covered by PostgresDeletedMessageVaultIntegrationTest"))
+                .orElse(ConditionEvaluationResult.enabled("Basic vault test"));
+        }
+    }
     @RegisterExtension
     static RabbitMQExtension rabbitMQExtension = new RabbitMQExtension();
 


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