You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ad...@apache.org on 2016/06/28 09:52:25 UTC
[1/4] james-project git commit: JAMES-1779 Fix DownloadGet feature
Repository: james-project
Updated Branches:
refs/heads/master 5f30b315f -> 6468afca0
JAMES-1779 Fix DownloadGet feature
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/d43fb7d4
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/d43fb7d4
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/d43fb7d4
Branch: refs/heads/master
Commit: d43fb7d461b664d30cfbcb900fb8acfc5971fb8a
Parents: 5f30b31
Author: Antoine Duprat <ad...@linagora.com>
Authored: Tue Jun 28 11:03:57 2016 +0200
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Tue Jun 28 11:05:35 2016 +0200
----------------------------------------------------------------------
.../src/test/resources/cucumber/DownloadGet.feature | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/d43fb7d4/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
index cd92d8a..7b02ee8 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
@@ -4,13 +4,14 @@ Feature: Download GET
Background:
Given a domain named "domain.tld"
- And a current user with username "username@domain.tld" and password "secret"
+ And a connected user "username@domain.tld"
+ And "username@domain.tld" has a mailbox "inbox"
Scenario: Getting an attachment previously stored
- Given a message containing an attachment
- When getting the attachment with its correct blobId
+ Given "username@domain.tld" mailbox "inbox" contains a message "1" with an attachment "2"
+ When "username@domain.tld" downloads "2"
Then the user should receive that attachment
Scenario: Getting an attachment with an unknown blobId
- When getting the attachment with an unknown blobId
+ When "username@domain.tld" downloads "123"
Then the user should receive a not found response
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[3/4] james-project git commit: JAMES-1776 Port GetMessagesMethodTest
to Cucumber
Posted by ad...@apache.org.
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/twoAttachmentsTextPlain.eml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/twoAttachmentsTextPlain.eml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/twoAttachmentsTextPlain.eml
deleted file mode 100644
index 7760185..0000000
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/twoAttachmentsTextPlain.eml
+++ /dev/null
@@ -1,73 +0,0 @@
-Return-Path: <fr...@linagora.com>
-Received: from alderaan.linagora.com (smtp.linagora.dc1 [172.16.18.53])
- by imap (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA;
- Fri, 27 Feb 2015 20:32:14 +0100
-X-Sieve: CMU Sieve 2.2
-Received: from canondir.par.lng (unknown [92.103.166.6])
- (using TLSv1 with cipher AES256-SHA (256/256 bits))
- (No client certificate requested)
- by alderaan.linagora.com (Postfix) with ESMTPSA id BAB0D728
- for <to...@linagora.com>; Fri, 27 Feb 2015 20:31:38 +0100 (CET)
-X-Priority: 3 (Normal)
-From: "From"
- <fr...@linagora.com>
-To: "To"
- <to...@linagora.com>
-Subject: [8/10]Attached Image light with text
-Date: Fri, 27 Mar 2015 21:48:38 +0100
-Message-Id: <20...@canondir.par.lng>
-Mime-Version: 1.0
-Content-Type: multipart/mixed;
- boundary="AHNPACBLDCDIDAGGGDDFAABECGCA"
-
---AHNPACBLDCDIDAGGGDDFAABECGCA
-Content-Type: text/plain; charset=utf-8; format=flowed
-Content-Transfer-Encoding: 8bit
-
-html
-
---AHNPACBLDCDIDAGGGDDFAABECGCA
-Content-Type: image/jpeg;
- name="4037_014.jpg"
-Content-Transfer-Encoding: base64
-Content-Disposition: attachment;
- filename="4037_014.jpg"
-
-/9j/4X2cRXhpZgAASUkqAAgAAAANAA8BAgAKAAAAqgAAABABAgAJAAAAtAAAABIBAwABAAAA
-AQAAABoBBQABAAAAvgAAABsBBQABAAAAxgAAACgBAwABAAAAAgAAADEBAgAKAAAAzgAAADIB
-AgAUAAAA2AAAABMCAwABAAAAAgAAAGmHBAABAAAAfAIAAKXEBwDQAAAA7AAAANLGBwBAAAAA
-vAEAANPGBwCAAAAA/AEAAEwqAABQYW5hc29uaWMARE1DLUZaNDUAALQAAAABAAAAtAAAAAEA
-AABWZXIuMS4wICAAMjAxNDowMjoyNSAxMDozMjowOQBQcmludElNADAyNTAAAA4AAQAWABYA
-AgAAAAAAAwBkAAAABwAAAAAACAAAAAAACQAAAAAACgAAAAAACwCsAAAADAAAAAAADQAAAAAA
-DgDEAAAAAAEFAAAAAQEBAAAAEAGAAAAACREAABAnAAALDwAAECcAAJcFAAAQJwAAsAgAABAn
-AAABHAAAECcAAF4CAAAQJwAAiwAAABAnAADLAwAAECcAAOUbAAAQJwAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-
---AHNPACBLDCDIDAGGGDDFAABECGCA
-Content-Type: image/jpeg;
- name="4037_015.jpg"
-Content-Transfer-Encoding: base64
-Content-Disposition: attachment;
- filename="4037_015.jpg"
-
-iVBORw0KGgoAAAANSUhEUgAABYUAAAL4CAIAAACrzA8fAAAACXBIWXMAAAsTAAALEwEAmpwY
-AAAAB3RJTUUH3wMNDiUMca0XkQAAIABJREFUeNq8vWm0bdlVHja/tc+99zX13qv2VSeVmlIv
-FSqEOhA2AoEhxMRBg8QOyEkG6WMDSZzhMQTGDDcwiJPhBBMby4SMDJthgmOMAYvGMcF0QgIU
-WRKobymp+qpX9fp779nry4+9mjnnWuuc80qMvCpdvXrv3nP22Xutueb85je/D1/3+q+ipF9z
-nGfGdZznGCMjKaSIkJQwBYSAEMI0Tatptdrb21utVqvVtJKAAAABEAAiUP+IiECYfsfyJf1B
-10+cOHH48OGVlZVSypaWlv379zc2Nr722msNDQ2u+y9zaYQeAQAAAACCHgEAAAB0y969e+ON
-KnpOe3v7JZdccj6fwPXr10+aNKnAB956663Zs2fjTgMAAADOKzhOAQAAAFCYs+yO0XfNNQAA
-AAAA/nNBfgQAAADQDVddddW6detSqdQZ7JvL5W655RZIEgAAAAAAEayKigqcBQAAAKAAhw8f
-3rZt25AhQwYNGpTJZHq4V2tr6/bt25csWbJjxw6cQwAAAACACMiPAAAAAAAAAAAAQH8D/wgA
-AAAAAAAAAAD0N9AjAAAAAAAAAAAA0N9AjwAAAAAAAAAAAEB/Az0CAAAAAAAAAAAA/Q30CAAA
-AAAAAAAAAPQ30CMAAAAAAAAAAADQ30CPAAAAAAAAAAAAQH/z/0IKJwmNQbpqAAAAAElFTkSu
-QmCC
-
---AHNPACBLDCDIDAGGGDDFAABECGCA--
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessagesMethodTest.java
deleted file mode 100644
index 3451dd3..0000000
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessagesMethodTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.jmap.memory;
-
-import org.apache.james.GuiceJamesServer;
-import org.apache.james.MemoryJamesServerMain;
-import org.apache.james.jmap.methods.integration.GetMessagesMethodTest;
-import org.apache.james.jmap.servers.MemoryJmapServerModule;
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
-
-public class MemoryGetMessagesMethodTest extends GetMessagesMethodTest {
-
- @Rule
- public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- @Override
- protected GuiceJamesServer createJmapServer() {
- return new GuiceJamesServer()
- .combineWith(MemoryJamesServerMain.inMemoryServerModule)
- .overrideWith(new MemoryJmapServerModule(temporaryFolder));
- }
-
- @Override
- protected void await() {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryGetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryGetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryGetMessagesMethodTest.java
new file mode 100644
index 0000000..ae261a6
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryGetMessagesMethodTest.java
@@ -0,0 +1,32 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.jmap.memory.cucumber;
+
+import org.junit.runner.RunWith;
+
+import cucumber.api.CucumberOptions;
+import cucumber.api.junit.Cucumber;
+
+@RunWith(Cucumber.class)
+@CucumberOptions(features="classpath:cucumber/GetMessages.feature",
+ glue={"org.apache.james.jmap.methods.integration", "org.apache.james.jmap.memory.cucumber"},
+ strict = true)
+public class MemoryGetMessagesMethodTest {
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[4/4] james-project git commit: JAMES-1776 Port GetMessagesMethodTest
to Cucumber
Posted by ad...@apache.org.
JAMES-1776 Port GetMessagesMethodTest to Cucumber
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/6468afca
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/6468afca
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/6468afca
Branch: refs/heads/master
Commit: 6468afca0cab72a15d38fc2018b7cb41706286ae
Parents: f744458
Author: Antoine Duprat <ad...@linagora.com>
Authored: Wed Jun 22 16:43:05 2016 +0200
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Tue Jun 28 11:06:40 2016 +0200
----------------------------------------------------------------------
.../CassandraGetMessagesMethodTest.java | 54 --
.../CassandraGetMessagesMethodTest.java | 32 ++
.../integration/GetMessagesMethodTest.java | 508 -------------------
.../integration/cucumber/ContentType.java | 49 ++
.../cucumber/GetMessagesMethodStepdefs.java | 324 ++++++++++++
.../integration/cucumber/MainStepdefs.java | 10 +-
.../integration/cucumber/UserStepdefs.java | 3 +-
.../test/resources/cucumber/GetMessages.feature | 184 +++++++
.../htmlAndTextMultipartWithOneAttachment.eml | 64 +++
.../src/test/resources/eml/twoAttachments.eml | 73 +++
.../resources/eml/twoAttachmentsTextPlain.eml | 73 +++
.../htmlAndTextMultipartWithOneAttachment.eml | 64 ---
.../src/test/resources/twoAttachments.eml | 73 ---
.../test/resources/twoAttachmentsTextPlain.eml | 73 ---
.../memory/MemoryGetMessagesMethodTest.java | 45 --
.../cucumber/MemoryGetMessagesMethodTest.java | 32 ++
16 files changed, 837 insertions(+), 824 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessagesMethodTest.java
deleted file mode 100644
index 5c161b8..0000000
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessagesMethodTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.jmap.cassandra;
-
-import org.apache.james.CassandraJamesServerMain;
-import org.apache.james.GuiceJamesServer;
-import org.apache.james.backends.cassandra.EmbeddedCassandra;
-import org.apache.james.jmap.methods.integration.GetMessagesMethodTest;
-import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
-import org.apache.james.modules.CassandraJmapServerModule;
-import org.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TemporaryFolder;
-
-public class CassandraGetMessagesMethodTest extends GetMessagesMethodTest {
-
- private TemporaryFolder temporaryFolder = new TemporaryFolder();
- private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
- private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();
-
- @Rule
- public RuleChain chain = RuleChain
- .outerRule(temporaryFolder)
- .around(embeddedElasticSearch);
-
- @Override
- protected GuiceJamesServer createJmapServer() {
- return new GuiceJamesServer()
- .combineWith(CassandraJamesServerMain.cassandraServerModule)
- .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra));
- }
-
- @Override
- protected void await() {
- embeddedElasticSearch.awaitForElasticSearch();
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraGetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraGetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraGetMessagesMethodTest.java
new file mode 100644
index 0000000..f43d624
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraGetMessagesMethodTest.java
@@ -0,0 +1,32 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.jmap.cassandra.cucumber;
+
+import org.junit.runner.RunWith;
+
+import cucumber.api.CucumberOptions;
+import cucumber.api.junit.Cucumber;
+
+@RunWith(Cucumber.class)
+@CucumberOptions(features="classpath:cucumber/GetMessages.feature",
+ glue={"org.apache.james.jmap.methods.integration", "org.apache.james.jmap.cassandra.cucumber"},
+ strict = true)
+public class CassandraGetMessagesMethodTest {
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessagesMethodTest.java
deleted file mode 100644
index 9382091..0000000
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessagesMethodTest.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.jmap.methods.integration;
-
-import static com.jayway.restassured.RestAssured.given;
-import static com.jayway.restassured.config.EncoderConfig.encoderConfig;
-import static com.jayway.restassured.config.RestAssuredConfig.newConfig;
-import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.nullValue;
-
-import java.io.ByteArrayInputStream;
-import java.time.ZonedDateTime;
-import java.util.Date;
-
-import javax.mail.Flags;
-
-import org.apache.james.GuiceJamesServer;
-import org.apache.james.jmap.JmapAuthentication;
-import org.apache.james.jmap.api.access.AccessToken;
-import org.apache.james.mailbox.model.MailboxConstants;
-import org.apache.james.mailbox.model.MailboxPath;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.google.common.base.Charsets;
-import com.google.common.collect.ImmutableMap;
-import com.jayway.restassured.RestAssured;
-import com.jayway.restassured.builder.RequestSpecBuilder;
-import com.jayway.restassured.filter.log.LogDetail;
-import com.jayway.restassured.http.ContentType;
-
-public abstract class GetMessagesMethodTest {
- private static final String NAME = "[0][0]";
- private static final String ARGUMENTS = "[0][1]";
- private static final String FIRST_MESSAGE = ARGUMENTS + ".list[0]";
- private static final String ATTACHMENTS = FIRST_MESSAGE + ".attachments";
- private static final String FIRST_ATTACHMENT = ATTACHMENTS + "[0]";
- private static final String SECOND_ATTACHMENT = ATTACHMENTS + "[1]";
-
- protected abstract GuiceJamesServer createJmapServer();
-
- protected abstract void await();
-
- private AccessToken accessToken;
- private String username;
- private GuiceJamesServer jmapServer;
-
- @Before
- public void setup() throws Throwable {
- jmapServer = createJmapServer();
- jmapServer.start();
-
- RestAssured.requestSpecification = new RequestSpecBuilder()
- .setContentType(ContentType.JSON)
- .setAccept(ContentType.JSON)
- .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)))
- .setPort(jmapServer.getJmapPort())
- .build();
-
- RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
-
- String domain = "domain.tld";
- username = "username@" + domain;
- String password = "password";
- jmapServer.serverProbe().addDomain(domain);
- jmapServer.serverProbe().addUser(username, password);
- jmapServer.serverProbe().createMailbox("#private", "username", "inbox");
- accessToken = JmapAuthentication.authenticateJamesUser(username, password);
- }
-
- @After
- public void teardown() {
- jmapServer.stop();
- }
-
- @Test
- public void getMessagesShouldErrorNotSupportedWhenRequestContainsNonNullAccountId() throws Exception {
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"accountId\": \"1\"}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("error"))
- .body(ARGUMENTS + ".type", equalTo("Not yet implemented"));
- }
-
- @Test
- public void getMessagesShouldIgnoreUnknownArguments() throws Exception {
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"WAT\": true}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(ARGUMENTS + ".notFound", empty())
- .body(ARGUMENTS + ".list", empty());
- }
-
- @Test
- public void getMessagesShouldErrorInvalidArgumentsWhenRequestContainsInvalidArgument() throws Exception {
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": null}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("error"))
- .body(ARGUMENTS + ".type", equalTo("invalidArguments"))
- .body(ARGUMENTS + ".description", equalTo("N/A (through reference chain: org.apache.james.jmap.model.Builder[\"ids\"])"));
- }
-
- @Test
- public void getMessagesShouldReturnEmptyListWhenNoMessage() throws Exception {
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": []}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", empty());
- }
-
- @Test
- public void getMessagesShouldReturnNoFoundIndicesWhenMessageNotFound() throws Exception {
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"username|inbox|12\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".notFound", contains("username|inbox|12"));
- }
-
- @Test
- public void getMessagesShouldReturnMessagesWhenAvailable() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "inbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "inbox"),
- new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes()), Date.from(dateTime.toInstant()), false, new Flags());
-
- await();
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"" + username + "|inbox|1\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", hasSize(1))
- .body(FIRST_MESSAGE + ".id", equalTo(username + "|inbox|1"))
- .body(FIRST_MESSAGE + ".threadId", equalTo(username + "|inbox|1"))
- .body(FIRST_MESSAGE + ".subject", equalTo("my test subject"))
- .body(FIRST_MESSAGE + ".textBody", equalTo("testmail"))
- .body(FIRST_MESSAGE + ".isUnread", equalTo(true))
- .body(FIRST_MESSAGE + ".preview", equalTo("testmail"))
- .body(FIRST_MESSAGE + ".headers", equalTo(ImmutableMap.of("subject", "my test subject")))
- .body(FIRST_MESSAGE + ".date", equalTo("2014-10-30T14:12:00Z"))
- .body(FIRST_MESSAGE + ".hasAttachment", equalTo(false))
- .body(ATTACHMENTS, empty());
- }
-
- @Test
- public void getMessagesShouldReturnMessageWhenHtmlMessage() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "inbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "inbox"),
- new ByteArrayInputStream("Content-Type: text/html\r\nSubject: my test subject\r\n\r\nThis is a <b>HTML</b> mail".getBytes()), Date.from(dateTime.toInstant()), false, new Flags());
-
- await();
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"" + username + "|inbox|1\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", hasSize(1))
- .body(FIRST_MESSAGE + ".id", equalTo(username + "|inbox|1"))
- .body(FIRST_MESSAGE + ".threadId", equalTo(username + "|inbox|1"))
- .body(FIRST_MESSAGE + ".subject", equalTo("my test subject"))
- .body(FIRST_MESSAGE + ".htmlBody", equalTo("This is a <b>HTML</b> mail"))
- .body(FIRST_MESSAGE + ".isUnread", equalTo(true))
- .body(FIRST_MESSAGE + ".preview", equalTo("This is a HTML mail"))
- .body(FIRST_MESSAGE + ".headers", equalTo(ImmutableMap.of("content-type", "text/html", "subject", "my test subject")))
- .body(FIRST_MESSAGE + ".date", equalTo("2014-10-30T14:12:00Z"));
- }
-
- @Test
- public void getMessagesShouldReturnMessageWhenComplexHtmlMessage() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "inbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "inbox"),
- new ByteArrayInputStream("Content-Type: text/html\r\nSubject: my test subject\r\n\r\nThis is a <b>HTML</b> mail containing <u>underlined part</u>, <i>italic part</i> and <u><i>underlined AND italic part</i></u>".getBytes()), Date.from(dateTime.toInstant()), false, new Flags());
-
- await();
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"" + username + "|inbox|1\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", hasSize(1))
- .body(FIRST_MESSAGE + ".id", equalTo(username + "|inbox|1"))
- .body(FIRST_MESSAGE + ".threadId", equalTo(username + "|inbox|1"))
- .body(FIRST_MESSAGE + ".subject", equalTo("my test subject"))
- .body(FIRST_MESSAGE + ".htmlBody", equalTo("This is a <b>HTML</b> mail containing <u>underlined part</u>, <i>italic part</i> and <u><i>underlined AND italic part</i></u>"))
- .body(FIRST_MESSAGE + ".isUnread", equalTo(true))
- .body(FIRST_MESSAGE + ".preview", equalTo("This is a HTML mail containing underlined part, italic part and underlined AND italic part"))
- .body(FIRST_MESSAGE + ".headers", equalTo(ImmutableMap.of("content-type", "text/html", "subject", "my test subject")))
- .body(FIRST_MESSAGE + ".date", equalTo("2014-10-30T14:12:00Z"));
- }
-
- @Test
- public void messagePreviewShouldContainTagsWhenPlainTextMessageContainsTags() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "inbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "inbox"),
- new ByteArrayInputStream("Content-Type: text/plain\r\nSubject: my test subject\r\n\r\nHere is a listing of HTML tags : <b>jfjfjfj</b>, <i>jfhdgdgdfj</i>, <u>jfjaaafj</u>".getBytes()), Date.from(dateTime.toInstant()), false, new Flags());
-
- await();
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"" + username + "|inbox|1\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", hasSize(1))
- .body(FIRST_MESSAGE + ".preview", equalTo("Here is a listing of HTML tags : <b>jfjfjfj</b>, <i>jfhdgdgdfj</i>, <u>jfjaaafj</u>"));
- }
-
- @Test
- public void getMessagesShouldReturnMessageWhenHtmlMessageWithIncorrectTag() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "inbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "inbox"),
- new ByteArrayInputStream("Content-Type: text/html\r\nSubject: my test subject\r\n\r\nThis is a <ganan>HTML</b> mail".getBytes()), Date.from(dateTime.toInstant()), false, new Flags());
-
- await();
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"" + username + "|inbox|1\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", hasSize(1))
- .body(FIRST_MESSAGE + ".id", equalTo(username + "|inbox|1"))
- .body(FIRST_MESSAGE + ".threadId", equalTo(username + "|inbox|1"))
- .body(FIRST_MESSAGE + ".subject", equalTo("my test subject"))
- .body(FIRST_MESSAGE + ".htmlBody", equalTo("This is a <ganan>HTML</b> mail"))
- .body(FIRST_MESSAGE + ".isUnread", equalTo(true))
- .body(FIRST_MESSAGE + ".preview", equalTo("This is a HTML mail"))
- .body(FIRST_MESSAGE + ".headers", equalTo(ImmutableMap.of("content-type", "text/html", "subject", "my test subject")))
- .body(FIRST_MESSAGE + ".date", equalTo("2014-10-30T14:12:00Z"));
- }
-
- @Test
- public void getMessagesShouldReturnFilteredPropertiesMessagesWhenAsked() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "inbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "inbox"),
- new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes()), Date.from(dateTime.toInstant()), false, new Flags());
-
- await();
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"" + username + "|inbox|1\"], \"properties\": [\"id\", \"subject\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", hasSize(1))
- .body(FIRST_MESSAGE + ".id", equalTo(username + "|inbox|1"))
- .body(FIRST_MESSAGE + ".subject", equalTo("my test subject"))
- .body(FIRST_MESSAGE + ".textBody", nullValue())
- .body(FIRST_MESSAGE + ".isUnread", nullValue())
- .body(FIRST_MESSAGE + ".preview", nullValue())
- .body(FIRST_MESSAGE + ".headers", nullValue())
- .body(FIRST_MESSAGE + ".date", nullValue());
- }
-
- @Test
- public void getMessagesShouldReturnFilteredHeaderPropertyWhenAsked() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "inbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "inbox"),
- new ByteArrayInputStream(("From: user@domain.tld\r\n"
- + "header1: Header1Content\r\n"
- + "HEADer2: Header2Content\r\n"
- + "Subject: my test subject\r\n"
- + "\r\n"
- + "testmail").getBytes()), Date.from(dateTime.toInstant()), false, new Flags());
-
- await();
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"" + username + "|inbox|1\"], \"properties\": [\"headers.from\", \"headers.heADER2\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", hasSize(1))
- .body(FIRST_MESSAGE + ".id", equalTo(username + "|inbox|1"))
- .body(FIRST_MESSAGE + ".subject", nullValue())
- .body(FIRST_MESSAGE + ".textBody", nullValue())
- .body(FIRST_MESSAGE + ".isUnread", nullValue())
- .body(FIRST_MESSAGE + ".preview", nullValue())
- .body(FIRST_MESSAGE + ".headers", equalTo(ImmutableMap.of("from", "user@domain.tld", "header2", "Header2Content")))
- .body(FIRST_MESSAGE + ".date", nullValue());
- }
-
- @Test
- public void getMessagesShouldReturnNotFoundWhenIdDoesntMatch() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "inbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "inbox"),
- new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes()), Date.from(dateTime.toInstant()), false, new Flags());
-
- await();
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"username|inbox|1\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", empty())
- .body(ARGUMENTS + ".notFound", hasSize(1));
- }
-
- @Test
- public void getMessagesShouldReturnMandatoryPropertiesMessagesWhenNotAsked() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
- new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes()), Date.from(dateTime.toInstant()), false, new Flags());
- await();
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"" + username + "|mailbox|1\"], \"properties\": [\"subject\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", hasSize(1))
- .body(FIRST_MESSAGE + ".id", equalTo("username@domain.tld|mailbox|1"))
- .body(FIRST_MESSAGE + ".subject", equalTo("my test subject"));
- }
-
- @Test
- public void getMessagesShouldReturnAttachmentsWhenSome() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "inbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "inbox"),
- ClassLoader.getSystemResourceAsStream("twoAttachments.eml"), Date.from(dateTime.toInstant()), false, new Flags());
-
- await();
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"" + username + "|inbox|1\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", hasSize(1))
- .body(FIRST_MESSAGE + ".hasAttachment", equalTo(true))
- .body(ATTACHMENTS, hasSize(2))
- .body(FIRST_ATTACHMENT + ".blobId", equalTo("223a76c0e8c1b1762487d8e0598bd88497d73ef2"))
- .body(FIRST_ATTACHMENT + ".type", equalTo("image/jpeg"))
- .body(FIRST_ATTACHMENT + ".size", equalTo(846))
- .body(SECOND_ATTACHMENT + ".blobId", equalTo("58aa22c2ec5770fb9e574ba19008dbfc647eba43"))
- .body(SECOND_ATTACHMENT + ".type", equalTo("image/jpeg"))
- .body(SECOND_ATTACHMENT + ".size", equalTo(597));
- }
-
- @Test
- public void getMessagesShouldReturnHTMLBodyWhenSomeAttachmentsAndHTMLmail() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "inbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "inbox"),
- ClassLoader.getSystemResourceAsStream("twoAttachments.eml"), Date.from(dateTime.toInstant()), false, new Flags());
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"" + username + "|inbox|1\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", hasSize(1))
- .body(FIRST_MESSAGE + ".hasAttachment", equalTo(true))
- .body(ATTACHMENTS, hasSize(2))
- .body(FIRST_MESSAGE + ".preview", equalTo("html\n"))
- .body(FIRST_MESSAGE + ".textBody", nullValue())
- .body(FIRST_MESSAGE + ".htmlBody", equalTo("<b>html</b>\n"));
- }
-
- @Test
- public void getMessagesShouldReturnTextBodyWhenSomeAttachmentsAndTextmail() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "inbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "inbox"),
- ClassLoader.getSystemResourceAsStream("twoAttachmentsTextPlain.eml"), Date.from(dateTime.toInstant()), false, new Flags());
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"" + username + "|inbox|1\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", hasSize(1))
- .body(FIRST_MESSAGE + ".hasAttachment", equalTo(true))
- .body(ATTACHMENTS, hasSize(2))
- .body(FIRST_MESSAGE + ".preview", equalTo("html\n"))
- .body(FIRST_MESSAGE + ".textBody", equalTo("html\n"))
- .body(FIRST_MESSAGE + ".htmlBody", nullValue());
- }
-
- @Test
- public void getMessagesShouldReturnBothHTMLAndTextBodyWhenOneAttachmentAndBothHTMLAndTextmail() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "inbox");
-
- ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "inbox"),
- ClassLoader.getSystemResourceAsStream("htmlAndTextMultipartWithOneAttachment.eml"), Date.from(dateTime.toInstant()), false, new Flags());
-
- given()
- .header("Authorization", accessToken.serialize())
- .body("[[\"getMessages\", {\"ids\": [\"" + username + "|inbox|1\"]}, \"#0\"]]")
- .when()
- .post("/jmap")
- .then()
- .statusCode(200)
- .body(NAME, equalTo("messages"))
- .body(ARGUMENTS + ".list", hasSize(1))
- .body(FIRST_MESSAGE + ".hasAttachment", equalTo(true))
- .body(ATTACHMENTS, hasSize(1))
- .body(FIRST_MESSAGE + ".preview", equalTo("blabla\nbloblo\n"))
- .body(FIRST_MESSAGE + ".textBody", equalTo("/blabla/\n*bloblo*\n"))
- .body(FIRST_MESSAGE + ".htmlBody", equalTo("<i>blabla</i>\n<b>bloblo</b>\n"));
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ContentType.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ContentType.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ContentType.java
new file mode 100644
index 0000000..04dbaba
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ContentType.java
@@ -0,0 +1,49 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.jmap.methods.integration.cucumber;
+
+import java.util.Optional;
+
+public class ContentType {
+
+ public static ContentType from(String contentType) {
+ return new ContentType(Optional.ofNullable(contentType));
+ }
+
+ public static ContentType noContentType() {
+ return new ContentType(Optional.empty());
+ }
+
+ private final Optional<String> contentType;
+
+ private ContentType(Optional<String> contentType) {
+ this.contentType = contentType;
+ }
+
+ public Optional<String> value() {
+ return contentType;
+ }
+
+ public String serializeToHeader() {
+ return contentType
+ .map(value -> "Content-Type: " + value + "\r\n")
+ .orElse("");
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
new file mode 100644
index 0000000..8907f98
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
@@ -0,0 +1,324 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.jmap.methods.integration.cucumber;
+
+import static com.jayway.restassured.RestAssured.with;
+import static org.hamcrest.Matchers.contains;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.nullValue;
+
+import java.io.ByteArrayInputStream;
+import java.time.ZonedDateTime;
+import java.util.Date;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import javax.inject.Inject;
+import javax.mail.Flags;
+
+import org.apache.james.mailbox.model.MailboxConstants;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.javatuples.Pair;
+
+import com.google.common.base.Charsets;
+import com.google.common.base.Joiner;
+import com.jayway.restassured.response.Response;
+import com.jayway.restassured.response.ValidatableResponse;
+
+import cucumber.api.DataTable;
+import cucumber.api.java.en.Given;
+import cucumber.api.java.en.Then;
+import cucumber.api.java.en.When;
+import cucumber.runtime.java.guice.ScenarioScoped;
+import groovy.json.StringEscapeUtils;
+
+@ScenarioScoped
+public class GetMessagesMethodStepdefs {
+
+ private static final Optional<Map<String, String>> NO_HEADERS = Optional.empty();
+ private static final String NAME = "[0][0]";
+ private static final String ARGUMENTS = "[0][1]";
+ private static final String FIRST_MESSAGE = ARGUMENTS + ".list[0]";
+ private static final String ATTACHMENTS = FIRST_MESSAGE + ".attachments";
+ private static final String FIRST_ATTACHMENT = ATTACHMENTS + "[0]";
+ private static final String SECOND_ATTACHMENT = ATTACHMENTS + "[1]";
+
+
+ private final MainStepdefs mainStepdefs;
+ private final UserStepdefs userStepdefs;
+
+ private Response post;
+ private ValidatableResponse response;
+
+ @Inject
+ private GetMessagesMethodStepdefs(MainStepdefs mainStepdefs, UserStepdefs userStepdefs) {
+ this.mainStepdefs = mainStepdefs;
+ this.userStepdefs = userStepdefs;
+ }
+
+ @Given("^the user has a message in \"([^\"]*)\" mailbox with subject \"([^\"]*)\" and content \"([^\"]*)\"$")
+ public void appendMessage(String mailbox, String subject, String content) throws Throwable {
+ appendMessage(mailbox, ContentType.noContentType(), subject, content, NO_HEADERS);
+ }
+
+ @Given("^the user has a message in \"([^\"]*)\" mailbox with content-type \"([^\"]*)\" subject \"([^\"]*)\" and content \"([^\"]*)\"$")
+ public void appendMessage(String mailbox, String contentType, String subject, String content) throws Throwable {
+ appendMessage(mailbox, ContentType.from(contentType), subject, content, NO_HEADERS);
+ }
+
+ @Given("^the user has a message in \"([^\"]*)\" mailbox with subject \"([^\"]*)\" and content \"([^\"]*)\" with headers$")
+ public void appendMessage(String mailbox, String subject, String content, DataTable headers) throws Throwable {
+ appendMessage(mailbox, ContentType.noContentType(), subject, content, Optional.of(headers.asMap(String.class, String.class)));
+ }
+
+ private void appendMessage(String mailbox, ContentType contentType, String subject, String content, Optional<Map<String, String>> headers) throws Exception {
+ ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
+ mainStepdefs.jmapServer.serverProbe().appendMessage(userStepdefs.lastConnectedUser,
+ new MailboxPath(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, mailbox),
+ new ByteArrayInputStream(message(contentType, subject, content, headers).getBytes(Charsets.UTF_8)),
+ Date.from(dateTime.toInstant()), false, new Flags());
+ }
+
+ private String message(ContentType contentType, String subject, String content, Optional<Map<String,String>> headers) {
+ return serialize(headers) + contentType.serializeToHeader() + "Subject: " + subject + "\r\n\r\n" + content;
+ }
+
+ private String serialize(Optional<Map<String,String>> headers) {
+ return headers
+ .map(map -> map.entrySet())
+ .map(entriesToString())
+ .orElse("");
+ }
+
+ private Function<Set<Entry<String, String>>, String> entriesToString() {
+ return entries -> entries.stream()
+ .map(this::entryToPair)
+ .map(this::joinKeyValue)
+ .collect(Collectors.joining("\r\n", "", "\r\n"));
+ }
+
+ @Given("^the user has a message in \"([^\"]*)\" mailbox with two attachments$")
+ public void appendHtmlMessageWithTwoAttachments(String mailbox) throws Throwable {
+ appendMessage("eml/twoAttachments.eml");
+ }
+
+ @Given("^the user has a message in \"([^\"]*)\" mailbox with two attachments in text$")
+ public void appendTextMessageWithTwoAttachments(String arg1) throws Throwable {
+ appendMessage("eml/twoAttachmentsTextPlain.eml");
+ }
+
+ @Given("^the user has a multipart message in \"([^\"]*)\" mailbox$")
+ public void appendMultipartMessageWithOneAttachments(String arg1) throws Throwable {
+ appendMessage("eml/htmlAndTextMultipartWithOneAttachment.eml");
+ }
+
+ private void appendMessage(String emlFileName) throws Exception {
+ ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
+ mainStepdefs.jmapServer.serverProbe().appendMessage(userStepdefs.lastConnectedUser,
+ new MailboxPath(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, "inbox"),
+ ClassLoader.getSystemResourceAsStream(emlFileName),
+ Date.from(dateTime.toInstant()), false, new Flags());
+ }
+
+ @When("^the user ask for messages using its accountId$")
+ public void postWithAccountId() throws Exception {
+ post("[[\"getMessages\", {\"accountId\": \"1\"}, \"#0\"]]");
+ }
+
+ @When("^the user ask for messages using unknown arguments$")
+ public void postWithUnknownArguments() throws Exception {
+ post("[[\"getMessages\", {\"WAT\": true}, \"#0\"]]");
+ }
+
+ @When("^the user ask for messages using invalid argument$")
+ public void postWithInvalidArguments() throws Exception {
+ post("[[\"getMessages\", {\"ids\": null}, \"#0\"]]");
+ }
+
+ @When("^the user ask for messages$")
+ public void post() throws Throwable {
+ post("[[\"getMessages\", {\"ids\": []}, \"#0\"]]");
+ }
+
+ @When("^the user ask for messages \"(.*?)\"$")
+ public void postWithAListOfIds(String ids) throws Throwable {
+ post("[[\"getMessages\", {\"ids\": " + ids + "}, \"#0\"]]");
+ }
+
+ @When("^the user is getting his messages with parameters$")
+ public void postWithParameters(DataTable parameters) throws Throwable {
+ String payload =
+ parameters.asMap(String.class, String.class)
+ .entrySet()
+ .stream()
+ .map(this::entryToPair)
+ .map(this::quoteIndex)
+ .map(this::joinKeyValue)
+ .collect(Collectors.joining(",", "{", "}"));
+
+ post("[[\"getMessages\", " + payload + ", \"#0\"]]");
+ }
+
+ private Pair<String, String> entryToPair(Map.Entry<String, String> entry) {
+ return Pair.with(entry.getKey(), entry.getValue());
+ }
+
+ private Pair<String, String> quoteIndex(Pair<String, String> pair) {
+ return Pair.with(String.format("\"%s\"", pair.getValue0()), pair.getValue1());
+ }
+
+ private String joinKeyValue(Pair<String, String> pair) {
+ return Joiner.on(": ").join(pair);
+ }
+
+ private void post(String requestBody) {
+ post = with()
+ .header("Authorization", userStepdefs.tokenByUser.get(userStepdefs.lastConnectedUser).serialize())
+ .body(requestBody)
+ .post("/jmap");
+ }
+
+ @Then("^an error \"([^\"]*)\" is returned$")
+ public void error(String type) throws Throwable {
+ response = post.then()
+ .statusCode(200)
+ .body(NAME, equalTo("error"))
+ .body(ARGUMENTS + ".type", equalTo(type));
+ }
+
+ @Then("^no error is returned$")
+ public void noError() throws Throwable {
+ response = post.then()
+ .statusCode(200)
+ .body(NAME, equalTo("messages"));
+ }
+
+ @Then("^the list of unknown messages is empty$")
+ public void assertNotFoundIsEmpty() {
+ response.body(ARGUMENTS + ".notFound", empty());
+ }
+
+ @Then("^the list of messages is empty$")
+ public void assertListIsEmpty() {
+ response.body(ARGUMENTS + ".list", empty());
+ }
+
+ @Then("^the description is \"(.*?)\"$")
+ public void assertDescription(String description) throws Throwable {
+ response.body(ARGUMENTS + ".description", equalTo(description));
+ }
+
+ @Then("^the notFound list should contains \"([^\"]*)\"$")
+ public void assertNotFoundListContains(String ids) throws Throwable {
+ response.body(ARGUMENTS + ".notFound", contains(ids));
+ }
+
+ @Then("^the list should contain (\\d+) message$")
+ public void assertListContains(int numberOfMessages) throws Throwable {
+ response.body(ARGUMENTS + ".list", hasSize(numberOfMessages));
+ }
+
+ @Then("^the id of the message is \"([^\"]*)\"$")
+ public void assertIdOfTheFirstMessage(String id) throws Throwable {
+ response.body(FIRST_MESSAGE + ".id", equalTo(id));
+ }
+
+ @Then("^the threadId of the message is \"([^\"]*)\"$")
+ public void assertThreadIdOfTheFirstMessage(String threadId) throws Throwable {
+ response.body(FIRST_MESSAGE + ".threadId", equalTo(threadId));
+ }
+
+ @Then("^the subject of the message is \"([^\"]*)\"$")
+ public void assertSubjectOfTheFirstMessage(String subject) throws Throwable {
+ response.body(FIRST_MESSAGE + ".subject", equalTo(subject));
+ }
+
+ @Then("^the textBody of the message is \"([^\"]*)\"$")
+ public void assertTextBodyOfTheFirstMessage(String textBody) throws Throwable {
+ response.body(FIRST_MESSAGE + ".textBody", equalTo(StringEscapeUtils.unescapeJava(textBody)));
+ }
+
+ @Then("^the htmlBody of the message is \"([^\"]*)\"$")
+ public void assertHtmlBodyOfTheFirstMessage(String htmlBody) throws Throwable {
+ response.body(FIRST_MESSAGE + ".htmlBody", equalTo(StringEscapeUtils.unescapeJava(htmlBody)));
+ }
+
+ @Then("^the isUnread of the message is \"([^\"]*)\"$")
+ public void assertIsUnreadOfTheFirstMessage(String isUnread) throws Throwable {
+ response.body(FIRST_MESSAGE + ".isUnread", equalTo(Boolean.valueOf(isUnread)));
+ }
+
+ @Then("^the preview of the message is \"([^\"]*)\"$")
+ public void assertPreviewOfTheFirstMessage(String preview) throws Throwable {
+ response.body(FIRST_MESSAGE + ".preview", equalTo(StringEscapeUtils.unescapeJava(preview)));
+ }
+
+ @Then("^the headers of the message contains:$")
+ public void assertHeadersOfTheFirstMessage(DataTable headers) throws Throwable {
+ response.body(FIRST_MESSAGE + ".headers", equalTo(headers.asMap(String.class, String.class)));
+ }
+
+ @Then("^the date of the message is \"([^\"]*)\"$")
+ public void assertDateOfTheFirstMessage(String date) throws Throwable {
+ response.body(FIRST_MESSAGE + ".date", equalTo(date));
+ }
+
+ @Then("^the hasAttachment of the message is \"([^\"]*)\"$")
+ public void assertHasAttachmentOfTheFirstMessage(String hasAttachment) throws Throwable {
+ response.body(FIRST_MESSAGE + ".hasAttachment", equalTo(Boolean.valueOf(hasAttachment)));
+ }
+
+ @Then("^the list of attachments of the message is empty$")
+ public void assertAttachmentsOfTheFirstMessageIsEmpty() throws Throwable {
+ response.body(ATTACHMENTS, empty());
+ }
+
+ @Then("^the property \"([^\"]*)\" of the message is null$")
+ public void assertPropertyIsNull(String property) throws Throwable {
+ response.body(FIRST_MESSAGE + "." + property, nullValue());
+ }
+
+ @Then("^the list of attachments of the message contains (\\d+) attachments?$")
+ public void assertAttachmentsHasSize(int numberOfAttachments) throws Throwable {
+ response.body(ATTACHMENTS, hasSize(numberOfAttachments));
+ }
+
+ @Then("^the first attachment is:$")
+ public void assertFirstAttachment(DataTable attachmentProperties) throws Throwable {
+ assertAttachment(FIRST_ATTACHMENT, attachmentProperties);
+ }
+
+ @Then("^the second attachment is:$")
+ public void assertSecondAttachment(DataTable attachmentProperties) throws Throwable {
+ assertAttachment(SECOND_ATTACHMENT, attachmentProperties);
+ }
+
+ private void assertAttachment(String attachment, DataTable attachmentProperties) {
+ attachmentProperties.asMap(String.class, String.class).entrySet()
+ .stream()
+ .map(entry -> response.body(attachment + "." + entry.getKey(), equalTo(entry.getValue())));
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MainStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MainStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MainStepdefs.java
index 0dc58ed..91eba14 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MainStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MainStepdefs.java
@@ -40,11 +40,11 @@ public class MainStepdefs {
public void init() throws Exception {
jmapServer.start();
RestAssured.requestSpecification = new RequestSpecBuilder()
- .setContentType(ContentType.JSON)
- .setAccept(ContentType.JSON)
- .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)))
- .setPort(jmapServer.getJmapPort())
- .build();
+ .setContentType(ContentType.JSON)
+ .setAccept(ContentType.JSON)
+ .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)))
+ .setPort(jmapServer.getJmapPort())
+ .build();
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java
index a8a5816..503fdbf 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java
@@ -59,7 +59,7 @@ public class UserStepdefs {
}
@Given("^a domain named \"([^\"]*)\"$")
- public void createDomain(String domain) throws Throwable {
+ public void createDomain(String domain) throws Exception {
mainStepdefs.jmapServer.serverProbe().addDomain(domain);
domains.add(domain);
}
@@ -111,5 +111,4 @@ public class UserStepdefs {
private String generatePassword(String username) {
return Hashing.murmur3_128().hashString(username, Charsets.UTF_8).toString();
}
-
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
new file mode 100644
index 0000000..0ec32fd
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
@@ -0,0 +1,184 @@
+Feature: GetMessages method
+ As a James user
+ I want to be able to retrieve my messages
+
+ Background:
+ Given a domain named "domain.tld"
+ And a connected user "username@domain.tld"
+ And "username@domain.tld" has a mailbox "inbox"
+
+ Scenario: Retrieving messages with a non null accountId should return a NotSupported error
+ When the user ask for messages using its accountId
+ Then an error "Not yet implemented" is returned
+
+ Scenario: Unknown arguments should be ignored when retrieving messages
+ When the user ask for messages using unknown arguments
+ Then no error is returned
+ And the list of unknown messages is empty
+ And the list of messages is empty
+
+ Scenario: Retrieving messages with invalid argument should return an InvalidArguments error
+ When the user ask for messages using invalid argument
+ Then an error "invalidArguments" is returned
+ And the description is "N/A (through reference chain: org.apache.james.jmap.model.Builder["ids"])"
+
+ Scenario: Retrieving messages should return empty list when no message
+ When the user ask for messages
+ Then no error is returned
+ And the list of messages is empty
+
+ Scenario: Retrieving message should return not found when message doesn't exist
+ When the user ask for messages "["username@domain.tld|inbox|12"]"
+ Then no error is returned
+ And the notFound list should contains "username@domain.tld|inbox|12"
+
+ Scenario: Retrieving message should return messages when exists
+ Given the user has a message in "inbox" mailbox with subject "my test subject" and content "testmail"
+ When the user ask for messages "["username@domain.tld|inbox|1"]"
+ Then no error is returned
+ And the list should contain 1 message
+ And the id of the message is "username@domain.tld|inbox|1"
+ And the threadId of the message is "username@domain.tld|inbox|1"
+ And the subject of the message is "my test subject"
+ And the textBody of the message is "testmail"
+ And the isUnread of the message is "true"
+ And the preview of the message is "testmail"
+ And the headers of the message contains:
+ |subject |my test subject |
+ And the date of the message is "2014-10-30T14:12:00Z"
+ And the hasAttachment of the message is "false"
+ And the list of attachments of the message is empty
+
+ Scenario Outline: Retrieving message should return messages when exists and is a html message
+ Given the user has a message in <mailbox> mailbox with content-type <content-type> subject <subject> and content <content>
+ When the user ask for messages "["username@domain.tld|inbox|1"]"
+ Then no error is returned
+ And the list should contain 1 message
+ And the id of the message is "username@domain.tld|inbox|1"
+ And the threadId of the message is "username@domain.tld|inbox|1"
+ And the subject of the message is <subject>
+ And the htmlBody of the message is <content>
+ And the isUnread of the message is "true"
+ And the preview of the message is <preview>
+ And the headers of the message contains:
+ |content-type |text/html |
+ |subject |<subject-header> |
+ And the date of the message is "2014-10-30T14:12:00Z"
+
+ Examples:
+ |mailbox |content-type |subject |subject-header |content |preview |
+ |"inbox" |"text/html" |"my test subject" |my test subject |"This is a <b>HTML</b> mail" |"This is a HTML mail" |
+ |"inbox" |"text/html" |"my test subject" |my test subject |"This is a <b>HTML</b> mail containing <u>underlined part</u>, <i>italic part</i> and <u><i>underlined AND italic part</i></u>" |"This is a HTML mail containing underlined part, italic part and underlined AND italic part" |
+ |"inbox" |"text/html" |"my test subject" |my test subject |"This is a <ganan>HTML</b> mail" |"This is a HTML mail" |
+
+ Scenario Outline: Retrieving message should return preview with tags when text message
+ Given the user has a message in <mailbox> mailbox with content-type <content-type> subject <subject> and content <content>
+ When the user ask for messages "["username@domain.tld|inbox|1"]"
+ Then no error is returned
+ And the list should contain 1 message
+ And the preview of the message is <preview>
+
+ Examples:
+ |mailbox |content-type |subject |content |preview |
+ |"inbox" |"text/plain" |"my test subject" |"Here is a listing of HTML tags : <b>jfjfjfj</b>, <i>jfhdgdgdfj</i>, <u>jfjaaafj</u>" |"Here is a listing of HTML tags : <b>jfjfjfj</b>, <i>jfhdgdgdfj</i>, <u>jfjaaafj</u>" |
+
+ Scenario: Retrieving message should filter properties
+ Given the user has a message in "inbox" mailbox with subject "my test subject" and content "testmail"
+ When the user is getting his messages with parameters
+ |ids |["username@domain.tld\|inbox\|1"] |
+ |properties |["id", "subject"] |
+ Then no error is returned
+ And the list should contain 1 message
+ And the id of the message is "username@domain.tld|inbox|1"
+ And the subject of the message is "my test subject"
+ And the property "textBody" of the message is null
+ And the property "isUnread" of the message is null
+ And the property "preview" of the message is null
+ And the property "headers" of the message is null
+ And the property "date" of the message is null
+
+ Scenario: Retrieving message should filter header properties
+ Given the user has a message in "inbox" mailbox with subject "my test subject" and content "testmail" with headers
+ |From |user@domain.tld |
+ |header1 |Header1Content |
+ |HEADer2 |Header2Content |
+ When the user is getting his messages with parameters
+ |ids |["username@domain.tld\|inbox\|1"] |
+ |properties |["headers.from", "headers.heADER2"] |
+ Then no error is returned
+ And the list should contain 1 message
+ And the id of the message is "username@domain.tld|inbox|1"
+ And the property "subject" of the message is null
+ And the property "textBody" of the message is null
+ And the property "isUnread" of the message is null
+ And the property "preview" of the message is null
+ And the headers of the message contains:
+ |from |user@domain.tld |
+ |header2 |Header2Content |
+ And the property "date" of the message is null
+
+ Scenario: Retrieving message should return not found when id does not match
+ Given the user has a message in "inbox" mailbox with subject "my test subject" and content "testmail"
+ When the user ask for messages "["username@domain.tld|inbox|12"]"
+ Then no error is returned
+ And the list of messages is empty
+ And the notFound list should contains "username@domain.tld|inbox|12"
+
+ Scenario: Retrieving message should return mandatory properties when not asked
+ Given the user has a message in "inbox" mailbox with subject "my test subject" and content "testmail"
+ When the user is getting his messages with parameters
+ |ids |["username@domain.tld\|inbox\|1"] |
+ |properties |["subject"] |
+ Then no error is returned
+ And the list should contain 1 message
+ And the id of the message is "username@domain.tld|inbox|1"
+ And the subject of the message is "my test subject"
+
+ Scenario: Retrieving message should return attachments when some
+ Given the user has a message in "inbox" mailbox with two attachments
+ When the user ask for messages "["username@domain.tld|inbox|1"]"
+ Then no error is returned
+ And the list should contain 1 message
+ And the hasAttachment of the message is "true"
+ And the list of attachments of the message contains 2 attachments
+ And the first attachment is:
+ |blobId |"223a76c0e8c1b1762487d8e0598bd88497d73ef2" |
+ |type |"image/jpeg" |
+ |size |846 |
+ And the second attachment is:
+ |blobId |"58aa22c2ec5770fb9e574ba19008dbfc647eba43" |
+ |type |"image/jpeg" |
+ |size |597 |
+
+ Scenario: Retrieving message should return attachments and html body when some attachments and html message
+ Given the user has a message in "inbox" mailbox with two attachments
+ When the user ask for messages "["username@domain.tld|inbox|1"]"
+ Then no error is returned
+ And the list should contain 1 message
+ And the hasAttachment of the message is "true"
+ And the list of attachments of the message contains 2 attachments
+ And the preview of the message is "html\n"
+ And the property "textBody" of the message is null
+ And the htmlBody of the message is "<b>html</b>\n"
+
+ Scenario: Retrieving message should return attachments and text body when some attachments and text message
+ Given the user has a message in "inbox" mailbox with two attachments in text
+ When the user ask for messages "["username@domain.tld|inbox|1"]"
+ Then no error is returned
+ And the list should contain 1 message
+ And the hasAttachment of the message is "true"
+ And the list of attachments of the message contains 2 attachments
+ And the preview of the message is "html\n"
+ And the textBody of the message is "html\n"
+ And the property "htmlBody" of the message is null
+
+ Scenario: Retrieving message should return attachments and both html/text body when some attachments and both html/text message
+ Given the user has a multipart message in "inbox" mailbox
+ When the user ask for messages "["username@domain.tld|inbox|1"]"
+ Then no error is returned
+ And the list should contain 1 message
+ And the hasAttachment of the message is "true"
+ And the list of attachments of the message contains 1 attachment
+ And the preview of the message is "blabla\nbloblo\n"
+ And the textBody of the message is "/blabla/\n*bloblo*\n"
+ And the htmlBody of the message is "<i>blabla</i>\n<b>bloblo</b>\n"
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/htmlAndTextMultipartWithOneAttachment.eml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/htmlAndTextMultipartWithOneAttachment.eml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/htmlAndTextMultipartWithOneAttachment.eml
new file mode 100644
index 0000000..a5ddc8b
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/htmlAndTextMultipartWithOneAttachment.eml
@@ -0,0 +1,64 @@
+Return-Path: <us...@open-paas.org>
+MIME-Version: 1.0
+Delivered-To: user0@open-paas.org
+Received: from 172.18.0.1 (EHLO [172.18.0.1]) ([172.18.0.1])
+ by open-paas.org (JAMES SMTP Server ) with ESMTP ID -674616268
+ for <us...@open-paas.org>;
+ Tue, 07 Jun 2016 14:23:37 +0000 (UTC)
+To: user0@open-paas.org
+From: user0 <us...@open-paas.org>
+Subject: BOTH
+Message-ID: <1c...@open-paas.org>
+Date: Tue, 7 Jun 2016 16:23:37 +0200
+User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
+ Thunderbird/45.1.1
+Content-Type: multipart/mixed;
+ boundary="------------7AF1D14DE1DFA16229726B54"
+
+This is a multi-part message in MIME format.
+--------------7AF1D14DE1DFA16229726B54
+Content-Type: multipart/alternative;
+ boundary="------------172F9470CFA3BF3417835D92"
+
+
+--------------172F9470CFA3BF3417835D92
+Content-Type: text/plain; charset=utf-8; format=flowed
+Content-Transfer-Encoding: 7bit
+
+/blabla/
+*bloblo*
+
+--------------172F9470CFA3BF3417835D92
+Content-Type: text/html; charset=utf-8
+Content-Transfer-Encoding: 7bit
+
+<i>blabla</i>
+<b>bloblo</b>
+
+--------------172F9470CFA3BF3417835D92--
+
+--------------7AF1D14DE1DFA16229726B54
+Content-Type: image/jpeg;
+ name="4037_014.jpg"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment;
+ filename="4037_014.jpg"
+
+/9j/4X2cRXhpZgAASUkqAAgAAAANAA8BAgAKAAAAqgAAABABAgAJAAAAtAAAABIBAwABAAAA
+AQAAABoBBQABAAAAvgAAABsBBQABAAAAxgAAACgBAwABAAAAAgAAADEBAgAKAAAAzgAAADIB
+AgAUAAAA2AAAABMCAwABAAAAAgAAAGmHBAABAAAAfAIAAKXEBwDQAAAA7AAAANLGBwBAAAAA
+vAEAANPGBwCAAAAA/AEAAEwqAABQYW5hc29uaWMARE1DLUZaNDUAALQAAAABAAAAtAAAAAEA
+AABWZXIuMS4wICAAMjAxNDowMjoyNSAxMDozMjowOQBQcmludElNADAyNTAAAA4AAQAWABYA
+AgAAAAAAAwBkAAAABwAAAAAACAAAAAAACQAAAAAACgAAAAAACwCsAAAADAAAAAAADQAAAAAA
+DgDEAAAAAAEFAAAAAQEBAAAAEAGAAAAACREAABAnAAALDwAAECcAAJcFAAAQJwAAsAgAABAn
+AAABHAAAECcAAF4CAAAQJwAAiwAAABAnAADLAwAAECcAAOUbAAAQJwAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+
+--------------7AF1D14DE1DFA16229726B54--
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachments.eml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachments.eml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachments.eml
new file mode 100644
index 0000000..85f0e3b
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachments.eml
@@ -0,0 +1,73 @@
+Return-Path: <fr...@linagora.com>
+Received: from alderaan.linagora.com (smtp.linagora.dc1 [172.16.18.53])
+ by imap (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA;
+ Fri, 27 Feb 2015 20:32:14 +0100
+X-Sieve: CMU Sieve 2.2
+Received: from canondir.par.lng (unknown [92.103.166.6])
+ (using TLSv1 with cipher AES256-SHA (256/256 bits))
+ (No client certificate requested)
+ by alderaan.linagora.com (Postfix) with ESMTPSA id BAB0D728
+ for <to...@linagora.com>; Fri, 27 Feb 2015 20:31:38 +0100 (CET)
+X-Priority: 3 (Normal)
+From: "From"
+ <fr...@linagora.com>
+To: "To"
+ <to...@linagora.com>
+Subject: [8/10]Attached Image light with text
+Date: Fri, 27 Mar 2015 21:48:38 +0100
+Message-Id: <20...@canondir.par.lng>
+Mime-Version: 1.0
+Content-Type: multipart/mixed;
+ boundary="AHNPACBLDCDIDAGGGDDFAABECGCA"
+
+--AHNPACBLDCDIDAGGGDDFAABECGCA
+Content-Type: text/html; charset=utf-8; format=flowed
+Content-Transfer-Encoding: 8bit
+
+<b>html</b>
+
+--AHNPACBLDCDIDAGGGDDFAABECGCA
+Content-Type: image/jpeg;
+ name="4037_014.jpg"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment;
+ filename="4037_014.jpg"
+
+/9j/4X2cRXhpZgAASUkqAAgAAAANAA8BAgAKAAAAqgAAABABAgAJAAAAtAAAABIBAwABAAAA
+AQAAABoBBQABAAAAvgAAABsBBQABAAAAxgAAACgBAwABAAAAAgAAADEBAgAKAAAAzgAAADIB
+AgAUAAAA2AAAABMCAwABAAAAAgAAAGmHBAABAAAAfAIAAKXEBwDQAAAA7AAAANLGBwBAAAAA
+vAEAANPGBwCAAAAA/AEAAEwqAABQYW5hc29uaWMARE1DLUZaNDUAALQAAAABAAAAtAAAAAEA
+AABWZXIuMS4wICAAMjAxNDowMjoyNSAxMDozMjowOQBQcmludElNADAyNTAAAA4AAQAWABYA
+AgAAAAAAAwBkAAAABwAAAAAACAAAAAAACQAAAAAACgAAAAAACwCsAAAADAAAAAAADQAAAAAA
+DgDEAAAAAAEFAAAAAQEBAAAAEAGAAAAACREAABAnAAALDwAAECcAAJcFAAAQJwAAsAgAABAn
+AAABHAAAECcAAF4CAAAQJwAAiwAAABAnAADLAwAAECcAAOUbAAAQJwAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+
+--AHNPACBLDCDIDAGGGDDFAABECGCA
+Content-Type: image/jpeg;
+ name="4037_015.jpg"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment;
+ filename="4037_015.jpg"
+
+iVBORw0KGgoAAAANSUhEUgAABYUAAAL4CAIAAACrzA8fAAAACXBIWXMAAAsTAAALEwEAmpwY
+AAAAB3RJTUUH3wMNDiUMca0XkQAAIABJREFUeNq8vWm0bdlVHja/tc+99zX13qv2VSeVmlIv
+FSqEOhA2AoEhxMRBg8QOyEkG6WMDSZzhMQTGDDcwiJPhBBMby4SMDJthgmOMAYvGMcF0QgIU
+WRKobymp+qpX9fp779nry4+9mjnnWuuc80qMvCpdvXrv3nP22Xutueb85je/D1/3+q+ipF9z
+nGfGdZznGCMjKaSIkJQwBYSAEMI0Tatptdrb21utVqvVtJKAAAABEAAiUP+IiECYfsfyJf1B
+10+cOHH48OGVlZVSypaWlv379zc2Nr722msNDQ2u+y9zaYQeAQAAAACCHgEAAAB0y969e+ON
+KnpOe3v7JZdccj6fwPXr10+aNKnAB956663Zs2fjTgMAAADOKzhOAQAAAFCYs+yO0XfNNQAA
+AAAA/nNBfgQAAADQDVddddW6detSqdQZ7JvL5W655RZIEgAAAAAAEayKigqcBQAAAKAAhw8f
+3rZt25AhQwYNGpTJZHq4V2tr6/bt25csWbJjxw6cQwAAAACACMiPAAAAAAAAAAAAQH8D/wgA
+AAAAAAAAAAD0N9AjAAAAAAAAAAAA0N9AjwAAAAAAAAAAAEB/Az0CAAAAAAAAAAAA/Q30CAAA
+AAAAAAAAAPQ30CMAAAAAAAAAAADQ30CPAAAAAAAAAAAAQH/z/0IKJwmNQbpqAAAAAElFTkSu
+QmCC
+
+--AHNPACBLDCDIDAGGGDDFAABECGCA--
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachmentsTextPlain.eml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachmentsTextPlain.eml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachmentsTextPlain.eml
new file mode 100644
index 0000000..7760185
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/twoAttachmentsTextPlain.eml
@@ -0,0 +1,73 @@
+Return-Path: <fr...@linagora.com>
+Received: from alderaan.linagora.com (smtp.linagora.dc1 [172.16.18.53])
+ by imap (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA;
+ Fri, 27 Feb 2015 20:32:14 +0100
+X-Sieve: CMU Sieve 2.2
+Received: from canondir.par.lng (unknown [92.103.166.6])
+ (using TLSv1 with cipher AES256-SHA (256/256 bits))
+ (No client certificate requested)
+ by alderaan.linagora.com (Postfix) with ESMTPSA id BAB0D728
+ for <to...@linagora.com>; Fri, 27 Feb 2015 20:31:38 +0100 (CET)
+X-Priority: 3 (Normal)
+From: "From"
+ <fr...@linagora.com>
+To: "To"
+ <to...@linagora.com>
+Subject: [8/10]Attached Image light with text
+Date: Fri, 27 Mar 2015 21:48:38 +0100
+Message-Id: <20...@canondir.par.lng>
+Mime-Version: 1.0
+Content-Type: multipart/mixed;
+ boundary="AHNPACBLDCDIDAGGGDDFAABECGCA"
+
+--AHNPACBLDCDIDAGGGDDFAABECGCA
+Content-Type: text/plain; charset=utf-8; format=flowed
+Content-Transfer-Encoding: 8bit
+
+html
+
+--AHNPACBLDCDIDAGGGDDFAABECGCA
+Content-Type: image/jpeg;
+ name="4037_014.jpg"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment;
+ filename="4037_014.jpg"
+
+/9j/4X2cRXhpZgAASUkqAAgAAAANAA8BAgAKAAAAqgAAABABAgAJAAAAtAAAABIBAwABAAAA
+AQAAABoBBQABAAAAvgAAABsBBQABAAAAxgAAACgBAwABAAAAAgAAADEBAgAKAAAAzgAAADIB
+AgAUAAAA2AAAABMCAwABAAAAAgAAAGmHBAABAAAAfAIAAKXEBwDQAAAA7AAAANLGBwBAAAAA
+vAEAANPGBwCAAAAA/AEAAEwqAABQYW5hc29uaWMARE1DLUZaNDUAALQAAAABAAAAtAAAAAEA
+AABWZXIuMS4wICAAMjAxNDowMjoyNSAxMDozMjowOQBQcmludElNADAyNTAAAA4AAQAWABYA
+AgAAAAAAAwBkAAAABwAAAAAACAAAAAAACQAAAAAACgAAAAAACwCsAAAADAAAAAAADQAAAAAA
+DgDEAAAAAAEFAAAAAQEBAAAAEAGAAAAACREAABAnAAALDwAAECcAAJcFAAAQJwAAsAgAABAn
+AAABHAAAECcAAF4CAAAQJwAAiwAAABAnAADLAwAAECcAAOUbAAAQJwAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+
+--AHNPACBLDCDIDAGGGDDFAABECGCA
+Content-Type: image/jpeg;
+ name="4037_015.jpg"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment;
+ filename="4037_015.jpg"
+
+iVBORw0KGgoAAAANSUhEUgAABYUAAAL4CAIAAACrzA8fAAAACXBIWXMAAAsTAAALEwEAmpwY
+AAAAB3RJTUUH3wMNDiUMca0XkQAAIABJREFUeNq8vWm0bdlVHja/tc+99zX13qv2VSeVmlIv
+FSqEOhA2AoEhxMRBg8QOyEkG6WMDSZzhMQTGDDcwiJPhBBMby4SMDJthgmOMAYvGMcF0QgIU
+WRKobymp+qpX9fp779nry4+9mjnnWuuc80qMvCpdvXrv3nP22Xutueb85je/D1/3+q+ipF9z
+nGfGdZznGCMjKaSIkJQwBYSAEMI0Tatptdrb21utVqvVtJKAAAABEAAiUP+IiECYfsfyJf1B
+10+cOHH48OGVlZVSypaWlv379zc2Nr722msNDQ2u+y9zaYQeAQAAAACCHgEAAAB0y969e+ON
+KnpOe3v7JZdccj6fwPXr10+aNKnAB956663Zs2fjTgMAAADOKzhOAQAAAFCYs+yO0XfNNQAA
+AAAA/nNBfgQAAADQDVddddW6detSqdQZ7JvL5W655RZIEgAAAAAAEayKigqcBQAAAKAAhw8f
+3rZt25AhQwYNGpTJZHq4V2tr6/bt25csWbJjxw6cQwAAAACACMiPAAAAAAAAAAAAQH8D/wgA
+AAAAAAAAAAD0N9AjAAAAAAAAAAAA0N9AjwAAAAAAAAAAAEB/Az0CAAAAAAAAAAAA/Q30CAAA
+AAAAAAAAAPQ30CMAAAAAAAAAAADQ30CPAAAAAAAAAAAAQH/z/0IKJwmNQbpqAAAAAElFTkSu
+QmCC
+
+--AHNPACBLDCDIDAGGGDDFAABECGCA--
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/htmlAndTextMultipartWithOneAttachment.eml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/htmlAndTextMultipartWithOneAttachment.eml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/htmlAndTextMultipartWithOneAttachment.eml
deleted file mode 100644
index a5ddc8b..0000000
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/htmlAndTextMultipartWithOneAttachment.eml
+++ /dev/null
@@ -1,64 +0,0 @@
-Return-Path: <us...@open-paas.org>
-MIME-Version: 1.0
-Delivered-To: user0@open-paas.org
-Received: from 172.18.0.1 (EHLO [172.18.0.1]) ([172.18.0.1])
- by open-paas.org (JAMES SMTP Server ) with ESMTP ID -674616268
- for <us...@open-paas.org>;
- Tue, 07 Jun 2016 14:23:37 +0000 (UTC)
-To: user0@open-paas.org
-From: user0 <us...@open-paas.org>
-Subject: BOTH
-Message-ID: <1c...@open-paas.org>
-Date: Tue, 7 Jun 2016 16:23:37 +0200
-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
- Thunderbird/45.1.1
-Content-Type: multipart/mixed;
- boundary="------------7AF1D14DE1DFA16229726B54"
-
-This is a multi-part message in MIME format.
---------------7AF1D14DE1DFA16229726B54
-Content-Type: multipart/alternative;
- boundary="------------172F9470CFA3BF3417835D92"
-
-
---------------172F9470CFA3BF3417835D92
-Content-Type: text/plain; charset=utf-8; format=flowed
-Content-Transfer-Encoding: 7bit
-
-/blabla/
-*bloblo*
-
---------------172F9470CFA3BF3417835D92
-Content-Type: text/html; charset=utf-8
-Content-Transfer-Encoding: 7bit
-
-<i>blabla</i>
-<b>bloblo</b>
-
---------------172F9470CFA3BF3417835D92--
-
---------------7AF1D14DE1DFA16229726B54
-Content-Type: image/jpeg;
- name="4037_014.jpg"
-Content-Transfer-Encoding: base64
-Content-Disposition: attachment;
- filename="4037_014.jpg"
-
-/9j/4X2cRXhpZgAASUkqAAgAAAANAA8BAgAKAAAAqgAAABABAgAJAAAAtAAAABIBAwABAAAA
-AQAAABoBBQABAAAAvgAAABsBBQABAAAAxgAAACgBAwABAAAAAgAAADEBAgAKAAAAzgAAADIB
-AgAUAAAA2AAAABMCAwABAAAAAgAAAGmHBAABAAAAfAIAAKXEBwDQAAAA7AAAANLGBwBAAAAA
-vAEAANPGBwCAAAAA/AEAAEwqAABQYW5hc29uaWMARE1DLUZaNDUAALQAAAABAAAAtAAAAAEA
-AABWZXIuMS4wICAAMjAxNDowMjoyNSAxMDozMjowOQBQcmludElNADAyNTAAAA4AAQAWABYA
-AgAAAAAAAwBkAAAABwAAAAAACAAAAAAACQAAAAAACgAAAAAACwCsAAAADAAAAAAADQAAAAAA
-DgDEAAAAAAEFAAAAAQEBAAAAEAGAAAAACREAABAnAAALDwAAECcAAJcFAAAQJwAAsAgAABAn
-AAABHAAAECcAAF4CAAAQJwAAiwAAABAnAADLAwAAECcAAOUbAAAQJwAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-
---------------7AF1D14DE1DFA16229726B54--
http://git-wip-us.apache.org/repos/asf/james-project/blob/6468afca/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/twoAttachments.eml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/twoAttachments.eml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/twoAttachments.eml
deleted file mode 100644
index 85f0e3b..0000000
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/twoAttachments.eml
+++ /dev/null
@@ -1,73 +0,0 @@
-Return-Path: <fr...@linagora.com>
-Received: from alderaan.linagora.com (smtp.linagora.dc1 [172.16.18.53])
- by imap (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA;
- Fri, 27 Feb 2015 20:32:14 +0100
-X-Sieve: CMU Sieve 2.2
-Received: from canondir.par.lng (unknown [92.103.166.6])
- (using TLSv1 with cipher AES256-SHA (256/256 bits))
- (No client certificate requested)
- by alderaan.linagora.com (Postfix) with ESMTPSA id BAB0D728
- for <to...@linagora.com>; Fri, 27 Feb 2015 20:31:38 +0100 (CET)
-X-Priority: 3 (Normal)
-From: "From"
- <fr...@linagora.com>
-To: "To"
- <to...@linagora.com>
-Subject: [8/10]Attached Image light with text
-Date: Fri, 27 Mar 2015 21:48:38 +0100
-Message-Id: <20...@canondir.par.lng>
-Mime-Version: 1.0
-Content-Type: multipart/mixed;
- boundary="AHNPACBLDCDIDAGGGDDFAABECGCA"
-
---AHNPACBLDCDIDAGGGDDFAABECGCA
-Content-Type: text/html; charset=utf-8; format=flowed
-Content-Transfer-Encoding: 8bit
-
-<b>html</b>
-
---AHNPACBLDCDIDAGGGDDFAABECGCA
-Content-Type: image/jpeg;
- name="4037_014.jpg"
-Content-Transfer-Encoding: base64
-Content-Disposition: attachment;
- filename="4037_014.jpg"
-
-/9j/4X2cRXhpZgAASUkqAAgAAAANAA8BAgAKAAAAqgAAABABAgAJAAAAtAAAABIBAwABAAAA
-AQAAABoBBQABAAAAvgAAABsBBQABAAAAxgAAACgBAwABAAAAAgAAADEBAgAKAAAAzgAAADIB
-AgAUAAAA2AAAABMCAwABAAAAAgAAAGmHBAABAAAAfAIAAKXEBwDQAAAA7AAAANLGBwBAAAAA
-vAEAANPGBwCAAAAA/AEAAEwqAABQYW5hc29uaWMARE1DLUZaNDUAALQAAAABAAAAtAAAAAEA
-AABWZXIuMS4wICAAMjAxNDowMjoyNSAxMDozMjowOQBQcmludElNADAyNTAAAA4AAQAWABYA
-AgAAAAAAAwBkAAAABwAAAAAACAAAAAAACQAAAAAACgAAAAAACwCsAAAADAAAAAAADQAAAAAA
-DgDEAAAAAAEFAAAAAQEBAAAAEAGAAAAACREAABAnAAALDwAAECcAAJcFAAAQJwAAsAgAABAn
-AAABHAAAECcAAF4CAAAQJwAAiwAAABAnAADLAwAAECcAAOUbAAAQJwAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-
---AHNPACBLDCDIDAGGGDDFAABECGCA
-Content-Type: image/jpeg;
- name="4037_015.jpg"
-Content-Transfer-Encoding: base64
-Content-Disposition: attachment;
- filename="4037_015.jpg"
-
-iVBORw0KGgoAAAANSUhEUgAABYUAAAL4CAIAAACrzA8fAAAACXBIWXMAAAsTAAALEwEAmpwY
-AAAAB3RJTUUH3wMNDiUMca0XkQAAIABJREFUeNq8vWm0bdlVHja/tc+99zX13qv2VSeVmlIv
-FSqEOhA2AoEhxMRBg8QOyEkG6WMDSZzhMQTGDDcwiJPhBBMby4SMDJthgmOMAYvGMcF0QgIU
-WRKobymp+qpX9fp779nry4+9mjnnWuuc80qMvCpdvXrv3nP22Xutueb85je/D1/3+q+ipF9z
-nGfGdZznGCMjKaSIkJQwBYSAEMI0Tatptdrb21utVqvVtJKAAAABEAAiUP+IiECYfsfyJf1B
-10+cOHH48OGVlZVSypaWlv379zc2Nr722msNDQ2u+y9zaYQeAQAAAACCHgEAAAB0y969e+ON
-KnpOe3v7JZdccj6fwPXr10+aNKnAB956663Zs2fjTgMAAADOKzhOAQAAAFCYs+yO0XfNNQAA
-AAAA/nNBfgQAAADQDVddddW6detSqdQZ7JvL5W655RZIEgAAAAAAEayKigqcBQAAAKAAhw8f
-3rZt25AhQwYNGpTJZHq4V2tr6/bt25csWbJjxw6cQwAAAACACMiPAAAAAAAAAAAAQH8D/wgA
-AAAAAAAAAAD0N9AjAAAAAAAAAAAA0N9AjwAAAAAAAAAAAEB/Az0CAAAAAAAAAAAA/Q30CAAA
-AAAAAAAAAPQ30CMAAAAAAAAAAADQ30CPAAAAAAAAAAAAQH/z/0IKJwmNQbpqAAAAAElFTkSu
-QmCC
-
---AHNPACBLDCDIDAGGGDDFAABECGCA--
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[2/4] james-project git commit: JAMES-1779 Fails when stepdef is not
defined
Posted by ad...@apache.org.
JAMES-1779 Fails when stepdef is not defined
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/f7444584
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/f7444584
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/f7444584
Branch: refs/heads/master
Commit: f7444584c9dfab11df465a8f1eb0f3e9b26899c2
Parents: d43fb7d
Author: Antoine Duprat <ad...@linagora.com>
Authored: Tue Jun 28 11:05:07 2016 +0200
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Tue Jun 28 11:05:52 2016 +0200
----------------------------------------------------------------------
.../jmap/cassandra/cucumber/CassandraDownloadCucumberTest.java | 3 ++-
.../cucumber/CassandraSetMailboxesMethodCucumberTest.java | 3 ++-
.../james/jmap/memory/cucumber/MemoryDownloadCucumberTest.java | 3 ++-
.../memory/cucumber/MemorySetMailboxesMethodCucumberTest.java | 3 ++-
4 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/f7444584/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraDownloadCucumberTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraDownloadCucumberTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraDownloadCucumberTest.java
index 9bbbdd2..bbf56bc 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraDownloadCucumberTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraDownloadCucumberTest.java
@@ -27,6 +27,7 @@ import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features={"classpath:cucumber/DownloadEndpoint.feature", "classpath:cucumber/DownloadGet.feature"},
glue={"org.apache.james.jmap.methods.integration", "org.apache.james.jmap.cassandra.cucumber"},
- tags = {"~@Ignore"})
+ tags = {"~@Ignore"},
+ strict = true)
public class CassandraDownloadCucumberTest {
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/f7444584/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSetMailboxesMethodCucumberTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSetMailboxesMethodCucumberTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSetMailboxesMethodCucumberTest.java
index 6e1ee33..3d0af24 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSetMailboxesMethodCucumberTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSetMailboxesMethodCucumberTest.java
@@ -26,6 +26,7 @@ import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features="classpath:cucumber/MailboxModification.feature",
- glue={"org.apache.james.jmap.methods.integration", "org.apache.james.jmap.cassandra.cucumber"})
+ glue={"org.apache.james.jmap.methods.integration", "org.apache.james.jmap.cassandra.cucumber"},
+ strict = true)
public class CassandraSetMailboxesMethodCucumberTest {
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/f7444584/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryDownloadCucumberTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryDownloadCucumberTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryDownloadCucumberTest.java
index 509fdac..85a0cdd 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryDownloadCucumberTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryDownloadCucumberTest.java
@@ -27,6 +27,7 @@ import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features={"classpath:cucumber/DownloadEndpoint.feature", "classpath:cucumber/DownloadGet.feature"},
glue={"org.apache.james.jmap.methods.integration", "org.apache.james.jmap.memory.cucumber"},
- tags = {"~@Ignore"})
+ tags = {"~@Ignore"},
+ strict = true)
public class MemoryDownloadCucumberTest {
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/f7444584/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySetMailboxesMethodCucumberTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySetMailboxesMethodCucumberTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySetMailboxesMethodCucumberTest.java
index 52b25fd..c61cfb5 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySetMailboxesMethodCucumberTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemorySetMailboxesMethodCucumberTest.java
@@ -26,6 +26,7 @@ import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features="classpath:cucumber/MailboxModification.feature",
- glue={"org.apache.james.jmap.methods.integration", "org.apache.james.jmap.memory.cucumber"})
+ glue={"org.apache.james.jmap.methods.integration", "org.apache.james.jmap.memory.cucumber"},
+ strict = true)
public class MemorySetMailboxesMethodCucumberTest {
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org