This is an automated email from the ASF dual-hosted git repository. chibenwa pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 486dc6516e72daf6ba734f2c0461e8edd86dedff Author: Quan Tran <[email protected]> AuthorDate: Mon Jul 13 22:58:39 2026 +0700 [BUILD] EchoMethodContract: isolate using different users --- .../rfc8621/distributed/DistributedEchoMethodTest.java | 2 +- .../james/jmap/rfc8621/contract/EchoMethodContract.scala | 15 +++++++++++++-- .../james/jmap/rfc8621/memory/MemoryEchoMethodTest.java | 2 +- .../jmap/rfc8621/postgres/PostgresEchoMethodTest.java | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/distributed/DistributedEchoMethodTest.java b/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/distributed/DistributedEchoMethodTest.java index 4f9a3d5ff3..d9d95658c9 100644 --- a/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/distributed/DistributedEchoMethodTest.java +++ b/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/distributed/DistributedEchoMethodTest.java @@ -21,6 +21,6 @@ package org.apache.james.jmap.rfc8621.distributed; import org.apache.james.jmap.rfc8621.contract.EchoMethodContract; -public class DistributedEchoMethodTest extends DistributedBase implements EchoMethodContract { +public class DistributedEchoMethodTest extends PerClassDistributedBase implements EchoMethodContract { } diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EchoMethodContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EchoMethodContract.scala index 5473a1662f..64dd5c2426 100644 --- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EchoMethodContract.scala +++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EchoMethodContract.scala @@ -18,12 +18,15 @@ ****************************************************************/ package org.apache.james.jmap.rfc8621.contract +import java.util.UUID + import io.netty.handler.codec.http.HttpHeaderNames.ACCEPT import io.restassured.RestAssured._ import io.restassured.http.ContentType.JSON import net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson import org.apache.http.HttpStatus.{SC_BAD_REQUEST, SC_OK} import org.apache.james.GuiceJamesServer +import org.apache.james.core.Username import org.apache.james.jmap.core.ResponseObject.SESSION_STATE import org.apache.james.jmap.http.UserCredential import org.apache.james.jmap.rfc8621.contract.EchoMethodContract._ @@ -32,6 +35,10 @@ import org.apache.james.jmap.rfc8621.contract.tags.CategoryTags import org.apache.james.utils.DataProbeImpl import org.junit.jupiter.api.{BeforeEach, Tag, Test} +object EchoMethodContractContext { + val currentUsername: java.util.concurrent.atomic.AtomicReference[Username] = new java.util.concurrent.atomic.AtomicReference[Username]() +} + object EchoMethodContract { private val REQUEST_OBJECT_WITH_UNSUPPORTED_METHOD: String = """{ @@ -81,16 +88,20 @@ object EchoMethodContract { } trait EchoMethodContract { + import EchoMethodContractContext.currentUsername + + def bobUsername: Username = currentUsername.get() @BeforeEach def setUp(server: GuiceJamesServer): Unit = { + currentUsername.set(Username.fromLocalPartWithDomain(s"bob${UUID.randomUUID().toString.replace("-", "").take(8)}", DOMAIN)) server.getProbe(classOf[DataProbeImpl]) .fluent() .addDomain(DOMAIN.asString()) - .addUser(BOB.asString(), BOB_PASSWORD) + .addUser(bobUsername.asString(), BOB_PASSWORD) requestSpecification = baseRequestSpecBuilder(server) - .setAuth(authScheme(UserCredential(BOB, BOB_PASSWORD))) + .setAuth(authScheme(UserCredential(bobUsername, BOB_PASSWORD))) .build } diff --git a/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/memory/MemoryEchoMethodTest.java b/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/memory/MemoryEchoMethodTest.java index 553a271efe..8f58789dd7 100644 --- a/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/memory/MemoryEchoMethodTest.java +++ b/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/memory/MemoryEchoMethodTest.java @@ -21,6 +21,6 @@ package org.apache.james.jmap.rfc8621.memory; import org.apache.james.jmap.rfc8621.contract.EchoMethodContract; -public class MemoryEchoMethodTest extends MemoryBase implements EchoMethodContract { +public class MemoryEchoMethodTest extends PerClassMemoryBase implements EchoMethodContract { } diff --git a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEchoMethodTest.java b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEchoMethodTest.java index 83bef32ee2..1aa98f110e 100644 --- a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEchoMethodTest.java +++ b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEchoMethodTest.java @@ -21,5 +21,5 @@ package org.apache.james.jmap.rfc8621.postgres; import org.apache.james.jmap.rfc8621.contract.EchoMethodContract; -public class PostgresEchoMethodTest extends PostgresBase implements EchoMethodContract { +public class PostgresEchoMethodTest extends PerClassPostgresBase implements EchoMethodContract { } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
