Repository: james-project Updated Branches: refs/heads/master 3f2f8a709 -> 42c684678
JAMES-2538 SetFilter should tolerate null values Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/ff0ff102 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/ff0ff102 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/ff0ff102 Branch: refs/heads/master Commit: ff0ff1022ae072a1a6abb3f266074723bdb56308 Parents: 45357f3 Author: Raphael Ouazana <[email protected]> Authored: Tue Sep 4 15:35:12 2018 +0200 Committer: Antoine Duprat <[email protected]> Committed: Wed Sep 5 11:48:33 2018 +0200 ---------------------------------------------------------------------- .../jmap/methods/integration/FilterTest.java | 38 ++++++++++++++++++++ .../james/jmap/model/SetFilterRequest.java | 10 ++++-- 2 files changed, 46 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/ff0ff102/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/FilterTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/FilterTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/FilterTest.java index 3b6dab5..fee2696 100644 --- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/FilterTest.java +++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/FilterTest.java @@ -379,6 +379,25 @@ public abstract class FilterTest { } @Test + public void setFilterShouldAcceptNullAccountId() { + given() + .header("Authorization", accessToken.serialize()) + .body("[[" + + " \"setFilter\", " + + " {" + + " \"accountId\": null," + + " \"singleton\": []" + + " }, " + + "\"#0\"" + + "]]") + .when() + .post("/jmap") + .then() + .body(NAME, equalTo("filterSet")) + .body(ARGUMENTS + ".updated", hasSize(1)); + } + + @Test public void setFilterShouldRejectIfInState() { given() .header("Authorization", accessToken.serialize()) @@ -399,6 +418,25 @@ public abstract class FilterTest { } @Test + public void setFilterShouldAcceptNullIfInState() { + given() + .header("Authorization", accessToken.serialize()) + .body("[[" + + " \"setFilter\", " + + " {" + + " \"ifInState\": null," + + " \"singleton\": []" + + " }, " + + "\"#0\"" + + "]]") + .when() + .post("/jmap") + .then() + .body(NAME, equalTo("filterSet")) + .body(ARGUMENTS + ".updated", hasSize(1)); + } + + @Test public void getFilterShouldRetrievePreviouslyStoredRules() { MailboxId mailbox1 = randomMailboxId(); MailboxId mailbox2 = randomMailboxId(); http://git-wip-us.apache.org/repos/asf/james-project/blob/ff0ff102/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetFilterRequest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetFilterRequest.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetFilterRequest.java index 5371534..82d5e68 100644 --- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetFilterRequest.java +++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetFilterRequest.java @@ -42,11 +42,17 @@ public class SetFilterRequest implements JmapRequest { } public Builder accountId(String accountId) { - throw new JmapFieldNotSupportedException(ISSUER, "accountId"); + if (accountId != null) { + throw new JmapFieldNotSupportedException(ISSUER, "accountId"); + } + return this; } public Builder ifInState(String ifInState) { - throw new JmapFieldNotSupportedException(ISSUER, "ifInState"); + if (ifInState != null) { + throw new JmapFieldNotSupportedException(ISSUER, "ifInState"); + } + return this; } public Builder singleton(List<JmapRuleDTO> rules) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
