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:46 UTC
[05/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/mailet/integration-testing/src/test/java/org/apache/james/mailets/SieveDelivery.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SieveDelivery.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SieveDelivery.java
index ce660de..e9a0016 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SieveDelivery.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SieveDelivery.java
@@ -20,10 +20,15 @@
package org.apache.james.mailets;
import org.apache.james.mailbox.model.MailboxConstants;
+import org.apache.james.mailbox.store.probe.MailboxProbe;
import org.apache.james.mailets.configuration.CommonProcessors;
import org.apache.james.mailets.configuration.MailetContainer;
import org.apache.james.mailets.utils.SMTPMessageSender;
+import org.apache.james.modules.MailboxProbeImpl;
+import org.apache.james.modules.protocols.SieveProbeImpl;
+import org.apache.james.probe.DataProbe;
import org.apache.james.utils.IMAPMessageReader;
+import org.apache.james.utils.DataProbeImpl;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -79,12 +84,14 @@ public class SieveDelivery {
String recipient = "user2@" + DEFAULT_DOMAIN;
String targetedMailbox = "INBOX.any";
- jamesServer.getServerProbe().addDomain(DEFAULT_DOMAIN);
- jamesServer.getServerProbe().addUser(from, PASSWORD);
- jamesServer.getServerProbe().addUser(recipient, PASSWORD);
- jamesServer.getServerProbe().createMailbox(MailboxConstants.USER_NAMESPACE, recipient, "INBOX");
- jamesServer.getServerProbe().createMailbox(MailboxConstants.USER_NAMESPACE, recipient, targetedMailbox);
- jamesServer.getServerProbe().addActiveSieveScript(recipient, "myscript.sieve", "require \"fileinto\";\n" +
+ DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
+ dataProbe.addDomain(DEFAULT_DOMAIN);
+ dataProbe.addUser(from, PASSWORD);
+ dataProbe.addUser(recipient, PASSWORD);
+ MailboxProbe mailboxProbe = jamesServer.getProbe(MailboxProbeImpl.class);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipient, "INBOX");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipient, targetedMailbox);
+ jamesServer.getProbe(SieveProbeImpl.class).addActiveSieveScript(recipient, "myscript.sieve", "require \"fileinto\";\n" +
"\n" +
"fileinto \"" + targetedMailbox + "\";");
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryJamesServer.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryJamesServer.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryJamesServer.java
index 86dad85..86c5d45 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryJamesServer.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/TemporaryJamesServer.java
@@ -34,7 +34,7 @@ import org.apache.james.GuiceJamesServer;
import org.apache.james.MemoryJamesServerMain;
import org.apache.james.mailets.configuration.MailetContainer;
import org.apache.james.modules.TestJMAPServerModule;
-import org.apache.james.utils.GuiceServerProbe;
+import org.apache.james.utils.GuiceProbe;
import org.junit.rules.TemporaryFolder;
import com.google.common.collect.ImmutableList;
@@ -78,8 +78,9 @@ public class TemporaryJamesServer {
public void shutdown() {
jamesServer.stop();
}
-
- public GuiceServerProbe getServerProbe() {
- return jamesServer.serverProbe();
+
+ public <T extends GuiceProbe> T getProbe(Class<T> probe) {
+ return jamesServer.getProbe(probe);
}
+
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
index 499df3d..960eb72 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
@@ -31,8 +31,10 @@ import org.apache.james.mailets.configuration.MailetConfiguration;
import org.apache.james.mailets.configuration.MailetContainer;
import org.apache.james.mailets.configuration.ProcessorConfiguration;
import org.apache.james.mailets.utils.SMTPMessageSender;
+import org.apache.james.modules.MailboxProbeImpl;
import org.apache.james.util.date.ZonedDateTimeProvider;
import org.apache.james.utils.IMAPMessageReader;
+import org.apache.james.utils.DataProbeImpl;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -100,9 +102,11 @@ public class SMIMEDecryptIntegrationTest {
Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
calmlyAwait = Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
- jamesServer.getServerProbe().addDomain(DEFAULT_DOMAIN);
- jamesServer.getServerProbe().addUser(FROM, PASSWORD);
- jamesServer.getServerProbe().createMailbox(MailboxConstants.USER_NAMESPACE, FROM, "INBOX");
+ DataProbeImpl serverProbe = jamesServer.getProbe(DataProbeImpl.class);
+ serverProbe.addDomain(DEFAULT_DOMAIN);
+ serverProbe.addUser(FROM, PASSWORD);
+ MailboxProbeImpl mailboxProbe = jamesServer.getProbe(MailboxProbeImpl.class);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, FROM, "INBOX");
}
@After
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java
index 69c444a..ecd0729 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java
@@ -30,8 +30,11 @@ import org.apache.james.mailets.configuration.MailetConfiguration;
import org.apache.james.mailets.configuration.MailetContainer;
import org.apache.james.mailets.configuration.ProcessorConfiguration;
import org.apache.james.mailets.utils.SMTPMessageSender;
+import org.apache.james.modules.MailboxProbeImpl;
+import org.apache.james.probe.DataProbe;
import org.apache.james.util.date.ZonedDateTimeProvider;
import org.apache.james.utils.IMAPMessageReader;
+import org.apache.james.utils.DataProbeImpl;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -136,10 +139,11 @@ public class SMIMESignIntegrationTest {
Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
calmlyAwait = Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
- jamesServer.getServerProbe().addDomain(DEFAULT_DOMAIN);
- jamesServer.getServerProbe().addUser(FROM, PASSWORD);
- jamesServer.getServerProbe().addUser(RECIPIENT, PASSWORD);
- jamesServer.getServerProbe().createMailbox(MailboxConstants.USER_NAMESPACE, RECIPIENT, "INBOX");
+ DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
+ dataProbe.addDomain(DEFAULT_DOMAIN);
+ dataProbe.addUser(FROM, PASSWORD);
+ dataProbe.addUser(RECIPIENT, PASSWORD);
+ jamesServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, RECIPIENT, "INBOX");
}
@After
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
index 12b230c..01a3e02 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
@@ -30,9 +30,12 @@ import org.apache.james.mailets.configuration.MailetConfiguration;
import org.apache.james.mailets.configuration.MailetContainer;
import org.apache.james.mailets.configuration.ProcessorConfiguration;
import org.apache.james.mailets.utils.SMTPMessageSender;
+import org.apache.james.modules.MailboxProbeImpl;
+import org.apache.james.probe.DataProbe;
import org.apache.james.transport.mailets.amqp.AmqpRule;
import org.apache.james.util.streams.SwarmGenericContainer;
import org.apache.james.utils.IMAPMessageReader;
+import org.apache.james.utils.DataProbeImpl;
import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
import org.apache.mailet.base.test.FakeMail;
@@ -133,10 +136,11 @@ public class AmqpForwardAttachmentTest {
.pollDelay(slowPacedPollInterval)
.await();
- jamesServer.getServerProbe().addDomain(JAMES_APACHE_ORG);
- jamesServer.getServerProbe().addUser(FROM, PASSWORD);
- jamesServer.getServerProbe().addUser(RECIPIENT, PASSWORD);
- jamesServer.getServerProbe().createMailbox(MailboxConstants.USER_NAMESPACE, RECIPIENT, "INBOX");
+ DataProbe dataprobe = jamesServer.getProbe(DataProbeImpl.class);
+ dataprobe.addDomain(JAMES_APACHE_ORG);
+ dataprobe.addUser(FROM, PASSWORD);
+ dataprobe.addUser(RECIPIENT, PASSWORD);
+ jamesServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, RECIPIENT, "INBOX");
}
@After
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
index 2fa14c4..15b1fac 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
@@ -32,9 +32,12 @@ import org.apache.james.mailets.configuration.MailetConfiguration;
import org.apache.james.mailets.configuration.MailetContainer;
import org.apache.james.mailets.configuration.ProcessorConfiguration;
import org.apache.james.mailets.utils.SMTPMessageSender;
+import org.apache.james.modules.MailboxProbeImpl;
+import org.apache.james.probe.DataProbe;
import org.apache.james.transport.mailets.amqp.AmqpRule;
import org.apache.james.util.streams.SwarmGenericContainer;
import org.apache.james.utils.IMAPMessageReader;
+import org.apache.james.utils.DataProbeImpl;
import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
import org.apache.mailet.base.test.FakeMail;
@@ -510,10 +513,11 @@ public class ICSAttachmentWorkflowTest {
Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
calmlyAwait = Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
- jamesServer.getServerProbe().addDomain(JAMES_APACHE_ORG);
- jamesServer.getServerProbe().addUser(FROM, PASSWORD);
- jamesServer.getServerProbe().addUser(RECIPIENT, PASSWORD);
- jamesServer.getServerProbe().createMailbox(MailboxConstants.USER_NAMESPACE, RECIPIENT, "INBOX");
+ DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
+ dataProbe.addDomain(JAMES_APACHE_ORG);
+ dataProbe.addUser(FROM, PASSWORD);
+ dataProbe.addUser(RECIPIENT, PASSWORD);
+ jamesServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, RECIPIENT, "INBOX");
messageWithoutICSAttached = MimeMessageBuilder.mimeMessageBuilder()
.setMultipartWithBodyParts(
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
index 60d11a8..b11d216 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
@@ -30,7 +30,10 @@ import org.apache.james.mailets.configuration.MailetConfiguration;
import org.apache.james.mailets.configuration.MailetContainer;
import org.apache.james.mailets.configuration.ProcessorConfiguration;
import org.apache.james.mailets.utils.SMTPMessageSender;
+import org.apache.james.modules.MailboxProbeImpl;
+import org.apache.james.probe.DataProbe;
import org.apache.james.utils.IMAPMessageReader;
+import org.apache.james.utils.DataProbeImpl;
import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
import org.apache.mailet.base.test.FakeMail;
@@ -109,10 +112,11 @@ public class StripAttachmentTest {
Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
calmlyAwait = Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
- jamesServer.getServerProbe().addDomain(JAMES_APACHE_ORG);
- jamesServer.getServerProbe().addUser(FROM, PASSWORD);
- jamesServer.getServerProbe().addUser(RECIPIENT, PASSWORD);
- jamesServer.getServerProbe().createMailbox(MailboxConstants.USER_NAMESPACE, RECIPIENT, "INBOX");
+ DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
+ dataProbe.addDomain(JAMES_APACHE_ORG);
+ dataProbe.addUser(FROM, PASSWORD);
+ dataProbe.addUser(RECIPIENT, PASSWORD);
+ jamesServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, RECIPIENT, "INBOX");
}
@After
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/JMAPAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java
index 8580562..42da7fe 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java
@@ -34,6 +34,7 @@ import java.util.UUID;
import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.model.ContinuationToken;
+import org.apache.james.utils.DataProbeImpl;
import org.apache.james.utils.JmapGuiceProbe;
import org.junit.After;
import org.junit.Before;
@@ -74,8 +75,8 @@ public abstract class JMAPAuthenticationTest {
String domain = "domain.tld";
- jmapServer.serverProbe().addDomain(domain);
- jmapServer.serverProbe().addUser(userCredentials.getUsername(), userCredentials.getPassword());
+ jmapServer.getProbe(DataProbeImpl.class).addDomain(domain);
+ jmapServer.getProbe(DataProbeImpl.class).addUser(userCredentials.getUsername(), userCredentials.getPassword());
}
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/UserProvisionningConcurrencyTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/UserProvisionningConcurrencyTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/UserProvisionningConcurrencyTest.java
index b210e4c..7f28e41 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/UserProvisionningConcurrencyTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/UserProvisionningConcurrencyTest.java
@@ -34,6 +34,7 @@ import org.apache.http.client.utils.URIBuilder;
import org.apache.james.GuiceJamesServer;
import org.apache.james.util.concurrency.ConcurrentTestRunner;
import org.apache.james.utils.JmapGuiceProbe;
+import org.apache.james.utils.DataProbeImpl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -61,8 +62,9 @@ public abstract class UserProvisionningConcurrencyTest {
.setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
.build();
- jmapServer.serverProbe().addDomain(DOMAIN);
- jmapServer.serverProbe().addUser(USER, PASSWORD);
+ DataProbeImpl serverProbe = jmapServer.getProbe(DataProbeImpl.class);
+ serverProbe.addDomain(DOMAIN);
+ serverProbe.addUser(USER, PASSWORD);
}
@After
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/VacationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
index 9d0b4a1..b845c66 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
@@ -37,7 +37,11 @@ import org.apache.james.jmap.api.access.AccessToken;
import org.apache.james.jmap.api.vacation.AccountId;
import org.apache.james.jmap.api.vacation.VacationPatch;
import org.apache.james.mailbox.model.MailboxConstants;
+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.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -76,14 +80,16 @@ public abstract class VacationIntegrationTest {
guiceJamesServer = createJmapServer();
guiceJamesServer.start();
- guiceJamesServer.serverProbe().addDomain(DOMAIN);
- guiceJamesServer.serverProbe().addUser(USER_1, PASSWORD);
- guiceJamesServer.serverProbe().addUser(USER_2, PASSWORD);
- guiceJamesServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USER_2, DefaultMailboxes.OUTBOX);
- guiceJamesServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USER_1, DefaultMailboxes.SENT);
- guiceJamesServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USER_2, DefaultMailboxes.SENT);
- guiceJamesServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USER_1, DefaultMailboxes.INBOX);
- guiceJamesServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USER_2, DefaultMailboxes.INBOX);
+ DataProbe dataProbe = guiceJamesServer.getProbe(DataProbeImpl.class);
+ dataProbe.addDomain(DOMAIN);
+ dataProbe.addUser(USER_1, PASSWORD);
+ dataProbe.addUser(USER_2, PASSWORD);
+ MailboxProbe mailboxProbe = guiceJamesServer.getProbe(MailboxProbeImpl.class);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USER_2, DefaultMailboxes.OUTBOX);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USER_1, DefaultMailboxes.SENT);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USER_2, DefaultMailboxes.SENT);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USER_1, DefaultMailboxes.INBOX);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, USER_2, DefaultMailboxes.INBOX);
await();
jmapGuiceProbe = guiceJamesServer.getProbe(JmapGuiceProbe.class);
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/GetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
index 301e862..60806e7 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
@@ -47,7 +47,11 @@ import org.apache.james.mailbox.model.MailboxConstants;
import org.apache.james.mailbox.model.MailboxId;
import org.apache.james.mailbox.model.MailboxPath;
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.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -67,11 +71,13 @@ public abstract class GetMailboxesMethodTest {
private AccessToken accessToken;
private String username;
private GuiceJamesServer jmapServer;
-
+ private MailboxProbe mailboxProbe;
+
@Before
public void setup() throws Throwable {
jmapServer = createJmapServer();
jmapServer.start();
+ mailboxProbe = jmapServer.getProbe(MailboxProbeImpl.class);
RestAssured.requestSpecification = new RequestSpecBuilder()
.setContentType(ContentType.JSON)
@@ -83,8 +89,9 @@ public abstract class GetMailboxesMethodTest {
String domain = "domain.tld";
username = "username@" + domain;
String password = "password";
- jmapServer.serverProbe().addDomain(domain);
- jmapServer.serverProbe().addUser(username, password);
+ DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class);
+ dataProbe.addDomain(domain);
+ dataProbe.addUser(username, password);
accessToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), username, password);
}
@@ -117,10 +124,10 @@ public abstract class GetMailboxesMethodTest {
@Test
public void getMailboxesShouldReturnEmptyWhenIdsDoesntMatch() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "name");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "quicklyRemoved");
- String removedId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "quicklyRemoved").getMailboxId().serialize();
- jmapServer.serverProbe().deleteMailbox(MailboxConstants.USER_NAMESPACE, username, "quicklyRemoved");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "name");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "quicklyRemoved");
+ String removedId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "quicklyRemoved").getMailboxId().serialize();
+ mailboxProbe.deleteMailbox(MailboxConstants.USER_NAMESPACE, username, "quicklyRemoved");
given()
.header("Authorization", accessToken.serialize())
@@ -148,11 +155,11 @@ public abstract class GetMailboxesMethodTest {
@Test
public void getMailboxesShouldReturnMailboxesWhenIdsMatch() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX);
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myMailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "myMailbox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX);
- Mailbox mailbox2 = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "myMailbox");
+ Mailbox mailbox = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX);
+ Mailbox mailbox2 = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "myMailbox");
String mailboxId = mailbox.getMailboxId().serialize();
String mailboxId2 = mailbox2.getMailboxId().serialize();
@@ -172,10 +179,10 @@ public abstract class GetMailboxesMethodTest {
@Test
public void getMailboxesShouldReturnOnlyMatchingMailboxesWhenIdsGiven() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX);
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myMailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "myMailbox");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX);
+ Mailbox mailbox = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX);
String mailboxId = mailbox.getMailboxId().serialize();
@@ -193,7 +200,7 @@ public abstract class GetMailboxesMethodTest {
@Test
public void getMailboxesShouldReturnEmptyWhenIdsIsEmpty() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX);
given()
.header("Authorization", accessToken.serialize())
@@ -208,14 +215,15 @@ public abstract class GetMailboxesMethodTest {
@Test
public void getMailboxesShouldReturnAllMailboxesWhenIdsIsNull() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myMailbox");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "myMailbox2");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "myMailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "myMailbox2");
List<String> expectedMailboxes = ImmutableList.<String> builder()
.addAll(DefaultMailboxes.DEFAULT_MAILBOXES)
.add("myMailbox")
.add("myMailbox2")
.build();
+
given()
.header("Authorization", accessToken.serialize())
.body("[[\"getMailboxes\", {\"ids\": null}, \"#0\"]]")
@@ -284,9 +292,9 @@ public abstract class GetMailboxesMethodTest {
@Test
public void getMailboxesShouldReturnMailboxesWhenAvailable() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "name");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "name");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "name"),
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "name"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
given()
@@ -302,12 +310,12 @@ public abstract class GetMailboxesMethodTest {
@Test
public void getMailboxesShouldReturnMailboxPropertiesWhenAvailable() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "name");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "name");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "name"),
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "name"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "name").getMailboxId();
+ MailboxId mailboxId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "name").getMailboxId();
given()
.header("Authorization", accessToken.serialize())
.body("[[\"getMailboxes\", {\"ids\": [\"" + mailboxId.serialize() + "\"]}, \"#0\"]]")
@@ -334,9 +342,9 @@ public abstract class GetMailboxesMethodTest {
@Test
public void getMailboxesShouldReturnFilteredMailboxesPropertiesWhenRequestContainsFilterProperties() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "name");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "name");
- MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "name").getMailboxId();
+ MailboxId mailboxId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "name").getMailboxId();
given()
.header("Authorization", accessToken.serialize())
.body("[[\"getMailboxes\", {\"ids\": [\"" + mailboxId.serialize() + "\"], \"properties\" : [\"unreadMessages\", \"sortOrder\"]}, \"#0\"]]")
@@ -364,7 +372,7 @@ public abstract class GetMailboxesMethodTest {
@Test
public void getMailboxesShouldReturnIdWhenRequestContainsEmptyPropertyListFilter() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "name");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "name");
given()
.header("Authorization", accessToken.serialize())
@@ -380,7 +388,7 @@ public abstract class GetMailboxesMethodTest {
@Test
public void getMailboxesShouldIgnoreUnknownPropertiesWhenRequestContainsUnknownPropertyListFilter() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "name");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "name");
given()
.header("Authorization", accessToken.serialize())
@@ -396,11 +404,11 @@ public abstract class GetMailboxesMethodTest {
@Test
public void getMailboxesShouldReturnMailboxesWithSortOrder() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX);
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.TRASH);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.TRASH);
- MailboxId inboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX).getMailboxId();
- MailboxId trashId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.TRASH).getMailboxId();
+ MailboxId inboxId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.INBOX).getMailboxId();
+ MailboxId trashId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.TRASH).getMailboxId();
given()
.header("Authorization", accessToken.serialize())
.body("[[\"getMailboxes\", {\"ids\": [\"" + inboxId.serialize() + "\", \"" + trashId.serialize() + "\"]}, \"#0\"]]")
@@ -418,9 +426,9 @@ public abstract class GetMailboxesMethodTest {
@Test
public void getMailboxesShouldReturnMailboxesWithRolesInLowerCase() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.OUTBOX);
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.OUTBOX);
- MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.OUTBOX).getMailboxId();
+ MailboxId mailboxId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, DefaultMailboxes.OUTBOX).getMailboxId();
given()
.header("Authorization", accessToken.serialize())
.body("[[\"getMailboxes\", {\"ids\": [\"" + mailboxId.serialize() + "\"]}, \"#0\"]]")
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org