This is an automated email from the ASF dual-hosted git repository. rcordier pushed a commit to branch postgresql in repository https://gitbox.apache.org/repos/asf/james-project.git
commit bdf92d37b05e028b3447f7249089447cf44d2d41 Author: hung phan <hp...@linagora.com> AuthorDate: Thu Mar 14 16:39:02 2024 +0700 JAMES-2586 Fix PostgresEmailQueryMethodTest --- .../contract/EmailQueryMethodContract.scala | 34 ++++++------ .../postgres/PostgresEmailQueryMethodTest.java | 61 ++++++++++++++++++++-- 2 files changed, 76 insertions(+), 19 deletions(-) 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/EmailQueryMethodContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala index b85a358bcc..c693f4fad7 100644 --- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala +++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala @@ -55,7 +55,7 @@ import org.apache.james.util.ClassLoaderUtils import org.apache.james.utils.DataProbeImpl import org.awaitility.Awaitility import org.awaitility.Durations.ONE_HUNDRED_MILLISECONDS -import org.junit.jupiter.api.{BeforeEach, Test} +import org.junit.jupiter.api.{BeforeEach, RepeatedTest, Test} import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.{Arguments, MethodSource, ValueSource} import org.threeten.extra.Seconds @@ -7034,22 +7034,24 @@ trait EmailQueryMethodContract { | "c1"]] |}""".stripMargin - val response = `given` - .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) - .body(request) - .when - .post - .`then` - .statusCode(SC_OK) - .contentType(JSON) - .extract - .body - .asString + awaitAtMostTenSeconds.untilAsserted { () => + val response = `given` + .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER) + .body(request) + .when + .post + .`then` + .statusCode(SC_OK) + .contentType(JSON) + .extract + .body + .asString - assertThatJson(response) - .withOptions(new Options(IGNORING_ARRAY_ORDER)) - .inPath("$.methodResponses[0][1].ids") - .isEqualTo(s"""["${messageId1.serialize}","${messageId2.serialize}"]""") + assertThatJson(response) + .withOptions(new Options(IGNORING_ARRAY_ORDER)) + .inPath("$.methodResponses[0][1].ids") + .isEqualTo(s"""["${messageId1.serialize}","${messageId2.serialize}"]""") + } } @Test 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/PostgresEmailQueryMethodTest.java b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEmailQueryMethodTest.java index 3d4c3d336c..9ca92ff0d6 100644 --- a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEmailQueryMethodTest.java +++ b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEmailQueryMethodTest.java @@ -19,10 +19,65 @@ package org.apache.james.jmap.rfc8621.postgres; +import static org.apache.james.data.UsersRepositoryModuleChooser.Implementation.DEFAULT; + +import org.apache.james.DockerOpenSearchExtension; +import org.apache.james.GuiceJamesServer; +import org.apache.james.JamesServerBuilder; +import org.apache.james.JamesServerExtension; +import org.apache.james.PostgresJamesConfiguration; +import org.apache.james.PostgresJamesServerMain; +import org.apache.james.SearchConfiguration; +import org.apache.james.backends.postgres.PostgresExtension; import org.apache.james.jmap.rfc8621.contract.EmailQueryMethodContract; +import org.apache.james.jmap.rfc8621.contract.IdentityProbeModule; +import org.apache.james.jmap.rfc8621.contract.probe.DelegationProbeModule; +import org.apache.james.modules.RabbitMQExtension; +import org.apache.james.modules.TestJMAPServerModule; +import org.apache.james.modules.blobstore.BlobStoreConfiguration; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +public class PostgresEmailQueryMethodTest implements EmailQueryMethodContract { + @RegisterExtension + static JamesServerExtension testExtension = new JamesServerBuilder<PostgresJamesConfiguration>(tmpDir -> + PostgresJamesConfiguration.builder() + .workingDirectory(tmpDir) + .configurationFromClasspath() + .searchConfiguration(SearchConfiguration.openSearch()) + .usersRepository(DEFAULT) + .eventBusImpl(PostgresJamesConfiguration.EventBusImpl.RABBITMQ) + .blobStore(BlobStoreConfiguration.builder() + .postgres() + .disableCache() + .deduplication() + .noCryptoConfig()) + .build()) + .extension(PostgresExtension.empty()) + .extension(new RabbitMQExtension()) + .extension(new DockerOpenSearchExtension()) + .server(configuration -> PostgresJamesServerMain.createServer(configuration) + .overrideWith(new TestJMAPServerModule()) + .overrideWith(new DelegationProbeModule()) + .overrideWith(new IdentityProbeModule())) + .build(); + + @Override + @Test + @Disabled("Flaky test. TODO stabilize it.") + public void listMailsShouldBeSortedWhenUsingTo(GuiceJamesServer server) { + } + + @Override + @Test + @Disabled("Flaky test. TODO stabilize it.") + public void listMailsShouldBeSortedWhenUsingFrom(GuiceJamesServer server) { + } -@Disabled -// TODO Need to fix -public class PostgresEmailQueryMethodTest extends PostgresBase implements EmailQueryMethodContract { + @Override + @Test + @Disabled("Flaky test. TODO stabilize it.") + public void inMailboxOtherThanShouldBeRejectedWhenInOperator(GuiceJamesServer server) { + } } --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org