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 bt...@apache.org on 2017/03/14 11:14:44 UTC
[03/21] james-project git commit: JAMES-1902 split probes to prevent
them to pull unwanted dependencies
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
index df568cf..87d0c94 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
@@ -46,7 +46,11 @@ import org.apache.james.jmap.api.access.AccessToken;
import org.apache.james.mailbox.model.MailboxConstants;
import org.apache.james.mailbox.model.MailboxId;
import org.apache.james.mailbox.store.mail.model.Mailbox;
+import org.apache.james.mailbox.store.probe.MailboxProbe;
+import org.apache.james.modules.MailboxProbeImpl;
+import org.apache.james.probe.DataProbe;
import org.apache.james.utils.JmapGuiceProbe;
+import org.apache.james.utils.DataProbeImpl;
import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Before;
@@ -71,12 +75,16 @@ public abstract class SetMailboxesMethodTest {
private AccessToken accessToken;
private String username;
private GuiceJamesServer jmapServer;
-
+ private MailboxProbe mailboxProbe;
+ private DataProbe dataProbe;
+
@Before
public void setup() throws Throwable {
jmapServer = createJmapServer();
jmapServer.start();
-
+ mailboxProbe = jmapServer.getProbe(MailboxProbeImpl.class);
+ dataProbe = jmapServer.getProbe(DataProbeImpl.class);
+
RestAssured.requestSpecification = new RequestSpecBuilder()
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
@@ -87,9 +95,9 @@ public abstract class SetMailboxesMethodTest {
username = "username@" + USERS_DOMAIN;
String password = "password";
- jmapServer.serverProbe().addDomain(USERS_DOMAIN);
- jmapServer.serverProbe().addUser(username, password);
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, MailboxConstants.INBOX);
+ dataProbe.addDomain(USERS_DOMAIN);
+ dataProbe.addUser(username, password);
+ mailboxProbe.createMailbox("#private", username, DefaultMailboxes.INBOX);
accessToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), username, password);
await();
@@ -144,8 +152,8 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldNotUpdateMailboxWhenOverLimitName() {
String overLimitName = StringUtils.repeat("a", MAILBOX_NAME_LENGTH_64K);
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
"[" +
@@ -206,8 +214,8 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldUpdateMailboxWhenOverLimitName() throws Exception {
String overLimitName = StringUtils.repeat("a", MAILBOX_NAME_LENGTH_64K);
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
"[" +
@@ -232,7 +240,7 @@ public abstract class SetMailboxesMethodTest {
.body(NAME, equalTo("mailboxesSet"))
.body(ARGUMENTS + ".updated", contains(mailboxId));
- assertThat(jmapServer.serverProbe().listSubscriptions(username)).containsOnly(overLimitName);
+ assertThat(jmapServer.getProbe(MailboxProbeImpl.class).listSubscriptions(username)).containsOnly(overLimitName);
}
@Test
@@ -261,12 +269,12 @@ public abstract class SetMailboxesMethodTest {
.body(NAME, equalTo("mailboxesSet"))
.body(ARGUMENTS + ".created", hasKey("create-id01"));
- assertThat(jmapServer.serverProbe().listSubscriptions(username)).containsOnly("foo");
+ assertThat(jmapServer.getProbe(MailboxProbeImpl.class).listSubscriptions(username)).containsOnly("foo");
}
@Test
public void userShouldBeSubscribedOnCreatedMailboxWhenCreateChildOfInboxMailbox() throws Exception {
- MailboxId inboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, MailboxConstants.INBOX).getMailboxId();
+ MailboxId inboxId = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, MailboxConstants.INBOX).getMailboxId();
String requestBody =
"[" +
@@ -289,15 +297,15 @@ public abstract class SetMailboxesMethodTest {
.when()
.post("/jmap");
- assertThat(jmapServer.serverProbe().listSubscriptions(username)).containsOnly(DefaultMailboxes.INBOX + ".foo");
+ assertThat(jmapServer.getProbe(MailboxProbeImpl.class).listSubscriptions(username)).containsOnly(DefaultMailboxes.INBOX + ".foo");
}
@Test
public void subscriptionUserShouldBeChangedWhenUpdateMailbox() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "root");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "root");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
@@ -318,7 +326,7 @@ public abstract class SetMailboxesMethodTest {
.body(requestBody)
.post("/jmap");
- assertThat(jmapServer.serverProbe().listSubscriptions(username)).containsOnly("mySecondBox");
+ assertThat(jmapServer.getProbe(MailboxProbeImpl.class).listSubscriptions(username)).containsOnly("mySecondBox");
}
@Test
@@ -347,7 +355,7 @@ public abstract class SetMailboxesMethodTest {
.body(NAME, equalTo("mailboxesSet"))
.body(ARGUMENTS + ".created", hasKey("create-id01"));
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "foo");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "foo");
String mailboxId = mailbox.getMailboxId().serialize();
requestBody =
@@ -369,13 +377,13 @@ public abstract class SetMailboxesMethodTest {
.body(requestBody)
.post("/jmap");
- assertThat(jmapServer.serverProbe().listSubscriptions(username)).containsOnly("mySecondBox");
+ assertThat(jmapServer.getProbe(MailboxProbeImpl.class).listSubscriptions(username)).containsOnly("mySecondBox");
}
@Test
public void subscriptionUserShouldBeDeletedWhenDestroyMailbox() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String requestBody =
"[" +
" [ \"setMailboxes\"," +
@@ -394,7 +402,7 @@ public abstract class SetMailboxesMethodTest {
.then()
.statusCode(200);
- assertThat(jmapServer.serverProbe().listSubscriptions(username)).isEmpty();
+ assertThat(jmapServer.getProbe(MailboxProbeImpl.class).listSubscriptions(username)).isEmpty();
}
@Test
@@ -423,7 +431,7 @@ public abstract class SetMailboxesMethodTest {
.body(NAME, equalTo("mailboxesSet"))
.body(ARGUMENTS + ".created", hasKey("create-id01"));
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "foo");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "foo");
requestBody =
"[" +
@@ -443,7 +451,7 @@ public abstract class SetMailboxesMethodTest {
.then()
.statusCode(200);
- assertThat(jmapServer.serverProbe().listSubscriptions(username)).isEmpty();
+ assertThat(jmapServer.getProbe(MailboxProbeImpl.class).listSubscriptions(username)).isEmpty();
}
@Test
@@ -606,7 +614,7 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldCreateMailboxWhenChildOfInboxMailbox() {
- MailboxId inboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, MailboxConstants.INBOX).getMailboxId();
+ MailboxId inboxId = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, MailboxConstants.INBOX).getMailboxId();
String requestBody =
"[" +
@@ -747,7 +755,7 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnNotCreatedWhenMailboxAlreadyExists() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String requestBody =
"[" +
" [ \"setMailboxes\"," +
@@ -849,8 +857,8 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnDestroyedMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
"[" +
@@ -875,8 +883,8 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldDestroyMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String requestBody =
"[" +
" [ \"setMailboxes\"," +
@@ -935,9 +943,9 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnNotDestroyedWhenMailboxHasChild() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox.child");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox.child");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
"[" +
@@ -965,7 +973,7 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnNotDestroyedWhenSystemMailbox() {
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, MailboxConstants.INBOX);
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, MailboxConstants.INBOX);
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
"[" +
@@ -993,11 +1001,11 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnDestroyedWhenParentThenChildMailboxes() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "parent");
- Mailbox parentMailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "parent");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "parent");
+ Mailbox parentMailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "parent");
String parentMailboxId = parentMailbox.getMailboxId().serialize();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "parent.child");
- Mailbox childMailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "parent.child");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "parent.child");
+ Mailbox childMailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "parent.child");
String childMailboxId = childMailbox.getMailboxId().serialize();
String requestBody =
"[" +
@@ -1022,11 +1030,11 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnDestroyedWhenChildThenParentMailboxes() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "parent");
- Mailbox parentMailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "parent");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "parent");
+ Mailbox parentMailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "parent");
String parentMailboxId = parentMailbox.getMailboxId().serialize();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "parent.child");
- Mailbox childMailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "parent.child");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "parent.child");
+ Mailbox childMailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "parent.child");
String childMailboxId = childMailbox.getMailboxId().serialize();
String requestBody =
"[" +
@@ -1050,9 +1058,9 @@ public abstract class SetMailboxesMethodTest {
}
private MailboxId getRemovedMailboxId() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "quicklyRemoved");
- MailboxId removedId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "quicklyRemoved").getMailboxId();
- jmapServer.serverProbe().deleteMailbox(MailboxConstants.USER_NAMESPACE, username, "quicklyRemoved");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "quicklyRemoved");
+ MailboxId removedId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "quicklyRemoved").getMailboxId();
+ mailboxProbe.deleteMailbox(MailboxConstants.USER_NAMESPACE, username, "quicklyRemoved");
return removedId;
}
@@ -1088,8 +1096,8 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnUpdatedMailboxIdWhenNoUpdateAskedOnExistingMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
"[" +
@@ -1117,8 +1125,8 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnUpdatedWhenNameUpdateAskedOnExistingMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
"[" +
@@ -1147,8 +1155,8 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldUpdateMailboxNameWhenNameUpdateAskedOnExistingMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
"[" +
@@ -1183,12 +1191,12 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnMailboxIdWhenMovingToAnotherParentMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String mailboxId = mailbox.getMailboxId().serialize();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myChosenParentBox");
- Mailbox chosenMailboxParent = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myChosenParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myChosenParentBox");
+ Mailbox chosenMailboxParent = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myChosenParentBox");
String chosenMailboxParentId = chosenMailboxParent.getMailboxId().serialize();
String requestBody =
@@ -1218,12 +1226,12 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldUpdateMailboxParentIdWhenMovingToAnotherParentMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
String mailboxId = mailbox.getMailboxId().serialize();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
- Mailbox newParentMailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
+ Mailbox newParentMailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
String newParentMailboxId = newParentMailbox.getMailboxId().serialize();
String requestBody =
@@ -1259,14 +1267,14 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnMailboxIdWhenParentIdUpdateAskedOnExistingMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
String mailboxId = mailbox.getMailboxId().serialize();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
- Mailbox newParentMailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
+ Mailbox newParentMailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
String newParentMailboxId = newParentMailbox.getMailboxId().serialize();
String requestBody =
@@ -1296,14 +1304,14 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldUpdateMailboxParentIdWhenParentIdUpdateAskedOnExistingMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
String mailboxId = mailbox.getMailboxId().serialize();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
- Mailbox newParentMailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
+ Mailbox newParentMailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
String newParentMailboxId = newParentMailbox.getMailboxId().serialize();
String requestBody =
@@ -1339,10 +1347,10 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnMailboxIdWhenParentIdUpdateAskedAsOrphanForExistingMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
@@ -1372,10 +1380,10 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldUpdateParentIdWhenAskedAsOrphanForExistingMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
@@ -1411,14 +1419,14 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnMailboxIdWhenNameAndParentIdUpdateForExistingMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
String mailboxId = mailbox.getMailboxId().serialize();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
- Mailbox newParentMailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
+ Mailbox newParentMailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
String newParentMailboxId = newParentMailbox.getMailboxId().serialize();
String requestBody =
@@ -1449,14 +1457,14 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShoulUpdateMailboxIAndParentIddWhenBothUpdatedForExistingMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myPreviousParentBox.myBox");
String mailboxId = mailbox.getMailboxId().serialize();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
- Mailbox newParentMailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
+ Mailbox newParentMailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
String newParentMailboxId = newParentMailbox.getMailboxId().serialize();
String requestBody =
@@ -1494,8 +1502,8 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnNotUpdatedWhenNameContainsPathDelimiter() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
"[" +
@@ -1526,8 +1534,8 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnNotUpdatedWhenNewParentDoesntExist() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String badParentId = getRemovedMailboxId().serialize();
String requestBody =
@@ -1559,16 +1567,16 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnNotUpdatedWhenUpdatingParentIdOfAParentMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "root");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "root");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
String mailboxId = mailbox.getMailboxId().serialize();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox.child");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox.child");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
- Mailbox newParentMailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
+ Mailbox newParentMailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myNewParentBox");
String newParentMailboxId = newParentMailbox.getMailboxId().serialize();
@@ -1601,11 +1609,11 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnNotUpdatedWhenRenamingAMailboxToAnAlreadyExistingMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String mailboxId = mailbox.getMailboxId().serialize();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mySecondBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "mySecondBox");
String requestBody =
"[" +
@@ -1636,10 +1644,10 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnUpdatedWhenRenamingAChildMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "root");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "root");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
@@ -1669,10 +1677,10 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldUpdateMailboxNameWhenRenamingAChildMailbox() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "root");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "root");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "root.myBox");
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
@@ -1709,7 +1717,7 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnNotUpdatedWhenRenamingSystemMailbox() {
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, MailboxConstants.INBOX);
+ Mailbox mailbox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, MailboxConstants.INBOX);
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
@@ -1742,8 +1750,8 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnNotUpdatedWhenRenameToSystemMailboxName() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
- Mailbox mailboxMyBox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
+ Mailbox mailboxMyBox = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "myBox");
String mailboxIdMyBox = mailboxMyBox.getMailboxId().serialize();
String requestBody =
@@ -1776,15 +1784,15 @@ public abstract class SetMailboxesMethodTest {
@Test
public void setMailboxesShouldReturnNotUpdatedErrorWhenMovingMailboxTriggersNameConflict() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "A");
- Mailbox mailboxRootA = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "A");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "A");
+ Mailbox mailboxRootA = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "A");
String mailboxRootAId = mailboxRootA.getMailboxId().serialize();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "A.B");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "A.C");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "A.B");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "A.C");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "A.B.C");
- Mailbox mailboxChildToMoveC = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "A.B.C");
+ jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "A.B.C");
+ Mailbox mailboxChildToMoveC = jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, username, "A.B.C");
String mailboxChildToMoveCId = mailboxChildToMoveC.getMailboxId().serialize();
String requestBody =
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
index 278430f..8b6255e 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
@@ -66,8 +66,12 @@ import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.model.MessageId;
import org.apache.james.mailbox.store.event.EventFactory;
import org.apache.james.mailbox.store.mail.model.Mailbox;
+import org.apache.james.mailbox.store.probe.MailboxProbe;
+import org.apache.james.modules.MailboxProbeImpl;
+import org.apache.james.probe.DataProbe;
import org.apache.james.util.ZeroedInputStream;
import org.apache.james.utils.JmapGuiceProbe;
+import org.apache.james.utils.DataProbeImpl;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.junit.After;
@@ -110,11 +114,16 @@ public abstract class SetMessagesMethodTest {
private AccessToken accessToken;
private GuiceJamesServer jmapServer;
-
+ private MailboxProbe mailboxProbe;
+ private DataProbe dataProbe;
+
@Before
public void setup() throws Throwable {
jmapServer = createJmapServer();
jmapServer.start();
+ mailboxProbe = jmapServer.getProbe(MailboxProbeImpl.class);
+ dataProbe = jmapServer.getProbe(DataProbeImpl.class);
+
RestAssured.requestSpecification = new RequestSpecBuilder()
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
@@ -124,15 +133,15 @@ public abstract class SetMessagesMethodTest {
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
String password = "password";
- jmapServer.serverProbe().addDomain(USERS_DOMAIN);
- jmapServer.serverProbe().addUser(USERNAME, password);
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.INBOX);
+ dataProbe.addDomain(USERS_DOMAIN);
+ dataProbe.addUser(USERNAME, password);
+ mailboxProbe.createMailbox("#private", USERNAME, DefaultMailboxes.INBOX);
accessToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), USERNAME, password);
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.OUTBOX);
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.TRASH);
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.DRAFTS);
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.SENT);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.OUTBOX);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.TRASH);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.DRAFTS);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.SENT);
await();
Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
@@ -226,7 +235,7 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldReturnNotDestroyedWhenNoMatchingMessage() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
String messageId = randomMessageId().serialize();
given()
@@ -249,9 +258,9 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldReturnDestroyedWhenMatchingMessage() throws Exception {
// Given
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
await();
@@ -272,9 +281,9 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldDeleteMessageWhenMatchingMessage() throws Exception {
// Given
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
await();
@@ -303,15 +312,15 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldReturnDestroyedNotDestroyWhenMixed() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message1 = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
- jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
- ComposedMessageId message3 = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message3 = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test3\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
await();
@@ -340,15 +349,15 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldDeleteMatchingMessagesWhenMixed() throws Exception {
// Given
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message1 = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message2 = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
- ComposedMessageId message3 = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message3 = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test3\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
await();
@@ -380,9 +389,9 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldReturnUpdatedIdAndNoErrorWhenIsUnreadPassedToFalse() throws MailboxException {
// Given
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
await();
@@ -414,9 +423,9 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldMarkAsReadWhenIsUnreadPassedToFalse() throws MailboxException {
// Given
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
await();
@@ -443,9 +452,9 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldReturnUpdatedIdAndNoErrorWhenIsUnreadPassed() throws MailboxException {
// Given
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags(Flags.Flag.SEEN));
await();
@@ -465,9 +474,9 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldMarkAsUnreadWhenIsUnreadPassed() throws MailboxException {
// Given
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags(Flags.Flag.SEEN));
await();
@@ -494,9 +503,9 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldReturnUpdatedIdAndNoErrorWhenIsFlaggedPassed() throws MailboxException {
// Given
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
await();
@@ -516,9 +525,9 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldMarkAsFlaggedWhenIsFlaggedPassed() throws MailboxException {
// Given
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
await();
@@ -543,8 +552,8 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldRejectUpdateWhenPropertyHasWrongType() throws MailboxException {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
await();
@@ -571,8 +580,8 @@ public abstract class SetMessagesMethodTest {
@Test
@Ignore("Jackson json deserializer stops after first error found")
public void setMessagesShouldRejectUpdateWhenPropertiesHaveWrongTypes() throws MailboxException {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
await();
@@ -599,9 +608,9 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldMarkMessageAsAnsweredWhenIsAnsweredPassed() throws MailboxException {
// Given
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
await();
@@ -621,9 +630,9 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldMarkAsAnsweredWhenIsAnsweredPassed() throws MailboxException {
// Given
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, USER_MAILBOX,
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, USER_MAILBOX,
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), new Date(), false, new Flags());
await();
@@ -648,7 +657,7 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessageShouldReturnNotFoundWhenUpdateUnknownMessage() {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "mailbox");
String nonExistingMessageId = randomMessageId().serialize();
@@ -1229,8 +1238,10 @@ public abstract class SetMessagesMethodTest {
// Recipient
String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
String password = "password";
- jmapServer.serverProbe().addUser(recipientAddress, password);
+ dataProbe.addUser(recipientAddress, password);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
AccessToken recipientToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), recipientAddress, password);
+ await();
String messageCreationId = "creationId1337";
String fromAddress = USERNAME;
@@ -1269,8 +1280,10 @@ public abstract class SetMessagesMethodTest {
String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
String bccRecipient = "bob@" + USERS_DOMAIN;
String password = "password";
- jmapServer.serverProbe().addUser(recipientAddress, password);
- jmapServer.serverProbe().addUser(bccRecipient, password);
+ dataProbe.addUser(recipientAddress, password);
+ dataProbe.addUser(bccRecipient, password);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
+ await();
AccessToken recipientToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), recipientAddress, password);
String messageCreationId = "creationId1337";
@@ -1324,7 +1337,8 @@ public abstract class SetMessagesMethodTest {
// Recipient
String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
String password = "password";
- jmapServer.serverProbe().addUser(recipientAddress, password);
+ dataProbe.addUser(recipientAddress, password);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
await();
String messageCreationId = "creationId1337";
@@ -1377,10 +1391,12 @@ public abstract class SetMessagesMethodTest {
// Recipient
String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
String password = "password";
- jmapServer.serverProbe().addUser(recipientAddress, password);
+ dataProbe.addUser(recipientAddress, password);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
String bccAddress = "bob" + "@" + USERS_DOMAIN;
- jmapServer.serverProbe().addUser(bccAddress, password);
+ dataProbe.addUser(bccAddress, password);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, bccAddress, DefaultMailboxes.INBOX);
await();
AccessToken bccToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), bccAddress, password);
@@ -1448,11 +1464,11 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldSendAReadableHtmlMessage() throws Exception {
- // Sender
// Recipient
String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
String password = "password";
- jmapServer.serverProbe().addUser(recipientAddress, password);
+ dataProbe.addUser(recipientAddress, password);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
await();
AccessToken recipientToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), recipientAddress, password);
@@ -1491,8 +1507,10 @@ public abstract class SetMessagesMethodTest {
public void setMessagesWhenSavingToDraftsShouldNotSendMessage() throws Exception {
String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
String recipientPassword = "password";
- jmapServer.serverProbe().addUser(recipientAddress, recipientPassword);
+ dataProbe.addUser(recipientAddress, recipientPassword);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
AccessToken recipientToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), recipientAddress, recipientPassword);
+ await();
String senderDraftsMailboxId = getMailboxId(accessToken, Role.DRAFTS);
@@ -1533,11 +1551,11 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesWhenSavingToRegularMailboxShouldNotSendMessage() throws Exception {
String sender = USERNAME;
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, sender, "regular");
- Mailbox regularMailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, sender, "regular");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, sender, "regular");
+ Mailbox regularMailbox = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, sender, "regular");
String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
String recipientPassword = "password";
- jmapServer.serverProbe().addUser(recipientAddress, recipientPassword);
+ dataProbe.addUser(recipientAddress, recipientPassword);
await();
String messageCreationId = "creationId";
@@ -1597,8 +1615,10 @@ public abstract class SetMessagesMethodTest {
// Recipient
String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
String password = "password";
- jmapServer.serverProbe().addUser(recipientAddress, password);
+ dataProbe.addUser(recipientAddress, password);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
AccessToken recipientToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), recipientAddress, password);
+ await();
String messageCreationId = "creationId1337";
String fromAddress = USERNAME;
@@ -1653,7 +1673,7 @@ public abstract class SetMessagesMethodTest {
@Test
public void mailboxIdsShouldReturnUpdatedWhenNoChange() throws Exception {
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
String messageToMoveId = message.getMessageId().serialize();
@@ -1683,12 +1703,12 @@ public abstract class SetMessagesMethodTest {
@Test
public void mailboxIdsShouldBeInDestinationWhenUsingForMove() throws Exception {
String newMailboxName = "heartFolder";
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
- Mailbox heartFolder = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ Mailbox heartFolder = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
String heartFolderId = heartFolder.getMailboxId().serialize();
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
String messageToMoveId = message.getMessageId().serialize();
@@ -1727,14 +1747,14 @@ public abstract class SetMessagesMethodTest {
@Test
public void mailboxIdsShouldBeInDestinationWhenUsingForMoveWithoutTrashFolder() throws Exception {
- jmapServer.serverProbe().deleteMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.TRASH);
+ mailboxProbe.deleteMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.TRASH);
String newMailboxName = "heartFolder";
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
- Mailbox heartFolder = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ Mailbox heartFolder = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
String heartFolderId = heartFolder.getMailboxId().serialize();
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
String messageToMoveId = message.getMessageId().serialize();
@@ -1773,12 +1793,12 @@ public abstract class SetMessagesMethodTest {
@Test
public void mailboxIdsShouldNotBeAnymoreInSourceWhenUsingForMove() throws Exception {
String newMailboxName = "heartFolder";
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
- Mailbox heartFolder = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ Mailbox heartFolder = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
String heartFolderId = heartFolder.getMailboxId().serialize();
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
String messageToMoveId = message.getMessageId().serialize();
@@ -1818,12 +1838,12 @@ public abstract class SetMessagesMethodTest {
@Test
public void mailboxIdsShouldBeInBothMailboxWhenUsingForCopy() throws Exception {
String newMailboxName = "heartFolder";
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
- Mailbox heartFolder = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ Mailbox heartFolder = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
String heartFolderId = heartFolder.getMailboxId().serialize();
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
String messageToMoveId = message.getMessageId().serialize();
@@ -1863,7 +1883,7 @@ public abstract class SetMessagesMethodTest {
@Test
public void mailboxIdsShouldBeInOriginalMailboxWhenNoChange() throws Exception {
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
String messageToMoveId = message.getMessageId().serialize();
@@ -1903,14 +1923,14 @@ public abstract class SetMessagesMethodTest {
@Test
public void mailboxIdsShouldReturnErrorWhenMovingToADeletedMailbox() throws Exception {
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "any");
- String mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "any")
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "any");
+ String mailboxId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "any")
.getMailboxId()
.serialize();
- jmapServer.serverProbe().deleteMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "any");
+ mailboxProbe.deleteMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "any");
String messageToMoveId = message.getMessageId().serialize();
String requestBody = "[" +
@@ -1942,7 +1962,7 @@ public abstract class SetMessagesMethodTest {
@Test
public void mailboxIdsShouldReturnErrorWhenSetToEmpty() throws Exception {
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
String messageToMoveId = message.getMessageId().serialize();
@@ -1977,12 +1997,12 @@ public abstract class SetMessagesMethodTest {
@Test
public void updateShouldNotReturnErrorWithFlagsAndMailboxUpdate() throws Exception {
String newMailboxName = "heartFolder";
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
- Mailbox heartFolder = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ Mailbox heartFolder = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
String heartFolderId = heartFolder.getMailboxId().serialize();
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
String messageToMoveId = message.getMessageId().serialize();
@@ -2012,12 +2032,12 @@ public abstract class SetMessagesMethodTest {
@Test
public void updateShouldWorkWithFlagsAndMailboxUpdate() throws Exception {
String newMailboxName = "heartFolder";
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
- Mailbox heartFolder = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ Mailbox heartFolder = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
String heartFolderId = heartFolder.getMailboxId().serialize();
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
String messageToMoveId = message.getMessageId().serialize();
@@ -2057,10 +2077,10 @@ public abstract class SetMessagesMethodTest {
@Test
public void setMessagesShouldWorkForMoveToTrash() throws Exception {
- String trashId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.TRASH).getMailboxId().serialize();
+ String trashId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.TRASH).getMailboxId().serialize();
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
String messageToMoveId = message.getMessageId().serialize();
@@ -2092,11 +2112,11 @@ public abstract class SetMessagesMethodTest {
@Test
public void copyToTrashShouldWork() throws Exception {
String newMailboxName = "heartFolder";
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
- String trashId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.TRASH).getMailboxId().serialize();
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, newMailboxName);
+ String trashId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, DefaultMailboxes.TRASH).getMailboxId().serialize();
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
+ ComposedMessageId message = mailboxProbe.appendMessage(USERNAME, new MailboxPath(MailboxConstants.USER_NAMESPACE, USERNAME, MailboxConstants.INBOX),
new ByteArrayInputStream("Subject: my test subject\r\n\r\ntestmail".getBytes(Charsets.UTF_8)), Date.from(dateTime.toInstant()), false, new Flags());
String messageToMoveId = message.getMessageId().serialize();
@@ -2839,7 +2859,8 @@ public abstract class SetMessagesMethodTest {
public void setMessageShouldVerifyHeaderOfMessageInInbox() throws Exception {
String toUsername = "username1@" + USERS_DOMAIN;
String password = "password";
- jmapServer.serverProbe().addUser(toUsername, password);
+ dataProbe.addUser(toUsername, password);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, toUsername, DefaultMailboxes.INBOX);
String messageCreationId = "creationId1337";
String fromAddress = USERNAME;
@@ -2875,7 +2896,8 @@ public abstract class SetMessagesMethodTest {
public void setMessageShouldVerifyHeaderOfMessageInSent() throws Exception {
String toUsername = "username1@" + USERS_DOMAIN;
String password = "password";
- jmapServer.serverProbe().addUser(toUsername, password);
+ dataProbe.addUser(toUsername, password);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, toUsername, DefaultMailboxes.INBOX);
String messageCreationId = "creationId1337";
String fromAddress = USERNAME;
@@ -2948,14 +2970,12 @@ public abstract class SetMessagesMethodTest {
private Matcher<Map<? extends String, ? extends String>> allHeadersMatcher(ImmutableList<String> expectedHeaders) {
return Matchers.allOf(expectedHeaders.stream()
- .map((String header) -> hasEntry(equalTo(header), not(isEmptyOrNullString())))
- .collect(Collectors.toList()));
+ .map((String header) -> hasEntry(equalTo(header), not(isEmptyOrNullString())))
+ .collect(Collectors.toList()));
}
@Test
public void setMessagesShouldCreateMessageWhenSendingMessageWithNonIndexableAttachment() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "sent");
-
Attachment nonIndexableAttachment = Attachment.builder()
.bytes(IOUtils.toByteArray(ClassLoader.getSystemResourceAsStream("attachment/nonIndexableAttachment.html")))
.type("text/html")
@@ -3008,8 +3028,6 @@ public abstract class SetMessagesMethodTest {
@Test
public void messageWithNonIndexableAttachmentShouldBeRetrievedWhenChainingSetMessagesAndGetMessages() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "sent");
-
Attachment nonIndexableAttachment = Attachment.builder()
.bytes(IOUtils.toByteArray(ClassLoader.getSystemResourceAsStream("attachment/nonIndexableAttachment.html")))
.type("text/html")
@@ -3070,8 +3088,6 @@ public abstract class SetMessagesMethodTest {
@Test
public void messageWithNonIndexableAttachmentShouldHaveItsEmailBodyIndexed() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USERNAME, "sent");
-
Attachment nonIndexableAttachment = Attachment.builder()
.bytes(IOUtils.toByteArray(ClassLoader.getSystemResourceAsStream("attachment/nonIndexableAttachment.html")))
.type("text/html")
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
index 4945f0b..2c88e54 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
@@ -37,6 +37,7 @@ import org.apache.james.jmap.api.vacation.Vacation;
import org.apache.james.jmap.api.vacation.VacationPatch;
import org.apache.james.util.ValuePatch;
import org.apache.james.utils.JmapGuiceProbe;
+import org.apache.james.utils.DataProbeImpl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -76,8 +77,8 @@ public abstract class SetVacationResponseTest {
.getJmapPort())
.build();
- jmapServer.serverProbe().addDomain(USERS_DOMAIN);
- jmapServer.serverProbe().addUser(USER, PASSWORD);
+ jmapServer.getProbe(DataProbeImpl.class).addDomain(USERS_DOMAIN);
+ jmapServer.getProbe(DataProbeImpl.class).addUser(USER, PASSWORD);
accessToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), USER, PASSWORD);
await();
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
index d74481f..0d11f7f 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
@@ -42,6 +42,7 @@ import org.apache.james.jmap.model.AttachmentAccessToken;
import org.apache.james.mailbox.model.MailboxConstants;
import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mime4j.codec.DecoderUtil;
+import org.apache.james.modules.MailboxProbeImpl;
import com.google.common.base.CharMatcher;
import com.google.common.base.Charsets;
@@ -87,7 +88,7 @@ public class DownloadStepdefs {
public void appendMessageWithAttachmentToMailbox(String user, String mailbox, String messageId, String attachmentId) throws Throwable {
MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, user, mailbox);
- mainStepdefs.jmapServer.serverProbe().appendMessage(user, mailboxPath,
+ mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).appendMessage(user, mailboxPath,
ClassLoader.getSystemResourceAsStream("eml/oneAttachment.eml"), new Date(), false, new Flags());
attachmentsByMessageId.put(messageId, attachmentId);
@@ -98,7 +99,7 @@ public class DownloadStepdefs {
public void appendMessageWithInlinedAttachmentToMailbox(String user, String mailbox, String messageId, String attachmentId) throws Throwable {
MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, user, mailbox);
- mainStepdefs.jmapServer.serverProbe().appendMessage(user, mailboxPath,
+ mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).appendMessage(user, mailboxPath,
ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(), false, new Flags());
attachmentsByMessageId.put(messageId, attachmentId);
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org