james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject james-project git commit: JAMES-1780 Support accountId null in setVacationResponse
Date Mon, 27 Jun 2016 09:51:40 GMT
Repository: james-project
Updated Branches:
  refs/heads/master ef4f8d9ef -> 71153ddc1


JAMES-1780 Support accountId null in setVacationResponse


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/71153ddc
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/71153ddc
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/71153ddc

Branch: refs/heads/master
Commit: 71153ddc1d9976503b3af18d2b20493f5332ed6f
Parents: ef4f8d9
Author: Laura Royet <lroyet@linagora.com>
Authored: Fri Jun 24 15:51:15 2016 +0200
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Mon Jun 27 16:50:47 2016 +0700

----------------------------------------------------------------------
 .../integration/SetVacationResponseTest.java    | 32 ++++++++++++++++++++
 .../james/jmap/model/SetVacationRequest.java    |  5 ++-
 .../jmap/model/SetVacationRequestTest.java      | 11 +++++++
 3 files changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/71153ddc/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
index 0209593..818543a 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
@@ -304,4 +304,36 @@ public abstract class SetVacationResponseTest {
             .body(NAME, equalTo("error"))
             .body(ARGUMENTS + ".type", equalTo("Not yet implemented"));
     }
+
+    @Test
+    public void accountIdNullIsSupported() {
+        String bodyRequest = "[[" +
+            "\"setVacationResponse\", " +
+            "{" +
+                "\"accountId\": null," +
+                "\"update\":{" +
+                    "\"singleton\" : {" +
+                        "\"id\": \"singleton\"," +
+                        "\"isEnabled\": \"true\"," +
+                        "\"textBody\": \"Message explaining my wonderful vacations\"," +
+                        "\"fromDate\":\"2014-09-30T14:10:00Z\"," +
+                        "\"toDate\":\"2014-10-30T14:10:00Z\"" +
+                    "}" +
+                "}" +
+            "}, " +
+            "\"#0\"" +
+            "]]";
+
+        given()
+            .accept(ContentType.JSON)
+            .contentType(ContentType.JSON)
+            .header("Authorization", accessToken.serialize())
+            .body(bodyRequest)
+        .when()
+            .post("/jmap")
+        .then()
+            .statusCode(200)
+            .body(NAME, equalTo("vacationResponseSet"))
+            .body(ARGUMENTS + ".updated[0]", equalTo("singleton"));
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/71153ddc/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetVacationRequest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetVacationRequest.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetVacationRequest.java
index cbf3bca..5bf505d 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetVacationRequest.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetVacationRequest.java
@@ -44,7 +44,10 @@ public class SetVacationRequest implements JmapRequest {
         private Map<String, VacationResponse> update = Maps.newHashMap();
 
         public Builder accountId(String accountId) {
-            throw new NotImplementedException();
+            if (accountId != null) {
+                throw new NotImplementedException();
+            }
+            return this;
         }
 
         public Builder update(Map<String, VacationResponse> update) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/71153ddc/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/SetVacationRequestTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/SetVacationRequestTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/SetVacationRequestTest.java
index 96172f3..68a018e 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/SetVacationRequestTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/SetVacationRequestTest.java
@@ -51,4 +51,15 @@ public class SetVacationRequestTest {
             .build();
     }
 
+    @Test
+    public void accountIdNullShouldBeConsideredAsNoAccountId() {
+        VacationResponse vacationResponse = VacationResponse.builder().id(VACATION_ID).textBody(Optional.of("any
message")).build();
+        SetVacationRequest setVacationRequest = SetVacationRequest.builder()
+            .accountId(null)
+            .update(ImmutableMap.of(VACATION_ID, vacationResponse))
+            .build();
+
+        assertThat(setVacationRequest.getUpdate()).containsEntry(VACATION_ID, vacationResponse);
+    }
+
 }


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


Mime
View raw message