You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2020/10/02 08:48:42 UTC
[james-project] 06/08: JAMES-3390 Operator nesting should define
their priority
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 76d841379c6d90784396df99b5960c8f9b2f43c3
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Sep 30 17:05:06 2020 +0700
JAMES-3390 Operator nesting should define their priority
---
.../contract/EmailQueryMethodContract.scala | 71 ++++++++++++++++++++++
1 file changed, 71 insertions(+)
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 fd570bf..f01989d 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
@@ -5397,6 +5397,77 @@ trait EmailQueryMethodContract {
}
}
+ @Test
+ def priorityOfNestedOperatorsShouldBePreserved(server: GuiceJamesServer): Unit = {
+ val message: Message = buildTestMessage
+ server.getProbe(classOf[MailboxProbeImpl]).createMailbox(MailboxPath.inbox(BOB))
+
+ val messageId1 = server.getProbe(classOf[MailboxProbeImpl])
+ .appendMessage(BOB.asString, MailboxPath.inbox(BOB),
+ AppendCommand.builder()
+ .withFlags(new FlagsBuilder().add("custom_1", "custom_2").build())
+ .build(message))
+ .getMessageId
+
+ val messageId2 = server.getProbe(classOf[MailboxProbeImpl])
+ .appendMessage(BOB.asString, MailboxPath.inbox(BOB),
+ AppendCommand.builder()
+ .withFlags(new FlagsBuilder().add("custom_1", "custom_3").build())
+ .build(message))
+ .getMessageId
+
+ val messageId3 = server.getProbe(classOf[MailboxProbeImpl])
+ .appendMessage(BOB.asString, MailboxPath.inbox(BOB),
+ AppendCommand.builder()
+ .withFlags(new FlagsBuilder().add("custom_2", "custom_3").build())
+ .build(message))
+ .getMessageId
+
+ val request =
+ s"""{
+ | "using": [
+ | "urn:ietf:params:jmap:core",
+ | "urn:ietf:params:jmap:mail"],
+ | "methodCalls": [[
+ | "Email/query",
+ | {
+ | "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+ | "filter" : {
+ | "operator": "AND",
+ | "conditions": [
+ | {
+ | "operator": "OR",
+ | "conditions": [
+ | { "hasKeyword": "custom_1" }, { "hasKeyword": "custom_2" }
+ | ]
+ | },
+ | { "hasKeyword": "custom_3" }
+ | ]
+ | }
+ | },
+ | "c1"]]
+ |}""".stripMargin
+
+ 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"""["${messageId2.serialize}", "${messageId3.serialize}"]""")
+ }
+ }
+
private def sendMessageToBobInbox(server: GuiceJamesServer, message: Message, requestDate: Date): MessageId = {
server.getProbe(classOf[MailboxProbeImpl])
.appendMessage(BOB.asString, MailboxPath.inbox(BOB),
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org