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:42 UTC
[01/21] james-project git commit: JAMES-1902 Break guice-common to
other projects dependencies
Repository: james-project
Updated Branches:
refs/heads/master be7d02c49 -> a43fbd41b
JAMES-1902 Break guice-common to other projects dependencies
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/a43fbd41
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/a43fbd41
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/a43fbd41
Branch: refs/heads/master
Commit: a43fbd41b8c69ffec16bf752c0b71a4c984242d9
Parents: 61e1bdc
Author: Antoine Duprat <ad...@linagora.com>
Authored: Mon Mar 13 12:22:36 2017 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
server/container/guice/cassandra-guice/pom.xml | 28 ++++++++++++++++++
server/container/guice/guice-common/pom.xml | 12 ++++++++
server/container/guice/jpa-common-guice/pom.xml | 4 +++
server/container/guice/jpa-guice/pom.xml | 28 ++++++++++++++++++
server/container/guice/jpa-smtp/pom.xml | 4 +++
server/container/guice/memory-guice/pom.xml | 28 ++++++++++++++++++
server/pom.xml | 5 ++++
.../jmap-integration-testing-common/pom.xml | 30 ++++++++++++++++++++
8 files changed, 139 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/a43fbd41/server/container/guice/cassandra-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/pom.xml b/server/container/guice/cassandra-guice/pom.xml
index 65b2c2e..191800b 100644
--- a/server/container/guice/cassandra-guice/pom.xml
+++ b/server/container/guice/cassandra-guice/pom.xml
@@ -261,6 +261,34 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-imap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-lmtp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-pop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-managedsieve</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-smtp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-webadmin</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-jmap-integration-testing</artifactId>
<type>test-jar</type>
<scope>test</scope>
http://git-wip-us.apache.org/repos/asf/james-project/blob/a43fbd41/server/container/guice/guice-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/pom.xml b/server/container/guice/guice-common/pom.xml
index 80f8ea2..3494397 100644
--- a/server/container/guice/guice-common/pom.xml
+++ b/server/container/guice/guice-common/pom.xml
@@ -178,22 +178,27 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-imap</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-jmap</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-lmtp</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-pop</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-mailbox</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -202,14 +207,17 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-managedsieve</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-smtp</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-webadmin</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -260,6 +268,10 @@
<artifactId>protocols-imap</artifactId>
</dependency>
<dependency>
+ <groupId>com.github.steveash.guavate</groupId>
+ <artifactId>guavate</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/a43fbd41/server/container/guice/jpa-common-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-common-guice/pom.xml b/server/container/guice/jpa-common-guice/pom.xml
index 34af8d0..fb83a19 100644
--- a/server/container/guice/jpa-common-guice/pom.xml
+++ b/server/container/guice/jpa-common-guice/pom.xml
@@ -225,6 +225,10 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-configuration</artifactId>
+ </dependency>
+ <dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
http://git-wip-us.apache.org/repos/asf/james-project/blob/a43fbd41/server/container/guice/jpa-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/pom.xml b/server/container/guice/jpa-guice/pom.xml
index 07ca6bf..a3a9766 100644
--- a/server/container/guice/jpa-guice/pom.xml
+++ b/server/container/guice/jpa-guice/pom.xml
@@ -227,6 +227,34 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-imap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-lmtp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-pop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-managedsieve</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-smtp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-webadmin</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-jpa-common-guice</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/a43fbd41/server/container/guice/jpa-smtp/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/pom.xml b/server/container/guice/jpa-smtp/pom.xml
index 430fb8f..2e712b7 100644
--- a/server/container/guice/jpa-smtp/pom.xml
+++ b/server/container/guice/jpa-smtp/pom.xml
@@ -215,6 +215,10 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-smtp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-jpa-common-guice</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/a43fbd41/server/container/guice/memory-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/pom.xml b/server/container/guice/memory-guice/pom.xml
index 8173aca..9575cd0 100644
--- a/server/container/guice/memory-guice/pom.xml
+++ b/server/container/guice/memory-guice/pom.xml
@@ -216,12 +216,40 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-imap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-jmap</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-lmtp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-pop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-managedsieve</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-smtp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-webadmin</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>apache-mailet-base</artifactId>
<type>test-jar</type>
<scope>test</scope>
http://git-wip-us.apache.org/repos/asf/james-project/blob/a43fbd41/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index b8dc69c..4ceaa15 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -257,6 +257,11 @@
</dependency>
<dependency>
<groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-mailbox</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
<artifactId>james-server-jetty</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/a43fbd41/server/protocols/jmap-integration-testing/jmap-integration-testing-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/pom.xml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/pom.xml
index 34f6d5b..1ccc510 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/pom.xml
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/pom.xml
@@ -152,6 +152,11 @@
<dependencies>
<dependency>
<groupId>org.apache.james</groupId>
+ <artifactId>james-server-data-jmap</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
<artifactId>james-server-guice-common</artifactId>
<scope>test</scope>
</dependency>
@@ -163,6 +168,16 @@
</dependency>
<dependency>
<groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-mailbox</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
<artifactId>james-server-testing</artifactId>
<scope>test</scope>
</dependency>
@@ -261,6 +276,11 @@
<dependencies>
<dependency>
<groupId>org.apache.james</groupId>
+ <artifactId>james-server-data-jmap</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
<artifactId>james-server-guice-common</artifactId>
<scope>test</scope>
</dependency>
@@ -272,6 +292,16 @@
</dependency>
<dependency>
<groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-mailbox</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
<artifactId>james-server-testing</artifactId>
<scope>test</scope>
</dependency>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[05/21] james-project git commit: JAMES-1902 split probes to prevent
them to pull unwanted dependencies
Posted by bt...@apache.org.
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
[21/21] james-project git commit: JAMES-1902 get rid of
JmapJamesServer & GuiceJamesServerImpl
Posted by bt...@apache.org.
JAMES-1902 get rid of JmapJamesServer & GuiceJamesServerImpl
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/ac56c422
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/ac56c422
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/ac56c422
Branch: refs/heads/master
Commit: ac56c42221359c83c904021d12e83b2cadb79339
Parents: ddda1d7
Author: Antoine Duprat <ad...@linagora.com>
Authored: Fri Jan 27 11:42:13 2017 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
.../smtp/host/CassandraJamesSmtpHostSystem.java | 9 +-
.../apache/james/CassandraJamesServerMain.java | 2 +-
.../apache/james/CassandraJamesServerTest.java | 2 +-
.../org/apache/james/CassandraJmapTestRule.java | 4 +-
.../james/CassandraLogConfigurationTest.java | 19 +++--
.../CassandraMessageIdManagerInjectionTest.java | 2 +-
.../org/apache/james/CassandraNodeConfTest.java | 2 +-
.../java/org/apache/james/ESReporterTest.java | 9 +-
.../james/JamesCapabilitiesServerTest.java | 6 +-
.../james/CassandraLdapJamesServerMain.java | 2 +-
.../james/CassandraLdapJamesServerTest.java | 2 +-
.../apache/james/CassandraLdapJmapTestRule.java | 4 +-
.../java/org/apache/james/GuiceJamesServer.java | 63 +++++++++++++-
.../org/apache/james/GuiceJamesServerImpl.java | 86 --------------------
.../java/org/apache/james/JmapJamesServer.java | 64 ---------------
.../apache/james/AbstractJamesServerTest.java | 4 +-
.../james/AbstractJmapJamesServerTest.java | 8 +-
.../org/apache/james/JPAJamesServerMain.java | 2 +-
.../org/apache/james/JPAJamesServerTest.java | 4 +-
.../james/JamesCapabilitiesServerTest.java | 2 +-
server/container/guice/memory-guice/pom.xml | 9 +-
.../org/apache/james/MemoryJamesServerMain.java | 4 +-
.../org/apache/james/MemoryJamesServerTest.java | 2 +-
.../org/apache/james/MemoryJmapTestRule.java | 4 +-
server/mailet/integration-testing/pom.xml | 6 ++
.../james/mailets/TemporaryJamesServer.java | 6 +-
server/pom.xml | 11 +++
.../CassandraGetMailboxesMethodTest.java | 4 +-
.../CassandraGetMessageListMethodTest.java | 4 +-
.../CassandraGetVacationResponseTest.java | 4 +-
.../CassandraJmapAuthenticationTest.java | 4 +-
.../CassandraSetMailboxesMethodTest.java | 4 +-
.../CassandraSetMessagesMethodTest.java | 4 +-
.../CassandraSetVacationResponseTest.java | 4 +-
...ssandraUserProvisionningConcurrencyTest.java | 4 +-
.../CassandraVacationIntegrationTest.java | 4 +-
.../cassandra/cucumber/CassandraStepdefs.java | 4 +-
.../james/jmap/JMAPAuthenticationTest.java | 10 +--
.../jmap/UserProvisionningConcurrencyTest.java | 13 ++-
.../james/jmap/VacationIntegrationTest.java | 10 +--
.../integration/GetMailboxesMethodTest.java | 12 +--
.../integration/GetMessageListMethodTest.java | 14 ++--
.../integration/GetVacationResponseTest.java | 10 +--
.../integration/SetMailboxesMethodTest.java | 12 +--
.../integration/SetMessagesMethodTest.java | 14 ++--
.../integration/SetVacationResponseTest.java | 10 +--
.../cucumber/GetMessagesMethodStepdefs.java | 3 +-
.../integration/cucumber/MainStepdefs.java | 8 +-
.../memory-jmap-integration-testing/pom.xml | 6 ++
.../memory/MemoryGetMailboxesMethodTest.java | 4 +-
.../memory/MemoryGetMessageListMethodTest.java | 4 +-
.../MemoryGetVacationResponseMethodTest.java | 4 +-
.../memory/MemoryJmapAuthenticationTest.java | 4 +-
.../memory/MemorySetMailboxesMethodTest.java | 4 +-
.../memory/MemorySetMessagesMethodTest.java | 4 +-
.../MemorySetVacationResponseMethodTest.java | 4 +-
.../MemoryUserProvisionningConcurrencyTest.java | 4 +-
.../memory/MemoryVacationIntegrationTest.java | 4 +-
.../jmap/memory/cucumber/MemoryStepdefs.java | 4 +-
.../WebAdminServerIntegrationTest.java | 7 +-
60 files changed, 243 insertions(+), 304 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
index d59a9ef..65311c3 100644
--- a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
+++ b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
@@ -22,7 +22,7 @@ package org.apache.james.mpt.smtp.host;
import java.util.Iterator;
import org.apache.james.CassandraJamesServerMain;
-import org.apache.james.GuiceJamesServerImpl;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.backends.cassandra.EmbeddedCassandra;
import org.apache.james.backends.es.EmbeddedElasticSearch;
import org.apache.james.dnsservice.api.DNSService;
@@ -45,7 +45,7 @@ public class CassandraJamesSmtpHostSystem extends ExternalSessionFactory impleme
private EmbeddedCassandra embeddedCassandra;
private EmbeddedElasticSearch embeddedElasticSearch;
- private GuiceJamesServerImpl jamesServer;
+ private GuiceJamesServer jamesServer;
private InMemoryDNSService inMemoryDNSService;
@@ -106,9 +106,8 @@ public class CassandraJamesSmtpHostSystem extends ExternalSessionFactory impleme
public InMemoryDNSService getInMemoryDnsService() {
return inMemoryDNSService;
}
-
- protected GuiceJamesServerImpl createJamesServer() {
- return new GuiceJamesServerImpl()
+ protected GuiceJamesServer createJamesServer() {
+ return new GuiceJamesServer()
.combineWith(CassandraJamesServerMain.cassandraServerModule, new SMTPServerModule(), new ProtocolHandlerModule())
.overrideWith(new CassandraJmapServerModule(folder::getRoot, embeddedElasticSearch, embeddedCassandra),
(binder) -> binder.bind(DNSService.class).toInstance(inMemoryDNSService));
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
index 24705a7..fc2384d 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
@@ -70,7 +70,7 @@ public class CassandraJamesServerMain {
public static void main(String[] args) throws Exception {
- GuiceJamesServerImpl server = new GuiceJamesServerImpl()
+ GuiceJamesServer server = new GuiceJamesServer()
.combineWith(cassandraServerModule, protocols, new JMXServerModule());
server.start();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
index 579e30c..b15491e 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
@@ -27,7 +27,7 @@ public class CassandraJamesServerTest extends AbstractJmapJamesServerTest {
public CassandraJmapTestRule cassandraJmap = CassandraJmapTestRule.defaultTestRule();
@Override
- protected JmapJamesServer createJamesServer() {
+ protected GuiceJamesServer createJamesServer() {
return cassandraJmap.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java
index d3588eb..8289b3c 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java
@@ -45,8 +45,8 @@ public class CassandraJmapTestRule implements TestRule {
.aggregate(new TempFilesystemTestRule());
}
- public JmapJamesServer jmapServer(Module... additionals) {
- return new JmapJamesServer()
+ public GuiceJamesServer jmapServer(Module... additionals) {
+ return new GuiceJamesServer()
.combineWith(CassandraJamesServerMain.cassandraServerModule, CassandraJamesServerMain.protocols)
.overrideWith(new TestJMAPServerModule(LIMIT_TO_3_MESSAGES))
.overrideWith(new TestESMetricReporterModule())
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraLogConfigurationTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraLogConfigurationTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraLogConfigurationTest.java
index 5d7f156..659453e 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraLogConfigurationTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraLogConfigurationTest.java
@@ -18,7 +18,14 @@
****************************************************************/
package org.apache.james;
-import com.google.inject.ProvisionException;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.SocketChannel;
+import java.nio.charset.Charset;
+
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.james.modules.mailbox.CassandraSessionConfiguration;
import org.junit.After;
@@ -27,13 +34,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.nio.ByteBuffer;
-import java.nio.channels.SocketChannel;
-import java.nio.charset.Charset;
-
-import static org.assertj.core.api.Assertions.assertThat;
+import com.google.inject.ProvisionException;
public class CassandraLogConfigurationTest {
@@ -48,7 +49,7 @@ public class CassandraLogConfigurationTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
- private GuiceJamesServerImpl jamesServer;
+ private GuiceJamesServer jamesServer;
private SocketChannel socketChannel;
@Before
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraMessageIdManagerInjectionTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraMessageIdManagerInjectionTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraMessageIdManagerInjectionTest.java
index b5e9dc2..e8395cb 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraMessageIdManagerInjectionTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraMessageIdManagerInjectionTest.java
@@ -42,7 +42,7 @@ public class CassandraMessageIdManagerInjectionTest {
@Rule
public CassandraJmapTestRule cassandraJmap = CassandraJmapTestRule.defaultTestRule();
- private JmapJamesServer server;
+ private GuiceJamesServer server;
@Before
public void test() throws Exception {
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraNodeConfTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraNodeConfTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraNodeConfTest.java
index 180aea6..9bc6de5 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraNodeConfTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraNodeConfTest.java
@@ -48,7 +48,7 @@ public class CassandraNodeConfTest {
public CassandraJmapTestRule cassandraJmapTestRule = new CassandraJmapTestRule(dockerCassandraRule,
new EmbeddedElasticSearchRule());
- private GuiceJamesServerImpl jamesServer;
+ private GuiceJamesServer jamesServer;
private SocketChannel socketChannel;
@Before
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
index ef33b42..238a934 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
@@ -36,6 +36,7 @@ import org.apache.james.jmap.HttpJmapAuthentication;
import org.apache.james.jmap.api.access.AccessToken;
import org.apache.james.modules.TestESMetricReporterModule;
import org.apache.james.utils.GuiceServerProbe;
+import org.apache.james.utils.JmapGuiceProbe;
import org.elasticsearch.client.Client;
import org.elasticsearch.index.query.QueryBuilders;
import org.junit.After;
@@ -67,14 +68,14 @@ public class ESReporterTest {
@Rule
public CassandraJmapTestRule cassandraJmap = new CassandraJmapTestRule(embeddedElasticSearchRule, new EmbeddedCassandraRule());
- private JmapJamesServer server;
+ private GuiceJamesServer server;
private AccessToken accessToken;
@Before
public void setup() throws Exception {
server = cassandraJmap.jmapServer();
server.start();
- GuiceServerProbe serverProbe = server.getGuiceProbeProvider().getProbe(GuiceServerProbe.class);
+ GuiceServerProbe serverProbe = server.getProbe(GuiceServerProbe.class);
serverProbe.addDomain(DOMAIN);
serverProbe.addUser(USERNAME, PASSWORD);
@@ -82,7 +83,7 @@ public class ESReporterTest {
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
.setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)))
- .setPort(server.getJmapProbe().getJmapPort())
+ .setPort(server.getProbe(JmapGuiceProbe.class).getJmapPort())
.build();
accessToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), USERNAME, PASSWORD);
@@ -93,7 +94,7 @@ public class ESReporterTest {
return new URIBuilder()
.setScheme("http")
.setHost("localhost")
- .setPort(server.getJmapProbe().getJmapPort())
+ .setPort(server.getProbe(JmapGuiceProbe.class).getJmapPort())
.setCharset(Charsets.UTF_8);
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
index 69c20f3..3dbce73 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
@@ -49,7 +49,7 @@ import com.google.inject.Singleton;
public class JamesCapabilitiesServerTest {
- private GuiceJamesServerImpl server;
+ private GuiceJamesServer server;
private TemporaryFolder temporaryFolder = new TemporaryFolder();
private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder, MailboxElasticsearchConstants.MAILBOX_INDEX);
@@ -61,10 +61,10 @@ public class JamesCapabilitiesServerTest {
server.stop();
}
- private GuiceJamesServerImpl createCassandraJamesServer(final MailboxManager mailboxManager) {
+ private GuiceJamesServer createCassandraJamesServer(final MailboxManager mailboxManager) {
Module mockMailboxManager = (binder) -> binder.bind(MailboxManager.class).toInstance(mailboxManager);
- return new GuiceJamesServerImpl()
+ return new GuiceJamesServer()
.combineWith(CassandraJamesServerMain.cassandraServerModule, CassandraJamesServerMain.protocols)
.overrideWith((binder) -> binder.bind(PersistenceAdapter.class).to(MemoryPersistenceAdapter.class))
.overrideWith(new TestElasticSearchModule(embeddedElasticSearch),
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/cassandra-ldap-guice/src/main/java/org/apache/james/CassandraLdapJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-ldap-guice/src/main/java/org/apache/james/CassandraLdapJamesServerMain.java b/server/container/guice/cassandra-ldap-guice/src/main/java/org/apache/james/CassandraLdapJamesServerMain.java
index f2fe651..746abec 100644
--- a/server/container/guice/cassandra-ldap-guice/src/main/java/org/apache/james/CassandraLdapJamesServerMain.java
+++ b/server/container/guice/cassandra-ldap-guice/src/main/java/org/apache/james/CassandraLdapJamesServerMain.java
@@ -31,7 +31,7 @@ public class CassandraLdapJamesServerMain {
.with(new LdapUsersRepositoryModule());
public static void main(String[] args) throws Exception {
- GuiceJamesServerImpl server = new GuiceJamesServerImpl()
+ GuiceJamesServer server = new GuiceJamesServer()
.combineWith(cassandraLdapServerModule, new JMXServerModule());
server.start();
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/CassandraLdapJamesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/CassandraLdapJamesServerTest.java b/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/CassandraLdapJamesServerTest.java
index 0e93c50..de2ac6c 100644
--- a/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/CassandraLdapJamesServerTest.java
+++ b/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/CassandraLdapJamesServerTest.java
@@ -48,7 +48,7 @@ public class CassandraLdapJamesServerTest extends AbstractJmapJamesServerTest {
public RuleChain ruleChain = RuleChain.outerRule(ldapContainer).around(cassandraLdapJmap);
@Override
- protected JmapJamesServer createJamesServer() {
+ protected GuiceJamesServer createJamesServer() {
ldapContainer.start();
return cassandraLdapJmap.jmapServer(ldapContainer.getLdapHost());
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/CassandraLdapJmapTestRule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/CassandraLdapJmapTestRule.java b/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/CassandraLdapJmapTestRule.java
index a571818..aa6233d 100644
--- a/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/CassandraLdapJmapTestRule.java
+++ b/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/CassandraLdapJmapTestRule.java
@@ -51,8 +51,8 @@ public class CassandraLdapJmapTestRule implements TestRule {
.aggregate(new TempFilesystemTestRule());
}
- public JmapJamesServer jmapServer(String ldapIp, Module... additionals) {
- return new JmapJamesServer()
+ public GuiceJamesServer jmapServer(String ldapIp, Module... additionals) {
+ return new GuiceJamesServer()
.combineWith(CassandraLdapJamesServerMain.cassandraLdapServerModule,
binder -> binder.bind(String.class).annotatedWith(Names.named("ldapIp")).toInstance(ldapIp))
.overrideWith(new TestJMAPServerModule(LIMIT_TO_3_MESSAGES))
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java b/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java
index d77521b..20e4318 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java
@@ -18,13 +18,68 @@
****************************************************************/
package org.apache.james;
+import java.util.Arrays;
+
+import javax.annotation.PreDestroy;
+
+import org.apache.james.modules.CommonServicesModule;
+import org.apache.james.modules.MailetProcessingModule;
+import org.apache.james.onami.lifecycle.Stager;
+import org.apache.james.utils.ConfigurationsPerformer;
+import org.apache.james.utils.GuiceProbe;
+import org.apache.james.utils.GuiceProbeProvider;
import org.apache.james.utils.GuiceServerProbe;
-public interface GuiceJamesServer {
+import com.google.common.collect.Iterables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Module;
+import com.google.inject.TypeLiteral;
+import com.google.inject.util.Modules;
+
+public class GuiceJamesServer {
+
+ protected final Module module;
+ private Stager<PreDestroy> preDestroy;
+ private GuiceProbeProvider guiceProbeProvider;
+
+ public GuiceJamesServer() {
+ this(Modules.combine(
+ new CommonServicesModule(),
+ new MailetProcessingModule()));
+ }
+
+ protected GuiceJamesServer(Module module) {
+ this.module = module;
+ }
+
+ public GuiceJamesServer combineWith(Module... modules) {
+ return new GuiceJamesServer(Modules.combine(Iterables.concat(Arrays.asList(module), Arrays.asList(modules))));
+ }
+
+ public GuiceJamesServer overrideWith(Module... overrides) {
+ return new GuiceJamesServer(Modules.override(module).with(overrides));
+ }
+
+ public void start() throws Exception {
+ Injector injector = Guice.createInjector(module);
+ preDestroy = injector.getInstance(Key.get(new TypeLiteral<Stager<PreDestroy>>() {}));
+ injector.getInstance(ConfigurationsPerformer.class).initModules();
+ guiceProbeProvider = injector.getInstance(GuiceProbeProvider.class);
+ }
- void start() throws Exception;
+ public void stop() {
+ if (preDestroy != null) {
+ preDestroy.stage();
+ }
+ }
- void stop();
+ public GuiceServerProbe serverProbe() {
+ return guiceProbeProvider.getProbe(GuiceServerProbe.class);
+ }
- GuiceServerProbe serverProbe();
+ public <T extends GuiceProbe> T getProbe(Class<T> probe) {
+ return guiceProbeProvider.getProbe(probe);
+ }
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServerImpl.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServerImpl.java b/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServerImpl.java
deleted file mode 100644
index 63d184d..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServerImpl.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james;
-
-import java.util.Arrays;
-
-import javax.annotation.PreDestroy;
-
-import org.apache.james.modules.CommonServicesModule;
-import org.apache.james.modules.MailetProcessingModule;
-import org.apache.james.onami.lifecycle.Stager;
-import org.apache.james.utils.ConfigurationsPerformer;
-import org.apache.james.utils.GuiceProbeProvider;
-import org.apache.james.utils.GuiceServerProbe;
-
-import com.google.common.collect.Iterables;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import com.google.inject.Module;
-import com.google.inject.TypeLiteral;
-import com.google.inject.util.Modules;
-
-public class GuiceJamesServerImpl implements GuiceJamesServer {
- protected final Module module;
- private Stager<PreDestroy> preDestroy;
- private GuiceProbeProvider guiceProbeProvider;
-
- public GuiceJamesServerImpl() {
- this(Modules.combine(
- new CommonServicesModule(),
- new MailetProcessingModule()));
- }
-
- protected GuiceJamesServerImpl(Module module) {
- this.module = module;
- }
-
- public GuiceJamesServerImpl combineWith(Module... modules) {
- return new GuiceJamesServerImpl(Modules.combine(Iterables.concat(Arrays.asList(module), Arrays.asList(modules))));
- }
-
- public GuiceJamesServerImpl overrideWith(Module... overrides) {
- return new GuiceJamesServerImpl(Modules.override(module).with(overrides));
- }
-
- @Override
- public void start() throws Exception {
- Injector injector = Guice.createInjector(module);
- preDestroy = injector.getInstance(Key.get(new TypeLiteral<Stager<PreDestroy>>() {}));
- injector.getInstance(ConfigurationsPerformer.class).initModules();
- guiceProbeProvider = injector.getInstance(GuiceProbeProvider.class);
- }
-
- @Override
- public void stop() {
- if (preDestroy != null) {
- preDestroy.stage();
- }
- }
-
- @Override
- public GuiceServerProbe serverProbe() {
- return guiceProbeProvider.getProbe(GuiceServerProbe.class);
- }
-
- protected GuiceProbeProvider getGuiceProbeProvider() {
- return guiceProbeProvider;
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/guice-common/src/main/java/org/apache/james/JmapJamesServer.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/JmapJamesServer.java b/server/container/guice/guice-common/src/main/java/org/apache/james/JmapJamesServer.java
deleted file mode 100644
index 46122a8..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/JmapJamesServer.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.apache.james.utils.JmapGuiceProbe;
-import org.apache.james.utils.WebAdminGuiceProbe;
-
-import com.google.common.collect.Iterables;
-import com.google.inject.Module;
-import com.google.inject.util.Modules;
-
-public class JmapJamesServer extends GuiceJamesServerImpl implements GuiceJamesServer, JmapServer, WebAdminServer {
-
- public JmapJamesServer() {
- super();
- }
-
- private JmapJamesServer(Module module) {
- super(module);
- }
-
- public JmapJamesServer combineWith(Module... modules) {
- return new JmapJamesServer(Modules.combine(Iterables.concat(Arrays.asList(module), Arrays.asList(modules))));
- }
-
- public JmapJamesServer overrideWith(Module... overrides) {
- return overrideWith(Arrays.asList(overrides));
- }
-
- public JmapJamesServer overrideWith(Collection<Module> overrides) {
- return new JmapJamesServer(Modules.override(module).with(overrides));
- }
-
- @Override
- public JmapGuiceProbe getJmapProbe() {
- return getGuiceProbeProvider().getProbe(JmapGuiceProbe.class);
- }
-
- @Override
- public WebAdminGuiceProbe getWebAdminProbe() {
- return getGuiceProbeProvider().getProbe(WebAdminGuiceProbe.class);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java b/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java
index 58039ea..fa85594 100644
--- a/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java
+++ b/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java
@@ -39,7 +39,7 @@ public abstract class AbstractJamesServerTest {
private static final int SMTP_PORT = 1025;
private static final int LMTP_PORT = 1024;
- private GuiceJamesServerImpl server;
+ private GuiceJamesServer server;
private SocketChannel socketChannel;
@Before
@@ -49,7 +49,7 @@ public abstract class AbstractJamesServerTest {
server.start();
}
- protected abstract GuiceJamesServerImpl createJamesServer();
+ protected abstract GuiceJamesServer createJamesServer();
protected abstract void clean();
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJmapJamesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJmapJamesServerTest.java b/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJmapJamesServerTest.java
index aff297f..de03298 100644
--- a/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJmapJamesServerTest.java
+++ b/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJmapJamesServerTest.java
@@ -30,6 +30,7 @@ import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;
+import org.apache.james.utils.JmapGuiceProbe;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -49,7 +50,7 @@ public abstract class AbstractJmapJamesServerTest {
protected static final String JAMES_SERVER_HOST = "127.0.0.1";
protected static final int IMAP_PORT = 1143; // You need to be root (superuser) to bind to ports under 1024.
- private JmapJamesServer server;
+ private GuiceJamesServer server;
private SocketChannel socketChannel;
@Before
@@ -62,12 +63,11 @@ public abstract class AbstractJmapJamesServerTest {
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
.setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)))
- .setPort(server.getJmapProbe()
- .getJmapPort())
+ .setPort(server.getProbe(JmapGuiceProbe.class).getJmapPort())
.build();
}
- protected abstract JmapJamesServer createJamesServer();
+ protected abstract GuiceJamesServer createJamesServer();
protected abstract void clean();
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
index ac99765..4cec352 100644
--- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
+++ b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
@@ -58,7 +58,7 @@ public class JPAJamesServerMain {
new RawPostDequeueDecoratorModule());
public static void main(String[] args) throws Exception {
- GuiceJamesServerImpl server = new GuiceJamesServerImpl()
+ GuiceJamesServer server = new GuiceJamesServer()
.combineWith(jpaServerModule, protocols,
new JMXServerModule(),
new LuceneSearchMailboxModule());
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java b/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
index 8ab4ad6..0684be1 100644
--- a/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
+++ b/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
@@ -29,8 +29,8 @@ public class JPAJamesServerTest extends AbstractJamesServerTest {
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Override
- protected GuiceJamesServerImpl createJamesServer() {
- return new GuiceJamesServerImpl()
+ protected GuiceJamesServer createJamesServer() {
+ return new GuiceJamesServer()
.combineWith(JPAJamesServerMain.jpaServerModule)
.overrideWith(new TestFilesystemModule(temporaryFolder),
new TestJPAConfigurationModule());
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/jpa-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java b/server/container/guice/jpa-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
index ad2a17c..82e728a 100644
--- a/server/container/guice/jpa-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
+++ b/server/container/guice/jpa-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
@@ -49,7 +49,7 @@ public class JamesCapabilitiesServerTest {
private GuiceJamesServer createJPAJamesServer(final MailboxManager mailboxManager) {
Module mockMailboxManager = (binder) -> binder.bind(MailboxManager.class).toInstance(mailboxManager);
- return new GuiceJamesServerImpl()
+ return new GuiceJamesServer()
.combineWith(JPAJamesServerMain.jpaServerModule)
.overrideWith(
new TestFilesystemModule(temporaryFolder),
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/memory-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/pom.xml b/server/container/guice/memory-guice/pom.xml
index 79ac0f4..8173aca 100644
--- a/server/container/guice/memory-guice/pom.xml
+++ b/server/container/guice/memory-guice/pom.xml
@@ -213,7 +213,14 @@
<artifactId>james-server-guice-common</artifactId>
<type>test-jar</type>
<scope>test</scope>
- </dependency><dependency>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>apache-mailet-base</artifactId>
<type>test-jar</type>
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java b/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
index 54f95c3..084d83e 100644
--- a/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
+++ b/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
@@ -22,6 +22,7 @@ package org.apache.james;
import org.apache.james.modules.data.MemoryDataJmapModule;
import org.apache.james.modules.data.MemoryDataModule;
import org.apache.james.modules.mailbox.MemoryMailboxModule;
+import org.apache.james.modules.protocols.IMAPServerModule;
import org.apache.james.modules.protocols.JMAPServerModule;
import org.apache.james.modules.server.JMXServerModule;
import org.apache.james.modules.server.MemoryMailQueueModule;
@@ -34,6 +35,7 @@ public class MemoryJamesServerMain {
public static final Module inMemoryServerModule = Modules.combine(
new JMAPServerModule(),
+ new IMAPServerModule(),
new MemoryDataModule(),
new MemoryDataJmapModule(),
new MemoryMailboxModule(),
@@ -41,7 +43,7 @@ public class MemoryJamesServerMain {
new MemoryMailQueueModule());
public static void main(String[] args) throws Exception {
- new JmapJamesServer()
+ new GuiceJamesServer()
.combineWith(inMemoryServerModule, new JMXServerModule())
.start();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java b/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java
index 6da4804..3a4f2b9 100644
--- a/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java
+++ b/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJamesServerTest.java
@@ -27,7 +27,7 @@ public class MemoryJamesServerTest extends AbstractJmapJamesServerTest {
public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
@Override
- protected JmapJamesServer createJamesServer() {
+ protected GuiceJamesServer createJamesServer() {
return memoryJmap.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJmapTestRule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJmapTestRule.java b/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJmapTestRule.java
index 6d48111..6653cd9 100644
--- a/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJmapTestRule.java
+++ b/server/container/guice/memory-guice/src/test/java/org/apache/james/MemoryJmapTestRule.java
@@ -34,8 +34,8 @@ public class MemoryJmapTestRule implements TestRule {
public TemporaryFolder temporaryFolder = new TemporaryFolder();
- public JmapJamesServer jmapServer() {
- return new JmapJamesServer()
+ public GuiceJamesServer jmapServer() {
+ return new GuiceJamesServer()
.combineWith(MemoryJamesServerMain.inMemoryServerModule)
.overrideWith(new TestFilesystemModule(temporaryFolder),
new TestJMAPServerModule(LIMIT_TO_3_MESSAGES))
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/mailet/integration-testing/pom.xml
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/pom.xml b/server/mailet/integration-testing/pom.xml
index d553be7..af2a2e6 100644
--- a/server/mailet/integration-testing/pom.xml
+++ b/server/mailet/integration-testing/pom.xml
@@ -176,6 +176,12 @@
</dependency>
<dependency>
<groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <scope>test</scope>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
<artifactId>james-server-mailetcontainer-camel</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/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 9f7919e..86dad85 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
@@ -30,7 +30,7 @@ import org.apache.activemq.store.PersistenceAdapter;
import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.io.IOUtils;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.MemoryJamesServerMain;
import org.apache.james.mailets.configuration.MailetContainer;
import org.apache.james.modules.TestJMAPServerModule;
@@ -46,13 +46,13 @@ public class TemporaryJamesServer {
private static final int LIMIT_TO_3_MESSAGES = 3;
- private final JmapJamesServer jamesServer;
+ private final GuiceJamesServer jamesServer;
public TemporaryJamesServer(TemporaryFolder temporaryFolder, MailetContainer mailetContainer, Module... additionalModules) throws Exception {
appendMailetConfigurations(temporaryFolder, mailetContainer);
- jamesServer = new JmapJamesServer()
+ jamesServer = new GuiceJamesServer()
.combineWith(MemoryJamesServerMain.inMemoryServerModule)
.overrideWith((binder) -> binder.bind(PersistenceAdapter.class).to(MemoryPersistenceAdapter.class))
.overrideWith(ImmutableList.<Module>builder().addAll(Arrays.asList(additionalModules))
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index e28a324..b8dc69c 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -246,6 +246,17 @@
</dependency>
<dependency>
<groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
<artifactId>james-server-jetty</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java
index 299a8f1..ce824ef 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMailboxesMethodTest.java
@@ -20,7 +20,7 @@
package org.apache.james.jmap.cassandra;
import org.apache.james.CassandraJmapTestRule;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.methods.integration.GetMailboxesMethodTest;
import org.junit.Rule;
@@ -30,7 +30,7 @@ public class CassandraGetMailboxesMethodTest extends GetMailboxesMethodTest {
public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return rule.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java
index cae3a6d..8207859 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetMessageListMethodTest.java
@@ -20,7 +20,7 @@
package org.apache.james.jmap.cassandra;
import org.apache.james.CassandraJmapTestRule;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.methods.integration.GetMessageListMethodTest;
import org.junit.Rule;
@@ -30,7 +30,7 @@ public class CassandraGetMessageListMethodTest extends GetMessageListMethodTest
public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return rule.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java
index c50f048..96101bc 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraGetVacationResponseTest.java
@@ -20,7 +20,7 @@
package org.apache.james.jmap.cassandra;
import org.apache.james.CassandraJmapTestRule;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.methods.integration.GetVacationResponseTest;
import org.apache.james.util.date.ZonedDateTimeProvider;
import org.junit.Rule;
@@ -31,7 +31,7 @@ public class CassandraGetVacationResponseTest extends GetVacationResponseTest {
public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
@Override
- protected JmapJamesServer createJmapServer(ZonedDateTimeProvider zonedDateTimeProvider) {
+ protected GuiceJamesServer createJmapServer(ZonedDateTimeProvider zonedDateTimeProvider) {
return rule.jmapServer()
.overrideWith(binder -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider));
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java
index d4027aa..71a42c3 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraJmapAuthenticationTest.java
@@ -19,7 +19,7 @@
package org.apache.james.jmap.cassandra;
import org.apache.james.CassandraJmapTestRule;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.FixedDateZonedDateTimeProvider;
import org.apache.james.jmap.JMAPAuthenticationTest;
import org.apache.james.util.date.ZonedDateTimeProvider;
@@ -31,7 +31,7 @@ public class CassandraJmapAuthenticationTest extends JMAPAuthenticationTest {
public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
@Override
- protected JmapJamesServer createJmapServer(FixedDateZonedDateTimeProvider zonedDateTimeProvider) {
+ protected GuiceJamesServer createJmapServer(FixedDateZonedDateTimeProvider zonedDateTimeProvider) {
return rule.jmapServer()
.overrideWith(binder -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider));
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodTest.java
index 7aea5d8..cdad450 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMailboxesMethodTest.java
@@ -20,7 +20,7 @@
package org.apache.james.jmap.cassandra;
import org.apache.james.CassandraJmapTestRule;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.methods.integration.SetMailboxesMethodTest;
import org.junit.Ignore;
import org.junit.Rule;
@@ -31,7 +31,7 @@ public class CassandraSetMailboxesMethodTest extends SetMailboxesMethodTest {
public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return rule.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
index e0e36c5..9a56d2b 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
@@ -20,7 +20,7 @@
package org.apache.james.jmap.cassandra;
import org.apache.james.CassandraJmapTestRule;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.methods.integration.SetMessagesMethodTest;
import org.apache.james.mailbox.cassandra.CassandraMessageId;
import org.apache.james.mailbox.model.MessageId;
@@ -32,7 +32,7 @@ public class CassandraSetMessagesMethodTest extends SetMessagesMethodTest {
public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return rule.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
index 6300459..ca9af6b 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
@@ -20,7 +20,7 @@
package org.apache.james.jmap.cassandra;
import org.apache.james.CassandraJmapTestRule;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.methods.integration.SetVacationResponseTest;
import org.junit.Rule;
@@ -30,7 +30,7 @@ public class CassandraSetVacationResponseTest extends SetVacationResponseTest {
public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return rule.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraUserProvisionningConcurrencyTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraUserProvisionningConcurrencyTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraUserProvisionningConcurrencyTest.java
index efd5be7..ea63d10 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraUserProvisionningConcurrencyTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraUserProvisionningConcurrencyTest.java
@@ -20,7 +20,7 @@
package org.apache.james.jmap.cassandra;
import org.apache.james.CassandraJmapTestRule;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.UserProvisionningConcurrencyTest;
import org.junit.Rule;
@@ -29,7 +29,7 @@ public class CassandraUserProvisionningConcurrencyTest extends UserProvisionning
public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return rule.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
index adbb077..186a3ce 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
@@ -20,7 +20,7 @@
package org.apache.james.jmap.cassandra;
import org.apache.james.CassandraJmapTestRule;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.VacationIntegrationTest;
import org.junit.Rule;
@@ -31,7 +31,7 @@ public class CassandraVacationIntegrationTest extends VacationIntegrationTest {
public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return rule.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
index abae9bd..249cc06 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
@@ -26,7 +26,7 @@ import javax.inject.Inject;
import org.apache.activemq.store.PersistenceAdapter;
import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
import org.apache.james.CassandraJamesServerMain;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.backends.cassandra.EmbeddedCassandra;
import org.apache.james.backends.es.EmbeddedElasticSearch;
import org.apache.james.jmap.methods.integration.cucumber.MainStepdefs;
@@ -59,7 +59,7 @@ public class CassandraStepdefs {
temporaryFolder.create();
embeddedElasticSearch.before();
mainStepdefs.messageIdFactory = new CassandraMessageId.Factory();
- mainStepdefs.jmapServer = new JmapJamesServer()
+ mainStepdefs.jmapServer = new GuiceJamesServer()
.combineWith(CassandraJamesServerMain.cassandraServerModule, CassandraJamesServerMain.protocols)
.overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra))
.overrideWith((binder) -> binder.bind(PersistenceAdapter.class).to(MemoryPersistenceAdapter.class));
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/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 41104ab..8580562 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
@@ -32,8 +32,9 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.UUID;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.model.ContinuationToken;
+import org.apache.james.utils.JmapGuiceProbe;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -49,11 +50,11 @@ public abstract class JMAPAuthenticationTest {
private static final ZonedDateTime newDate = ZonedDateTime.parse("2011-12-03T10:16:30+01:00", DateTimeFormatter.ISO_OFFSET_DATE_TIME);
private static final ZonedDateTime afterExpirationDate = ZonedDateTime.parse("2011-12-03T10:30:31+01:00", DateTimeFormatter.ISO_OFFSET_DATE_TIME);
- protected abstract JmapJamesServer createJmapServer(FixedDateZonedDateTimeProvider zonedDateTimeProvider);
+ protected abstract GuiceJamesServer createJmapServer(FixedDateZonedDateTimeProvider zonedDateTimeProvider);
private UserCredentials userCredentials;
private FixedDateZonedDateTimeProvider zonedDateTimeProvider;
- private JmapJamesServer jmapServer;
+ private GuiceJamesServer jmapServer;
@Before
public void setup() throws Throwable {
@@ -63,8 +64,7 @@ public abstract class JMAPAuthenticationTest {
jmapServer.start();
RestAssured.requestSpecification = new RequestSpecBuilder()
.setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)))
- .setPort(jmapServer.getJmapProbe()
- .getJmapPort())
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
.build();
userCredentials = UserCredentials.builder()
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/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 643500d..b210e4c 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
@@ -31,8 +31,9 @@ import static org.hamcrest.Matchers.hasSize;
import java.util.concurrent.TimeUnit;
import org.apache.http.client.utils.URIBuilder;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.util.concurrency.ConcurrentTestRunner;
+import org.apache.james.utils.JmapGuiceProbe;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -47,9 +48,9 @@ public abstract class UserProvisionningConcurrencyTest {
private static final String DOMAIN = "mydomain.tld";
private static final String USER = "myuser@" + DOMAIN;
private static final String PASSWORD = "secret";
- protected abstract JmapJamesServer createJmapServer();
+ protected abstract GuiceJamesServer createJmapServer();
- private JmapJamesServer jmapServer;
+ private GuiceJamesServer jmapServer;
@Before
public void setup() throws Throwable {
@@ -57,8 +58,7 @@ public abstract class UserProvisionningConcurrencyTest {
jmapServer.start();
RestAssured.requestSpecification = new RequestSpecBuilder()
.setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)))
- .setPort(jmapServer.getJmapProbe()
- .getJmapPort())
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
.build();
jmapServer.serverProbe().addDomain(DOMAIN);
@@ -101,8 +101,7 @@ public abstract class UserProvisionningConcurrencyTest {
return new URIBuilder()
.setScheme("http")
.setHost("localhost")
- .setPort(jmapServer.getJmapProbe()
- .getJmapPort())
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
.setCharset(Charsets.UTF_8);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/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 d3221f0..9d0b4a1 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
@@ -32,7 +32,7 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.http.client.utils.URIBuilder;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.api.access.AccessToken;
import org.apache.james.jmap.api.vacation.AccountId;
import org.apache.james.jmap.api.vacation.VacationPatch;
@@ -64,10 +64,10 @@ public abstract class VacationIntegrationTest {
public static final String ORIGINAL_MESSAGE_TEXT_BODY = "Hello someone, and thank you for joining example.com!";
private ConditionFactory calmlyAwait;
- private JmapJamesServer guiceJamesServer;
+ private GuiceJamesServer guiceJamesServer;
private JmapGuiceProbe jmapGuiceProbe;
- protected abstract JmapJamesServer createJmapServer();
+ protected abstract GuiceJamesServer createJmapServer();
protected abstract void await();
@@ -86,7 +86,7 @@ public abstract class VacationIntegrationTest {
guiceJamesServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, USER_2, DefaultMailboxes.INBOX);
await();
- jmapGuiceProbe = guiceJamesServer.getJmapProbe();
+ jmapGuiceProbe = guiceJamesServer.getProbe(JmapGuiceProbe.class);
RestAssured.requestSpecification = new RequestSpecBuilder()
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
@@ -103,7 +103,7 @@ public abstract class VacationIntegrationTest {
return new URIBuilder()
.setScheme("http")
.setHost("localhost")
- .setPort(guiceJamesServer.getJmapProbe()
+ .setPort(guiceJamesServer.getProbe(JmapGuiceProbe.class)
.getJmapPort())
.setCharset(Charsets.UTF_8);
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/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 49caa3e..301e862 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
@@ -39,7 +39,7 @@ import java.util.Locale;
import javax.mail.Flags;
import org.apache.http.client.utils.URIBuilder;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.DefaultMailboxes;
import org.apache.james.jmap.HttpJmapAuthentication;
import org.apache.james.jmap.api.access.AccessToken;
@@ -47,6 +47,7 @@ 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.utils.JmapGuiceProbe;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -61,11 +62,11 @@ public abstract class GetMailboxesMethodTest {
private static final String NAME = "[0][0]";
private static final String ARGUMENTS = "[0][1]";
- protected abstract JmapJamesServer createJmapServer();
+ protected abstract GuiceJamesServer createJmapServer();
private AccessToken accessToken;
private String username;
- private JmapJamesServer jmapServer;
+ private GuiceJamesServer jmapServer;
@Before
public void setup() throws Throwable {
@@ -76,8 +77,7 @@ public abstract class GetMailboxesMethodTest {
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
.setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)))
- .setPort(jmapServer.getJmapProbe()
- .getJmapPort())
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
.build();
String domain = "domain.tld";
@@ -92,7 +92,7 @@ public abstract class GetMailboxesMethodTest {
return new URIBuilder()
.setScheme("http")
.setHost("localhost")
- .setPort(jmapServer.getJmapProbe()
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class)
.getJmapPort())
.setCharset(Charsets.UTF_8);
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java
index 03b7bf2..b60906a 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java
@@ -38,7 +38,7 @@ import java.util.Date;
import javax.mail.Flags;
import org.apache.http.client.utils.URIBuilder;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.HttpJmapAuthentication;
import org.apache.james.jmap.api.access.AccessToken;
import org.apache.james.mailbox.FlagsBuilder;
@@ -47,6 +47,7 @@ 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.utils.JmapGuiceProbe;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -61,14 +62,14 @@ public abstract class GetMessageListMethodTest {
private static final String ARGUMENTS = "[0][1]";
private static final ZoneId ZONE_ID = ZoneId.of("Europe/Paris");
- protected abstract JmapJamesServer createJmapServer();
+ protected abstract GuiceJamesServer createJmapServer();
protected abstract void await();
private AccessToken accessToken;
private String username;
private String domain;
- private JmapJamesServer jmapServer;
+ private GuiceJamesServer jmapServer;
@Before
public void setup() throws Throwable {
@@ -78,8 +79,7 @@ public abstract class GetMessageListMethodTest {
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
.setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)))
- .setPort(jmapServer.getJmapProbe()
- .getJmapPort())
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
.build();
this.domain = "domain.tld";
@@ -94,7 +94,7 @@ public abstract class GetMessageListMethodTest {
return new URIBuilder()
.setScheme("http")
.setHost("localhost")
- .setPort(jmapServer.getJmapProbe()
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class)
.getJmapPort())
.setCharset(Charsets.UTF_8);
}
@@ -116,7 +116,7 @@ public abstract class GetMessageListMethodTest {
await();
- jmapServer.getJmapProbe().setInMailboxes(message.getMessageId(), username, mailbox.getMailboxId(), mailbox2.getMailboxId());
+ jmapServer.getProbe(JmapGuiceProbe.class).setInMailboxes(message.getMessageId(), username, mailbox.getMailboxId(), mailbox2.getMailboxId());
given()
.header("Authorization", accessToken.serialize())
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
index a1ff796..815cbe2 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
@@ -29,7 +29,7 @@ import static org.hamcrest.core.IsNull.nullValue;
import java.time.ZonedDateTime;
import org.apache.http.client.utils.URIBuilder;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.FixedDateZonedDateTimeProvider;
import org.apache.james.jmap.HttpJmapAuthentication;
import org.apache.james.jmap.api.access.AccessToken;
@@ -59,12 +59,12 @@ public abstract class GetVacationResponseTest {
public static final ZonedDateTime DATE_2016 = ZonedDateTime.parse("2016-04-15T11:56:32.224+07:00[Asia/Vientiane]");
private JmapGuiceProbe jmapGuiceProbe;
- protected abstract JmapJamesServer createJmapServer(ZonedDateTimeProvider zonedDateTimeProvider);
+ protected abstract GuiceJamesServer createJmapServer(ZonedDateTimeProvider zonedDateTimeProvider);
protected abstract void await();
private AccessToken accessToken;
- private JmapJamesServer jmapServer;
+ private GuiceJamesServer jmapServer;
private FixedDateZonedDateTimeProvider fixedDateZonedDateTimeProvider;
@Before
@@ -75,7 +75,7 @@ public abstract class GetVacationResponseTest {
jmapServer = createJmapServer(fixedDateZonedDateTimeProvider);
jmapServer.start();
- jmapGuiceProbe = jmapServer.getJmapProbe();
+ jmapGuiceProbe = jmapServer.getProbe(JmapGuiceProbe.class);
RestAssured.requestSpecification = new RequestSpecBuilder()
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
@@ -95,7 +95,7 @@ public abstract class GetVacationResponseTest {
return new URIBuilder()
.setScheme("http")
.setHost("localhost")
- .setPort(jmapServer.getJmapProbe()
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class)
.getJmapPort())
.setCharset(Charsets.UTF_8);
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/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 3a310f0..df568cf 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
@@ -39,13 +39,14 @@ import static org.hamcrest.collection.IsMapWithSize.aMapWithSize;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.utils.URIBuilder;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.DefaultMailboxes;
import org.apache.james.jmap.HttpJmapAuthentication;
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.utils.JmapGuiceProbe;
import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Before;
@@ -63,13 +64,13 @@ public abstract class SetMailboxesMethodTest {
private static final String USERS_DOMAIN = "domain.tld";
private static int MAILBOX_NAME_LENGTH_64K = 65536;
- protected abstract JmapJamesServer createJmapServer();
+ protected abstract GuiceJamesServer createJmapServer();
protected abstract void await();
private AccessToken accessToken;
private String username;
- private JmapJamesServer jmapServer;
+ private GuiceJamesServer jmapServer;
@Before
public void setup() throws Throwable {
@@ -80,8 +81,7 @@ public abstract class SetMailboxesMethodTest {
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
.setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)))
- .setPort(jmapServer.getJmapProbe()
- .getJmapPort())
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
.build();
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
@@ -99,7 +99,7 @@ public abstract class SetMailboxesMethodTest {
return new URIBuilder()
.setScheme("http")
.setHost("localhost")
- .setPort(jmapServer.getJmapProbe()
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class)
.getJmapPort())
.setCharset(Charsets.UTF_8);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[16/21] james-project git commit: JAMES-1902 create mailet module
Posted by bt...@apache.org.
JAMES-1902 create mailet module
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/5e965d82
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/5e965d82
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/5e965d82
Branch: refs/heads/master
Commit: 5e965d829fbfa4d0f0af5fc824ae9215a95a78a2
Parents: dc03251
Author: Antoine Duprat <ad...@linagora.com>
Authored: Tue Mar 7 11:12:42 2017 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
server/container/guice/guice-common/pom.xml | 16 +-
.../server/CamelMailetContainerModule.java | 187 ------------------
.../apache/james/utils/GuiceGenericLoader.java | 47 -----
.../apache/james/utils/GuiceMailetLoader.java | 53 -----
.../apache/james/utils/GuiceMatcherLoader.java | 53 -----
.../james/jmap/MailetPreconditionTest.java | 122 ------------
server/container/guice/mailet/pom.xml | 192 +++++++++++++++++++
.../server/CamelMailetContainerModule.java | 187 ++++++++++++++++++
.../apache/james/utils/GuiceGenericLoader.java | 47 +++++
.../apache/james/utils/GuiceMailetLoader.java | 53 +++++
.../apache/james/utils/GuiceMatcherLoader.java | 53 +++++
server/container/guice/pom.xml | 6 +
12 files changed, 542 insertions(+), 474 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/5e965d82/server/container/guice/guice-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/pom.xml b/server/container/guice/guice-common/pom.xml
index 1576d90..6071182 100644
--- a/server/container/guice/guice-common/pom.xml
+++ b/server/container/guice/guice-common/pom.xml
@@ -137,10 +137,6 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>apache-mailet-standard</artifactId>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
<artifactId>james-server-cli</artifactId>
</dependency>
<dependency>
@@ -197,6 +193,10 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-mailet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-managedsieve</artifactId>
</dependency>
<dependency>
@@ -212,14 +212,6 @@
<artifactId>james-server-mailets</artifactId>
</dependency>
<dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>james-server-mailetcontainer-api</artifactId>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>james-server-mailetcontainer-camel</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.james</groupId>
<artifactId>metrics-api</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/5e965d82/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
deleted file mode 100644
index 34a64a5..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.modules.server;
-
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
-
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.SimpleRegistry;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.dnsservice.api.DNSService;
-import org.apache.james.domainlist.api.DomainList;
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.mailetcontainer.api.MailProcessor;
-import org.apache.james.mailetcontainer.api.MailetLoader;
-import org.apache.james.mailetcontainer.api.MatcherLoader;
-import org.apache.james.mailetcontainer.api.jmx.MailSpoolerMBean;
-import org.apache.james.mailetcontainer.impl.JamesMailSpooler;
-import org.apache.james.mailetcontainer.impl.JamesMailetContext;
-import org.apache.james.mailetcontainer.impl.MatcherMailetPair;
-import org.apache.james.mailetcontainer.impl.camel.CamelCompositeProcessor;
-import org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor;
-import org.apache.james.queue.api.MailQueueFactory;
-import org.apache.james.transport.mailets.RemoveMimeHeader;
-import org.apache.james.transport.matchers.All;
-import org.apache.james.user.api.UsersRepository;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.ConfigurationProvider;
-import org.apache.james.utils.GuiceMailetLoader;
-import org.apache.james.utils.GuiceMatcherLoader;
-import org.apache.mailet.MailetContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-
-public class CamelMailetContainerModule extends AbstractModule {
-
- private static final Logger CAMEL_LOGGER = LoggerFactory.getLogger(CamelCompositeProcessor.class);
- private static final Logger SPOOLER_LOGGER = LoggerFactory.getLogger(JamesMailSpooler.class);
- private static final Logger MAILET_LOGGER = LoggerFactory.getLogger(JamesMailetContext.class);
-
- @Override
- protected void configure() {
- bind(CamelCompositeProcessor.class).in(Scopes.SINGLETON);
- bind(MailProcessor.class).to(CamelCompositeProcessor.class);
-
- bind(JamesMailSpooler.class).in(Scopes.SINGLETON);
- bind(MailSpoolerMBean.class).to(JamesMailSpooler.class);
-
- bind(MailetLoader.class).to(GuiceMailetLoader.class);
- bind(MatcherLoader.class).to(GuiceMatcherLoader.class);
-
- Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(MailetModuleConfigurationPerformer.class);
-
- Multibinder<CamelMailetContainerModule.TransportProcessorCheck> transportProcessorChecks = Multibinder.newSetBinder(binder(), CamelMailetContainerModule.TransportProcessorCheck.class);
- transportProcessorChecks.addBinding().to(BccMailetCheck.class);
- }
-
- @Provides
- @Singleton
- private MailetContext provideMailetContext(MailQueueFactory mailQueueFactory,
- DNSService dns,
- UsersRepository localusers,
- DomainList domains) {
- JamesMailetContext jamesMailetContext = new JamesMailetContext();
- jamesMailetContext.setLog(MAILET_LOGGER);
- jamesMailetContext.setDNSService(dns);
- jamesMailetContext.retrieveRootMailQueue(mailQueueFactory);
- jamesMailetContext.setUsersRepository(localusers);
- jamesMailetContext.setDomainList(domains);
- return jamesMailetContext;
- }
-
- @Singleton
- public static class MailetModuleConfigurationPerformer implements ConfigurationPerformer {
-
- private final ConfigurationProvider configurationProvider;
- private final CamelCompositeProcessor camelCompositeProcessor;
- private final JamesMailSpooler jamesMailSpooler;
- private final JamesMailetContext mailetContext;
- private final MailQueueFactory mailQueueFactory;
- private Set<TransportProcessorCheck> transportProcessorCheckSet;
-
- @Inject
- public MailetModuleConfigurationPerformer(ConfigurationProvider configurationProvider,
- CamelCompositeProcessor camelCompositeProcessor,
- JamesMailSpooler jamesMailSpooler,
- JamesMailetContext mailetContext,
- MailQueueFactory mailQueueFactory,
- Set<TransportProcessorCheck> transportProcessorCheckSet) {
- this.configurationProvider = configurationProvider;
- this.camelCompositeProcessor = camelCompositeProcessor;
- this.jamesMailSpooler = jamesMailSpooler;
- this.mailetContext = mailetContext;
- this.mailQueueFactory = mailQueueFactory;
- this.transportProcessorCheckSet = transportProcessorCheckSet;
- }
-
- @Override
- public void initModule() {
- try {
- DefaultCamelContext camelContext = new DefaultCamelContext();
- camelContext.disableJMX();
- camelContext.setRegistry(new SimpleRegistry());
- camelCompositeProcessor.setLog(CAMEL_LOGGER);
- camelCompositeProcessor.setCamelContext(camelContext);
- camelCompositeProcessor.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("processors"));
- camelCompositeProcessor.init();
- checkProcessors();
- jamesMailSpooler.setMailProcessor(camelCompositeProcessor);
- jamesMailSpooler.setLog(SPOOLER_LOGGER);
- jamesMailSpooler.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("spooler"));
- jamesMailSpooler.init();
- mailetContext.setLog(MAILET_LOGGER);
- mailetContext.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("context"));
- mailetContext.retrieveRootMailQueue(mailQueueFactory);
- } catch (Exception e) {
- throw Throwables.propagate(e);
- }
-
- }
-
- private void checkProcessors() throws ConfigurationException {
- MailProcessor mailProcessor = Optional.ofNullable(camelCompositeProcessor.getProcessor("transport"))
- .orElseThrow(() -> new RuntimeException("JMAP needs a transport processor"));
- if (mailProcessor instanceof CamelMailetProcessor) {
- List<MatcherMailetPair> matcherMailetPairs = ((CamelMailetProcessor) mailProcessor).getPairs();
- for (TransportProcessorCheck check : transportProcessorCheckSet) {
- check.check(matcherMailetPairs);
- }
- } else {
- throw new RuntimeException("Can not perform checks as transport processor is not an instance of " + MailProcessor.class);
- }
- }
-
- @Override
- public List<Class<? extends Configurable>> forClasses() {
- return ImmutableList.of(CamelCompositeProcessor.class, JamesMailSpooler.class, JamesMailetContext.class);
- }
- }
-
- @FunctionalInterface
- public interface TransportProcessorCheck {
- void check(List<MatcherMailetPair> pairs) throws ConfigurationException;
- }
-
- public static class BccMailetCheck implements CamelMailetContainerModule.TransportProcessorCheck {
- @Override
- public void check(List<MatcherMailetPair> pairs) throws ConfigurationException {
- Preconditions.checkNotNull(pairs);
- pairs.stream()
- .filter(pair -> pair.getMailet().getClass().equals(RemoveMimeHeader.class))
- .filter(pair -> pair.getMatcher().getClass().equals(All.class))
- .filter(pair -> pair.getMailet().getMailetConfig().getInitParameter("name").equals("bcc"))
- .findAny()
- .orElseThrow(() -> new ConfigurationException("Missing RemoveMimeHeader in mailets configuration (mailetcontainer -> processors -> transport). Should be configured to remove Bcc header"));
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/5e965d82/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceGenericLoader.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceGenericLoader.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceGenericLoader.java
deleted file mode 100644
index 645d9b0..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceGenericLoader.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.utils;
-
-import com.google.inject.Injector;
-
-public class GuiceGenericLoader<T> {
-
- private final Injector injector;
- private final String defaultPackageName;
-
- public GuiceGenericLoader(Injector injector, String defaultPackageName) {
- this.injector = injector;
- this.defaultPackageName = defaultPackageName;
- }
-
- public T instanciate(String className) throws Exception {
- @SuppressWarnings("unchecked")
- Class<T> clazz = (Class<T>) ClassLoader.getSystemClassLoader().loadClass(constructFullName(className));
- return injector.getInstance(clazz);
- }
-
- private String constructFullName(String name) {
- if (! name.contains(".")) {
- return defaultPackageName + name;
- }
- return name;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/5e965d82/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceMailetLoader.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceMailetLoader.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceMailetLoader.java
deleted file mode 100644
index f979ac2..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceMailetLoader.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.utils;
-
-import javax.mail.MessagingException;
-
-import org.apache.james.mailetcontainer.api.MailetLoader;
-import org.apache.mailet.Mailet;
-import org.apache.mailet.MailetConfig;
-
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-
-public class GuiceMailetLoader implements MailetLoader {
-
- private static final String STANDARD_PACKAGE = "org.apache.james.transport.mailets.";
-
- private final GuiceGenericLoader<Mailet> genericLoader;
-
- @Inject
- public GuiceMailetLoader(Injector injector) {
- this.genericLoader = new GuiceGenericLoader<>(injector, STANDARD_PACKAGE);
- }
-
- @Override
- public Mailet getMailet(MailetConfig config) throws MessagingException {
- try {
- Mailet result = genericLoader.instanciate(config.getMailetName());
- result.init(config);
- return result;
- } catch (Exception e) {
- throw new MessagingException("Can not load mailet " + config.getMailetName(), e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/5e965d82/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceMatcherLoader.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceMatcherLoader.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceMatcherLoader.java
deleted file mode 100644
index 10e7cd6..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceMatcherLoader.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.utils;
-
-import javax.mail.MessagingException;
-
-import org.apache.james.mailetcontainer.api.MatcherLoader;
-import org.apache.mailet.Matcher;
-import org.apache.mailet.MatcherConfig;
-
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-
-public class GuiceMatcherLoader implements MatcherLoader {
-
- private static final String STANDARD_PACKAGE = "org.apache.james.transport.matchers.";
-
- private final GuiceGenericLoader<Matcher> genericLoader;
-
- @Inject
- public GuiceMatcherLoader(Injector injector) {
- this.genericLoader = new GuiceGenericLoader<>(injector, STANDARD_PACKAGE);
- }
-
- @Override
- public Matcher getMatcher(MatcherConfig config) throws MessagingException {
- try {
- Matcher result = genericLoader.instanciate(config.getMatcherName());
- result.init(config);
- return result;
- } catch (Exception e) {
- throw new MessagingException("Can not load matcher " + config.getMatcherName(), e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/5e965d82/server/container/guice/guice-common/src/test/java/org/apache/james/jmap/MailetPreconditionTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/test/java/org/apache/james/jmap/MailetPreconditionTest.java b/server/container/guice/guice-common/src/test/java/org/apache/james/jmap/MailetPreconditionTest.java
deleted file mode 100644
index 0e1af99..0000000
--- a/server/container/guice/guice-common/src/test/java/org/apache/james/jmap/MailetPreconditionTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.jmap;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.jmap.mailet.VacationMailet;
-import org.apache.james.mailetcontainer.impl.MatcherMailetPair;
-import org.apache.james.modules.server.CamelMailetContainerModule;
-import org.apache.james.transport.mailets.Null;
-import org.apache.james.transport.mailets.RemoveMimeHeader;
-import org.apache.james.transport.matchers.All;
-import org.apache.james.transport.matchers.RecipientIsLocal;
-import org.apache.mailet.MailetContext;
-import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Test;
-
-import com.google.common.collect.Lists;
-
-public class MailetPreconditionTest {
-
- private static final MailetContext MAILET_CONTEXT = null;
- private static final String WRONG_NAME = "wrong";
- private static final String BCC = "bcc";
-
- @Test(expected = ConfigurationException.class)
- public void vacationMailetCheckShouldThrowOnEmptyList() throws Exception {
- new JMAPModule.VacationMailetCheck().check(Lists.newArrayList());
- }
-
- @Test(expected = NullPointerException.class)
- public void vacationMailetCheckShouldThrowOnNullList() throws Exception {
- new JMAPModule.VacationMailetCheck().check(null);
- }
-
- @Test(expected = ConfigurationException.class)
- public void vacationMailetCheckShouldThrowOnWrongMatcher() throws Exception {
- List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), new VacationMailet(null, null, null, null, null)));
- new JMAPModule.VacationMailetCheck().check(pairs);
- }
-
- @Test(expected = ConfigurationException.class)
- public void vacationMailetCheckShouldThrowOnWrongMailet() throws Exception {
- List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new RecipientIsLocal(), new Null()));
- new JMAPModule.VacationMailetCheck().check(pairs);
- }
-
- @Test
- public void vacationMailetCheckShouldNotThrowIfValidPairPresent() throws Exception {
- List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new RecipientIsLocal(), new VacationMailet(null, null, null, null, null)));
- new JMAPModule.VacationMailetCheck().check(pairs);
- }
-
- @Test(expected = ConfigurationException.class)
- public void bccMailetCheckShouldThrowOnEmptyList() throws Exception {
- new CamelMailetContainerModule.BccMailetCheck().check(Lists.newArrayList());
- }
-
- @Test(expected = NullPointerException.class)
- public void bccMailetCheckShouldThrowOnNullList() throws Exception {
- new CamelMailetContainerModule.BccMailetCheck().check(null);
- }
-
- @Test(expected = ConfigurationException.class)
- public void bccMailetCheckShouldThrowOnWrongMatcher() throws Exception {
- List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new RecipientIsLocal(), new RemoveMimeHeader()));
- new JMAPModule.VacationMailetCheck().check(pairs);
- }
-
- @Test(expected = ConfigurationException.class)
- public void bccMailetCheckShouldThrowOnWrongMailet() throws Exception {
- List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), new Null()));
- new JMAPModule.VacationMailetCheck().check(pairs);
- }
-
- @Test(expected = ConfigurationException.class)
- public void bccMailetCheckShouldThrowOnWrongMailetName() throws Exception {
- Properties properties = new Properties();
- properties.setProperty("name", WRONG_NAME);
- RemoveMimeHeader removeMimeHeader = new RemoveMimeHeader();
- removeMimeHeader.init(FakeMailetConfig.builder()
- .mailetName(WRONG_NAME)
- .mailetContext(MAILET_CONTEXT)
- .setProperty("name", WRONG_NAME)
- .build());
-
- List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), removeMimeHeader));
- new JMAPModule.VacationMailetCheck().check(pairs);
- }
-
- @Test(expected = ConfigurationException.class)
- public void bccMailetCheckShouldNotThrowOnValidPair() throws Exception {
- RemoveMimeHeader removeMimeHeader = new RemoveMimeHeader();
- removeMimeHeader.init(FakeMailetConfig.builder()
- .mailetName(BCC)
- .mailetContext(MAILET_CONTEXT)
- .setProperty("name", BCC)
- .build());
-
- List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), removeMimeHeader));
- new JMAPModule.VacationMailetCheck().check(pairs);
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/5e965d82/server/container/guice/mailet/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/mailet/pom.xml b/server/container/guice/mailet/pom.xml
new file mode 100644
index 0000000..80edd78
--- /dev/null
+++ b/server/container/guice/mailet/pom.xml
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>james-server-guice</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>james-server-guice-mailet</artifactId>
+
+ <name>Apache James :: Server :: Guice :: Mailet</name>
+ <description>Mailet modules for Guice implementation of James server</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-mailet-standard</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-mailetcontainer-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-mailetcontainer-camel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>animal-sniffer-java-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java18</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check_java_8</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/5e965d82/server/container/guice/mailet/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/mailet/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java b/server/container/guice/mailet/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
new file mode 100644
index 0000000..34a64a5
--- /dev/null
+++ b/server/container/guice/mailet/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
@@ -0,0 +1,187 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.modules.server;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.SimpleRegistry;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.dnsservice.api.DNSService;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.mailetcontainer.api.MailProcessor;
+import org.apache.james.mailetcontainer.api.MailetLoader;
+import org.apache.james.mailetcontainer.api.MatcherLoader;
+import org.apache.james.mailetcontainer.api.jmx.MailSpoolerMBean;
+import org.apache.james.mailetcontainer.impl.JamesMailSpooler;
+import org.apache.james.mailetcontainer.impl.JamesMailetContext;
+import org.apache.james.mailetcontainer.impl.MatcherMailetPair;
+import org.apache.james.mailetcontainer.impl.camel.CamelCompositeProcessor;
+import org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor;
+import org.apache.james.queue.api.MailQueueFactory;
+import org.apache.james.transport.mailets.RemoveMimeHeader;
+import org.apache.james.transport.matchers.All;
+import org.apache.james.user.api.UsersRepository;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.apache.james.utils.GuiceMailetLoader;
+import org.apache.james.utils.GuiceMatcherLoader;
+import org.apache.mailet.MailetContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class CamelMailetContainerModule extends AbstractModule {
+
+ private static final Logger CAMEL_LOGGER = LoggerFactory.getLogger(CamelCompositeProcessor.class);
+ private static final Logger SPOOLER_LOGGER = LoggerFactory.getLogger(JamesMailSpooler.class);
+ private static final Logger MAILET_LOGGER = LoggerFactory.getLogger(JamesMailetContext.class);
+
+ @Override
+ protected void configure() {
+ bind(CamelCompositeProcessor.class).in(Scopes.SINGLETON);
+ bind(MailProcessor.class).to(CamelCompositeProcessor.class);
+
+ bind(JamesMailSpooler.class).in(Scopes.SINGLETON);
+ bind(MailSpoolerMBean.class).to(JamesMailSpooler.class);
+
+ bind(MailetLoader.class).to(GuiceMailetLoader.class);
+ bind(MatcherLoader.class).to(GuiceMatcherLoader.class);
+
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(MailetModuleConfigurationPerformer.class);
+
+ Multibinder<CamelMailetContainerModule.TransportProcessorCheck> transportProcessorChecks = Multibinder.newSetBinder(binder(), CamelMailetContainerModule.TransportProcessorCheck.class);
+ transportProcessorChecks.addBinding().to(BccMailetCheck.class);
+ }
+
+ @Provides
+ @Singleton
+ private MailetContext provideMailetContext(MailQueueFactory mailQueueFactory,
+ DNSService dns,
+ UsersRepository localusers,
+ DomainList domains) {
+ JamesMailetContext jamesMailetContext = new JamesMailetContext();
+ jamesMailetContext.setLog(MAILET_LOGGER);
+ jamesMailetContext.setDNSService(dns);
+ jamesMailetContext.retrieveRootMailQueue(mailQueueFactory);
+ jamesMailetContext.setUsersRepository(localusers);
+ jamesMailetContext.setDomainList(domains);
+ return jamesMailetContext;
+ }
+
+ @Singleton
+ public static class MailetModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final CamelCompositeProcessor camelCompositeProcessor;
+ private final JamesMailSpooler jamesMailSpooler;
+ private final JamesMailetContext mailetContext;
+ private final MailQueueFactory mailQueueFactory;
+ private Set<TransportProcessorCheck> transportProcessorCheckSet;
+
+ @Inject
+ public MailetModuleConfigurationPerformer(ConfigurationProvider configurationProvider,
+ CamelCompositeProcessor camelCompositeProcessor,
+ JamesMailSpooler jamesMailSpooler,
+ JamesMailetContext mailetContext,
+ MailQueueFactory mailQueueFactory,
+ Set<TransportProcessorCheck> transportProcessorCheckSet) {
+ this.configurationProvider = configurationProvider;
+ this.camelCompositeProcessor = camelCompositeProcessor;
+ this.jamesMailSpooler = jamesMailSpooler;
+ this.mailetContext = mailetContext;
+ this.mailQueueFactory = mailQueueFactory;
+ this.transportProcessorCheckSet = transportProcessorCheckSet;
+ }
+
+ @Override
+ public void initModule() {
+ try {
+ DefaultCamelContext camelContext = new DefaultCamelContext();
+ camelContext.disableJMX();
+ camelContext.setRegistry(new SimpleRegistry());
+ camelCompositeProcessor.setLog(CAMEL_LOGGER);
+ camelCompositeProcessor.setCamelContext(camelContext);
+ camelCompositeProcessor.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("processors"));
+ camelCompositeProcessor.init();
+ checkProcessors();
+ jamesMailSpooler.setMailProcessor(camelCompositeProcessor);
+ jamesMailSpooler.setLog(SPOOLER_LOGGER);
+ jamesMailSpooler.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("spooler"));
+ jamesMailSpooler.init();
+ mailetContext.setLog(MAILET_LOGGER);
+ mailetContext.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("context"));
+ mailetContext.retrieveRootMailQueue(mailQueueFactory);
+ } catch (Exception e) {
+ throw Throwables.propagate(e);
+ }
+
+ }
+
+ private void checkProcessors() throws ConfigurationException {
+ MailProcessor mailProcessor = Optional.ofNullable(camelCompositeProcessor.getProcessor("transport"))
+ .orElseThrow(() -> new RuntimeException("JMAP needs a transport processor"));
+ if (mailProcessor instanceof CamelMailetProcessor) {
+ List<MatcherMailetPair> matcherMailetPairs = ((CamelMailetProcessor) mailProcessor).getPairs();
+ for (TransportProcessorCheck check : transportProcessorCheckSet) {
+ check.check(matcherMailetPairs);
+ }
+ } else {
+ throw new RuntimeException("Can not perform checks as transport processor is not an instance of " + MailProcessor.class);
+ }
+ }
+
+ @Override
+ public List<Class<? extends Configurable>> forClasses() {
+ return ImmutableList.of(CamelCompositeProcessor.class, JamesMailSpooler.class, JamesMailetContext.class);
+ }
+ }
+
+ @FunctionalInterface
+ public interface TransportProcessorCheck {
+ void check(List<MatcherMailetPair> pairs) throws ConfigurationException;
+ }
+
+ public static class BccMailetCheck implements CamelMailetContainerModule.TransportProcessorCheck {
+ @Override
+ public void check(List<MatcherMailetPair> pairs) throws ConfigurationException {
+ Preconditions.checkNotNull(pairs);
+ pairs.stream()
+ .filter(pair -> pair.getMailet().getClass().equals(RemoveMimeHeader.class))
+ .filter(pair -> pair.getMatcher().getClass().equals(All.class))
+ .filter(pair -> pair.getMailet().getMailetConfig().getInitParameter("name").equals("bcc"))
+ .findAny()
+ .orElseThrow(() -> new ConfigurationException("Missing RemoveMimeHeader in mailets configuration (mailetcontainer -> processors -> transport). Should be configured to remove Bcc header"));
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/5e965d82/server/container/guice/mailet/src/main/java/org/apache/james/utils/GuiceGenericLoader.java
----------------------------------------------------------------------
diff --git a/server/container/guice/mailet/src/main/java/org/apache/james/utils/GuiceGenericLoader.java b/server/container/guice/mailet/src/main/java/org/apache/james/utils/GuiceGenericLoader.java
new file mode 100644
index 0000000..645d9b0
--- /dev/null
+++ b/server/container/guice/mailet/src/main/java/org/apache/james/utils/GuiceGenericLoader.java
@@ -0,0 +1,47 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.utils;
+
+import com.google.inject.Injector;
+
+public class GuiceGenericLoader<T> {
+
+ private final Injector injector;
+ private final String defaultPackageName;
+
+ public GuiceGenericLoader(Injector injector, String defaultPackageName) {
+ this.injector = injector;
+ this.defaultPackageName = defaultPackageName;
+ }
+
+ public T instanciate(String className) throws Exception {
+ @SuppressWarnings("unchecked")
+ Class<T> clazz = (Class<T>) ClassLoader.getSystemClassLoader().loadClass(constructFullName(className));
+ return injector.getInstance(clazz);
+ }
+
+ private String constructFullName(String name) {
+ if (! name.contains(".")) {
+ return defaultPackageName + name;
+ }
+ return name;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/5e965d82/server/container/guice/mailet/src/main/java/org/apache/james/utils/GuiceMailetLoader.java
----------------------------------------------------------------------
diff --git a/server/container/guice/mailet/src/main/java/org/apache/james/utils/GuiceMailetLoader.java b/server/container/guice/mailet/src/main/java/org/apache/james/utils/GuiceMailetLoader.java
new file mode 100644
index 0000000..f979ac2
--- /dev/null
+++ b/server/container/guice/mailet/src/main/java/org/apache/james/utils/GuiceMailetLoader.java
@@ -0,0 +1,53 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.utils;
+
+import javax.mail.MessagingException;
+
+import org.apache.james.mailetcontainer.api.MailetLoader;
+import org.apache.mailet.Mailet;
+import org.apache.mailet.MailetConfig;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+public class GuiceMailetLoader implements MailetLoader {
+
+ private static final String STANDARD_PACKAGE = "org.apache.james.transport.mailets.";
+
+ private final GuiceGenericLoader<Mailet> genericLoader;
+
+ @Inject
+ public GuiceMailetLoader(Injector injector) {
+ this.genericLoader = new GuiceGenericLoader<>(injector, STANDARD_PACKAGE);
+ }
+
+ @Override
+ public Mailet getMailet(MailetConfig config) throws MessagingException {
+ try {
+ Mailet result = genericLoader.instanciate(config.getMailetName());
+ result.init(config);
+ return result;
+ } catch (Exception e) {
+ throw new MessagingException("Can not load mailet " + config.getMailetName(), e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/5e965d82/server/container/guice/mailet/src/main/java/org/apache/james/utils/GuiceMatcherLoader.java
----------------------------------------------------------------------
diff --git a/server/container/guice/mailet/src/main/java/org/apache/james/utils/GuiceMatcherLoader.java b/server/container/guice/mailet/src/main/java/org/apache/james/utils/GuiceMatcherLoader.java
new file mode 100644
index 0000000..10e7cd6
--- /dev/null
+++ b/server/container/guice/mailet/src/main/java/org/apache/james/utils/GuiceMatcherLoader.java
@@ -0,0 +1,53 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.utils;
+
+import javax.mail.MessagingException;
+
+import org.apache.james.mailetcontainer.api.MatcherLoader;
+import org.apache.mailet.Matcher;
+import org.apache.mailet.MatcherConfig;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+public class GuiceMatcherLoader implements MatcherLoader {
+
+ private static final String STANDARD_PACKAGE = "org.apache.james.transport.matchers.";
+
+ private final GuiceGenericLoader<Matcher> genericLoader;
+
+ @Inject
+ public GuiceMatcherLoader(Injector injector) {
+ this.genericLoader = new GuiceGenericLoader<>(injector, STANDARD_PACKAGE);
+ }
+
+ @Override
+ public Matcher getMatcher(MatcherConfig config) throws MessagingException {
+ try {
+ Matcher result = genericLoader.instanciate(config.getMatcherName());
+ result.init(config);
+ return result;
+ } catch (Exception e) {
+ throw new MessagingException("Can not load matcher " + config.getMatcherName(), e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/5e965d82/server/container/guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 7c712cd..f762e63 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -56,6 +56,11 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-mailet</artifactId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-managedsieve</artifactId>
<version>3.0.0-beta6-SNAPSHOT</version>
</dependency>
@@ -78,6 +83,7 @@
<module>cassandra-guice</module>
<module>cassandra-ldap-guice</module>
<module>mailbox</module>
+ <module>mailet</module>
<module>memory-guice</module>
<module>jpa-guice</module>
<module>onami</module>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[20/21] james-project git commit: JAMES-1902 get rid of
JmapJamesServer & GuiceJamesServerImpl
Posted by bt...@apache.org.
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/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 b5ef729..278430f 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
@@ -52,7 +52,7 @@ import javax.mail.Flags;
import org.apache.commons.io.IOUtils;
import org.apache.http.client.utils.URIBuilder;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.DefaultMailboxes;
import org.apache.james.jmap.HttpJmapAuthentication;
import org.apache.james.jmap.api.access.AccessToken;
@@ -67,6 +67,7 @@ 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.util.ZeroedInputStream;
+import org.apache.james.utils.JmapGuiceProbe;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.junit.After;
@@ -101,14 +102,14 @@ public abstract class SetMessagesMethodTest {
private ConditionFactory calmlyAwait;
- protected abstract JmapJamesServer createJmapServer();
+ protected abstract GuiceJamesServer createJmapServer();
protected abstract MessageId randomMessageId();
protected abstract void await();
private AccessToken accessToken;
- private JmapJamesServer jmapServer;
+ private GuiceJamesServer jmapServer;
@Before
public void setup() throws Throwable {
@@ -118,8 +119,7 @@ public abstract class SetMessagesMethodTest {
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
.setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)))
- .setPort(jmapServer.getJmapProbe()
- .getJmapPort())
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
.build();
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
@@ -143,7 +143,7 @@ public abstract class SetMessagesMethodTest {
return new URIBuilder()
.setScheme("http")
.setHost("localhost")
- .setPort(jmapServer.getJmapProbe()
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class)
.getJmapPort())
.setCharset(Charsets.UTF_8);
}
@@ -878,7 +878,7 @@ public abstract class SetMessagesMethodTest {
"]";
List<MailboxListener.Event> events = Lists.newArrayList();
- jmapServer.getJmapProbe().addMailboxListener(new MailboxListener() {
+ jmapServer.getProbe(JmapGuiceProbe.class).addMailboxListener(new MailboxListener() {
@Override
public ListenerType getType() {
return ListenerType.ONCE;
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/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 457b46e..4945f0b 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
@@ -29,7 +29,7 @@ import java.time.ZonedDateTime;
import java.util.Optional;
import org.apache.http.client.utils.URIBuilder;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.jmap.HttpJmapAuthentication;
import org.apache.james.jmap.api.access.AccessToken;
import org.apache.james.jmap.api.vacation.AccountId;
@@ -56,18 +56,18 @@ public abstract class SetVacationResponseTest {
public static final String SUBJECT = "subject";
private JmapGuiceProbe jmapGuiceProbe;
- protected abstract JmapJamesServer createJmapServer();
+ protected abstract GuiceJamesServer createJmapServer();
protected abstract void await();
private AccessToken accessToken;
- private JmapJamesServer jmapServer;
+ private GuiceJamesServer jmapServer;
@Before
public void setup() throws Throwable {
jmapServer = createJmapServer();
jmapServer.start();
- jmapGuiceProbe = jmapServer.getJmapProbe();
+ jmapGuiceProbe = jmapServer.getProbe(JmapGuiceProbe.class);
RestAssured.requestSpecification = new RequestSpecBuilder()
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
@@ -87,7 +87,7 @@ public abstract class SetVacationResponseTest {
return new URIBuilder()
.setScheme("http")
.setHost("localhost")
- .setPort(jmapServer.getJmapProbe()
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class)
.getJmapPort())
.setCharset(Charsets.UTF_8);
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
index 9d91811..f1a9e55 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
@@ -45,6 +45,7 @@ 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.model.MessageId;
+import org.apache.james.utils.JmapGuiceProbe;
import org.javatuples.Pair;
import com.github.fge.lambdas.Throwing;
@@ -102,7 +103,7 @@ public class GetMessagesMethodStepdefs {
MailboxId mailboxId1 = mainStepdefs.jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, mailbox1).getMailboxId();
MailboxId mailboxId2 = mainStepdefs.jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, mailbox2).getMailboxId();
- mainStepdefs.jmapServer.getJmapProbe().setInMailboxes(id, userStepdefs.lastConnectedUser, mailboxId1, mailboxId2);
+ mainStepdefs.jmapServer.getProbe(JmapGuiceProbe.class).setInMailboxes(id, userStepdefs.lastConnectedUser, mailboxId1, mailboxId2);
messageIdsByName.put(messageName, id);
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MainStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MainStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MainStepdefs.java
index e8aae5b..c2286f2 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MainStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/MainStepdefs.java
@@ -20,8 +20,9 @@
package org.apache.james.jmap.methods.integration.cucumber;
import org.apache.http.client.utils.URIBuilder;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.mailbox.model.MessageId;
+import org.apache.james.utils.JmapGuiceProbe;
import com.google.common.base.Charsets;
@@ -30,7 +31,7 @@ import cucumber.runtime.java.guice.ScenarioScoped;
@ScenarioScoped
public class MainStepdefs {
- public JmapJamesServer jmapServer;
+ public GuiceJamesServer jmapServer;
public Runnable awaitMethod = () -> {};
public MessageId.Factory messageIdFactory;
@@ -43,8 +44,7 @@ public class MainStepdefs {
return new URIBuilder()
.setScheme("http")
.setHost("localhost")
- .setPort(jmapServer.getJmapProbe()
- .getJmapPort())
+ .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
.setCharset(Charsets.UTF_8);
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml
index b843132..dc2af81 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml
@@ -154,6 +154,12 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.apache.james</groupId>
<artifactId>james-server-jmap-integration-testing</artifactId>
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMailboxesMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMailboxesMethodTest.java
index 02d3185..32d9ace 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMailboxesMethodTest.java
@@ -19,7 +19,7 @@
package org.apache.james.jmap.memory;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.MemoryJmapTestRule;
import org.apache.james.jmap.methods.integration.GetMailboxesMethodTest;
import org.junit.Rule;
@@ -30,7 +30,7 @@ public class MemoryGetMailboxesMethodTest extends GetMailboxesMethodTest {
public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return memoryJmap.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java
index c40fe5c..e1817e2 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetMessageListMethodTest.java
@@ -19,7 +19,7 @@
package org.apache.james.jmap.memory;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.MemoryJmapTestRule;
import org.apache.james.jmap.methods.integration.GetMessageListMethodTest;
import org.junit.Rule;
@@ -30,7 +30,7 @@ public class MemoryGetMessageListMethodTest extends GetMessageListMethodTest {
public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return memoryJmap.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetVacationResponseMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetVacationResponseMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetVacationResponseMethodTest.java
index 70348f4..47af78c 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetVacationResponseMethodTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryGetVacationResponseMethodTest.java
@@ -19,7 +19,7 @@
package org.apache.james.jmap.memory;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.MemoryJmapTestRule;
import org.apache.james.jmap.methods.integration.GetVacationResponseTest;
import org.apache.james.util.date.ZonedDateTimeProvider;
@@ -31,7 +31,7 @@ public class MemoryGetVacationResponseMethodTest extends GetVacationResponseTest
public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
@Override
- protected JmapJamesServer createJmapServer(ZonedDateTimeProvider zonedDateTimeProvider) {
+ protected GuiceJamesServer createJmapServer(ZonedDateTimeProvider zonedDateTimeProvider) {
return memoryJmap.jmapServer()
.overrideWith(binder -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider));
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryJmapAuthenticationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryJmapAuthenticationTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryJmapAuthenticationTest.java
index e561a09..fc4b338 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryJmapAuthenticationTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryJmapAuthenticationTest.java
@@ -19,7 +19,7 @@
package org.apache.james.jmap.memory;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.MemoryJmapTestRule;
import org.apache.james.jmap.FixedDateZonedDateTimeProvider;
import org.apache.james.jmap.JMAPAuthenticationTest;
@@ -32,7 +32,7 @@ public class MemoryJmapAuthenticationTest extends JMAPAuthenticationTest {
public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
@Override
- protected JmapJamesServer createJmapServer(FixedDateZonedDateTimeProvider zonedDateTimeProvider) {
+ protected GuiceJamesServer createJmapServer(FixedDateZonedDateTimeProvider zonedDateTimeProvider) {
return memoryJmap.jmapServer()
.overrideWith((binder) -> binder.bind(ZonedDateTimeProvider.class).toInstance(zonedDateTimeProvider));
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMailboxesMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMailboxesMethodTest.java
index 7306165..0f588f0 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMailboxesMethodTest.java
@@ -19,7 +19,7 @@
package org.apache.james.jmap.memory;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.MemoryJmapTestRule;
import org.apache.james.jmap.methods.integration.SetMailboxesMethodTest;
import org.junit.Ignore;
@@ -31,7 +31,7 @@ public class MemorySetMailboxesMethodTest extends SetMailboxesMethodTest {
public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return memoryJmap.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMessagesMethodTest.java
index 1498749..bb337e8 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetMessagesMethodTest.java
@@ -21,7 +21,7 @@ package org.apache.james.jmap.memory;
import java.util.Random;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.MemoryJmapTestRule;
import org.apache.james.jmap.methods.integration.SetMessagesMethodTest;
import org.apache.james.mailbox.inmemory.InMemoryMessageId;
@@ -36,7 +36,7 @@ public class MemorySetMessagesMethodTest extends SetMessagesMethodTest {
private Random random = new Random();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return memoryJmap.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetVacationResponseMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetVacationResponseMethodTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetVacationResponseMethodTest.java
index bca1a90..9977361 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetVacationResponseMethodTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemorySetVacationResponseMethodTest.java
@@ -19,7 +19,7 @@
package org.apache.james.jmap.memory;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.MemoryJmapTestRule;
import org.apache.james.jmap.methods.integration.SetVacationResponseTest;
import org.junit.Rule;
@@ -30,7 +30,7 @@ public class MemorySetVacationResponseMethodTest extends SetVacationResponseTest
public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return memoryJmap.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryUserProvisionningConcurrencyTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryUserProvisionningConcurrencyTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryUserProvisionningConcurrencyTest.java
index 056d4e7..01bf796 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryUserProvisionningConcurrencyTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryUserProvisionningConcurrencyTest.java
@@ -19,7 +19,7 @@
package org.apache.james.jmap.memory;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.MemoryJmapTestRule;
import org.apache.james.jmap.UserProvisionningConcurrencyTest;
import org.junit.Rule;
@@ -29,7 +29,7 @@ public class MemoryUserProvisionningConcurrencyTest extends UserProvisionningCon
public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return memoryJmap.jmapServer();
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryVacationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryVacationIntegrationTest.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryVacationIntegrationTest.java
index df5b1f7..703a312 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryVacationIntegrationTest.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryVacationIntegrationTest.java
@@ -19,7 +19,7 @@
package org.apache.james.jmap.memory;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.MemoryJmapTestRule;
import org.apache.james.jmap.VacationIntegrationTest;
import org.junit.Rule;
@@ -30,7 +30,7 @@ public class MemoryVacationIntegrationTest extends VacationIntegrationTest {
public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule();
@Override
- protected JmapJamesServer createJmapServer() {
+ protected GuiceJamesServer createJmapServer() {
return memoryJmap.jmapServer();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryStepdefs.java b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryStepdefs.java
index fc13c55..89d4b87 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryStepdefs.java
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/cucumber/MemoryStepdefs.java
@@ -23,7 +23,7 @@ import javax.inject.Inject;
import org.apache.activemq.store.PersistenceAdapter;
import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
import org.apache.james.MemoryJamesServerMain;
import org.apache.james.jmap.methods.integration.cucumber.MainStepdefs;
import org.apache.james.jmap.servers.MemoryJmapServerModule;
@@ -51,7 +51,7 @@ public class MemoryStepdefs {
public void init() throws Exception {
temporaryFolder.create();
mainStepdefs.messageIdFactory = new InMemoryMessageId.Factory();
- mainStepdefs.jmapServer = new JmapJamesServer()
+ mainStepdefs.jmapServer = new GuiceJamesServer()
.combineWith(MemoryJamesServerMain.inMemoryServerModule)
.overrideWith(new MemoryJmapServerModule(temporaryFolder),
(binder) -> binder.bind(MessageId.Factory.class).toInstance(mainStepdefs.messageIdFactory))
http://git-wip-us.apache.org/repos/asf/james-project/blob/ac56c422/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
index 6bc58fa..f6194bc 100644
--- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
@@ -28,7 +28,8 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.is;
import org.apache.james.CassandraJmapTestRule;
-import org.apache.james.JmapJamesServer;
+import org.apache.james.GuiceJamesServer;
+import org.apache.james.utils.WebAdminGuiceProbe;
import org.apache.james.webadmin.routes.DomainRoutes;
import org.apache.james.webadmin.routes.UserMailboxesRoutes;
import org.apache.james.webadmin.routes.UserRoutes;
@@ -54,7 +55,7 @@ public class WebAdminServerIntegrationTest {
@Rule
public CassandraJmapTestRule cassandraJmapTestRule = CassandraJmapTestRule.defaultTestRule();
- private JmapJamesServer guiceJamesServer;
+ private GuiceJamesServer guiceJamesServer;
@Before
public void setUp() throws Exception {
@@ -66,7 +67,7 @@ public class WebAdminServerIntegrationTest {
.setContentType(ContentType.JSON)
.setAccept(ContentType.JSON)
.setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(Charsets.UTF_8)))
- .setPort(guiceJamesServer.getWebAdminProbe().getWebAdminPort())
+ .setPort(guiceJamesServer.getProbe(WebAdminGuiceProbe.class).getWebAdminPort())
.build();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[13/21] james-project git commit: JAMES-1902 create lmtp module
Posted by bt...@apache.org.
JAMES-1902 create lmtp module
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/1a986e1a
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/1a986e1a
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/1a986e1a
Branch: refs/heads/master
Commit: 1a986e1a3ece24845ac1069c8c650002b957e1d8
Parents: 3c5f8ab
Author: Matthieu Baechler <ma...@gmail.com>
Authored: Mon Dec 26 19:22:28 2016 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
server/container/guice/guice-common/pom.xml | 8 +-
.../modules/protocols/LMTPServerModule.java | 76 --------
server/container/guice/pom.xml | 6 +
server/container/guice/protocols/lmtp/pom.xml | 184 +++++++++++++++++++
.../modules/protocols/LMTPServerModule.java | 76 ++++++++
5 files changed, 270 insertions(+), 80 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/1a986e1a/server/container/guice/guice-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/pom.xml b/server/container/guice/guice-common/pom.xml
index 7c192a5..702fade 100644
--- a/server/container/guice/guice-common/pom.xml
+++ b/server/container/guice/guice-common/pom.xml
@@ -185,6 +185,10 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-lmtp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-pop</artifactId>
</dependency>
<dependency>
@@ -233,10 +237,6 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>james-server-protocols-lmtp</artifactId>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
<artifactId>james-server-protocols-managesieve</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/1a986e1a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
deleted file mode 100644
index 22fbb65..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.modules.protocols;
-
-import java.util.List;
-
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.lmtpserver.netty.LMTPServerFactory;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.ConfigurationProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-
-public class LMTPServerModule extends AbstractModule {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(LMTPServerModule.class);
-
- @Override
- protected void configure() {
- Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(LMTPModuleConfigurationPerformer.class);
- }
-
- @Singleton
- public static class LMTPModuleConfigurationPerformer implements ConfigurationPerformer {
-
- private final ConfigurationProvider configurationProvider;
- private final LMTPServerFactory lmtpServerFactory;
-
- @Inject
- public LMTPModuleConfigurationPerformer(ConfigurationProvider configurationProvider, LMTPServerFactory lmtpServerFactory) {
- this.configurationProvider = configurationProvider;
- this.lmtpServerFactory = lmtpServerFactory;
- }
-
- @Override
- public void initModule() {
- try {
- lmtpServerFactory.setLog(LOGGER);
- lmtpServerFactory.configure(configurationProvider.getConfiguration("lmtpserver"));
- lmtpServerFactory.init();
- } catch (Exception e) {
- Throwables.propagate(e);
- }
- }
-
- @Override
- public List<Class<? extends Configurable>> forClasses() {
- return ImmutableList.of(LMTPServerFactory.class);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/1a986e1a/server/container/guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index cabe0ce..9cd80d5 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -46,6 +46,11 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-lmtp</artifactId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-mailbox</artifactId>
<version>3.0.0-beta6-SNAPSHOT</version>
</dependency>
@@ -72,6 +77,7 @@
<module>jpa-guice</module>
<module>onami</module>
<module>protocols/imap</module>
+ <module>protocols/lmtp</module>
<module>protocols/pop</module>
<module>protocols/smtp</module>
</modules>
http://git-wip-us.apache.org/repos/asf/james-project/blob/1a986e1a/server/container/guice/protocols/lmtp/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/lmtp/pom.xml b/server/container/guice/protocols/lmtp/pom.xml
new file mode 100644
index 0000000..ef0b78a
--- /dev/null
+++ b/server/container/guice/protocols/lmtp/pom.xml
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>james-server-guice</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>james-server-guice-lmtp</artifactId>
+
+ <name>Apache James :: Server :: Guice :: Lmtp</name>
+ <description>Lmtp modules for Guice implementation of James server</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-protocols-lmtp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>animal-sniffer-java-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java18</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check_java_8</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/1a986e1a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
new file mode 100644
index 0000000..22fbb65
--- /dev/null
+++ b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
@@ -0,0 +1,76 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.modules.protocols;
+
+import java.util.List;
+
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.lmtpserver.netty.LMTPServerFactory;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class LMTPServerModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(LMTPServerModule.class);
+
+ @Override
+ protected void configure() {
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(LMTPModuleConfigurationPerformer.class);
+ }
+
+ @Singleton
+ public static class LMTPModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final LMTPServerFactory lmtpServerFactory;
+
+ @Inject
+ public LMTPModuleConfigurationPerformer(ConfigurationProvider configurationProvider, LMTPServerFactory lmtpServerFactory) {
+ this.configurationProvider = configurationProvider;
+ this.lmtpServerFactory = lmtpServerFactory;
+ }
+
+ @Override
+ public void initModule() {
+ try {
+ lmtpServerFactory.setLog(LOGGER);
+ lmtpServerFactory.configure(configurationProvider.getConfiguration("lmtpserver"));
+ lmtpServerFactory.init();
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ }
+
+ @Override
+ public List<Class<? extends Configurable>> forClasses() {
+ return ImmutableList.of(LMTPServerFactory.class);
+ }
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[11/21] james-project git commit: JAMES-1902 create pop3 module
Posted by bt...@apache.org.
JAMES-1902 create pop3 module
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/4b20e4d8
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/4b20e4d8
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/4b20e4d8
Branch: refs/heads/master
Commit: 4b20e4d88bd914eb7b0e28e9e751bf9e256c4ecd
Parents: cbeef69
Author: Matthieu Baechler <ma...@gmail.com>
Authored: Mon Dec 26 19:14:45 2016 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
server/container/guice/guice-common/pom.xml | 4 +
.../modules/protocols/POP3ServerModule.java | 76 --------
server/container/guice/pom.xml | 6 +
server/container/guice/protocols/pop/pom.xml | 184 +++++++++++++++++++
.../modules/protocols/POP3ServerModule.java | 76 ++++++++
5 files changed, 270 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/4b20e4d8/server/container/guice/guice-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/pom.xml b/server/container/guice/guice-common/pom.xml
index 39035c4..50b1bcd 100644
--- a/server/container/guice/guice-common/pom.xml
+++ b/server/container/guice/guice-common/pom.xml
@@ -185,6 +185,10 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-pop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-mailbox</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/4b20e4d8/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
deleted file mode 100644
index 4efd481..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.modules.protocols;
-
-import java.util.List;
-
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.pop3server.netty.POP3ServerFactory;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.ConfigurationProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-
-public class POP3ServerModule extends AbstractModule {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(POP3ServerModule.class);
-
- @Override
- protected void configure() {
- Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(POP3ModuleConfigurationPerformer.class);
- }
-
- @Singleton
- public static class POP3ModuleConfigurationPerformer implements ConfigurationPerformer {
-
- private final ConfigurationProvider configurationProvider;
- private final POP3ServerFactory pop3ServerFactory;
-
- @Inject
- public POP3ModuleConfigurationPerformer(ConfigurationProvider configurationProvider, POP3ServerFactory pop3ServerFactory) {
- this.configurationProvider = configurationProvider;
- this.pop3ServerFactory = pop3ServerFactory;
- }
-
- @Override
- public void initModule() {
- try {
- pop3ServerFactory.setLog(LOGGER);
- pop3ServerFactory.configure(configurationProvider.getConfiguration("pop3server"));
- pop3ServerFactory.init();
- } catch (Exception e) {
- Throwables.propagate(e);
- }
- }
-
- @Override
- public List<Class<? extends Configurable>> forClasses() {
- return ImmutableList.of(POP3ServerFactory.class);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/4b20e4d8/server/container/guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index fe13431..02084e2 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -49,6 +49,11 @@
<artifactId>james-server-guice-mailbox</artifactId>
<version>3.0.0-beta6-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-pop</artifactId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ </dependency>
</dependencies>
</dependencyManagement>
@@ -62,6 +67,7 @@
<module>jpa-guice</module>
<module>onami</module>
<module>protocols/imap</module>
+ <module>protocols/pop</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/4b20e4d8/server/container/guice/protocols/pop/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/pop/pom.xml b/server/container/guice/protocols/pop/pom.xml
new file mode 100644
index 0000000..7bb7f71
--- /dev/null
+++ b/server/container/guice/protocols/pop/pom.xml
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>james-server-guice</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>james-server-guice-pop</artifactId>
+
+ <name>Apache James :: Server :: Guice :: Pop</name>
+ <description>Pop modules for Guice implementation of James server</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-protocols-pop3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>animal-sniffer-java-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java18</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check_java_8</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/4b20e4d8/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java b/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
new file mode 100644
index 0000000..4efd481
--- /dev/null
+++ b/server/container/guice/protocols/pop/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
@@ -0,0 +1,76 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.modules.protocols;
+
+import java.util.List;
+
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.pop3server.netty.POP3ServerFactory;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class POP3ServerModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(POP3ServerModule.class);
+
+ @Override
+ protected void configure() {
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(POP3ModuleConfigurationPerformer.class);
+ }
+
+ @Singleton
+ public static class POP3ModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final POP3ServerFactory pop3ServerFactory;
+
+ @Inject
+ public POP3ModuleConfigurationPerformer(ConfigurationProvider configurationProvider, POP3ServerFactory pop3ServerFactory) {
+ this.configurationProvider = configurationProvider;
+ this.pop3ServerFactory = pop3ServerFactory;
+ }
+
+ @Override
+ public void initModule() {
+ try {
+ pop3ServerFactory.setLog(LOGGER);
+ pop3ServerFactory.configure(configurationProvider.getConfiguration("pop3server"));
+ pop3ServerFactory.init();
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ }
+
+ @Override
+ public List<Class<? extends Configurable>> forClasses() {
+ return ImmutableList.of(POP3ServerFactory.class);
+ }
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[15/21] james-project git commit: JAMES-1902 create webadmin module
Posted by bt...@apache.org.
JAMES-1902 create webadmin module
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/6cc8ed09
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/6cc8ed09
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/6cc8ed09
Branch: refs/heads/master
Commit: 6cc8ed093bfc5631abb75048c7346a643f40c0ab
Parents: 3d0e2ae
Author: Matthieu Baechler <ma...@gmail.com>
Authored: Tue Dec 27 15:16:09 2016 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
server/container/guice/guice-common/pom.xml | 8 +-
.../java/org/apache/james/WebAdminServer.java | 25 ---
.../modules/server/WebAdminServerModule.java | 115 ------------
.../apache/james/utils/WebAdminGuiceProbe.java | 37 ----
server/container/guice/pom.xml | 26 ++-
.../container/guice/protocols/webadmin/pom.xml | 184 +++++++++++++++++++
.../java/org/apache/james/WebAdminServer.java | 25 +++
.../modules/server/WebAdminServerModule.java | 115 ++++++++++++
.../apache/james/utils/WebAdminGuiceProbe.java | 37 ++++
9 files changed, 381 insertions(+), 191 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/6cc8ed09/server/container/guice/guice-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/pom.xml b/server/container/guice/guice-common/pom.xml
index d294ca2..80f8ea2 100644
--- a/server/container/guice/guice-common/pom.xml
+++ b/server/container/guice/guice-common/pom.xml
@@ -209,6 +209,10 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-webadmin</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-mailets</artifactId>
</dependency>
<dependency>
@@ -252,10 +256,6 @@
<artifactId>james-server-onami</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.james</groupId>
- <artifactId>james-server-webadmin</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.james.protocols</groupId>
<artifactId>protocols-imap</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/6cc8ed09/server/container/guice/guice-common/src/main/java/org/apache/james/WebAdminServer.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/WebAdminServer.java b/server/container/guice/guice-common/src/main/java/org/apache/james/WebAdminServer.java
deleted file mode 100644
index a08df88..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/WebAdminServer.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james;
-
-import org.apache.james.utils.WebAdminGuiceProbe;
-
-public interface WebAdminServer {
- WebAdminGuiceProbe getWebAdminProbe();
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6cc8ed09/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
deleted file mode 100644
index a9aed5c..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.modules.server;
-
-import static org.apache.james.webadmin.WebAdminServer.NO_CONFIGURATION;
-import static org.apache.james.webadmin.WebAdminServer.WEBADMIN_ENABLED;
-import static org.apache.james.webadmin.WebAdminServer.WEBADMIN_PORT;
-
-import java.io.FileNotFoundException;
-import java.util.List;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.GuiceProbe;
-import org.apache.james.utils.PropertiesProvider;
-import org.apache.james.utils.WebAdminGuiceProbe;
-import org.apache.james.webadmin.FixedPort;
-import org.apache.james.webadmin.Port;
-import org.apache.james.webadmin.Routes;
-import org.apache.james.webadmin.WebAdminServer;
-import org.apache.james.webadmin.routes.DomainRoutes;
-import org.apache.james.webadmin.routes.UserMailboxesRoutes;
-import org.apache.james.webadmin.routes.UserRoutes;
-import org.apache.james.webadmin.utils.JsonTransformer;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-import com.google.inject.name.Named;
-
-public class WebAdminServerModule extends AbstractModule {
-
- @Override
- protected void configure() {
- bind(JsonTransformer.class).in(Scopes.SINGLETON);
- bind(WebAdminServer.class).in(Scopes.SINGLETON);
-
- Multibinder<Routes> routesMultibinder = Multibinder.newSetBinder(binder(), Routes.class);
- routesMultibinder.addBinding().to(DomainRoutes.class);
- routesMultibinder.addBinding().to(UserRoutes.class);
- routesMultibinder.addBinding().to(UserMailboxesRoutes.class);
-
- Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(WebAdminServerModuleConfigurationPerformer.class);
- Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(WebAdminGuiceProbe.class);
- }
-
- @Provides
- @Named(WEBADMIN_PORT)
- public Port provideWebAdminPort(PropertiesProvider propertiesProvider) throws Exception {
- try {
- return new FixedPort(propertiesProvider.getConfiguration("webadmin").getInt("port", WebAdminServer.DEFAULT_PORT));
- } catch (FileNotFoundException e) {
- return new FixedPort(WebAdminServer.DEFAULT_PORT);
- }
- }
-
- @Provides
- @Named(WEBADMIN_ENABLED)
- public boolean provideWebAdminEnabled(PropertiesProvider propertiesProvider) throws Exception {
- try {
- return propertiesProvider.getConfiguration("webadmin").getBoolean("enabled", false);
- } catch (FileNotFoundException e) {
- return false;
- }
- }
-
- @Singleton
- public static class WebAdminServerModuleConfigurationPerformer implements ConfigurationPerformer {
-
- private final WebAdminServer webAdminServer;
-
- @Inject
- public WebAdminServerModuleConfigurationPerformer(WebAdminServer webAdminServer) {
- this.webAdminServer = webAdminServer;
- }
-
- @Override
- public void initModule() {
- try {
- webAdminServer.configure(NO_CONFIGURATION);
- } catch (ConfigurationException e) {
- throw Throwables.propagate(e);
- }
- }
-
- @Override
- public List<Class<? extends Configurable>> forClasses() {
- return ImmutableList.of(WebAdminServer.class);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6cc8ed09/server/container/guice/guice-common/src/main/java/org/apache/james/utils/WebAdminGuiceProbe.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/WebAdminGuiceProbe.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/WebAdminGuiceProbe.java
deleted file mode 100644
index a68155c..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/WebAdminGuiceProbe.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.utils;
-
-import javax.inject.Inject;
-
-import org.apache.james.webadmin.WebAdminServer;
-
-public class WebAdminGuiceProbe implements GuiceProbe {
- private final WebAdminServer webAdminServer;
-
- @Inject
- public WebAdminGuiceProbe(WebAdminServer webAdminServer) {
- this.webAdminServer = webAdminServer;
- }
-
- public int getWebAdminPort() {
- return webAdminServer.getPort().toInt();
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6cc8ed09/server/container/guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 44fdf85..5824129 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -37,53 +37,58 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-configuration</artifactId>
- <version>3.0.0-beta6-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-imap</artifactId>
- <version>3.0.0-beta6-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-jmap</artifactId>
- <version>3.0.0-beta6-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-jmap</artifactId>
- <version>3.0.0-beta6-SNAPSHOT</version>
+ <version>${project.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-lmtp</artifactId>
- <version>3.0.0-beta6-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-mailbox</artifactId>
- <version>3.0.0-beta6-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-mailet</artifactId>
- <version>3.0.0-beta6-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-managedsieve</artifactId>
- <version>3.0.0-beta6-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-pop</artifactId>
- <version>3.0.0-beta6-SNAPSHOT</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-smtp</artifactId>
- <version>3.0.0-beta6-SNAPSHOT</version>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-webadmin</artifactId>
+ <version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
@@ -104,6 +109,7 @@
<module>protocols/managedsieve</module>
<module>protocols/pop</module>
<module>protocols/smtp</module>
+ <module>protocols/webadmin</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/6cc8ed09/server/container/guice/protocols/webadmin/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/webadmin/pom.xml b/server/container/guice/protocols/webadmin/pom.xml
new file mode 100644
index 0000000..acfeda2
--- /dev/null
+++ b/server/container/guice/protocols/webadmin/pom.xml
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>james-server-guice</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>james-server-guice-webadmin</artifactId>
+
+ <name>Apache James :: Server :: Guice :: Webadmin</name>
+ <description>Webadmin modules for Guice implementation of James server</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-webadmin</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>animal-sniffer-java-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java18</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check_java_8</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/6cc8ed09/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/WebAdminServer.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/WebAdminServer.java b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/WebAdminServer.java
new file mode 100644
index 0000000..a08df88
--- /dev/null
+++ b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/WebAdminServer.java
@@ -0,0 +1,25 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james;
+
+import org.apache.james.utils.WebAdminGuiceProbe;
+
+public interface WebAdminServer {
+ WebAdminGuiceProbe getWebAdminProbe();
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6cc8ed09/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
new file mode 100644
index 0000000..a9aed5c
--- /dev/null
+++ b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
@@ -0,0 +1,115 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.modules.server;
+
+import static org.apache.james.webadmin.WebAdminServer.NO_CONFIGURATION;
+import static org.apache.james.webadmin.WebAdminServer.WEBADMIN_ENABLED;
+import static org.apache.james.webadmin.WebAdminServer.WEBADMIN_PORT;
+
+import java.io.FileNotFoundException;
+import java.util.List;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.GuiceProbe;
+import org.apache.james.utils.PropertiesProvider;
+import org.apache.james.utils.WebAdminGuiceProbe;
+import org.apache.james.webadmin.FixedPort;
+import org.apache.james.webadmin.Port;
+import org.apache.james.webadmin.Routes;
+import org.apache.james.webadmin.WebAdminServer;
+import org.apache.james.webadmin.routes.DomainRoutes;
+import org.apache.james.webadmin.routes.UserMailboxesRoutes;
+import org.apache.james.webadmin.routes.UserRoutes;
+import org.apache.james.webadmin.utils.JsonTransformer;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+import com.google.inject.name.Named;
+
+public class WebAdminServerModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ bind(JsonTransformer.class).in(Scopes.SINGLETON);
+ bind(WebAdminServer.class).in(Scopes.SINGLETON);
+
+ Multibinder<Routes> routesMultibinder = Multibinder.newSetBinder(binder(), Routes.class);
+ routesMultibinder.addBinding().to(DomainRoutes.class);
+ routesMultibinder.addBinding().to(UserRoutes.class);
+ routesMultibinder.addBinding().to(UserMailboxesRoutes.class);
+
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(WebAdminServerModuleConfigurationPerformer.class);
+ Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(WebAdminGuiceProbe.class);
+ }
+
+ @Provides
+ @Named(WEBADMIN_PORT)
+ public Port provideWebAdminPort(PropertiesProvider propertiesProvider) throws Exception {
+ try {
+ return new FixedPort(propertiesProvider.getConfiguration("webadmin").getInt("port", WebAdminServer.DEFAULT_PORT));
+ } catch (FileNotFoundException e) {
+ return new FixedPort(WebAdminServer.DEFAULT_PORT);
+ }
+ }
+
+ @Provides
+ @Named(WEBADMIN_ENABLED)
+ public boolean provideWebAdminEnabled(PropertiesProvider propertiesProvider) throws Exception {
+ try {
+ return propertiesProvider.getConfiguration("webadmin").getBoolean("enabled", false);
+ } catch (FileNotFoundException e) {
+ return false;
+ }
+ }
+
+ @Singleton
+ public static class WebAdminServerModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final WebAdminServer webAdminServer;
+
+ @Inject
+ public WebAdminServerModuleConfigurationPerformer(WebAdminServer webAdminServer) {
+ this.webAdminServer = webAdminServer;
+ }
+
+ @Override
+ public void initModule() {
+ try {
+ webAdminServer.configure(NO_CONFIGURATION);
+ } catch (ConfigurationException e) {
+ throw Throwables.propagate(e);
+ }
+ }
+
+ @Override
+ public List<Class<? extends Configurable>> forClasses() {
+ return ImmutableList.of(WebAdminServer.class);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/6cc8ed09/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/utils/WebAdminGuiceProbe.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/utils/WebAdminGuiceProbe.java b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/utils/WebAdminGuiceProbe.java
new file mode 100644
index 0000000..a68155c
--- /dev/null
+++ b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/utils/WebAdminGuiceProbe.java
@@ -0,0 +1,37 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.utils;
+
+import javax.inject.Inject;
+
+import org.apache.james.webadmin.WebAdminServer;
+
+public class WebAdminGuiceProbe implements GuiceProbe {
+ private final WebAdminServer webAdminServer;
+
+ @Inject
+ public WebAdminGuiceProbe(WebAdminServer webAdminServer) {
+ this.webAdminServer = webAdminServer;
+ }
+
+ public int getWebAdminPort() {
+ return webAdminServer.getPort().toInt();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[08/21] james-project git commit: JAMES-1902 create jmap module
Posted by bt...@apache.org.
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/protocols/jmap/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java
new file mode 100644
index 0000000..a04e1db
--- /dev/null
+++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java
@@ -0,0 +1,83 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.modules.protocols;
+
+import java.security.Security;
+import java.util.List;
+
+import org.apache.james.jmap.JMAPModule;
+import org.apache.james.jmap.JMAPServer;
+import org.apache.james.jmap.crypto.JamesSignatureHandler;
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.GuiceProbe;
+import org.apache.james.utils.JmapGuiceProbe;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class JMAPServerModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ install(new JMAPModule());
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JMAPModuleConfigurationPerformer.class);
+ Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(JmapGuiceProbe.class);
+ }
+
+ @Singleton
+ public static class JMAPModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final JMAPServer server;
+ private final JamesSignatureHandler signatureHandler;
+
+ @Inject
+ public JMAPModuleConfigurationPerformer(JMAPServer server, JamesSignatureHandler signatureHandler) {
+ this.server = server;
+ this.signatureHandler = signatureHandler;
+ }
+
+ @Override
+ public void initModule() {
+ try {
+ signatureHandler.init();
+ server.configure(null);
+ registerPEMWithSecurityProvider();
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ }
+
+ private void registerPEMWithSecurityProvider() {
+ Security.addProvider(new BouncyCastleProvider());
+ }
+
+ @Override
+ public List<Class<? extends Configurable>> forClasses() {
+ return ImmutableList.of(JMAPServer.class);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/protocols/jmap/src/main/java/org/apache/james/utils/JmapGuiceProbe.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/utils/JmapGuiceProbe.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/utils/JmapGuiceProbe.java
new file mode 100644
index 0000000..627d1c6
--- /dev/null
+++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/utils/JmapGuiceProbe.java
@@ -0,0 +1,78 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.utils;
+
+import java.util.Arrays;
+
+import javax.inject.Inject;
+
+import org.apache.james.jmap.JMAPServer;
+import org.apache.james.jmap.api.vacation.AccountId;
+import org.apache.james.jmap.api.vacation.Vacation;
+import org.apache.james.jmap.api.vacation.VacationPatch;
+import org.apache.james.jmap.api.vacation.VacationRepository;
+import org.apache.james.mailbox.MailboxListener;
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.MailboxSession;
+import org.apache.james.mailbox.MessageIdManager;
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.MailboxId;
+import org.apache.james.mailbox.model.MessageId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JmapGuiceProbe implements GuiceProbe {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(JmapGuiceProbe.class);
+
+ private final VacationRepository vacationRepository;
+ private final JMAPServer jmapServer;
+ private final MessageIdManager messageIdManager;
+ private final MailboxManager mailboxManager;
+
+ @Inject
+ private JmapGuiceProbe(VacationRepository vacationRepository, JMAPServer jmapServer, MessageIdManager messageIdManager, MailboxManager mailboxManager) {
+ this.vacationRepository = vacationRepository;
+ this.jmapServer = jmapServer;
+ this.messageIdManager = messageIdManager;
+ this.mailboxManager = mailboxManager;
+ }
+
+ public int getJmapPort() {
+ return jmapServer.getPort();
+ }
+
+ public void addMailboxListener(MailboxListener listener) throws MailboxException {
+ mailboxManager.addGlobalListener(listener, mailboxManager.createSystemSession("jmap", LOGGER));
+ }
+
+ public void modifyVacation(AccountId accountId, VacationPatch vacationPatch) {
+ vacationRepository.modifyVacation(accountId, vacationPatch).join();
+ }
+
+ public Vacation retrieveVacation(AccountId accountId) {
+ return vacationRepository.retrieveVacation(accountId).join();
+ }
+
+ public void setInMailboxes(MessageId messageId, String username, MailboxId... mailboxIds) throws MailboxException {
+ MailboxSession mailboxSession = mailboxManager.createSystemSession(username, LOGGER);
+ messageIdManager.setInMailboxes(messageId, Arrays.asList(mailboxIds), mailboxSession);
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/protocols/jmap/src/test/java/org/apache/james/jmap/MailetPreconditionTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/jmap/src/test/java/org/apache/james/jmap/MailetPreconditionTest.java b/server/container/guice/protocols/jmap/src/test/java/org/apache/james/jmap/MailetPreconditionTest.java
new file mode 100644
index 0000000..0e1af99
--- /dev/null
+++ b/server/container/guice/protocols/jmap/src/test/java/org/apache/james/jmap/MailetPreconditionTest.java
@@ -0,0 +1,122 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.jmap;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.jmap.mailet.VacationMailet;
+import org.apache.james.mailetcontainer.impl.MatcherMailetPair;
+import org.apache.james.modules.server.CamelMailetContainerModule;
+import org.apache.james.transport.mailets.Null;
+import org.apache.james.transport.mailets.RemoveMimeHeader;
+import org.apache.james.transport.matchers.All;
+import org.apache.james.transport.matchers.RecipientIsLocal;
+import org.apache.mailet.MailetContext;
+import org.apache.mailet.base.test.FakeMailetConfig;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+
+public class MailetPreconditionTest {
+
+ private static final MailetContext MAILET_CONTEXT = null;
+ private static final String WRONG_NAME = "wrong";
+ private static final String BCC = "bcc";
+
+ @Test(expected = ConfigurationException.class)
+ public void vacationMailetCheckShouldThrowOnEmptyList() throws Exception {
+ new JMAPModule.VacationMailetCheck().check(Lists.newArrayList());
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void vacationMailetCheckShouldThrowOnNullList() throws Exception {
+ new JMAPModule.VacationMailetCheck().check(null);
+ }
+
+ @Test(expected = ConfigurationException.class)
+ public void vacationMailetCheckShouldThrowOnWrongMatcher() throws Exception {
+ List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), new VacationMailet(null, null, null, null, null)));
+ new JMAPModule.VacationMailetCheck().check(pairs);
+ }
+
+ @Test(expected = ConfigurationException.class)
+ public void vacationMailetCheckShouldThrowOnWrongMailet() throws Exception {
+ List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new RecipientIsLocal(), new Null()));
+ new JMAPModule.VacationMailetCheck().check(pairs);
+ }
+
+ @Test
+ public void vacationMailetCheckShouldNotThrowIfValidPairPresent() throws Exception {
+ List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new RecipientIsLocal(), new VacationMailet(null, null, null, null, null)));
+ new JMAPModule.VacationMailetCheck().check(pairs);
+ }
+
+ @Test(expected = ConfigurationException.class)
+ public void bccMailetCheckShouldThrowOnEmptyList() throws Exception {
+ new CamelMailetContainerModule.BccMailetCheck().check(Lists.newArrayList());
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void bccMailetCheckShouldThrowOnNullList() throws Exception {
+ new CamelMailetContainerModule.BccMailetCheck().check(null);
+ }
+
+ @Test(expected = ConfigurationException.class)
+ public void bccMailetCheckShouldThrowOnWrongMatcher() throws Exception {
+ List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new RecipientIsLocal(), new RemoveMimeHeader()));
+ new JMAPModule.VacationMailetCheck().check(pairs);
+ }
+
+ @Test(expected = ConfigurationException.class)
+ public void bccMailetCheckShouldThrowOnWrongMailet() throws Exception {
+ List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), new Null()));
+ new JMAPModule.VacationMailetCheck().check(pairs);
+ }
+
+ @Test(expected = ConfigurationException.class)
+ public void bccMailetCheckShouldThrowOnWrongMailetName() throws Exception {
+ Properties properties = new Properties();
+ properties.setProperty("name", WRONG_NAME);
+ RemoveMimeHeader removeMimeHeader = new RemoveMimeHeader();
+ removeMimeHeader.init(FakeMailetConfig.builder()
+ .mailetName(WRONG_NAME)
+ .mailetContext(MAILET_CONTEXT)
+ .setProperty("name", WRONG_NAME)
+ .build());
+
+ List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), removeMimeHeader));
+ new JMAPModule.VacationMailetCheck().check(pairs);
+ }
+
+ @Test(expected = ConfigurationException.class)
+ public void bccMailetCheckShouldNotThrowOnValidPair() throws Exception {
+ RemoveMimeHeader removeMimeHeader = new RemoveMimeHeader();
+ removeMimeHeader.init(FakeMailetConfig.builder()
+ .mailetName(BCC)
+ .mailetContext(MAILET_CONTEXT)
+ .setProperty("name", BCC)
+ .build());
+
+ List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), removeMimeHeader));
+ new JMAPModule.VacationMailetCheck().check(pairs);
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/protocols/jmap/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/jmap/src/test/java/org/apache/james/modules/TestJMAPServerModule.java b/server/container/guice/protocols/jmap/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
new file mode 100644
index 0000000..6512fac
--- /dev/null
+++ b/server/container/guice/protocols/jmap/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
@@ -0,0 +1,68 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.modules;
+
+import java.io.FileNotFoundException;
+import java.util.Optional;
+
+import javax.inject.Singleton;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.jmap.JMAPConfiguration;
+import org.apache.james.jmap.methods.GetMessageListMethod;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.name.Names;
+
+public class TestJMAPServerModule extends AbstractModule{
+
+ private static final String PUBLIC_PEM_KEY = "-----BEGIN PUBLIC KEY-----\n" +
+ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtlChO/nlVP27MpdkG0Bh\n" +
+ "16XrMRf6M4NeyGa7j5+1UKm42IKUf3lM28oe82MqIIRyvskPc11NuzSor8HmvH8H\n" +
+ "lhDs5DyJtx2qp35AT0zCqfwlaDnlDc/QDlZv1CoRZGpQk1Inyh6SbZwYpxxwh0fi\n" +
+ "+d/4RpE3LBVo8wgOaXPylOlHxsDizfkL8QwXItyakBfMO6jWQRrj7/9WDhGf4Hi+\n" +
+ "GQur1tPGZDl9mvCoRHjFrD5M/yypIPlfMGWFVEvV5jClNMLAQ9bYFuOc7H1fEWw6\n" +
+ "U1LZUUbJW9/CH45YXz82CYqkrfbnQxqRb2iVbVjs/sHopHd1NTiCfUtwvcYJiBVj\n" +
+ "kwIDAQAB\n" +
+ "-----END PUBLIC KEY-----";
+
+ private final int maximumLimit;
+
+ public TestJMAPServerModule(int maximumLimit) {
+ this.maximumLimit = maximumLimit;
+ }
+
+ @Override
+ protected void configure() {
+ bindConstant().annotatedWith(Names.named(GetMessageListMethod.MAXIMUM_LIMIT)).to(maximumLimit);
+ }
+
+ @Provides
+ @Singleton
+ JMAPConfiguration provideConfiguration() throws FileNotFoundException, ConfigurationException{
+ return JMAPConfiguration.builder()
+ .keystore("keystore")
+ .secret("james72laBalle")
+ .jwtPublicKeyPem(Optional.of(PUBLIC_PEM_KEY))
+ .randomPort()
+ .build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml
index 13c1463..cc96dd9 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml
@@ -185,6 +185,12 @@
</dependency>
<dependency>
<groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <scope>test</scope>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
<artifactId>james-server-jmap-integration-testing</artifactId>
<type>test-jar</type>
<scope>test</scope>
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/protocols/webadmin-integration-test/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin-integration-test/pom.xml b/server/protocols/webadmin-integration-test/pom.xml
index 5f3d9db..0817987 100644
--- a/server/protocols/webadmin-integration-test/pom.xml
+++ b/server/protocols/webadmin-integration-test/pom.xml
@@ -166,6 +166,12 @@
</dependency>
<dependency>
<groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
<artifactId>james-server-webadmin</artifactId>
<scope>test</scope>
</dependency>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[03/21] james-project git commit: JAMES-1902 split probes to prevent
them to pull unwanted dependencies
Posted by bt...@apache.org.
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
[06/21] james-project git commit: JAMES-1902 split probes to prevent
them to pull unwanted dependencies
Posted by bt...@apache.org.
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/cli/src/test/java/org/apache/james/cli/ServerCmdTest.java
----------------------------------------------------------------------
diff --git a/server/container/cli/src/test/java/org/apache/james/cli/ServerCmdTest.java b/server/container/cli/src/test/java/org/apache/james/cli/ServerCmdTest.java
index b406912..2e2ae1e 100644
--- a/server/container/cli/src/test/java/org/apache/james/cli/ServerCmdTest.java
+++ b/server/container/cli/src/test/java/org/apache/james/cli/ServerCmdTest.java
@@ -30,14 +30,17 @@ import java.util.HashMap;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.ParseException;
-import org.apache.james.adapter.mailbox.SerializableQuota;
import org.apache.james.cli.exceptions.InvalidArgumentNumberException;
import org.apache.james.cli.exceptions.InvalidPortException;
import org.apache.james.cli.exceptions.MissingCommandException;
import org.apache.james.cli.exceptions.UnrecognizedCommandException;
-import org.apache.james.cli.probe.ServerProbe;
import org.apache.james.cli.type.CmdType;
import org.apache.james.mailbox.model.Quota;
+import org.apache.james.mailbox.store.mail.model.SerializableQuota;
+import org.apache.james.mailbox.store.probe.MailboxProbe;
+import org.apache.james.mailbox.store.probe.QuotaProbe;
+import org.apache.james.mailbox.store.probe.SieveProbe;
+import org.apache.james.probe.DataProbe;
import org.apache.james.rrt.lib.Mappings;
import org.apache.james.rrt.lib.MappingsImpl;
import org.easymock.IMocksControl;
@@ -51,15 +54,22 @@ public class ServerCmdTest {
public static final String ADDITIONAL_ARGUMENT = "additionalArgument";
private IMocksControl control;
- private ServerProbe serverProbe;
+
+ private DataProbe dataProbe;
+ private MailboxProbe mailboxProbe;
+ private QuotaProbe quotaProbe;
+ private SieveProbe sieveProbe;
private ServerCmd testee;
@Before
public void setup() {
control = createControl();
- serverProbe = control.createMock(ServerProbe.class);
- testee = new ServerCmd(serverProbe);
+ dataProbe = control.createMock(DataProbe.class);
+ mailboxProbe = control.createMock(MailboxProbe.class);
+ quotaProbe = control.createMock(QuotaProbe.class);
+ sieveProbe = control.createMock(SieveProbe.class);
+ testee = new ServerCmd(dataProbe, mailboxProbe, quotaProbe, sieveProbe);
}
@Test
@@ -68,7 +78,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.ADDDOMAIN.getCommand(), domain};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.addDomain(domain);
+ dataProbe.addDomain(domain);
expectLastCall();
control.replay();
@@ -82,7 +92,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.REMOVEDOMAIN.getCommand(), domain};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.removeDomain(domain);
+ dataProbe.removeDomain(domain);
expectLastCall();
control.replay();
@@ -96,7 +106,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.CONTAINSDOMAIN.getCommand(), domain};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.containsDomain(domain)).andReturn(true);
+ expect(dataProbe.containsDomain(domain)).andReturn(true);
control.replay();
testee.executeCommandLine(commandLine);
@@ -108,7 +118,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.LISTDOMAINS.getCommand()};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.listDomains()).andReturn(ImmutableList.<String> of());
+ expect(dataProbe.listDomains()).andReturn(ImmutableList.<String> of());
control.replay();
testee.executeCommandLine(commandLine);
@@ -122,7 +132,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.ADDUSER.getCommand(), user, password};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.addUser(user, password);
+ dataProbe.addUser(user, password);
expectLastCall();
control.replay();
@@ -136,7 +146,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.REMOVEUSER.getCommand(), user};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.removeUser(user);
+ dataProbe.removeUser(user);
expectLastCall();
control.replay();
@@ -150,7 +160,7 @@ public class ServerCmdTest {
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
String[] res = {};
- expect(serverProbe.listUsers()).andReturn(res);
+ expect(dataProbe.listUsers()).andReturn(res);
control.replay();
testee.executeCommandLine(commandLine);
@@ -162,7 +172,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.LISTMAPPINGS.getCommand()};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.listMappings()).andReturn(new HashMap<String, Mappings>());
+ expect(dataProbe.listMappings()).andReturn(new HashMap<String, Mappings>());
control.replay();
testee.executeCommandLine(commandLine);
@@ -176,7 +186,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.LISTUSERDOMAINMAPPINGS.getCommand(), user, domain};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.listUserDomainMappings(user, domain)).andReturn(MappingsImpl.empty());
+ expect(dataProbe.listUserDomainMappings(user, domain)).andReturn(MappingsImpl.empty());
control.replay();
testee.executeCommandLine(commandLine);
@@ -191,7 +201,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.ADDADDRESSMAPPING.getCommand(), user, domain, address};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.addAddressMapping(user, domain, address);
+ dataProbe.addAddressMapping(user, domain, address);
expectLastCall();
control.replay();
@@ -207,7 +217,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.REMOVEADDRESSMAPPING.getCommand(), user, domain, address};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.removeAddressMapping(user, domain, address);
+ dataProbe.removeAddressMapping(user, domain, address);
expectLastCall();
control.replay();
@@ -223,7 +233,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.ADDREGEXMAPPING.getCommand(), user, domain, regex};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.addRegexMapping(user, domain, regex);
+ dataProbe.addRegexMapping(user, domain, regex);
expectLastCall();
control.replay();
@@ -239,7 +249,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.REMOVEREGEXMAPPING.getCommand(), user, domain, regex};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.removeRegexMapping(user, domain, regex);
+ dataProbe.removeRegexMapping(user, domain, regex);
expectLastCall();
control.replay();
@@ -254,7 +264,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.SETPASSWORD.getCommand(), user, password};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.setPassword(user, password);
+ dataProbe.setPassword(user, password);
expectLastCall();
control.replay();
@@ -269,7 +279,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.COPYMAILBOX.getCommand(), srcBean, dstBean};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.copyMailbox(srcBean, dstBean);
+ mailboxProbe.copyMailbox(srcBean, dstBean);
expectLastCall();
control.replay();
@@ -283,7 +293,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.DELETEUSERMAILBOXES.getCommand(), user};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.deleteUserMailboxesNames(user);
+ mailboxProbe.deleteUserMailboxesNames(user);
expectLastCall();
control.replay();
@@ -299,7 +309,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.CREATEMAILBOX.getCommand(), namespace, user, name};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.createMailbox(namespace, user, name);
+ mailboxProbe.createMailbox(namespace, user, name);
expectLastCall();
control.replay();
@@ -315,7 +325,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.DELETEMAILBOX.getCommand(), namespace, user, name};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.deleteMailbox(namespace, user, name);
+ mailboxProbe.deleteMailbox(namespace, user, name);
expectLastCall();
control.replay();
@@ -329,7 +339,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.LISTUSERMAILBOXES.getCommand(), user};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.listUserMailboxes(user)).andReturn(new ArrayList<String>());
+ expect(mailboxProbe.listUserMailboxes(user)).andReturn(new ArrayList<String>());
control.replay();
testee.executeCommandLine(commandLine);
@@ -344,7 +354,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.GETQUOTAROOT.getCommand(), namespace, user, name};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.getQuotaRoot(namespace, user, name)).andReturn(namespace + "&" + user);
+ expect(quotaProbe.getQuotaRoot(namespace, user, name)).andReturn(namespace + "&" + user);
control.replay();
testee.executeCommandLine(commandLine);
@@ -356,7 +366,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.GETDEFAULTMAXMESSAGECOUNTQUOTA.getCommand()};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.getDefaultMaxMessageCount()).andReturn(1024L * 1024L);
+ expect(quotaProbe.getDefaultMaxMessageCount()).andReturn(1024L * 1024L);
control.replay();
testee.executeCommandLine(commandLine);
@@ -368,7 +378,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.GETDEFAULTMAXSTORAGEQUOTA.getCommand()};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.getDefaultMaxStorage()).andReturn(1024L * 1024L * 1024L);
+ expect(quotaProbe.getDefaultMaxStorage()).andReturn(1024L * 1024L * 1024L);
control.replay();
testee.executeCommandLine(commandLine);
@@ -380,7 +390,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.SETDEFAULTMAXMESSAGECOUNTQUOTA.getCommand(), "1054"};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.setDefaultMaxMessageCount(1054);
+ quotaProbe.setDefaultMaxMessageCount(1054);
expectLastCall();
control.replay();
@@ -393,7 +403,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.SETDEFAULTMAXSTORAGEQUOTA.getCommand(), "1G"};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.setDefaultMaxStorage(1024 * 1024 * 1024);
+ quotaProbe.setDefaultMaxStorage(1024 * 1024 * 1024);
expectLastCall();
control.replay();
@@ -407,7 +417,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.SETMAXMESSAGECOUNTQUOTA.getCommand(), quotaroot, "1000"};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.setMaxMessageCount(quotaroot, 1000);
+ quotaProbe.setMaxMessageCount(quotaroot, 1000);
expectLastCall();
control.replay();
@@ -421,7 +431,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.SETMAXSTORAGEQUOTA.getCommand(), quotaroot, "5M"};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.setMaxStorage(quotaroot, 5 * 1024 * 1024);
+ quotaProbe.setMaxStorage(quotaroot, 5 * 1024 * 1024);
expectLastCall();
control.replay();
@@ -435,7 +445,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.GETMAXMESSAGECOUNTQUOTA.getCommand(), quotaroot};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.getMaxMessageCount(quotaroot)).andReturn(Quota.UNLIMITED);
+ expect(quotaProbe.getMaxMessageCount(quotaroot)).andReturn(Quota.UNLIMITED);
control.replay();
testee.executeCommandLine(commandLine);
@@ -448,7 +458,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.GETMAXSTORAGEQUOTA.getCommand(), quotaroot};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.getMaxStorage(quotaroot)).andReturn(Quota.UNLIMITED);
+ expect(quotaProbe.getMaxStorage(quotaroot)).andReturn(Quota.UNLIMITED);
control.replay();
testee.executeCommandLine(commandLine);
@@ -461,7 +471,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.GETSTORAGEQUOTA.getCommand(), quotaroot};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.getStorageQuota(quotaroot)).andReturn(new SerializableQuota(Quota.UNLIMITED, Quota.UNKNOWN));
+ expect(quotaProbe.getStorageQuota(quotaroot)).andReturn(new SerializableQuota(Quota.UNLIMITED, Quota.UNKNOWN));
control.replay();
testee.executeCommandLine(commandLine);
@@ -474,7 +484,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.GETMESSAGECOUNTQUOTA.getCommand(), quotaroot};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.getMessageCountQuota(quotaroot)).andReturn(new SerializableQuota(Quota.UNLIMITED, Quota.UNKNOWN));
+ expect(quotaProbe.getMessageCountQuota(quotaroot)).andReturn(new SerializableQuota(Quota.UNLIMITED, Quota.UNKNOWN));
control.replay();
testee.executeCommandLine(commandLine);
@@ -486,7 +496,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.REINDEXALL.getCommand()};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.reIndexAll();
+ mailboxProbe.reIndexAll();
expectLastCall();
control.replay();
@@ -502,7 +512,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.REINDEXMAILBOX.getCommand(), namespace, user, name};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.reIndexMailbox(namespace, user, name);
+ mailboxProbe.reIndexMailbox(namespace, user, name);
expectLastCall();
control.replay();
@@ -515,7 +525,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.SETSIEVEQUOTA.getCommand(), "2K"};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.setSieveQuota(2048);
+ sieveProbe.setSieveQuota(2048);
expectLastCall();
control.replay();
@@ -529,7 +539,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.SETSIEVEUSERQUOTA.getCommand(), user, "1K"};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.setSieveQuota(user, 1024);
+ sieveProbe.setSieveQuota(user, 1024);
expectLastCall();
control.replay();
@@ -542,7 +552,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.GETSIEVEQUOTA.getCommand()};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.getSieveQuota()).andReturn(18L);
+ expect(sieveProbe.getSieveQuota()).andReturn(18L);
expectLastCall();
control.replay();
@@ -556,7 +566,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.GETSIEVEUSERQUOTA.getCommand(), user};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- expect(serverProbe.getSieveQuota(user)).andReturn(18L);
+ expect(sieveProbe.getSieveQuota(user)).andReturn(18L);
expectLastCall();
control.replay();
@@ -569,7 +579,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.REMOVESIEVEQUOTA.getCommand()};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.removeSieveQuota();
+ sieveProbe.removeSieveQuota();
expectLastCall();
control.replay();
@@ -583,7 +593,7 @@ public class ServerCmdTest {
String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.REMOVESIEVEUSERQUOTA.getCommand(), user};
CommandLine commandLine = ServerCmd.parseCommandLine(arguments);
- serverProbe.removeSieveQuota(user);
+ sieveProbe.removeSieveQuota(user);
expectLastCall();
control.replay();
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
index fc2384d..3282fe5 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
@@ -19,6 +19,7 @@
package org.apache.james;
+import org.apache.james.modules.MailboxModule;
import org.apache.james.modules.data.CassandraDomainListModule;
import org.apache.james.modules.data.CassandraJmapModule;
import org.apache.james.modules.data.CassandraRecipientRewriteTableModule;
@@ -66,7 +67,8 @@ public class CassandraJamesServerMain {
new ElasticSearchMailboxModule(),
new QuotaModule(),
new ActiveMQQueueModule(),
- new ESMetricReporterModule());
+ new ESMetricReporterModule(),
+ new MailboxModule());
public static void main(String[] args) throws Exception {
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
index 238a934..ede63e2 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
@@ -35,8 +35,8 @@ import org.apache.http.client.utils.URIBuilder;
import org.apache.james.jmap.HttpJmapAuthentication;
import org.apache.james.jmap.api.access.AccessToken;
import org.apache.james.modules.TestESMetricReporterModule;
-import org.apache.james.utils.GuiceServerProbe;
import org.apache.james.utils.JmapGuiceProbe;
+import org.apache.james.utils.DataProbeImpl;
import org.elasticsearch.client.Client;
import org.elasticsearch.index.query.QueryBuilders;
import org.junit.After;
@@ -75,7 +75,7 @@ public class ESReporterTest {
public void setup() throws Exception {
server = cassandraJmap.jmapServer();
server.start();
- GuiceServerProbe serverProbe = server.getProbe(GuiceServerProbe.class);
+ DataProbeImpl serverProbe = server.getProbe(DataProbeImpl.class);
serverProbe.addDomain(DOMAIN);
serverProbe.addUser(USERNAME, PASSWORD);
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java b/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java
index 20e4318..b9a5bd0 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java
@@ -28,7 +28,6 @@ import org.apache.james.onami.lifecycle.Stager;
import org.apache.james.utils.ConfigurationsPerformer;
import org.apache.james.utils.GuiceProbe;
import org.apache.james.utils.GuiceProbeProvider;
-import org.apache.james.utils.GuiceServerProbe;
import com.google.common.collect.Iterables;
import com.google.inject.Guice;
@@ -75,10 +74,6 @@ public class GuiceJamesServer {
}
}
- public GuiceServerProbe serverProbe() {
- return guiceProbeProvider.getProbe(GuiceServerProbe.class);
- }
-
public <T extends GuiceProbe> T getProbe(Class<T> probe) {
return guiceProbeProvider.getProbe(probe);
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
index cf449a2..c06b7e5 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
@@ -35,7 +35,7 @@ import org.apache.james.modules.server.DNSServiceModule;
import org.apache.james.modules.server.DropWizardMetricsModule;
import org.apache.james.onami.lifecycle.PreDestroyModule;
import org.apache.james.utils.GuiceProbe;
-import org.apache.james.utils.GuiceServerProbe;
+import org.apache.james.utils.DataProbeImpl;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
@@ -61,7 +61,7 @@ public class CommonServicesModule extends AbstractModule {
bind(FileSystemImpl.class).in(Scopes.SINGLETON);
bind(FileSystem.class).to(FileSystemImpl.class);
- Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(GuiceServerProbe.class);
+ Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(DataProbeImpl.class);
}
@Provides @Singleton @Named(CONFIGURATION_PATH)
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/guice-common/src/main/java/org/apache/james/utils/DataProbeImpl.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/DataProbeImpl.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/DataProbeImpl.java
new file mode 100644
index 0000000..8fdfccf
--- /dev/null
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/DataProbeImpl.java
@@ -0,0 +1,130 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.utils;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.apache.commons.lang.NotImplementedException;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.probe.DataProbe;
+import org.apache.james.rrt.api.RecipientRewriteTable;
+import org.apache.james.rrt.lib.Mappings;
+import org.apache.james.user.api.UsersRepository;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+
+public class DataProbeImpl implements GuiceProbe, DataProbe {
+
+ private final DomainList domainList;
+ private final UsersRepository usersRepository;
+ private final RecipientRewriteTable recipientRewriteTable;
+
+ @Inject
+ private DataProbeImpl(
+ DomainList domainList,
+ UsersRepository usersRepository,
+ RecipientRewriteTable recipientRewriteTable) {
+ this.domainList = domainList;
+ this.usersRepository = usersRepository;
+ this.recipientRewriteTable = recipientRewriteTable;
+ }
+
+ @Override
+ public void addUser(String userName, String password) throws Exception {
+ usersRepository.addUser(userName, password);
+ }
+
+ @Override
+ public void removeUser(String username) throws Exception {
+ usersRepository.removeUser(username);
+ }
+
+ @Override
+ public void setPassword(String userName, String password) throws Exception {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public String[] listUsers() throws Exception {
+ return Iterables.toArray(ImmutableList.copyOf(usersRepository.list()), String.class);
+ }
+
+ @Override
+ public void addDomain(String domain) throws Exception {
+ domainList.addDomain(domain);
+ }
+
+
+ @Override
+ public boolean containsDomain(String domain) throws Exception {
+ return domainList.containsDomain(domain);
+ }
+
+ @Override
+ public String getDefaultDomain() throws Exception {
+ return domainList.getDefaultDomain();
+ }
+
+ @Override
+ public void removeDomain(String domain) throws Exception {
+ domainList.removeDomain(domain);
+ }
+
+ @Override
+ public List<String> listDomains() throws Exception {
+ return domainList.getDomains();
+ }
+
+ @Override
+ public Map<String, Mappings> listMappings() throws Exception {
+ return recipientRewriteTable.getAllMappings();
+ }
+
+ @Override
+ public Mappings listUserDomainMappings(String user, String domain) throws Exception {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void addAddressMapping(String user, String domain, String toAddress) throws Exception {
+ recipientRewriteTable.addAddressMapping(user, domain, toAddress);
+ }
+
+ @Override
+ public void removeAddressMapping(String user, String domain, String fromAddress) throws Exception {
+ recipientRewriteTable.removeAddressMapping(user, domain, fromAddress);
+ }
+
+ @Override
+ public void addRegexMapping(String user, String domain, String regex) throws Exception {
+ recipientRewriteTable.addRegexMapping(user, domain, regex);
+ }
+
+
+ @Override
+ public void removeRegexMapping(String user, String domain, String regex) throws Exception {
+ recipientRewriteTable.removeRegexMapping(user, domain, regex);
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ExtendedServerProbe.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ExtendedServerProbe.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ExtendedServerProbe.java
deleted file mode 100644
index bcd5296..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ExtendedServerProbe.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.utils;
-
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Date;
-
-import javax.mail.Flags;
-
-import org.apache.james.cli.probe.ServerProbe;
-import org.apache.james.mailbox.exception.BadCredentialsException;
-import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.model.ComposedMessageId;
-import org.apache.james.mailbox.model.MailboxPath;
-import org.apache.james.mailbox.store.mail.model.Mailbox;
-
-public interface ExtendedServerProbe extends ServerProbe {
-
- ComposedMessageId appendMessage(String username, MailboxPath mailboxPath, InputStream message, Date internalDate, boolean isRecent, Flags flags)
- throws BadCredentialsException, MailboxException;
-
- Mailbox getMailbox(String namespace, String user, String name);
-
- void addActiveSieveScript(String user, String name, String script) throws Exception;
-
- Collection<String> listSubscriptions(String user) throws Exception;
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java
deleted file mode 100644
index ec9bcc8..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.utils;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import javax.inject.Inject;
-import javax.mail.Flags;
-
-import org.apache.commons.lang.NotImplementedException;
-import org.apache.james.adapter.mailbox.SerializableQuota;
-import org.apache.james.domainlist.api.DomainList;
-import org.apache.james.mailbox.MailboxManager;
-import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.mailbox.MessageManager;
-import org.apache.james.mailbox.SubscriptionManager;
-import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.model.ComposedMessageId;
-import org.apache.james.mailbox.model.MailboxConstants;
-import org.apache.james.mailbox.model.MailboxMetaData;
-import org.apache.james.mailbox.model.MailboxPath;
-import org.apache.james.mailbox.model.MailboxQuery;
-import org.apache.james.mailbox.store.mail.MailboxMapper;
-import org.apache.james.mailbox.store.mail.MailboxMapperFactory;
-import org.apache.james.mailbox.store.mail.model.Mailbox;
-import org.apache.james.rrt.api.RecipientRewriteTable;
-import org.apache.james.rrt.lib.Mappings;
-import org.apache.james.sieverepository.api.SieveRepository;
-import org.apache.james.user.api.UsersRepository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-public class GuiceServerProbe implements ExtendedServerProbe, GuiceProbe {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(GuiceServerProbe.class);
-
- private final MailboxManager mailboxManager;
- private final MailboxMapperFactory mailboxMapperFactory;
- private final DomainList domainList;
- private final UsersRepository usersRepository;
- private final RecipientRewriteTable recipientRewriteTable;
- private final SieveRepository sieveRepository;
- private final SubscriptionManager subscriptionManager;
-
- @Inject
- private GuiceServerProbe(MailboxManager mailboxManager, MailboxMapperFactory mailboxMapperFactory,
- DomainList domainList, UsersRepository usersRepository, SieveRepository sieveRepository,
- RecipientRewriteTable recipientRewriteTable, SubscriptionManager subscriptionManager) {
- this.mailboxManager = mailboxManager;
- this.mailboxMapperFactory = mailboxMapperFactory;
- this.domainList = domainList;
- this.usersRepository = usersRepository;
- this.sieveRepository = sieveRepository;
- this.recipientRewriteTable = recipientRewriteTable;
- this.subscriptionManager = subscriptionManager;
- }
-
- @Override
- public void close() throws IOException {
- }
-
- @Override
- public void addUser(String userName, String password) throws Exception {
- usersRepository.addUser(userName, password);
- }
-
- @Override
- public void removeUser(String username) throws Exception {
- usersRepository.removeUser(username);
- }
-
- @Override
- public String[] listUsers() throws Exception {
- return Iterables.toArray(ImmutableList.copyOf(usersRepository.list()), String.class);
- }
-
- @Override
- public void setPassword(String userName, String password) throws Exception {
- throw new NotImplementedException();
- }
-
- @Override
- public void addDomain(String domain) throws Exception {
- domainList.addDomain(domain);
- }
-
- @Override
- public boolean containsDomain(String domain) throws Exception {
- return domainList.containsDomain(domain);
- }
-
- @Override
- public String getDefaultDomain() throws Exception {
- return domainList.getDefaultDomain();
- }
-
- @Override
- public void removeDomain(String domain) throws Exception {
- domainList.removeDomain(domain);
- }
-
- @Override
- public List<String> listDomains() throws Exception {
- return domainList.getDomains();
- }
-
- @Override
- public Map<String, Mappings> listMappings() throws Exception {
- return recipientRewriteTable.getAllMappings();
- }
-
- @Override
- public void addAddressMapping(String user, String domain, String toAddress) throws Exception {
- recipientRewriteTable.addAddressMapping(user, domain, toAddress);
- }
-
- @Override
- public void removeAddressMapping(String user, String domain, String fromAddress) throws Exception {
- recipientRewriteTable.removeAddressMapping(user, domain, fromAddress);
- }
-
- @Override
- public Mappings listUserDomainMappings(String user, String domain) throws Exception {
- throw new NotImplementedException();
- }
-
- @Override
- public void addRegexMapping(String user, String domain, String regex) throws Exception {
- recipientRewriteTable.addRegexMapping(user, domain, regex);
- }
-
- @Override
- public void removeRegexMapping(String user, String domain, String regex) throws Exception {
- recipientRewriteTable.removeRegexMapping(user, domain, regex);
- }
-
- @Override
- public void copyMailbox(String srcBean, String dstBean) throws Exception {
- throw new NotImplementedException();
- }
-
- @Override
- public void deleteUserMailboxesNames(String user) throws Exception {
- throw new NotImplementedException();
- }
-
- @Override
- public void createMailbox(String namespace, String user, String name) {
- MailboxSession mailboxSession = null;
- try {
- mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
- mailboxManager.startProcessingRequest(mailboxSession);
- mailboxManager.createMailbox(new MailboxPath(namespace, user, name), mailboxSession);
- } catch (MailboxException e) {
- throw Throwables.propagate(e);
- } finally {
- closeSession(mailboxSession);
- }
- }
-
- @Override
- public Mailbox getMailbox(String namespace, String user, String name) {
- MailboxSession mailboxSession = null;
- try {
- mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
- MailboxMapper mailboxMapper = mailboxMapperFactory.getMailboxMapper(mailboxSession);
- return mailboxMapper.findMailboxByPath(new MailboxPath(namespace, user, name));
- } catch (MailboxException e) {
- throw Throwables.propagate(e);
- } finally {
- closeSession(mailboxSession);
- }
- }
-
- private void closeSession(MailboxSession session) {
- if (session != null) {
- mailboxManager.endProcessingRequest(session);
- try {
- mailboxManager.logout(session, true);
- } catch (MailboxException e) {
- throw Throwables.propagate(e);
- }
- }
- }
-
- @Override
- public Collection<String> listUserMailboxes(String user) {
- MailboxSession mailboxSession = null;
- try {
- mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
- mailboxManager.startProcessingRequest(mailboxSession);
- return searchUserMailboxes(user, mailboxSession)
- .stream()
- .map(MailboxMetaData::getPath)
- .map(MailboxPath::getName)
- .collect(Collectors.toList());
- } catch (MailboxException e) {
- throw Throwables.propagate(e);
- } finally {
- closeSession(mailboxSession);
- }
- }
-
- private List<MailboxMetaData> searchUserMailboxes(String username, MailboxSession session) throws MailboxException {
- return mailboxManager.search(
- new MailboxQuery(new MailboxPath(MailboxConstants.USER_NAMESPACE, username, ""),
- "*",
- session.getPathDelimiter()),
- session);
- }
-
- @Override
- public void deleteMailbox(String namespace, String user, String name) {
- MailboxSession mailboxSession = null;
- try {
- mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
- mailboxManager.startProcessingRequest(mailboxSession);
- mailboxManager.deleteMailbox(new MailboxPath(namespace, user, name), mailboxSession);
- } catch (MailboxException e) {
- throw Throwables.propagate(e);
- } finally {
- closeSession(mailboxSession);
- }
- }
-
- @Override
- public String getQuotaRoot(String namespace, String user, String name) throws MailboxException {
- throw new NotImplementedException();
- }
-
- @Override
- public SerializableQuota getMessageCountQuota(String quotaRoot) throws MailboxException {
- throw new NotImplementedException();
- }
-
- @Override
- public SerializableQuota getStorageQuota(String quotaRoot) throws MailboxException {
- throw new NotImplementedException();
- }
-
- @Override
- public long getMaxMessageCount(String quotaRoot) throws MailboxException {
- throw new NotImplementedException();
- }
-
- @Override
- public long getMaxStorage(String quotaRoot) throws MailboxException {
- throw new NotImplementedException();
- }
-
- @Override
- public long getDefaultMaxMessageCount() throws MailboxException {
- throw new NotImplementedException();
- }
-
- @Override
- public long getDefaultMaxStorage() throws MailboxException {
- throw new NotImplementedException();
- }
-
- @Override
- public void setMaxMessageCount(String quotaRoot, long maxMessageCount) throws MailboxException {
- throw new NotImplementedException();
- }
-
- @Override
- public void setMaxStorage(String quotaRoot, long maxSize) throws MailboxException {
- throw new NotImplementedException();
- }
-
- @Override
- public void setDefaultMaxMessageCount(long maxDefaultMessageCount) throws MailboxException {
- throw new NotImplementedException();
- }
-
- @Override
- public void setDefaultMaxStorage(long maxDefaultSize) throws MailboxException {
- throw new NotImplementedException();
- }
-
- @Override
- public ComposedMessageId appendMessage(String username, MailboxPath mailboxPath, InputStream message, Date internalDate, boolean isRecent, Flags flags)
- throws MailboxException {
-
- MailboxSession mailboxSession = mailboxManager.createSystemSession(username, LOGGER);
- MessageManager messageManager = mailboxManager.getMailbox(mailboxPath, mailboxSession);
- return messageManager.appendMessage(message, internalDate, mailboxSession, isRecent, flags);
- }
-
- @Override
- public void reIndexMailbox(String namespace, String user, String name) throws Exception {
- throw new NotImplementedException();
- }
-
- @Override
- public void reIndexAll() throws Exception {
- throw new NotImplementedException();
- }
-
- @Override
- public long getSieveQuota() throws Exception {
- return sieveRepository.getQuota();
- }
-
- @Override
- public void setSieveQuota(long quota) throws Exception {
- sieveRepository.setQuota(quota);
- }
-
- @Override
- public void removeSieveQuota() throws Exception {
- sieveRepository.removeQuota();
- }
-
- @Override
- public long getSieveQuota(String user) throws Exception {
- return sieveRepository.getQuota(user);
- }
-
- @Override
- public void setSieveQuota(String user, long quota) throws Exception {
- sieveRepository.setQuota(user, quota);
- }
-
- @Override
- public void removeSieveQuota(String user) throws Exception {
- sieveRepository.removeQuota(user);
- }
-
- @Override
- public void addActiveSieveScript(String user, String name, String script) throws Exception {
- sieveRepository.putScript(user, name, script);
- sieveRepository.setActive(user, name);
- }
-
- @Override
- public Collection<String> listSubscriptions(String user) throws Exception {
- MailboxSession mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
- return subscriptionManager.subscriptions(mailboxSession);
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java b/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java
index fa85594..0e21021 100644
--- a/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java
+++ b/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJamesServerTest.java
@@ -27,6 +27,7 @@ import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;
+import org.apache.james.utils.DataProbeImpl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -63,7 +64,7 @@ public abstract class AbstractJamesServerTest {
public void hostnameShouldBeUsedAsDefaultDomain() throws Exception {
String expectedDefaultDomain = InetAddress.getLocalHost().getHostName();
- assertThat(server.serverProbe().getDefaultDomain()).isEqualTo(expectedDefaultDomain);
+ assertThat(server.getProbe(DataProbeImpl.class).getDefaultDomain()).isEqualTo(expectedDefaultDomain);
}
@Test
@@ -72,7 +73,7 @@ public abstract class AbstractJamesServerTest {
server.start();
String expectedDefaultDomain = InetAddress.getLocalHost().getHostName();
- assertThat(server.serverProbe().getDefaultDomain()).isEqualTo(expectedDefaultDomain);
+ assertThat(server.getProbe(DataProbeImpl.class).getDefaultDomain()).isEqualTo(expectedDefaultDomain);
}
@Test
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJmapJamesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJmapJamesServerTest.java b/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJmapJamesServerTest.java
index de03298..051fc46 100644
--- a/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJmapJamesServerTest.java
+++ b/server/container/guice/guice-common/src/test/java/org/apache/james/AbstractJmapJamesServerTest.java
@@ -30,6 +30,7 @@ import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;
+import org.apache.james.utils.DataProbeImpl;
import org.apache.james.utils.JmapGuiceProbe;
import org.junit.After;
import org.junit.Before;
@@ -83,7 +84,7 @@ public abstract class AbstractJmapJamesServerTest {
public void hostnameShouldBeUsedAsDefaultDomain() throws Exception {
String expectedDefaultDomain = InetAddress.getLocalHost().getHostName();
- assertThat(server.serverProbe().getDefaultDomain()).isEqualTo(expectedDefaultDomain);
+ assertThat(server.getProbe(DataProbeImpl.class).getDefaultDomain()).isEqualTo(expectedDefaultDomain);
}
@Test
@@ -92,7 +93,7 @@ public abstract class AbstractJmapJamesServerTest {
server.start();
String expectedDefaultDomain = InetAddress.getLocalHost().getHostName();
- assertThat(server.serverProbe().getDefaultDomain()).isEqualTo(expectedDefaultDomain);
+ assertThat(server.getProbe(DataProbeImpl.class).getDefaultDomain()).isEqualTo(expectedDefaultDomain);
}
@Test
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
index 4cec352..4235822 100644
--- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
+++ b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
@@ -19,6 +19,7 @@
package org.apache.james;
+import org.apache.james.modules.MailboxModule;
import org.apache.james.modules.data.JPADataModule;
import org.apache.james.modules.data.SieveFileRepositoryModule;
import org.apache.james.modules.mailbox.JPAMailboxModule;
@@ -40,7 +41,7 @@ import com.google.inject.util.Modules;
public class JPAJamesServerMain {
- private static final Module protocols = Modules.combine(
+ public static final Module protocols = Modules.combine(
new IMAPServerModule(),
new ProtocolHandlerModule(),
new POP3ServerModule(),
@@ -55,7 +56,8 @@ public class JPAJamesServerMain {
new SieveFileRepositoryModule(),
new QuotaModule(),
new ActiveMQQueueModule(),
- new RawPostDequeueDecoratorModule());
+ new RawPostDequeueDecoratorModule(),
+ new MailboxModule());
public static void main(String[] args) throws Exception {
GuiceJamesServer server = new GuiceJamesServer()
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java b/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
index 0684be1..1977930 100644
--- a/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
+++ b/server/container/guice/jpa-guice/src/test/java/org/apache/james/JPAJamesServerTest.java
@@ -31,7 +31,7 @@ public class JPAJamesServerTest extends AbstractJamesServerTest {
@Override
protected GuiceJamesServer createJamesServer() {
return new GuiceJamesServer()
- .combineWith(JPAJamesServerMain.jpaServerModule)
+ .combineWith(JPAJamesServerMain.jpaServerModule, JPAJamesServerMain.protocols)
.overrideWith(new TestFilesystemModule(temporaryFolder),
new TestJPAConfigurationModule());
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/mailbox/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/mailbox/pom.xml b/server/container/guice/mailbox/pom.xml
index 6b88022..f60fd9f 100644
--- a/server/container/guice/mailbox/pom.xml
+++ b/server/container/guice/mailbox/pom.xml
@@ -131,7 +131,26 @@
</plugins>
</build>
<dependencies>
-
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-james-mailbox-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-james-mailbox-store</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </dependency>
</dependencies>
</profile>
<profile>
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxModule.java b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxModule.java
new file mode 100644
index 0000000..b342aac
--- /dev/null
+++ b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxModule.java
@@ -0,0 +1,33 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.modules;
+
+import org.apache.james.utils.GuiceProbe;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.Multibinder;
+
+public class MailboxModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(MailboxProbeImpl.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java
----------------------------------------------------------------------
diff --git a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java
new file mode 100644
index 0000000..b478977
--- /dev/null
+++ b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java
@@ -0,0 +1,181 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.modules;
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.inject.Inject;
+import javax.mail.Flags;
+
+import org.apache.commons.lang.NotImplementedException;
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.MailboxSession;
+import org.apache.james.mailbox.MessageManager;
+import org.apache.james.mailbox.SubscriptionManager;
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.ComposedMessageId;
+import org.apache.james.mailbox.model.MailboxConstants;
+import org.apache.james.mailbox.model.MailboxMetaData;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.model.MailboxQuery;
+import org.apache.james.mailbox.store.mail.MailboxMapper;
+import org.apache.james.mailbox.store.mail.MailboxMapperFactory;
+import org.apache.james.mailbox.store.mail.model.Mailbox;
+import org.apache.james.mailbox.store.probe.MailboxProbe;
+import org.apache.james.utils.GuiceProbe;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Throwables;
+
+public class MailboxProbeImpl implements GuiceProbe, MailboxProbe {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(MailboxProbeImpl.class);
+ private final MailboxManager mailboxManager;
+ private final MailboxMapperFactory mailboxMapperFactory;
+ private final SubscriptionManager subscriptionManager;
+
+ @Inject
+ private MailboxProbeImpl(MailboxManager mailboxManager, MailboxMapperFactory mailboxMapperFactory, SubscriptionManager subscriptionManager) {
+ this.mailboxManager = mailboxManager;
+ this.mailboxMapperFactory = mailboxMapperFactory;
+ this.subscriptionManager = subscriptionManager;
+ }
+
+ @Override
+ public void createMailbox(String namespace, String user, String name) {
+ MailboxSession mailboxSession = null;
+ try {
+ mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
+ mailboxManager.startProcessingRequest(mailboxSession);
+ mailboxManager.createMailbox(new MailboxPath(namespace, user, name), mailboxSession);
+ } catch (MailboxException e) {
+ throw Throwables.propagate(e);
+ } finally {
+ closeSession(mailboxSession);
+ }
+ }
+
+
+ @Override
+ public Mailbox getMailbox(String namespace, String user, String name) {
+ MailboxSession mailboxSession = null;
+ try {
+ mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
+ MailboxMapper mailboxMapper = mailboxMapperFactory.getMailboxMapper(mailboxSession);
+ return mailboxMapper.findMailboxByPath(new MailboxPath(namespace, user, name));
+ } catch (MailboxException e) {
+ throw Throwables.propagate(e);
+ } finally {
+ closeSession(mailboxSession);
+ }
+ }
+
+ private void closeSession(MailboxSession session) {
+ if (session != null) {
+ mailboxManager.endProcessingRequest(session);
+ try {
+ mailboxManager.logout(session, true);
+ } catch (MailboxException e) {
+ throw Throwables.propagate(e);
+ }
+ }
+ }
+
+ @Override
+ public Collection<String> listUserMailboxes(String user) {
+ MailboxSession mailboxSession = null;
+ try {
+ mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
+ mailboxManager.startProcessingRequest(mailboxSession);
+ return searchUserMailboxes(user, mailboxSession)
+ .stream()
+ .map(MailboxMetaData::getPath)
+ .map(MailboxPath::getName)
+ .collect(Collectors.toList());
+ } catch (MailboxException e) {
+ throw Throwables.propagate(e);
+ } finally {
+ closeSession(mailboxSession);
+ }
+ }
+
+ private List<MailboxMetaData> searchUserMailboxes(String username, MailboxSession session) throws MailboxException {
+ return mailboxManager.search(
+ new MailboxQuery(new MailboxPath(MailboxConstants.USER_NAMESPACE, username, ""),
+ "*",
+ session.getPathDelimiter()),
+ session);
+ }
+
+
+ @Override
+ public void deleteMailbox(String namespace, String user, String name) {
+ MailboxSession mailboxSession = null;
+ try {
+ mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
+ mailboxManager.startProcessingRequest(mailboxSession);
+ mailboxManager.deleteMailbox(new MailboxPath(namespace, user, name), mailboxSession);
+ } catch (MailboxException e) {
+ throw Throwables.propagate(e);
+ } finally {
+ closeSession(mailboxSession);
+ }
+ }
+
+ @Override
+ public ComposedMessageId appendMessage(String username, MailboxPath mailboxPath, InputStream message, Date internalDate, boolean isRecent, Flags flags)
+ throws MailboxException {
+
+ MailboxSession mailboxSession = mailboxManager.createSystemSession(username, LOGGER);
+ MessageManager messageManager = mailboxManager.getMailbox(mailboxPath, mailboxSession);
+ return messageManager.appendMessage(message, internalDate, mailboxSession, isRecent, flags);
+ }
+
+ @Override
+ public void copyMailbox(String srcBean, String dstBean) throws Exception {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void deleteUserMailboxesNames(String user) throws Exception {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void reIndexMailbox(String namespace, String user, String name) throws Exception {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void reIndexAll() throws Exception {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public Collection<String> listSubscriptions(String user) throws Exception {
+ MailboxSession mailboxSession = mailboxManager.createSystemSession(user, LOGGER);
+ return subscriptionManager.subscriptions(mailboxSession);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java b/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
index 084d83e..ab47e0f 100644
--- a/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
+++ b/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java
@@ -19,14 +19,21 @@
package org.apache.james;
+import org.apache.james.modules.MailboxModule;
import org.apache.james.modules.data.MemoryDataJmapModule;
import org.apache.james.modules.data.MemoryDataModule;
import org.apache.james.modules.mailbox.MemoryMailboxModule;
import org.apache.james.modules.protocols.IMAPServerModule;
import org.apache.james.modules.protocols.JMAPServerModule;
+import org.apache.james.modules.protocols.LMTPServerModule;
+import org.apache.james.modules.protocols.ManageSieveServerModule;
+import org.apache.james.modules.protocols.POP3ServerModule;
+import org.apache.james.modules.protocols.ProtocolHandlerModule;
+import org.apache.james.modules.protocols.SMTPServerModule;
import org.apache.james.modules.server.JMXServerModule;
import org.apache.james.modules.server.MemoryMailQueueModule;
import org.apache.james.modules.server.QuotaModule;
+import org.apache.james.modules.server.WebAdminServerModule;
import com.google.inject.Module;
import com.google.inject.util.Modules;
@@ -34,13 +41,20 @@ import com.google.inject.util.Modules;
public class MemoryJamesServerMain {
public static final Module inMemoryServerModule = Modules.combine(
- new JMAPServerModule(),
- new IMAPServerModule(),
- new MemoryDataModule(),
- new MemoryDataJmapModule(),
- new MemoryMailboxModule(),
- new QuotaModule(),
- new MemoryMailQueueModule());
+ new JMAPServerModule(),
+ new IMAPServerModule(),
+ new ProtocolHandlerModule(),
+ new POP3ServerModule(),
+ new SMTPServerModule(),
+ new LMTPServerModule(),
+ new ManageSieveServerModule(),
+ new WebAdminServerModule(),
+ new MemoryDataModule(),
+ new MemoryDataJmapModule(),
+ new MemoryMailboxModule(),
+ new QuotaModule(),
+ new MemoryMailQueueModule(),
+ new MailboxModule());
public static void main(String[] args) throws Exception {
new GuiceJamesServer()
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/protocols/managedsieve/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/managedsieve/pom.xml b/server/container/guice/protocols/managedsieve/pom.xml
index 6f97529..ee35b1d 100644
--- a/server/container/guice/protocols/managedsieve/pom.xml
+++ b/server/container/guice/protocols/managedsieve/pom.xml
@@ -133,6 +133,10 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>apache-james-mailbox-store</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-configuration</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
index 539dba6..45bffdf 100644
--- a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
+++ b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
@@ -26,6 +26,7 @@ import org.apache.james.managesieve.core.CoreProcessor;
import org.apache.james.managesieveserver.netty.ManageSieveServerFactory;
import org.apache.james.utils.ConfigurationPerformer;
import org.apache.james.utils.ConfigurationProvider;
+import org.apache.james.utils.GuiceProbe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,6 +45,7 @@ public class ManageSieveServerModule extends AbstractModule {
protected void configure() {
bind(CoreCommands.class).to(CoreProcessor.class);
Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(ManageSieveModuleConfigurationPerformer.class);
+ Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(SieveProbeImpl.class);
}
@Singleton
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/SieveProbeImpl.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/SieveProbeImpl.java b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/SieveProbeImpl.java
new file mode 100644
index 0000000..07c18bb
--- /dev/null
+++ b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/SieveProbeImpl.java
@@ -0,0 +1,71 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.modules.protocols;
+
+import javax.inject.Inject;
+
+import org.apache.james.mailbox.store.probe.SieveProbe;
+import org.apache.james.sieverepository.api.SieveRepository;
+import org.apache.james.utils.GuiceProbe;
+
+public class SieveProbeImpl implements GuiceProbe, SieveProbe {
+
+ private final SieveRepository sieveRepository;
+
+ @Inject
+ private SieveProbeImpl(SieveRepository sieveRepository) {
+ this.sieveRepository = sieveRepository;
+ }
+
+ @Override
+ public long getSieveQuota() throws Exception {
+ return sieveRepository.getQuota();
+ }
+
+ @Override
+ public void setSieveQuota(long quota) throws Exception {
+ sieveRepository.setQuota(quota);
+ }
+
+ @Override
+ public void removeSieveQuota() throws Exception {
+ sieveRepository.removeQuota();
+ }
+
+ @Override
+ public long getSieveQuota(String user) throws Exception {
+ return sieveRepository.getQuota(user);
+ }
+
+ @Override
+ public void setSieveQuota(String user, long quota) throws Exception {
+ sieveRepository.setQuota(user, quota);
+ }
+
+ @Override
+ public void removeSieveQuota(String user) throws Exception {
+ sieveRepository.removeQuota(user);
+ }
+
+ @Override
+ public void addActiveSieveScript(String user, String name, String script) throws Exception {
+ sieveRepository.putScript(user, name, script);
+ sieveRepository.setActive(user, name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagement.java
----------------------------------------------------------------------
diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagement.java b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagement.java
index 767b339..dd779a3 100644
--- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagement.java
+++ b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagement.java
@@ -24,6 +24,7 @@ import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.quota.MaxQuotaManager;
import org.apache.james.mailbox.quota.QuotaManager;
import org.apache.james.mailbox.quota.QuotaRootResolver;
+import org.apache.james.mailbox.store.mail.model.SerializableQuota;
public class QuotaManagement implements QuotaManagementMBean {
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagementMBean.java
----------------------------------------------------------------------
diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagementMBean.java b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagementMBean.java
index 07a8e40..95cea22 100644
--- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagementMBean.java
+++ b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagementMBean.java
@@ -20,6 +20,7 @@
package org.apache.james.adapter.mailbox;
import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.store.mail.model.SerializableQuota;
public interface QuotaManagementMBean {
String getQuotaRoot(String namespace, String user, String name) throws MailboxException;
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/SerializableQuota.java
----------------------------------------------------------------------
diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/SerializableQuota.java b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/SerializableQuota.java
deleted file mode 100644
index 17dd729..0000000
--- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/SerializableQuota.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.adapter.mailbox;
-
-import org.apache.james.mailbox.model.Quota;
-
-import java.io.Serializable;
-
-public class SerializableQuota implements Serializable {
-
- private final long max;
- private final long used;
-
- public SerializableQuota(long max, long used) {
- this.max = max;
- this.used = used;
- }
-
- public SerializableQuota(Quota quota) {
- this.max = quota.getMax();
- this.used = quota.getUsed();
- }
-
- public long getMax() {
- return max;
- }
-
- public long getUsed() {
- return used;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/data/data-api/src/main/java/org/apache/james/probe/DataProbe.java
----------------------------------------------------------------------
diff --git a/server/data/data-api/src/main/java/org/apache/james/probe/DataProbe.java b/server/data/data-api/src/main/java/org/apache/james/probe/DataProbe.java
new file mode 100644
index 0000000..6f45e61
--- /dev/null
+++ b/server/data/data-api/src/main/java/org/apache/james/probe/DataProbe.java
@@ -0,0 +1,59 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.probe;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.james.rrt.lib.Mappings;
+
+public interface DataProbe {
+
+ void addUser(String userName, String password) throws Exception;
+
+ void removeUser(String username) throws Exception;
+
+ void setPassword(String userName, String password) throws Exception;
+
+ String[] listUsers() throws Exception;
+
+ void addDomain(String domain) throws Exception;
+
+ boolean containsDomain(String domain) throws Exception;
+
+ String getDefaultDomain() throws Exception;
+
+ void removeDomain(String domain) throws Exception;
+
+ List<String> listDomains() throws Exception;
+
+ Map<String, Mappings> listMappings() throws Exception;
+
+ Mappings listUserDomainMappings(String user, String domain) throws Exception;
+
+ void addAddressMapping(String user, String domain, String toAddress) throws Exception;
+
+ void removeAddressMapping(String user, String domain, String fromAddress) throws Exception;
+
+ void addRegexMapping(String user, String domain, String regex) throws Exception;
+
+ void removeRegexMapping(String user, String domain, String regex) throws Exception;
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java
index 9a64683..989beb5 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java
@@ -23,7 +23,10 @@ import org.apache.james.mailbox.model.MailboxConstants;
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.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 +82,13 @@ public class CommonMailetConfigurationTest {
@Test
public void simpleMailShouldBeSent() throws Exception {
- jamesServer.getServerProbe().addDomain(DEFAULT_DOMAIN);
+ DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
+ dataProbe.addDomain(DEFAULT_DOMAIN);
String from = "user@" + DEFAULT_DOMAIN;
- jamesServer.getServerProbe().addUser(from, PASSWORD);
+ dataProbe.addUser(from, PASSWORD);
String recipient = "user2@" + DEFAULT_DOMAIN;
- jamesServer.getServerProbe().addUser(recipient, PASSWORD);
- jamesServer.getServerProbe().createMailbox(MailboxConstants.USER_NAMESPACE, recipient, "INBOX");
+ dataProbe.addUser(recipient, PASSWORD);
+ jamesServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, recipient, "INBOX");
try (SMTPMessageSender messageSender = SMTPMessageSender.noAuthentication(LOCALHOST_IP, SMTP_PORT, DEFAULT_DOMAIN);
IMAPMessageReader imapMessageReader = new IMAPMessageReader(LOCALHOST_IP, IMAP_PORT)) {
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RecipientRewriteTableIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RecipientRewriteTableIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RecipientRewriteTableIntegrationTest.java
index 23ed827..3b0d101 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RecipientRewriteTableIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RecipientRewriteTableIntegrationTest.java
@@ -23,8 +23,10 @@ import org.apache.james.mailbox.model.MailboxConstants;
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.utils.GuiceServerProbe;
+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.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -54,7 +56,7 @@ public class RecipientRewriteTableIntegrationTest {
private TemporaryJamesServer jamesServer;
private ConditionFactory calmlyAwait;
- private GuiceServerProbe serverProbe;
+ private DataProbe dataProbe;
@Before
@@ -75,9 +77,9 @@ public class RecipientRewriteTableIntegrationTest {
jamesServer = new TemporaryJamesServer(temporaryFolder, mailetContainer);
Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
calmlyAwait = Awaitility.with().pollInterval(slowPacedPollInterval).and().with().pollDelay(slowPacedPollInterval).await();
- serverProbe = jamesServer.getServerProbe();
+ dataProbe = jamesServer.getProbe(DataProbeImpl.class);
- serverProbe.addDomain(JAMES_APACHE_ORG);
+ dataProbe.addDomain(JAMES_APACHE_ORG);
}
@After
@@ -87,13 +89,13 @@ public class RecipientRewriteTableIntegrationTest {
@Test
public void rrtServiceShouldDeliverEmailToMappingRecipients() throws Exception {
- serverProbe.addUser(FROM, PASSWORD);
+ dataProbe.addUser(FROM, PASSWORD);
createUserInbox(ANY_AT_JAMES);
createUserInbox(OTHER_AT_JAMES);
- serverProbe.addAddressMapping("touser", JAMES_APACHE_ORG, ANY_AT_JAMES);
- serverProbe.addAddressMapping("touser", JAMES_APACHE_ORG, OTHER_AT_JAMES);
+ dataProbe.addAddressMapping("touser", JAMES_APACHE_ORG, ANY_AT_JAMES);
+ dataProbe.addAddressMapping("touser", JAMES_APACHE_ORG, OTHER_AT_JAMES);
try (SMTPMessageSender messageSender = SMTPMessageSender.noAuthentication(LOCALHOST_IP, SMTP_PORT, JAMES_APACHE_ORG);
IMAPMessageReader imapMessageReader = new IMAPMessageReader(LOCALHOST_IP, IMAP_PORT)) {
@@ -106,14 +108,14 @@ public class RecipientRewriteTableIntegrationTest {
@Test
public void rrtServiceShouldNotDeliverEmailToRecipientWhenHaveMappingRecipients() throws Exception {
- serverProbe.addUser(FROM, PASSWORD);
+ dataProbe.addUser(FROM, PASSWORD);
createUserInbox(RECIPIENT);
createUserInbox(ANY_AT_JAMES);
createUserInbox(OTHER_AT_JAMES);
- serverProbe.addAddressMapping("touser", JAMES_APACHE_ORG, ANY_AT_JAMES);
- serverProbe.addAddressMapping("touser", JAMES_APACHE_ORG, OTHER_AT_JAMES);
+ dataProbe.addAddressMapping("touser", JAMES_APACHE_ORG, ANY_AT_JAMES);
+ dataProbe.addAddressMapping("touser", JAMES_APACHE_ORG, OTHER_AT_JAMES);
try (SMTPMessageSender messageSender = SMTPMessageSender.noAuthentication(LOCALHOST_IP, SMTP_PORT, JAMES_APACHE_ORG);
IMAPMessageReader imapMessageReader = new IMAPMessageReader(LOCALHOST_IP, IMAP_PORT)) {
@@ -127,15 +129,15 @@ public class RecipientRewriteTableIntegrationTest {
@Test
public void rrtServiceShouldDeliverEmailToRecipientOnLocalWhenMappingContainsNonDomain() throws Exception {
String nonDomainUser = "nondomain";
- String localUser = nonDomainUser + "@" + serverProbe.getDefaultDomain();
+ String localUser = nonDomainUser + "@" + dataProbe.getDefaultDomain();
- serverProbe.addUser(FROM, PASSWORD);
+ dataProbe.addUser(FROM, PASSWORD);
createUserInbox(localUser);
createUserInbox(OTHER_AT_JAMES);
- serverProbe.addAddressMapping("touser", JAMES_APACHE_ORG, nonDomainUser);
- serverProbe.addAddressMapping("touser", JAMES_APACHE_ORG, OTHER_AT_JAMES);
+ dataProbe.addAddressMapping("touser", JAMES_APACHE_ORG, nonDomainUser);
+ dataProbe.addAddressMapping("touser", JAMES_APACHE_ORG, OTHER_AT_JAMES);
try (SMTPMessageSender messageSender = SMTPMessageSender.noAuthentication(LOCALHOST_IP, SMTP_PORT, JAMES_APACHE_ORG);
IMAPMessageReader imapMessageReader = new IMAPMessageReader(LOCALHOST_IP, IMAP_PORT)) {
@@ -148,8 +150,8 @@ public class RecipientRewriteTableIntegrationTest {
}
private void createUserInbox(String username) throws Exception {
- serverProbe.addUser(username, PASSWORD);
- serverProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "INBOX");
+ dataProbe.addUser(username, PASSWORD);
+ jamesServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, "INBOX");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[17/21] james-project git commit: JAMES-1902 define supported
protocols in the server
Posted by bt...@apache.org.
JAMES-1902 define supported protocols in the server
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/ddda1d72
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/ddda1d72
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/ddda1d72
Branch: refs/heads/master
Commit: ddda1d72fe15667437692e5e5a3473fc40cda9ee
Parents: 6cc8ed0
Author: Matthieu Baechler <ma...@gmail.com>
Authored: Tue Dec 27 15:21:47 2016 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
.../smtp/host/CassandraJamesSmtpHostSystem.java | 4 +-
.../apache/james/CassandraJamesServerMain.java | 18 +++++++-
.../org/apache/james/CassandraJmapTestRule.java | 2 +-
.../james/JamesCapabilitiesServerTest.java | 2 +-
.../james/CassandraLdapJamesServerMain.java | 2 +-
.../org/apache/james/GuiceJamesServerImpl.java | 2 -
.../apache/james/modules/ProtocolsModule.java | 46 --------------------
.../org/apache/james/JPAJamesServerMain.java | 18 +++++++-
.../cassandra/cucumber/CassandraStepdefs.java | 2 +-
9 files changed, 41 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/ddda1d72/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
index c7320f3..d59a9ef 100644
--- a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
+++ b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
@@ -28,6 +28,8 @@ import org.apache.james.backends.es.EmbeddedElasticSearch;
import org.apache.james.dnsservice.api.DNSService;
import org.apache.james.mailbox.elasticsearch.MailboxElasticsearchConstants;
import org.apache.james.modules.CassandraJmapServerModule;
+import org.apache.james.modules.protocols.ProtocolHandlerModule;
+import org.apache.james.modules.protocols.SMTPServerModule;
import org.apache.james.mpt.monitor.SystemLoggingMonitor;
import org.apache.james.mpt.session.ExternalSessionFactory;
import org.apache.james.mpt.smtp.SmtpHostSystem;
@@ -107,7 +109,7 @@ public class CassandraJamesSmtpHostSystem extends ExternalSessionFactory impleme
protected GuiceJamesServerImpl createJamesServer() {
return new GuiceJamesServerImpl()
- .combineWith(CassandraJamesServerMain.cassandraServerModule)
+ .combineWith(CassandraJamesServerMain.cassandraServerModule, new SMTPServerModule(), new ProtocolHandlerModule())
.overrideWith(new CassandraJmapServerModule(folder::getRoot, embeddedElasticSearch, embeddedCassandra),
(binder) -> binder.bind(DNSService.class).toInstance(inMemoryDNSService));
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ddda1d72/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
index 431ea6b..24705a7 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
@@ -27,17 +27,33 @@ import org.apache.james.modules.data.CassandraUsersRepositoryModule;
import org.apache.james.modules.mailbox.CassandraMailboxModule;
import org.apache.james.modules.mailbox.CassandraSessionModule;
import org.apache.james.modules.mailbox.ElasticSearchMailboxModule;
+import org.apache.james.modules.protocols.IMAPServerModule;
import org.apache.james.modules.protocols.JMAPServerModule;
+import org.apache.james.modules.protocols.LMTPServerModule;
+import org.apache.james.modules.protocols.ManageSieveServerModule;
+import org.apache.james.modules.protocols.POP3ServerModule;
+import org.apache.james.modules.protocols.ProtocolHandlerModule;
+import org.apache.james.modules.protocols.SMTPServerModule;
import org.apache.james.modules.server.ActiveMQQueueModule;
import org.apache.james.modules.server.ESMetricReporterModule;
import org.apache.james.modules.server.JMXServerModule;
import org.apache.james.modules.server.QuotaModule;
+import org.apache.james.modules.server.WebAdminServerModule;
import com.google.inject.Module;
import com.google.inject.util.Modules;
public class CassandraJamesServerMain {
+ public static final Module protocols = Modules.combine(
+ new IMAPServerModule(),
+ new ProtocolHandlerModule(),
+ new POP3ServerModule(),
+ new SMTPServerModule(),
+ new LMTPServerModule(),
+ new ManageSieveServerModule(),
+ new WebAdminServerModule());
+
public static final Module cassandraServerModule = Modules.combine(
new JMAPServerModule(),
new CassandraUsersRepositoryModule(),
@@ -55,7 +71,7 @@ public class CassandraJamesServerMain {
public static void main(String[] args) throws Exception {
GuiceJamesServerImpl server = new GuiceJamesServerImpl()
- .combineWith(cassandraServerModule, new JMXServerModule());
+ .combineWith(cassandraServerModule, protocols, new JMXServerModule());
server.start();
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ddda1d72/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java
index 68d3371..d3588eb 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapTestRule.java
@@ -47,7 +47,7 @@ public class CassandraJmapTestRule implements TestRule {
public JmapJamesServer jmapServer(Module... additionals) {
return new JmapJamesServer()
- .combineWith(CassandraJamesServerMain.cassandraServerModule)
+ .combineWith(CassandraJamesServerMain.cassandraServerModule, CassandraJamesServerMain.protocols)
.overrideWith(new TestJMAPServerModule(LIMIT_TO_3_MESSAGES))
.overrideWith(new TestESMetricReporterModule())
.overrideWith(guiceModuleTestRule.getModule())
http://git-wip-us.apache.org/repos/asf/james-project/blob/ddda1d72/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
index 4fc103f..69c20f3 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/JamesCapabilitiesServerTest.java
@@ -65,7 +65,7 @@ public class JamesCapabilitiesServerTest {
Module mockMailboxManager = (binder) -> binder.bind(MailboxManager.class).toInstance(mailboxManager);
return new GuiceJamesServerImpl()
- .combineWith(CassandraJamesServerMain.cassandraServerModule)
+ .combineWith(CassandraJamesServerMain.cassandraServerModule, CassandraJamesServerMain.protocols)
.overrideWith((binder) -> binder.bind(PersistenceAdapter.class).to(MemoryPersistenceAdapter.class))
.overrideWith(new TestElasticSearchModule(embeddedElasticSearch),
new TestFilesystemModule(temporaryFolder),
http://git-wip-us.apache.org/repos/asf/james-project/blob/ddda1d72/server/container/guice/cassandra-ldap-guice/src/main/java/org/apache/james/CassandraLdapJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-ldap-guice/src/main/java/org/apache/james/CassandraLdapJamesServerMain.java b/server/container/guice/cassandra-ldap-guice/src/main/java/org/apache/james/CassandraLdapJamesServerMain.java
index 90e2c0d..f2fe651 100644
--- a/server/container/guice/cassandra-ldap-guice/src/main/java/org/apache/james/CassandraLdapJamesServerMain.java
+++ b/server/container/guice/cassandra-ldap-guice/src/main/java/org/apache/james/CassandraLdapJamesServerMain.java
@@ -27,7 +27,7 @@ import com.google.inject.util.Modules;
public class CassandraLdapJamesServerMain {
- public static final Module cassandraLdapServerModule = Modules.override(CassandraJamesServerMain.cassandraServerModule)
+ public static final Module cassandraLdapServerModule = Modules.override(CassandraJamesServerMain.cassandraServerModule, CassandraJamesServerMain.protocols)
.with(new LdapUsersRepositoryModule());
public static void main(String[] args) throws Exception {
http://git-wip-us.apache.org/repos/asf/james-project/blob/ddda1d72/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServerImpl.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServerImpl.java b/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServerImpl.java
index e33c72c..63d184d 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServerImpl.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServerImpl.java
@@ -24,7 +24,6 @@ import javax.annotation.PreDestroy;
import org.apache.james.modules.CommonServicesModule;
import org.apache.james.modules.MailetProcessingModule;
-import org.apache.james.modules.ProtocolsModule;
import org.apache.james.onami.lifecycle.Stager;
import org.apache.james.utils.ConfigurationsPerformer;
import org.apache.james.utils.GuiceProbeProvider;
@@ -46,7 +45,6 @@ public class GuiceJamesServerImpl implements GuiceJamesServer {
public GuiceJamesServerImpl() {
this(Modules.combine(
new CommonServicesModule(),
- new ProtocolsModule(),
new MailetProcessingModule()));
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ddda1d72/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.java
deleted file mode 100644
index 2600d44..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.modules;
-
-import org.apache.james.modules.protocols.IMAPServerModule;
-import org.apache.james.modules.protocols.JSPFModule;
-import org.apache.james.modules.protocols.LMTPServerModule;
-import org.apache.james.modules.protocols.ManageSieveServerModule;
-import org.apache.james.modules.protocols.POP3ServerModule;
-import org.apache.james.modules.protocols.ProtocolHandlerModule;
-import org.apache.james.modules.protocols.SMTPServerModule;
-import org.apache.james.modules.server.WebAdminServerModule;
-
-import com.google.inject.AbstractModule;
-
-public class ProtocolsModule extends AbstractModule {
-
- @Override
- protected void configure() {
- install(new JSPFModule());
- install(new IMAPServerModule());
- install(new ProtocolHandlerModule());
- install(new POP3ServerModule());
- install(new SMTPServerModule());
- install(new LMTPServerModule());
- install(new ManageSieveServerModule());
- install(new WebAdminServerModule());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/ddda1d72/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
index 19968a4..ac99765 100644
--- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
+++ b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
@@ -23,16 +23,32 @@ import org.apache.james.modules.data.JPADataModule;
import org.apache.james.modules.data.SieveFileRepositoryModule;
import org.apache.james.modules.mailbox.JPAMailboxModule;
import org.apache.james.modules.mailbox.LuceneSearchMailboxModule;
+import org.apache.james.modules.protocols.IMAPServerModule;
+import org.apache.james.modules.protocols.LMTPServerModule;
+import org.apache.james.modules.protocols.ManageSieveServerModule;
+import org.apache.james.modules.protocols.POP3ServerModule;
+import org.apache.james.modules.protocols.ProtocolHandlerModule;
+import org.apache.james.modules.protocols.SMTPServerModule;
import org.apache.james.modules.server.ActiveMQQueueModule;
import org.apache.james.modules.server.JMXServerModule;
import org.apache.james.modules.server.QuotaModule;
import org.apache.james.modules.server.RawPostDequeueDecoratorModule;
+import org.apache.james.modules.server.WebAdminServerModule;
import com.google.inject.Module;
import com.google.inject.util.Modules;
public class JPAJamesServerMain {
+ private static final Module protocols = Modules.combine(
+ new IMAPServerModule(),
+ new ProtocolHandlerModule(),
+ new POP3ServerModule(),
+ new SMTPServerModule(),
+ new LMTPServerModule(),
+ new ManageSieveServerModule(),
+ new WebAdminServerModule());
+
public static final Module jpaServerModule = Modules.combine(
new JPAMailboxModule(),
new JPADataModule(),
@@ -43,7 +59,7 @@ public class JPAJamesServerMain {
public static void main(String[] args) throws Exception {
GuiceJamesServerImpl server = new GuiceJamesServerImpl()
- .combineWith(jpaServerModule,
+ .combineWith(jpaServerModule, protocols,
new JMXServerModule(),
new LuceneSearchMailboxModule());
server.start();
http://git-wip-us.apache.org/repos/asf/james-project/blob/ddda1d72/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
index 915f40c..abae9bd 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
@@ -60,7 +60,7 @@ public class CassandraStepdefs {
embeddedElasticSearch.before();
mainStepdefs.messageIdFactory = new CassandraMessageId.Factory();
mainStepdefs.jmapServer = new JmapJamesServer()
- .combineWith(CassandraJamesServerMain.cassandraServerModule)
+ .combineWith(CassandraJamesServerMain.cassandraServerModule, CassandraJamesServerMain.protocols)
.overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch, cassandra))
.overrideWith((binder) -> binder.bind(PersistenceAdapter.class).to(MemoryPersistenceAdapter.class));
mainStepdefs.awaitMethod = () -> embeddedElasticSearch.awaitForElasticSearch();
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[10/21] james-project git commit: JAMES-1902 create imap module and
dependencies (mailbox and configuration)
Posted by bt...@apache.org.
JAMES-1902 create imap module and dependencies (mailbox and configuration)
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/cbeef69a
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/cbeef69a
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/cbeef69a
Branch: refs/heads/master
Commit: cbeef69a973837b5e13afb0b8426dbaac1079fba
Parents: be7d02c
Author: Matthieu Baechler <ma...@gmail.com>
Authored: Mon Dec 26 19:00:27 2016 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
server/container/guice/configuration/pom.xml | 172 +++++++++++++++++
.../james/utils/ConfigurationPerformer.java | 32 ++++
.../james/utils/ConfigurationProvider.java | 30 +++
server/container/guice/guice-common/pom.xml | 12 ++
.../java/org/apache/james/modules/Names.java | 24 ---
.../modules/protocols/IMAPServerModule.java | 120 ------------
.../james/utils/ConfigurationPerformer.java | 32 ----
.../james/utils/ConfigurationProvider.java | 30 ---
server/container/guice/mailbox/pom.xml | 169 +++++++++++++++++
.../java/org/apache/james/modules/Names.java | 24 +++
server/container/guice/pom.xml | 23 +++
server/container/guice/protocols/imap/pom.xml | 188 +++++++++++++++++++
.../modules/protocols/IMAPServerModule.java | 120 ++++++++++++
13 files changed, 770 insertions(+), 206 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/configuration/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/configuration/pom.xml b/server/container/guice/configuration/pom.xml
new file mode 100644
index 0000000..f535d43
--- /dev/null
+++ b/server/container/guice/configuration/pom.xml
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>james-server-guice</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>james-server-guice-configuration</artifactId>
+
+ <name>Apache James :: Server :: Guice :: Configuration</name>
+ <description>Configuration modules for Guice implementation of James server</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-lifecycle-api</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>animal-sniffer-java-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java18</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check_java_8</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/configuration/src/main/java/org/apache/james/utils/ConfigurationPerformer.java
----------------------------------------------------------------------
diff --git a/server/container/guice/configuration/src/main/java/org/apache/james/utils/ConfigurationPerformer.java b/server/container/guice/configuration/src/main/java/org/apache/james/utils/ConfigurationPerformer.java
new file mode 100644
index 0000000..449ec3c
--- /dev/null
+++ b/server/container/guice/configuration/src/main/java/org/apache/james/utils/ConfigurationPerformer.java
@@ -0,0 +1,32 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.utils;
+
+import java.util.List;
+
+import org.apache.james.lifecycle.api.Configurable;
+
+public interface ConfigurationPerformer {
+
+ void initModule();
+
+ List<Class<? extends Configurable>> forClasses();
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/configuration/src/main/java/org/apache/james/utils/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/server/container/guice/configuration/src/main/java/org/apache/james/utils/ConfigurationProvider.java b/server/container/guice/configuration/src/main/java/org/apache/james/utils/ConfigurationProvider.java
new file mode 100644
index 0000000..cf3126e
--- /dev/null
+++ b/server/container/guice/configuration/src/main/java/org/apache/james/utils/ConfigurationProvider.java
@@ -0,0 +1,30 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.utils;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalConfiguration;
+
+public interface ConfigurationProvider {
+
+ HierarchicalConfiguration getConfiguration(String component)
+ throws ConfigurationException;
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/guice-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/pom.xml b/server/container/guice/guice-common/pom.xml
index 72c2333..39035c4 100644
--- a/server/container/guice/guice-common/pom.xml
+++ b/server/container/guice/guice-common/pom.xml
@@ -177,6 +177,18 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-imap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-mailbox</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-jmap</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/Names.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/Names.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/Names.java
deleted file mode 100644
index b37ed14..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/Names.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.modules;
-
-public class Names {
- public static final String MAILBOXMANAGER_NAME = "mailboxmanager";
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
deleted file mode 100644
index 936bcfa..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.modules.protocols;
-
-import java.util.List;
-
-import org.apache.james.imap.api.process.ImapProcessor;
-import org.apache.james.imap.decode.ImapDecoder;
-import org.apache.james.imap.encode.ImapEncoder;
-import org.apache.james.imap.encode.main.DefaultImapEncoderFactory;
-import org.apache.james.imap.main.DefaultImapDecoderFactory;
-import org.apache.james.imap.processor.main.DefaultImapProcessorFactory;
-import org.apache.james.imapserver.netty.IMAPServerFactory;
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.mailbox.MailboxManager;
-import org.apache.james.mailbox.SubscriptionManager;
-import org.apache.james.mailbox.quota.QuotaManager;
-import org.apache.james.mailbox.quota.QuotaRootResolver;
-import org.apache.james.metrics.api.MetricFactory;
-import org.apache.james.modules.Names;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.ConfigurationProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Provides;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-import com.google.inject.name.Named;
-
-public class IMAPServerModule extends AbstractModule {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(IMAPServerModule.class);
-
- @Override
- protected void configure() {
- Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(IMAPModuleConfigurationPerformer.class);
- }
-
- @Provides
- @Singleton
- ImapProcessor provideImapProcessor(
- @Named(Names.MAILBOXMANAGER_NAME)MailboxManager mailboxManager,
- SubscriptionManager subscriptionManager,
- QuotaManager quotaManager,
- QuotaRootResolver quotaRootResolver,
- MetricFactory metricFactory) {
- return DefaultImapProcessorFactory.createXListSupportingProcessor(
- mailboxManager,
- subscriptionManager,
- null,
- quotaManager,
- quotaRootResolver,
- 120,
- ImmutableSet.of("ACL", "MOVE"),
- metricFactory);
- }
-
- @Provides
- @Singleton
- ImapDecoder provideImapDecoder() {
- return DefaultImapDecoderFactory.createDecoder();
- }
-
- @Provides
- @Singleton
- ImapEncoder provideImapEncoder() {
- return new DefaultImapEncoderFactory().buildImapEncoder();
- }
-
- @Singleton
- public static class IMAPModuleConfigurationPerformer implements ConfigurationPerformer {
-
- private final ConfigurationProvider configurationProvider;
- private final IMAPServerFactory imapServerFactory;
-
- @Inject
- public IMAPModuleConfigurationPerformer(ConfigurationProvider configurationProvider, IMAPServerFactory imapServerFactory) {
- this.configurationProvider = configurationProvider;
- this.imapServerFactory = imapServerFactory;
- }
-
- @Override
- public void initModule() {
- try {
- imapServerFactory.setLog(LOGGER);
- imapServerFactory.configure(configurationProvider.getConfiguration("imapserver"));
- imapServerFactory.init();
- } catch (Exception e) {
- Throwables.propagate(e);
- }
- }
-
- @Override
- public List<Class<? extends Configurable>> forClasses() {
- return ImmutableList.of(IMAPServerFactory.class);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ConfigurationPerformer.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ConfigurationPerformer.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ConfigurationPerformer.java
deleted file mode 100644
index 449ec3c..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ConfigurationPerformer.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.utils;
-
-import java.util.List;
-
-import org.apache.james.lifecycle.api.Configurable;
-
-public interface ConfigurationPerformer {
-
- void initModule();
-
- List<Class<? extends Configurable>> forClasses();
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ConfigurationProvider.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ConfigurationProvider.java
deleted file mode 100644
index cf3126e..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/ConfigurationProvider.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.utils;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.HierarchicalConfiguration;
-
-public interface ConfigurationProvider {
-
- HierarchicalConfiguration getConfiguration(String component)
- throws ConfigurationException;
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/mailbox/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/mailbox/pom.xml b/server/container/guice/mailbox/pom.xml
new file mode 100644
index 0000000..6b88022
--- /dev/null
+++ b/server/container/guice/mailbox/pom.xml
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>james-server-guice</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>james-server-guice-mailbox</artifactId>
+
+ <name>Apache James :: Server :: Guice :: Mailbox</name>
+ <description>Mailbox modules for Guice implementation of James server</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+
+ </dependencies>
+ </profile>
+ <profile>
+ <id>animal-sniffer-java-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java18</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check_java_8</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/Names.java
----------------------------------------------------------------------
diff --git a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/Names.java b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/Names.java
new file mode 100644
index 0000000..b37ed14
--- /dev/null
+++ b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/Names.java
@@ -0,0 +1,24 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.modules;
+
+public class Names {
+ public static final String MAILBOXMANAGER_NAME = "mailboxmanager";
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 81d603a..fe13431 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -32,13 +32,36 @@
<name>Apache James :: Server :: Guice</name>
<packaging>pom</packaging>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-configuration</artifactId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-imap</artifactId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-mailbox</artifactId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<modules>
+ <module>configuration</module>
<module>guice-common</module>
<module>cassandra-guice</module>
<module>cassandra-ldap-guice</module>
+ <module>mailbox</module>
<module>memory-guice</module>
<module>jpa-guice</module>
<module>onami</module>
+ <module>protocols/imap</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/protocols/imap/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/imap/pom.xml b/server/container/guice/protocols/imap/pom.xml
new file mode 100644
index 0000000..e8d84c6
--- /dev/null
+++ b/server/container/guice/protocols/imap/pom.xml
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>james-server-guice</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>james-server-guice-imap</artifactId>
+
+ <name>Apache James :: Server :: Guice :: Imap</name>
+ <description>Imap modules for Guice implementation of James server</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-mailbox</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-protocols-imap4</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>animal-sniffer-java-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java18</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check_java_8</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/cbeef69a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
new file mode 100644
index 0000000..936bcfa
--- /dev/null
+++ b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
@@ -0,0 +1,120 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.modules.protocols;
+
+import java.util.List;
+
+import org.apache.james.imap.api.process.ImapProcessor;
+import org.apache.james.imap.decode.ImapDecoder;
+import org.apache.james.imap.encode.ImapEncoder;
+import org.apache.james.imap.encode.main.DefaultImapEncoderFactory;
+import org.apache.james.imap.main.DefaultImapDecoderFactory;
+import org.apache.james.imap.processor.main.DefaultImapProcessorFactory;
+import org.apache.james.imapserver.netty.IMAPServerFactory;
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.SubscriptionManager;
+import org.apache.james.mailbox.quota.QuotaManager;
+import org.apache.james.mailbox.quota.QuotaRootResolver;
+import org.apache.james.metrics.api.MetricFactory;
+import org.apache.james.modules.Names;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Provides;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+import com.google.inject.name.Named;
+
+public class IMAPServerModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(IMAPServerModule.class);
+
+ @Override
+ protected void configure() {
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(IMAPModuleConfigurationPerformer.class);
+ }
+
+ @Provides
+ @Singleton
+ ImapProcessor provideImapProcessor(
+ @Named(Names.MAILBOXMANAGER_NAME)MailboxManager mailboxManager,
+ SubscriptionManager subscriptionManager,
+ QuotaManager quotaManager,
+ QuotaRootResolver quotaRootResolver,
+ MetricFactory metricFactory) {
+ return DefaultImapProcessorFactory.createXListSupportingProcessor(
+ mailboxManager,
+ subscriptionManager,
+ null,
+ quotaManager,
+ quotaRootResolver,
+ 120,
+ ImmutableSet.of("ACL", "MOVE"),
+ metricFactory);
+ }
+
+ @Provides
+ @Singleton
+ ImapDecoder provideImapDecoder() {
+ return DefaultImapDecoderFactory.createDecoder();
+ }
+
+ @Provides
+ @Singleton
+ ImapEncoder provideImapEncoder() {
+ return new DefaultImapEncoderFactory().buildImapEncoder();
+ }
+
+ @Singleton
+ public static class IMAPModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final IMAPServerFactory imapServerFactory;
+
+ @Inject
+ public IMAPModuleConfigurationPerformer(ConfigurationProvider configurationProvider, IMAPServerFactory imapServerFactory) {
+ this.configurationProvider = configurationProvider;
+ this.imapServerFactory = imapServerFactory;
+ }
+
+ @Override
+ public void initModule() {
+ try {
+ imapServerFactory.setLog(LOGGER);
+ imapServerFactory.configure(configurationProvider.getConfiguration("imapserver"));
+ imapServerFactory.init();
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ }
+
+ @Override
+ public List<Class<? extends Configurable>> forClasses() {
+ return ImmutableList.of(IMAPServerFactory.class);
+ }
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[07/21] james-project git commit: JAMES-1902 split probes to prevent
them to pull unwanted dependencies
Posted by bt...@apache.org.
JAMES-1902 split probes to prevent them to pull unwanted dependencies
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/793dae76
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/793dae76
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/793dae76
Branch: refs/heads/master
Commit: 793dae76f8025f9f305e777bb06280944433d9ac
Parents: ac56c42
Author: Matthieu Baechler <ma...@gmail.com>
Authored: Mon Jan 30 10:43:12 2017 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
.../store/mail/model/SerializableQuota.java | 49 +++
.../james/mailbox/store/probe/MailboxProbe.java | 55 +++
.../james/mailbox/store/probe/QuotaProbe.java | 49 +++
.../james/mailbox/store/probe/SieveProbe.java | 38 ++
.../smtp/host/CassandraJamesSmtpHostSystem.java | 9 +-
.../java/org/apache/james/cli/ServerCmd.java | 89 +++--
.../org/apache/james/cli/probe/ServerProbe.java | 265 -------------
.../james/cli/probe/impl/JmxConnection.java | 62 ++++
.../james/cli/probe/impl/JmxDataProbe.java | 130 +++++++
.../james/cli/probe/impl/JmxMailboxProbe.java | 118 ++++++
.../apache/james/cli/probe/impl/JmxProbe.java | 28 ++
.../james/cli/probe/impl/JmxQuotaProbe.java | 100 +++++
.../james/cli/probe/impl/JmxServerProbe.java | 339 -----------------
.../james/cli/probe/impl/JmxSieveProbe.java | 78 ++++
.../org/apache/james/cli/ServerCmdTest.java | 96 ++---
.../apache/james/CassandraJamesServerMain.java | 4 +-
.../java/org/apache/james/ESReporterTest.java | 4 +-
.../java/org/apache/james/GuiceJamesServer.java | 5 -
.../james/modules/CommonServicesModule.java | 4 +-
.../org/apache/james/utils/DataProbeImpl.java | 130 +++++++
.../apache/james/utils/ExtendedServerProbe.java | 46 ---
.../apache/james/utils/GuiceServerProbe.java | 367 -------------------
.../apache/james/AbstractJamesServerTest.java | 5 +-
.../james/AbstractJmapJamesServerTest.java | 5 +-
.../org/apache/james/JPAJamesServerMain.java | 6 +-
.../org/apache/james/JPAJamesServerTest.java | 2 +-
server/container/guice/mailbox/pom.xml | 21 +-
.../org/apache/james/modules/MailboxModule.java | 33 ++
.../apache/james/modules/MailboxProbeImpl.java | 181 +++++++++
.../org/apache/james/MemoryJamesServerMain.java | 28 +-
.../guice/protocols/managedsieve/pom.xml | 4 +
.../protocols/ManageSieveServerModule.java | 2 +
.../james/modules/protocols/SieveProbeImpl.java | 71 ++++
.../james/adapter/mailbox/QuotaManagement.java | 1 +
.../adapter/mailbox/QuotaManagementMBean.java | 1 +
.../adapter/mailbox/SerializableQuota.java | 49 ---
.../java/org/apache/james/probe/DataProbe.java | 59 +++
.../mailets/CommonMailetConfigurationTest.java | 12 +-
.../RecipientRewriteTableIntegrationTest.java | 34 +-
.../org/apache/james/mailets/SieveDelivery.java | 19 +-
.../james/mailets/TemporaryJamesServer.java | 9 +-
.../crypto/SMIMEDecryptIntegrationTest.java | 10 +-
.../crypto/SMIMESignIntegrationTest.java | 12 +-
.../mailets/AmqpForwardAttachmentTest.java | 12 +-
.../mailets/ICSAttachmentWorkflowTest.java | 12 +-
.../transport/mailets/StripAttachmentTest.java | 12 +-
.../james/jmap/JMAPAuthenticationTest.java | 5 +-
.../jmap/UserProvisionningConcurrencyTest.java | 6 +-
.../james/jmap/VacationIntegrationTest.java | 22 +-
.../integration/GetMailboxesMethodTest.java | 72 ++--
.../integration/GetMessageListMethodTest.java | 291 ++++++++-------
.../integration/GetVacationResponseTest.java | 8 +-
.../integration/SetMailboxesMethodTest.java | 234 ++++++------
.../integration/SetMessagesMethodTest.java | 208 ++++++-----
.../integration/SetVacationResponseTest.java | 5 +-
.../integration/cucumber/DownloadStepdefs.java | 5 +-
.../cucumber/GetMessagesMethodStepdefs.java | 13 +-
.../cucumber/SetMailboxesMethodStepdefs.java | 13 +-
.../cucumber/SetMessagesMethodStepdefs.java | 7 +-
.../integration/cucumber/UserStepdefs.java | 8 +-
.../WebAdminServerIntegrationTest.java | 39 +-
61 files changed, 1943 insertions(+), 1658 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/SerializableQuota.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/SerializableQuota.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/SerializableQuota.java
new file mode 100644
index 0000000..100b609
--- /dev/null
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/SerializableQuota.java
@@ -0,0 +1,49 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.store.mail.model;
+
+import org.apache.james.mailbox.model.Quota;
+
+import java.io.Serializable;
+
+public class SerializableQuota implements Serializable {
+
+ private final long max;
+ private final long used;
+
+ public SerializableQuota(long max, long used) {
+ this.max = max;
+ this.used = used;
+ }
+
+ public SerializableQuota(Quota quota) {
+ this.max = quota.getMax();
+ this.used = quota.getUsed();
+ }
+
+ public long getMax() {
+ return max;
+ }
+
+ public long getUsed() {
+ return used;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/MailboxProbe.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/MailboxProbe.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/MailboxProbe.java
new file mode 100644
index 0000000..2a64365
--- /dev/null
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/MailboxProbe.java
@@ -0,0 +1,55 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.store.probe;
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Date;
+
+import javax.mail.Flags;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.ComposedMessageId;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.store.mail.model.Mailbox;
+
+public interface MailboxProbe {
+
+ void createMailbox(String namespace, String user, String name);
+
+ Mailbox getMailbox(String namespace, String user, String name);
+
+ Collection<String> listUserMailboxes(String user);
+
+ void deleteMailbox(String namespace, String user, String name);
+
+ ComposedMessageId appendMessage(String username, MailboxPath mailboxPath, InputStream message, Date internalDate,
+ boolean isRecent, Flags flags) throws MailboxException;
+
+ void copyMailbox(String srcBean, String dstBean) throws Exception;
+
+ void deleteUserMailboxesNames(String user) throws Exception;
+
+ void reIndexMailbox(String namespace, String user, String name) throws Exception;
+
+ void reIndexAll() throws Exception;
+
+ Collection<String> listSubscriptions(String user) throws Exception;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/QuotaProbe.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/QuotaProbe.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/QuotaProbe.java
new file mode 100644
index 0000000..e5eec3f
--- /dev/null
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/QuotaProbe.java
@@ -0,0 +1,49 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.store.probe;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.store.mail.model.SerializableQuota;
+
+public interface QuotaProbe {
+
+ String getQuotaRoot(String namespace, String user, String name) throws MailboxException;
+
+ SerializableQuota getMessageCountQuota(String quotaRoot) throws MailboxException;
+
+ SerializableQuota getStorageQuota(String quotaRoot) throws MailboxException;
+
+ long getMaxMessageCount(String quotaRoot) throws MailboxException;
+
+ long getMaxStorage(String quotaRoot) throws MailboxException;
+
+ long getDefaultMaxMessageCount() throws MailboxException;
+
+ long getDefaultMaxStorage() throws MailboxException;
+
+ void setMaxMessageCount(String quotaRoot, long maxMessageCount) throws MailboxException;
+
+ void setMaxStorage(String quotaRoot, long maxSize) throws MailboxException;
+
+ void setDefaultMaxMessageCount(long maxDefaultMessageCount) throws MailboxException;
+
+ void setDefaultMaxStorage(long maxDefaultSize) throws MailboxException;
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/SieveProbe.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/SieveProbe.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/SieveProbe.java
new file mode 100644
index 0000000..9f3e18e
--- /dev/null
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/SieveProbe.java
@@ -0,0 +1,38 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mailbox.store.probe;
+
+public interface SieveProbe {
+
+ long getSieveQuota() throws Exception;
+
+ void setSieveQuota(long quota) throws Exception;
+
+ void removeSieveQuota() throws Exception;
+
+ long getSieveQuota(String user) throws Exception;
+
+ void setSieveQuota(String user, long quota) throws Exception;
+
+ void removeSieveQuota(String user) throws Exception;
+
+ void addActiveSieveScript(String user, String name, String script) throws Exception;
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
index 65311c3..d0cad96 100644
--- a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
+++ b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/host/CassandraJamesSmtpHostSystem.java
@@ -34,6 +34,7 @@ import org.apache.james.mpt.monitor.SystemLoggingMonitor;
import org.apache.james.mpt.session.ExternalSessionFactory;
import org.apache.james.mpt.smtp.SmtpHostSystem;
import org.apache.james.mpt.smtp.dns.InMemoryDNSService;
+import org.apache.james.utils.DataProbeImpl;
import org.junit.rules.TemporaryFolder;
import com.google.common.base.Preconditions;
@@ -61,19 +62,19 @@ public class CassandraJamesSmtpHostSystem extends ExternalSessionFactory impleme
String domain = split.next();
createDomainIfNeeded(domain);
- jamesServer.serverProbe().addUser(userAtDomain, password);
+ jamesServer.getProbe(DataProbeImpl.class).addUser(userAtDomain, password);
return true;
}
private void createDomainIfNeeded(String domain) throws Exception {
- if (!jamesServer.serverProbe().containsDomain(domain)) {
- jamesServer.serverProbe().addDomain(domain);
+ if (!jamesServer.getProbe(DataProbeImpl.class).containsDomain(domain)) {
+ jamesServer.getProbe(DataProbeImpl.class).addDomain(domain);
}
}
@Override
public void addAddressMapping(String user, String domain, String address) throws Exception {
- jamesServer.serverProbe().addAddressMapping(user, domain, address);
+ jamesServer.getProbe(DataProbeImpl.class).addAddressMapping(user, domain, address);
}
@Override
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java
----------------------------------------------------------------------
diff --git a/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java b/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java
index 539f2be..402b0d2 100644
--- a/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java
+++ b/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java
@@ -34,17 +34,24 @@ import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.time.StopWatch;
-import org.apache.james.adapter.mailbox.SerializableQuota;
import org.apache.james.cli.exceptions.InvalidArgumentNumberException;
import org.apache.james.cli.exceptions.InvalidPortException;
import org.apache.james.cli.exceptions.JamesCliException;
import org.apache.james.cli.exceptions.MissingCommandException;
import org.apache.james.cli.exceptions.UnrecognizedCommandException;
-import org.apache.james.cli.probe.ServerProbe;
-import org.apache.james.cli.probe.impl.JmxServerProbe;
+import org.apache.james.cli.probe.impl.JmxConnection;
+import org.apache.james.cli.probe.impl.JmxDataProbe;
+import org.apache.james.cli.probe.impl.JmxMailboxProbe;
+import org.apache.james.cli.probe.impl.JmxQuotaProbe;
+import org.apache.james.cli.probe.impl.JmxSieveProbe;
import org.apache.james.cli.type.CmdType;
import org.apache.james.cli.utils.ValueWithUnit;
import org.apache.james.mailbox.model.Quota;
+import org.apache.james.mailbox.store.mail.model.SerializableQuota;
+import org.apache.james.mailbox.store.probe.MailboxProbe;
+import org.apache.james.mailbox.store.probe.QuotaProbe;
+import org.apache.james.mailbox.store.probe.SieveProbe;
+import org.apache.james.probe.DataProbe;
import org.apache.james.rrt.lib.Mappings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,7 +70,7 @@ public class ServerCmd {
private static final int DEFAULT_PORT = 9999;
private static final Logger LOG = LoggerFactory.getLogger(ServerCmd.class);
-
+
private static Options createOptions() {
Options options = new Options();
Option optHost = new Option(HOST_OPT_SHORT, HOST_OPT_LONG, true, "node hostname or ip address");
@@ -73,12 +80,6 @@ public class ServerCmd {
return options;
}
- private final ServerProbe probe;
-
- public ServerCmd(ServerProbe probe) {
- this.probe = probe;
- }
-
/**
* Main method to initialize the class.
*
@@ -90,7 +91,13 @@ public class ServerCmd {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
CommandLine cmd = parseCommandLine(args);
- CmdType cmdType =new ServerCmd(new JmxServerProbe(cmd.getOptionValue(HOST_OPT_LONG), getPort(cmd)))
+ JmxConnection jmxConnection = new JmxConnection(cmd.getOptionValue(HOST_OPT_LONG), getPort(cmd));
+ CmdType cmdType = new ServerCmd(
+ new JmxDataProbe().connect(jmxConnection),
+ new JmxMailboxProbe().connect(jmxConnection),
+ new JmxQuotaProbe().connect(jmxConnection),
+ new JmxSieveProbe().connect(jmxConnection)
+ )
.executeCommandLine(cmd);
stopWatch.split();
print(new String[] { Joiner.on(' ')
@@ -111,6 +118,18 @@ public class ServerCmd {
}
+ private final DataProbe probe;
+ private final MailboxProbe mailboxProbe;
+ private final QuotaProbe quotaProbe;
+ private final SieveProbe sieveProbe;
+
+ public ServerCmd(DataProbe probe, MailboxProbe mailboxProbe, QuotaProbe quotaProbe, SieveProbe sieveProbe) {
+ this.probe = probe;
+ this.mailboxProbe = mailboxProbe;
+ this.quotaProbe = quotaProbe;
+ this.sieveProbe = sieveProbe;
+ }
+
@VisibleForTesting
static CommandLine parseCommandLine(String[] args) throws ParseException {
CommandLineParser parser = new PosixParser();
@@ -212,84 +231,84 @@ public class ServerCmd {
probe.setPassword(arguments[1], arguments[2]);
break;
case COPYMAILBOX:
- probe.copyMailbox(arguments[1], arguments[2]);
+ mailboxProbe.copyMailbox(arguments[1], arguments[2]);
break;
case DELETEUSERMAILBOXES:
- probe.deleteUserMailboxesNames(arguments[1]);
+ mailboxProbe.deleteUserMailboxesNames(arguments[1]);
break;
case CREATEMAILBOX:
- probe.createMailbox(arguments[1], arguments[2], arguments[3]);
+ mailboxProbe.createMailbox(arguments[1], arguments[2], arguments[3]);
break;
case LISTUSERMAILBOXES:
- Collection<String> mailboxes = probe.listUserMailboxes(arguments[1]);
+ Collection<String> mailboxes = mailboxProbe.listUserMailboxes(arguments[1]);
print(mailboxes.toArray(new String[0]), System.out);
break;
case DELETEMAILBOX:
- probe.deleteMailbox(arguments[1], arguments[2], arguments[3]);
+ mailboxProbe.deleteMailbox(arguments[1], arguments[2], arguments[3]);
break;
case GETSTORAGEQUOTA:
- printStorageQuota(arguments[1], probe.getStorageQuota(arguments[1]));
+ printStorageQuota(arguments[1], quotaProbe.getStorageQuota(arguments[1]));
break;
case GETMESSAGECOUNTQUOTA:
- printMessageQuota(arguments[1], probe.getMessageCountQuota(arguments[1]));
+ printMessageQuota(arguments[1], quotaProbe.getMessageCountQuota(arguments[1]));
break;
case GETQUOTAROOT:
- System.out.println("Quota Root : " + probe.getQuotaRoot(arguments[1], arguments[2], arguments[3]));
+ System.out.println("Quota Root : " + quotaProbe.getQuotaRoot(arguments[1], arguments[2], arguments[3]));
break;
case GETMAXSTORAGEQUOTA:
System.out.println("Storage space allowed for Quota Root "
+ arguments[1]
+ " : "
- + formatStorageValue(probe.getMaxStorage(arguments[1])));
+ + formatStorageValue(quotaProbe.getMaxStorage(arguments[1])));
break;
case GETMAXMESSAGECOUNTQUOTA:
- System.out.println("MailboxMessage count allowed for Quota Root " + arguments[1] + " : " + formatMessageValue(probe.getMaxMessageCount(arguments[1])));
+ System.out.println("MailboxMessage count allowed for Quota Root " + arguments[1] + " : " + formatMessageValue(quotaProbe.getMaxMessageCount(arguments[1])));
break;
case SETMAXSTORAGEQUOTA:
- probe.setMaxStorage(arguments[1], ValueWithUnit.parse(arguments[2]).getConvertedValue());
+ quotaProbe.setMaxStorage(arguments[1], ValueWithUnit.parse(arguments[2]).getConvertedValue());
break;
case SETMAXMESSAGECOUNTQUOTA:
- probe.setMaxMessageCount(arguments[1], Long.parseLong(arguments[2]));
+ quotaProbe.setMaxMessageCount(arguments[1], Long.parseLong(arguments[2]));
break;
case SETDEFAULTMAXSTORAGEQUOTA:
- probe.setDefaultMaxStorage(ValueWithUnit.parse(arguments[1]).getConvertedValue());
+ quotaProbe.setDefaultMaxStorage(ValueWithUnit.parse(arguments[1]).getConvertedValue());
break;
case SETDEFAULTMAXMESSAGECOUNTQUOTA:
- probe.setDefaultMaxMessageCount(Long.parseLong(arguments[1]));
+ quotaProbe.setDefaultMaxMessageCount(Long.parseLong(arguments[1]));
break;
case GETDEFAULTMAXSTORAGEQUOTA:
- System.out.println("Default Maximum Storage Quota : " + formatStorageValue(probe.getDefaultMaxStorage()));
+ System.out.println("Default Maximum Storage Quota : " + formatStorageValue(quotaProbe.getDefaultMaxStorage()));
break;
case GETDEFAULTMAXMESSAGECOUNTQUOTA:
- System.out.println("Default Maximum message count Quota : " + formatMessageValue(probe.getDefaultMaxMessageCount()));
+ System.out.println("Default Maximum message count Quota : " + formatMessageValue(quotaProbe.getDefaultMaxMessageCount()));
break;
case REINDEXMAILBOX:
- probe.reIndexMailbox(arguments[1], arguments[2], arguments[3]);
+ mailboxProbe.reIndexMailbox(arguments[1], arguments[2], arguments[3]);
break;
case REINDEXALL:
- probe.reIndexAll();
+ mailboxProbe.reIndexAll();
break;
case SETSIEVEQUOTA:
- probe.setSieveQuota(ValueWithUnit.parse(arguments[1]).getConvertedValue());
+ sieveProbe.setSieveQuota(ValueWithUnit.parse(arguments[1]).getConvertedValue());
break;
case SETSIEVEUSERQUOTA:
- probe.setSieveQuota(arguments[1], ValueWithUnit.parse(arguments[2]).getConvertedValue());
+ sieveProbe.setSieveQuota(arguments[1], ValueWithUnit.parse(arguments[2]).getConvertedValue());
break;
case GETSIEVEQUOTA:
System.out.println("Storage space allowed for Sieve scripts by default : "
- + formatStorageValue(probe.getSieveQuota()));
+ + formatStorageValue(sieveProbe.getSieveQuota()));
break;
case GETSIEVEUSERQUOTA:
System.out.println("Storage space allowed for "
+ arguments[1]
+ " Sieve scripts : "
- + formatStorageValue(probe.getSieveQuota(arguments[1])));
+ + formatStorageValue(sieveProbe.getSieveQuota(arguments[1])));
break;
case REMOVESIEVEQUOTA:
- probe.removeSieveQuota();
+ sieveProbe.removeSieveQuota();
break;
case REMOVESIEVEUSERQUOTA:
- probe.removeSieveQuota(arguments[1]);
+ sieveProbe.removeSieveQuota(arguments[1]);
break;
default:
throw new UnrecognizedCommandException(cmdType.getCommand());
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/cli/src/main/java/org/apache/james/cli/probe/ServerProbe.java
----------------------------------------------------------------------
diff --git a/server/container/cli/src/main/java/org/apache/james/cli/probe/ServerProbe.java b/server/container/cli/src/main/java/org/apache/james/cli/probe/ServerProbe.java
deleted file mode 100644
index 8ca3b15..0000000
--- a/server/container/cli/src/main/java/org/apache/james/cli/probe/ServerProbe.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.cli.probe;
-
-import java.io.Closeable;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.james.adapter.mailbox.SerializableQuota;
-import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.rrt.lib.Mappings;
-
-public interface ServerProbe extends Closeable {
- /**
- * Add a user to this mail server.
- *
- * @param userName
- * The name of the user being added.
- * @param password
- * The password of the user being added.
- * @throws Exception
- */
- void addUser(String userName, String password) throws Exception;
-
- /**
- * Delete a user from this mail server.
- *
- * @param username
- * The name of the user being deleted.
- * @throws Exception
- */
- void removeUser(String username) throws Exception;
-
- /**
- * Get a List the names of all users.
- *
- * @return a List of all user names.
- * @throws Exception
- */
- String[] listUsers() throws Exception;
-
- /**
- * Set a user's password.
- *
- * @param userName
- * The name of the user whose password will be changed.
- * @param password
- * The new password.
- * @throws Exception
- */
- void setPassword(String userName, String password) throws Exception;
-
- /**
- * Add domain to the service.
- *
- * @param domain
- * The domain to add.
- * @throws Exception
- */
- void addDomain(String domain) throws Exception;
-
- /**
- * Return true if the domain exists in the service
- *
- * @param domain
- * The domain to remove.
- * @throws Exception
- */
- boolean containsDomain(String domain) throws Exception;
-
- String getDefaultDomain() throws Exception;
-
- /**
- * Remove domain from the service
- *
- * @param domain
- * The domain to remove.
- * @throws Exception
- */
- void removeDomain(String domain) throws Exception;
-
- /**
- * Get a list of domains for the service.
- *
- * @return domains an array of domains, or null if no domains exist.
- * @throws Exception
- */
- List<String> listDomains() throws Exception;
-
- /**
- * Get a Map which holds all mappings. The key is the user@domain and the
- * value is a Collection which holds all mappings.
- *
- * @return a Map which holds all mappings.
- * @throws Exception
- */
- Map<String, Mappings> listMappings() throws Exception;
-
- /**
- * Add address mapping.
- *
- * @param user
- * The username, or null if no username should be used.
- * @param domain
- * The domain, or null if no domain should be used.
- * @param toAddress
- * The address.
- * @throws Exception
- */
- void addAddressMapping(String user, String domain, String toAddress) throws Exception;
-
- /**
- * Remove address mapping.
- *
- * @param user
- * The username, or null if no username should be used.
- * @param domain
- * The domain, or null if no domain should be used
- * @param fromAddress
- * The address.
- * @throws Exception
- */
- void removeAddressMapping(String user, String domain, String fromAddress) throws Exception;
-
- /**
- * Return the explicit mapping stored for the given user and domain. Return
- * null if no mapping was found
- *
- * @param user
- * The username.
- * @param domain
- * The domain.
- * @return the collection which holds the mappings, or null if no mapping is
- * found.
- * @throws Exception
- */
- Mappings listUserDomainMappings(String user, String domain) throws Exception;
-
- /**
- * Remove regex mapping.
- *
- * @param user
- * The username, or null if no username should be used.
- * @param domain
- * The domain, or null if no domain should be used.
- * @param regex
- * The regex.
- * @throws Exception
- */
- void addRegexMapping(String user, String domain, String regex) throws Exception;
-
- /**
- * Remove regex mapping.
- *
- * @param user
- * The username, or null if no username should be used.
- * @param domain
- * The domain, or null if no domain should be used.
- * @param regex
- * The regex.
- * @throws Exception
- */
- void removeRegexMapping(String user, String domain, String regex) throws Exception;
-
- /**
- * Copy Mailbox.
- *
- * @param srcBean
- * The name of the bean that manages the source mailbox.
- * @param dstBean
- * The name of the bean that manages the destination mailbox.
- * @throws Exception
- */
- void copyMailbox(String srcBean, String dstBean) throws Exception;
-
- /**
- * Delete mailboxes Belonging to #private:${user}
- *
- * @param user Username of the user we want to list mailboxes on
- * @return Collection of the mailboxes names
- * @throws Exception
- */
- void deleteUserMailboxesNames(String user) throws Exception;
-
- /**
- * Create a mailbox
- *
- * @param namespace Namespace of the created mailbox
- * @param user User of the created mailbox
- * @param name Name of the created mailbox
- */
- void createMailbox(String namespace, String user, String name);
-
- /**
- * List mailboxes belonging to the private namespace of a user
- *
- * @param user The given user
- * @return List of mailboxes belonging to the private namespace of a user
- */
- Collection<String> listUserMailboxes(String user);
-
- /**
- * Delete the given mailbox
- *
- * @param namespace Namespace of the mailbox to delete
- * @param user User the mailbox to delete belongs to
- * @param name Name of the mailbox to delete
- */
- void deleteMailbox(String namespace, String user, String name);
-
- String getQuotaRoot(String namespace, String user, String name) throws MailboxException;
-
- SerializableQuota getMessageCountQuota(String quotaRoot) throws MailboxException;
-
- SerializableQuota getStorageQuota(String quotaRoot) throws MailboxException;
-
- long getMaxMessageCount(String quotaRoot) throws MailboxException;
-
- long getMaxStorage(String quotaRoot) throws MailboxException;
-
- long getDefaultMaxMessageCount() throws MailboxException;
-
- long getDefaultMaxStorage() throws MailboxException;
-
- void setMaxMessageCount(String quotaRoot, long maxMessageCount) throws MailboxException;
-
- void setMaxStorage(String quotaRoot, long maxSize) throws MailboxException;
-
- void setDefaultMaxMessageCount(long maxDefaultMessageCount) throws MailboxException;
-
- void setDefaultMaxStorage(long maxDefaultSize) throws MailboxException;
-
- void reIndexMailbox(String namespace, String user, String name) throws Exception;
-
- void reIndexAll() throws Exception;
-
- long getSieveQuota() throws Exception;
-
- void setSieveQuota(long quota) throws Exception;
-
- void removeSieveQuota() throws Exception;
-
- long getSieveQuota(String user) throws Exception;
-
- void setSieveQuota(String user, long quota) throws Exception;
-
- void removeSieveQuota(String user) throws Exception;
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxConnection.java
----------------------------------------------------------------------
diff --git a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxConnection.java b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxConnection.java
new file mode 100644
index 0000000..ed416f3
--- /dev/null
+++ b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxConnection.java
@@ -0,0 +1,62 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.cli.probe.impl;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+public class JmxConnection implements Closeable {
+
+ private static final String fmtUrl = "service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi";
+ private static final int defaultPort = 9999;
+
+ public static JmxConnection defaultJmxConnection(String host) throws IOException {
+ return new JmxConnection(host, defaultPort);
+ }
+
+ private final JMXConnector jmxConnector;
+
+ public JmxConnection(String host, int port) throws IOException {
+ JMXServiceURL jmxUrl = new JMXServiceURL(String.format(fmtUrl, host, port));
+ jmxConnector = JMXConnectorFactory.connect(jmxUrl, null);
+ }
+
+ @Override
+ public void close() throws IOException {
+ jmxConnector.close();
+ }
+
+ public <T> T retrieveBean(Class<T> mbeanType, String name) throws MalformedObjectNameException, IOException {
+ return MBeanServerInvocationHandler.newProxyInstance(getMBeanServerConnection(), new ObjectName(name), mbeanType, true);
+ }
+
+ private MBeanServerConnection getMBeanServerConnection() throws IOException {
+ return jmxConnector.getMBeanServerConnection();
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxDataProbe.java
----------------------------------------------------------------------
diff --git a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxDataProbe.java b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxDataProbe.java
new file mode 100644
index 0000000..1256f0c
--- /dev/null
+++ b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxDataProbe.java
@@ -0,0 +1,130 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.cli.probe.impl;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MalformedObjectNameException;
+
+import org.apache.james.domainlist.api.DomainListManagementMBean;
+import org.apache.james.probe.DataProbe;
+import org.apache.james.rrt.api.RecipientRewriteTableManagementMBean;
+import org.apache.james.rrt.lib.Mappings;
+import org.apache.james.user.api.UsersRepositoryManagementMBean;
+
+public class JmxDataProbe implements DataProbe, JmxProbe {
+
+ private final static String DOMAINLIST_OBJECT_NAME = "org.apache.james:type=component,name=domainlist";
+ private final static String VIRTUALUSERTABLE_OBJECT_NAME = "org.apache.james:type=component,name=recipientrewritetable";
+ private final static String USERSREPOSITORY_OBJECT_NAME = "org.apache.james:type=component,name=usersrepository";
+
+ private DomainListManagementMBean domainListProxy;
+ private RecipientRewriteTableManagementMBean virtualUserTableProxy;
+ private UsersRepositoryManagementMBean usersRepositoryProxy;
+
+ public JmxDataProbe connect(JmxConnection jmxc) throws IOException {
+ try {
+ domainListProxy = jmxc.retrieveBean(DomainListManagementMBean.class, DOMAINLIST_OBJECT_NAME);
+ virtualUserTableProxy = jmxc.retrieveBean(RecipientRewriteTableManagementMBean.class, VIRTUALUSERTABLE_OBJECT_NAME);
+ usersRepositoryProxy = jmxc.retrieveBean(UsersRepositoryManagementMBean.class, USERSREPOSITORY_OBJECT_NAME);
+ } catch (MalformedObjectNameException e) {
+ throw new RuntimeException("Invalid ObjectName? Please report this as a bug.", e);
+ }
+ return this;
+ }
+
+ @Override
+ public void addUser(String userName, String password) throws Exception {
+ usersRepositoryProxy.addUser(userName, password);
+ }
+
+ @Override
+ public void removeUser(String username) throws Exception {
+ usersRepositoryProxy.deleteUser(username);
+ }
+
+ @Override
+ public String[] listUsers() throws Exception {
+ return usersRepositoryProxy.listAllUsers();
+ }
+
+ @Override
+ public void setPassword(String userName, String password) throws Exception {
+ usersRepositoryProxy.setPassword(userName, password);
+ }
+
+ @Override
+ public boolean containsDomain(String domain) throws Exception {
+ return domainListProxy.containsDomain(domain);
+ }
+
+ @Override
+ public String getDefaultDomain() throws Exception {
+ return domainListProxy.getDefaultDomain();
+ }
+
+ @Override
+ public void addDomain(String domain) throws Exception {
+ domainListProxy.addDomain(domain);
+ }
+
+ @Override
+ public void removeDomain(String domain) throws Exception {
+ domainListProxy.removeDomain(domain);
+ }
+
+ @Override
+ public List<String> listDomains() throws Exception {
+ return domainListProxy.getDomains();
+ }
+
+ @Override
+ public Map<String, Mappings> listMappings() throws Exception {
+ return virtualUserTableProxy.getAllMappings();
+ }
+
+ @Override
+ public void addAddressMapping(String user, String domain, String toAddress) throws Exception {
+ virtualUserTableProxy.addAddressMapping(user, domain, toAddress);
+ }
+
+ @Override
+ public void removeAddressMapping(String user, String domain, String fromAddress) throws Exception {
+ virtualUserTableProxy.removeAddressMapping(user, domain, fromAddress);
+ }
+
+ @Override
+ public Mappings listUserDomainMappings(String user, String domain) throws Exception {
+ return virtualUserTableProxy.getUserDomainMappings(user, domain);
+ }
+
+ @Override
+ public void addRegexMapping(String user, String domain, String regex) throws Exception {
+ virtualUserTableProxy.addRegexMapping(user, domain, regex);
+ }
+
+ @Override
+ public void removeRegexMapping(String user, String domain, String regex) throws Exception {
+ virtualUserTableProxy.removeRegexMapping(user, domain, regex);
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxMailboxProbe.java
----------------------------------------------------------------------
diff --git a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxMailboxProbe.java b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxMailboxProbe.java
new file mode 100644
index 0000000..59ac40d
--- /dev/null
+++ b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxMailboxProbe.java
@@ -0,0 +1,118 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.cli.probe.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Date;
+
+import javax.mail.Flags;
+import javax.management.MalformedObjectNameException;
+
+import org.apache.james.adapter.mailbox.MailboxCopierManagementMBean;
+import org.apache.james.adapter.mailbox.MailboxManagerManagementMBean;
+import org.apache.james.adapter.mailbox.ReIndexerManagementMBean;
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.ComposedMessageId;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.store.mail.model.Mailbox;
+import org.apache.james.mailbox.store.probe.MailboxProbe;
+
+public class JmxMailboxProbe implements MailboxProbe, JmxProbe {
+
+ private final static String MAILBOXCOPIER_OBJECT_NAME = "org.apache.james:type=component,name=mailboxcopier";
+ private final static String MAILBOXMANAGER_OBJECT_NAME = "org.apache.james:type=component,name=mailboxmanagerbean";
+ private final static String REINDEXER_OBJECT_NAME = "org.apache.james:type=component,name=reindexerbean";
+
+ private MailboxCopierManagementMBean mailboxCopierManagement;
+ private MailboxManagerManagementMBean mailboxManagerManagement;
+ private ReIndexerManagementMBean reIndexerManagement;
+
+ public JmxMailboxProbe connect(JmxConnection jmxc) throws IOException {
+ try {
+ mailboxCopierManagement = jmxc.retrieveBean(MailboxCopierManagementMBean.class, MAILBOXCOPIER_OBJECT_NAME);
+ mailboxManagerManagement = jmxc.retrieveBean(MailboxManagerManagementMBean.class, MAILBOXMANAGER_OBJECT_NAME);
+ reIndexerManagement = jmxc.retrieveBean(ReIndexerManagementMBean.class, REINDEXER_OBJECT_NAME);
+ } catch (MalformedObjectNameException e) {
+ throw new RuntimeException("Invalid ObjectName? Please report this as a bug.", e);
+ }
+ return this;
+ }
+
+
+ @Override
+ public void copyMailbox(String srcBean, String dstBean) throws Exception {
+ mailboxCopierManagement.copy(srcBean, dstBean);
+ }
+
+ @Override
+ public void deleteUserMailboxesNames(String user) throws Exception {
+ mailboxManagerManagement.deleteMailboxes(user);
+ }
+
+ @Override
+ public void createMailbox(String namespace, String user, String name) {
+ mailboxManagerManagement.createMailbox(namespace, user, name);
+ }
+
+ @Override
+ public Collection<String> listUserMailboxes(String user) {
+ return mailboxManagerManagement.listMailboxes(user);
+ }
+
+ @Override
+ public void deleteMailbox(String namespace, String user, String name) {
+ mailboxManagerManagement.deleteMailbox(namespace, user, name);
+ }
+
+ @Override
+ public void reIndexMailbox(String namespace, String user, String name) throws Exception {
+ reIndexerManagement.reIndex(namespace, user, name);
+ }
+
+ @Override
+ public void reIndexAll() throws Exception {
+ reIndexerManagement.reIndex();
+ }
+
+
+ @Override
+ public Mailbox getMailbox(String namespace, String user, String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ @Override
+ public ComposedMessageId appendMessage(String username, MailboxPath mailboxPath, InputStream message,
+ Date internalDate, boolean isRecent, Flags flags) throws MailboxException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ @Override
+ public Collection<String> listSubscriptions(String user) throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxProbe.java
----------------------------------------------------------------------
diff --git a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxProbe.java b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxProbe.java
new file mode 100644
index 0000000..76b6552
--- /dev/null
+++ b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxProbe.java
@@ -0,0 +1,28 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.cli.probe.impl;
+
+import java.io.IOException;
+
+public interface JmxProbe {
+
+ public JmxProbe connect(JmxConnection jmxc) throws IOException;
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxQuotaProbe.java
----------------------------------------------------------------------
diff --git a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxQuotaProbe.java b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxQuotaProbe.java
new file mode 100644
index 0000000..48191bb
--- /dev/null
+++ b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxQuotaProbe.java
@@ -0,0 +1,100 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.cli.probe.impl;
+
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+
+import org.apache.james.adapter.mailbox.QuotaManagementMBean;
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.store.mail.model.SerializableQuota;
+import org.apache.james.mailbox.store.probe.QuotaProbe;
+
+public class JmxQuotaProbe implements QuotaProbe, JmxProbe {
+ private final static String QUOTAMANAGER_OBJECT_NAME = "org.apache.james:type=component,name=quotamanagerbean";
+
+ private QuotaManagementMBean quotaManagement;
+
+ public JmxQuotaProbe connect(JmxConnection jmxc) throws IOException {
+ try {
+ quotaManagement = jmxc.retrieveBean(QuotaManagementMBean.class, QUOTAMANAGER_OBJECT_NAME);
+ } catch (MalformedObjectNameException e) {
+ throw new RuntimeException("Invalid ObjectName? Please report this as a bug.", e);
+ }
+ return this;
+ }
+
+ @Override
+ public String getQuotaRoot(String namespace, String user, String name) throws MailboxException {
+ return quotaManagement.getQuotaRoot(namespace, user, name);
+ }
+
+ @Override
+ public SerializableQuota getMessageCountQuota(String quotaRoot) throws MailboxException {
+ return quotaManagement.getMessageCountQuota(quotaRoot);
+ }
+
+ @Override
+ public SerializableQuota getStorageQuota(String quotaRoot) throws MailboxException {
+ return quotaManagement.getStorageQuota(quotaRoot);
+ }
+
+ @Override
+ public long getMaxMessageCount(String quotaRoot) throws MailboxException {
+ return quotaManagement.getMaxMessageCount(quotaRoot);
+ }
+
+ @Override
+ public long getMaxStorage(String quotaRoot) throws MailboxException {
+ return quotaManagement.getMaxStorage(quotaRoot);
+ }
+
+ @Override
+ public long getDefaultMaxMessageCount() throws MailboxException {
+ return quotaManagement.getDefaultMaxMessageCount();
+ }
+
+ @Override
+ public long getDefaultMaxStorage() throws MailboxException {
+ return quotaManagement.getDefaultMaxStorage();
+ }
+
+ @Override
+ public void setMaxMessageCount(String quotaRoot, long maxMessageCount) throws MailboxException {
+ quotaManagement.setMaxMessageCount(quotaRoot, maxMessageCount);
+ }
+
+ @Override
+ public void setMaxStorage(String quotaRoot, long maxSize) throws MailboxException {
+ quotaManagement.setMaxStorage(quotaRoot, maxSize);
+ }
+
+ @Override
+ public void setDefaultMaxMessageCount(long maxDefaultMessageCount) throws MailboxException {
+ quotaManagement.setDefaultMaxMessageCount(maxDefaultMessageCount);
+ }
+
+ @Override
+ public void setDefaultMaxStorage(long maxDefaultSize) throws MailboxException {
+ quotaManagement.setDefaultMaxStorage(maxDefaultSize);
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxServerProbe.java
----------------------------------------------------------------------
diff --git a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxServerProbe.java b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxServerProbe.java
deleted file mode 100644
index a24724c..0000000
--- a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxServerProbe.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.cli.probe.impl;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.MBeanServerConnection;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.remote.JMXServiceURL;
-
-import org.apache.james.adapter.mailbox.MailboxCopierManagementMBean;
-import org.apache.james.adapter.mailbox.MailboxManagerManagementMBean;
-import org.apache.james.adapter.mailbox.QuotaManagementMBean;
-import org.apache.james.adapter.mailbox.ReIndexerManagementMBean;
-import org.apache.james.adapter.mailbox.SerializableQuota;
-import org.apache.james.cli.probe.ServerProbe;
-import org.apache.james.domainlist.api.DomainListManagementMBean;
-import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.rrt.api.RecipientRewriteTableManagementMBean;
-import org.apache.james.rrt.lib.Mappings;
-import org.apache.james.sieverepository.api.SieveRepositoryManagementMBean;
-import org.apache.james.user.api.UsersRepositoryManagementMBean;
-
-public class JmxServerProbe implements ServerProbe {
-
- // TODO: Move this to somewhere else
- private final static String DOMAINLIST_OBJECT_NAME = "org.apache.james:type=component,name=domainlist";
- private final static String VIRTUALUSERTABLE_OBJECT_NAME = "org.apache.james:type=component,name=recipientrewritetable";
- private final static String USERSREPOSITORY_OBJECT_NAME = "org.apache.james:type=component,name=usersrepository";
- private final static String MAILBOXCOPIER_OBJECT_NAME = "org.apache.james:type=component,name=mailboxcopier";
- private final static String MAILBOXMANAGER_OBJECT_NAME = "org.apache.james:type=component,name=mailboxmanagerbean";
- private final static String SIEVEMANAGER_OBJECT_NAME = "org.apache.james:type=component,name=sievemanagerbean";
- private final static String QUOTAMANAGER_OBJECT_NAME = "org.apache.james:type=component,name=quotamanagerbean";
- private final static String REINDEXER_OBJECT_NAME = "org.apache.james:type=component,name=reindexerbean";
-
- private JMXConnector jmxc;
-
- private DomainListManagementMBean domainListProxy;
- private RecipientRewriteTableManagementMBean virtualUserTableProxy;
- private UsersRepositoryManagementMBean usersRepositoryProxy;
- private MailboxCopierManagementMBean mailboxCopierManagement;
- private MailboxManagerManagementMBean mailboxManagerManagement;
- private QuotaManagementMBean quotaManagement;
- private ReIndexerManagementMBean reIndexerManagement;
- private SieveRepositoryManagementMBean sieveRepositoryManagement;
-
- private static final String fmtUrl = "service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi";
- private static final int defaultPort = 9999;
- private final String host;
- private final int port;
-
- /**
- * Creates a ServerProbe using the specified JMX host and port.
- *
- * @param host hostname or IP address of the JMX agent
- * @param port TCP port of the remote JMX agent
- * @throws IOException on connection failures
- */
- public JmxServerProbe(String host, int port) throws IOException {
- this.host = host;
- this.port = port;
- connect();
- }
-
- /**
- * Creates a NodeProbe using the specified JMX host and default port.
- *
- * @param host hostname or IP address of the JMX agent
- * @throws IOException on connection failures
- */
- public JmxServerProbe(String host) throws IOException {
- this.host = host;
- this.port = defaultPort;
- connect();
- }
-
- /**
- * Create a connection to the JMX agent and setup the M[X]Bean proxies.
- *
- * @throws IOException on connection failures
- */
- private void connect() throws IOException {
- JMXServiceURL jmxUrl = new JMXServiceURL(String.format(fmtUrl, host, port));
- jmxc = JMXConnectorFactory.connect(jmxUrl, null);
- MBeanServerConnection mbeanServerConn = jmxc.getMBeanServerConnection();
-
- try {
- ObjectName name = new ObjectName(DOMAINLIST_OBJECT_NAME);
- domainListProxy = MBeanServerInvocationHandler.newProxyInstance(
- mbeanServerConn, name, DomainListManagementMBean.class, true);
- name = new ObjectName(VIRTUALUSERTABLE_OBJECT_NAME);
- virtualUserTableProxy = MBeanServerInvocationHandler
- .newProxyInstance(mbeanServerConn, name, RecipientRewriteTableManagementMBean.class, true);
- name = new ObjectName(USERSREPOSITORY_OBJECT_NAME);
- usersRepositoryProxy = MBeanServerInvocationHandler.newProxyInstance(
- mbeanServerConn, name, UsersRepositoryManagementMBean.class, true);
- name = new ObjectName(MAILBOXCOPIER_OBJECT_NAME);
- mailboxCopierManagement = MBeanServerInvocationHandler.newProxyInstance(
- mbeanServerConn, name, MailboxCopierManagementMBean.class, true);
- name = new ObjectName(MAILBOXMANAGER_OBJECT_NAME);
- mailboxManagerManagement = MBeanServerInvocationHandler.newProxyInstance(
- mbeanServerConn, name, MailboxManagerManagementMBean.class, true);
- name = new ObjectName(QUOTAMANAGER_OBJECT_NAME);
- quotaManagement = MBeanServerInvocationHandler.newProxyInstance(
- mbeanServerConn, name, QuotaManagementMBean.class, true);
- name = new ObjectName(REINDEXER_OBJECT_NAME);
- reIndexerManagement = MBeanServerInvocationHandler.newProxyInstance(
- mbeanServerConn, name, ReIndexerManagementMBean.class, true);
- name = new ObjectName(SIEVEMANAGER_OBJECT_NAME);
- sieveRepositoryManagement = MBeanServerInvocationHandler.newProxyInstance(
- mbeanServerConn, name, SieveRepositoryManagementMBean.class, true);
- } catch (MalformedObjectNameException e) {
- throw new RuntimeException("Invalid ObjectName? Please report this as a bug.", e);
- }
- }
-
- @Override
- public void close() throws IOException {
- jmxc.close();
- }
-
- @Override
- public void addUser(String userName, String password) throws Exception {
- usersRepositoryProxy.addUser(userName, password);
- }
-
- @Override
- public void removeUser(String username) throws Exception {
- usersRepositoryProxy.deleteUser(username);
- }
-
- @Override
- public String[] listUsers() throws Exception {
- return usersRepositoryProxy.listAllUsers();
- }
-
- @Override
- public void setPassword(String userName, String password) throws Exception {
- usersRepositoryProxy.setPassword(userName, password);
- }
-
- @Override
- public boolean containsDomain(String domain) throws Exception {
- return domainListProxy.containsDomain(domain);
- }
-
- @Override
- public String getDefaultDomain() throws Exception {
- return domainListProxy.getDefaultDomain();
- }
-
- @Override
- public void addDomain(String domain) throws Exception {
- domainListProxy.addDomain(domain);
- }
-
- @Override
- public void removeDomain(String domain) throws Exception {
- domainListProxy.removeDomain(domain);
- }
-
- @Override
- public List<String> listDomains() throws Exception {
- return domainListProxy.getDomains();
- }
-
- @Override
- public Map<String, Mappings> listMappings() throws Exception {
- return virtualUserTableProxy.getAllMappings();
- }
-
- @Override
- public void addAddressMapping(String user, String domain, String toAddress) throws Exception {
- virtualUserTableProxy.addAddressMapping(user, domain, toAddress);
- }
-
- @Override
- public void removeAddressMapping(String user, String domain, String fromAddress) throws Exception {
- virtualUserTableProxy.removeAddressMapping(user, domain, fromAddress);
- }
-
- @Override
- public Mappings listUserDomainMappings(String user, String domain) throws Exception {
- return virtualUserTableProxy.getUserDomainMappings(user, domain);
- }
-
- @Override
- public void addRegexMapping(String user, String domain, String regex) throws Exception {
- virtualUserTableProxy.addRegexMapping(user, domain, regex);
- }
-
- @Override
- public void removeRegexMapping(String user, String domain, String regex) throws Exception {
- virtualUserTableProxy.removeRegexMapping(user, domain, regex);
- }
-
- @Override
- public void copyMailbox(String srcBean, String dstBean) throws Exception {
- mailboxCopierManagement.copy(srcBean, dstBean);
- }
-
- @Override
- public void deleteUserMailboxesNames(String user) throws Exception {
- mailboxManagerManagement.deleteMailboxes(user);
- }
-
- @Override
- public void createMailbox(String namespace, String user, String name) {
- mailboxManagerManagement.createMailbox(namespace, user, name);
- }
-
- @Override
- public Collection<String> listUserMailboxes(String user) {
- return mailboxManagerManagement.listMailboxes(user);
- }
-
- @Override
- public void deleteMailbox(String namespace, String user, String name) {
- mailboxManagerManagement.deleteMailbox(namespace, user, name);
- }
-
- @Override
- public String getQuotaRoot(String namespace, String user, String name) throws MailboxException {
- return quotaManagement.getQuotaRoot(namespace, user, name);
- }
-
- @Override
- public SerializableQuota getMessageCountQuota(String quotaRoot) throws MailboxException {
- return quotaManagement.getMessageCountQuota(quotaRoot);
- }
-
- @Override
- public SerializableQuota getStorageQuota(String quotaRoot) throws MailboxException {
- return quotaManagement.getStorageQuota(quotaRoot);
- }
-
- @Override
- public long getMaxMessageCount(String quotaRoot) throws MailboxException {
- return quotaManagement.getMaxMessageCount(quotaRoot);
- }
-
- @Override
- public long getMaxStorage(String quotaRoot) throws MailboxException {
- return quotaManagement.getMaxStorage(quotaRoot);
- }
-
- @Override
- public long getDefaultMaxMessageCount() throws MailboxException {
- return quotaManagement.getDefaultMaxMessageCount();
- }
-
- @Override
- public long getDefaultMaxStorage() throws MailboxException {
- return quotaManagement.getDefaultMaxStorage();
- }
-
- @Override
- public void setMaxMessageCount(String quotaRoot, long maxMessageCount) throws MailboxException {
- quotaManagement.setMaxMessageCount(quotaRoot, maxMessageCount);
- }
-
- @Override
- public void setMaxStorage(String quotaRoot, long maxSize) throws MailboxException {
- quotaManagement.setMaxStorage(quotaRoot, maxSize);
- }
-
- @Override
- public void setDefaultMaxMessageCount(long maxDefaultMessageCount) throws MailboxException {
- quotaManagement.setDefaultMaxMessageCount(maxDefaultMessageCount);
- }
-
- @Override
- public void setDefaultMaxStorage(long maxDefaultSize) throws MailboxException {
- quotaManagement.setDefaultMaxStorage(maxDefaultSize);
- }
-
- @Override
- public void reIndexMailbox(String namespace, String user, String name) throws Exception {
- reIndexerManagement.reIndex(namespace, user, name);
- }
-
- @Override
- public void reIndexAll() throws Exception {
- reIndexerManagement.reIndex();
- }
-
- @Override
- public long getSieveQuota() throws Exception {
- return sieveRepositoryManagement.getQuota();
- }
-
- @Override
- public void setSieveQuota(long quota) throws Exception {
- sieveRepositoryManagement.setQuota(quota);
- }
-
- @Override
- public void removeSieveQuota() throws Exception {
- sieveRepositoryManagement.removeQuota();
- }
-
- @Override
- public long getSieveQuota(String user) throws Exception {
- return sieveRepositoryManagement.getQuota(user);
- }
-
- @Override
- public void setSieveQuota(String user, long quota) throws Exception {
- sieveRepositoryManagement.setQuota(user, quota);
- }
-
- @Override
- public void removeSieveQuota(String user) throws Exception {
- sieveRepositoryManagement.removeQuota(user);
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxSieveProbe.java
----------------------------------------------------------------------
diff --git a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxSieveProbe.java b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxSieveProbe.java
new file mode 100644
index 0000000..acfcf7d
--- /dev/null
+++ b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxSieveProbe.java
@@ -0,0 +1,78 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.cli.probe.impl;
+
+import java.io.IOException;
+
+import javax.management.MalformedObjectNameException;
+
+import org.apache.james.mailbox.store.probe.SieveProbe;
+import org.apache.james.sieverepository.api.SieveRepositoryManagementMBean;
+
+public class JmxSieveProbe implements SieveProbe, JmxProbe {
+
+ private final static String SIEVEMANAGER_OBJECT_NAME = "org.apache.james:type=component,name=sievemanagerbean";
+
+ private SieveRepositoryManagementMBean sieveRepositoryManagement;
+
+ public JmxSieveProbe connect(JmxConnection jmxc) throws IOException {
+ try {
+ jmxc.retrieveBean(SieveRepositoryManagementMBean.class, SIEVEMANAGER_OBJECT_NAME);
+ } catch (MalformedObjectNameException e) {
+ throw new RuntimeException("Invalid ObjectName? Please report this as a bug.", e);
+ }
+ return this;
+ }
+
+ @Override
+ public long getSieveQuota() throws Exception {
+ return sieveRepositoryManagement.getQuota();
+ }
+
+ @Override
+ public void setSieveQuota(long quota) throws Exception {
+ sieveRepositoryManagement.setQuota(quota);
+ }
+
+ @Override
+ public void removeSieveQuota() throws Exception {
+ sieveRepositoryManagement.removeQuota();
+ }
+
+ @Override
+ public long getSieveQuota(String user) throws Exception {
+ return sieveRepositoryManagement.getQuota(user);
+ }
+
+ @Override
+ public void setSieveQuota(String user, long quota) throws Exception {
+ sieveRepositoryManagement.setQuota(user, quota);
+ }
+
+ @Override
+ public void removeSieveQuota(String user) throws Exception {
+ sieveRepositoryManagement.removeQuota(user);
+ }
+
+ @Override
+ public void addActiveSieveScript(String user, String name, String script) throws Exception {
+ }
+
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[09/21] james-project git commit: JAMES-1902 create jmap module
Posted by bt...@apache.org.
JAMES-1902 create jmap module
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/3d0e2ae7
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/3d0e2ae7
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/3d0e2ae7
Branch: refs/heads/master
Commit: 3d0e2ae7163338870b09b6c3192be50759b8ffec
Parents: 5e965d8
Author: Antoine Duprat <ad...@linagora.com>
Authored: Tue Mar 7 11:12:53 2017 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
mpt/impl/smtp/cassandra/pom.xml | 12 ++
mpt/pom.xml | 6 +
server/container/guice/cassandra-guice/pom.xml | 6 +
.../modules/mailbox/CassandraMailboxModule.java | 4 +
.../guice/cassandra-ldap-guice/pom.xml | 6 +
server/container/guice/configuration/pom.xml | 8 +
.../java/org/apache/james/utils/GuiceProbe.java | 22 ++
.../apache/james/utils/PropertiesProvider.java | 46 +++++
server/container/guice/guice-common/pom.xml | 8 +-
.../main/java/org/apache/james/JmapServer.java | 26 ---
.../org/apache/james/jmap/JMAPCommonModule.java | 95 ---------
.../java/org/apache/james/jmap/JMAPModule.java | 142 -------------
.../org/apache/james/jmap/MethodsModule.java | 84 --------
.../modules/protocols/JMAPServerModule.java | 83 --------
.../java/org/apache/james/utils/GuiceProbe.java | 22 --
.../apache/james/utils/GuiceServerProbe.java | 2 +-
.../org/apache/james/utils/JmapGuiceProbe.java | 78 -------
.../apache/james/utils/PropertiesProvider.java | 46 -----
.../james/modules/TestJMAPServerModule.java | 68 -------
.../modules/mailbox/MemoryMailboxModule.java | 4 +
server/container/guice/pom.xml | 12 ++
server/container/guice/protocols/jmap/pom.xml | 203 +++++++++++++++++++
.../main/java/org/apache/james/JmapServer.java | 26 +++
.../org/apache/james/jmap/JMAPCommonModule.java | 91 +++++++++
.../java/org/apache/james/jmap/JMAPModule.java | 142 +++++++++++++
.../org/apache/james/jmap/MethodsModule.java | 84 ++++++++
.../modules/protocols/JMAPServerModule.java | 83 ++++++++
.../org/apache/james/utils/JmapGuiceProbe.java | 78 +++++++
.../james/jmap/MailetPreconditionTest.java | 122 +++++++++++
.../james/modules/TestJMAPServerModule.java | 68 +++++++
.../cassandra-jmap-integration-testing/pom.xml | 6 +
.../protocols/webadmin-integration-test/pom.xml | 6 +
32 files changed, 1040 insertions(+), 649 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/mpt/impl/smtp/cassandra/pom.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/pom.xml b/mpt/impl/smtp/cassandra/pom.xml
index 2ac1e1c..ad2afd7 100644
--- a/mpt/impl/smtp/cassandra/pom.xml
+++ b/mpt/impl/smtp/cassandra/pom.xml
@@ -189,6 +189,12 @@
<type>test-jar</type>
</dependency>
<dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <scope>test</scope>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
@@ -288,6 +294,12 @@
<type>test-jar</type>
</dependency>
<dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <scope>test</scope>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/mpt/pom.xml
----------------------------------------------------------------------
diff --git a/mpt/pom.xml b/mpt/pom.xml
index c8fdf5d..08450d8 100644
--- a/mpt/pom.xml
+++ b/mpt/pom.xml
@@ -315,6 +315,12 @@
</dependency>
<dependency>
<groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
<artifactId>james-server-util-java8</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/cassandra-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/pom.xml b/server/container/guice/cassandra-guice/pom.xml
index 957f51d..65b2c2e 100644
--- a/server/container/guice/cassandra-guice/pom.xml
+++ b/server/container/guice/cassandra-guice/pom.xml
@@ -267,6 +267,12 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-util-java8</artifactId>
<scope>test</scope>
<type>test-jar</type>
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java
index a6e6ac3..1ba4213 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java
@@ -23,6 +23,7 @@ import javax.inject.Singleton;
import org.apache.james.adapter.mailbox.store.UserRepositoryAuthenticator;
import org.apache.james.adapter.mailbox.store.UserRepositoryAuthorizator;
import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.mailbox.AttachmentManager;
import org.apache.james.mailbox.MailboxManager;
import org.apache.james.mailbox.MailboxPathLocker;
import org.apache.james.mailbox.MessageIdManager;
@@ -45,6 +46,7 @@ import org.apache.james.mailbox.store.Authenticator;
import org.apache.james.mailbox.store.Authorizator;
import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
import org.apache.james.mailbox.store.NoMailboxPathLocker;
+import org.apache.james.mailbox.store.StoreAttachmentManager;
import org.apache.james.mailbox.store.StoreMessageIdManager;
import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
import org.apache.james.mailbox.store.mail.AttachmentMapperFactory;
@@ -87,6 +89,7 @@ public class CassandraMailboxModule extends AbstractModule {
bind(CassandraMessageIdToImapUidDAO.class).in(Scopes.SINGLETON);
bind(MailboxEventDispatcher.class).in(Scopes.SINGLETON);
bind(StoreMessageIdManager.class).in(Scopes.SINGLETON);
+ bind(StoreAttachmentManager.class).in(Scopes.SINGLETON);
bind(MessageMapperFactory.class).to(CassandraMailboxSessionMapperFactory.class);
bind(MailboxMapperFactory.class).to(CassandraMailboxSessionMapperFactory.class);
@@ -103,6 +106,7 @@ public class CassandraMailboxModule extends AbstractModule {
bind(MailboxId.Factory.class).to(CassandraId.Factory.class);
bind(MessageId.Factory.class).to(CassandraMessageId.Factory.class);
bind(MessageIdManager.class).to(StoreMessageIdManager.class);
+ bind(AttachmentManager.class).to(StoreAttachmentManager.class);
Multibinder<CassandraModule> cassandraDataDefinitions = Multibinder.newSetBinder(binder(), CassandraModule.class);
cassandraDataDefinitions.addBinding().to(org.apache.james.mailbox.cassandra.modules.CassandraAclModule.class);
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/cassandra-ldap-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-ldap-guice/pom.xml b/server/container/guice/cassandra-ldap-guice/pom.xml
index 4ce7530..ca14cb8 100644
--- a/server/container/guice/cassandra-ldap-guice/pom.xml
+++ b/server/container/guice/cassandra-ldap-guice/pom.xml
@@ -238,6 +238,12 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-util-java8</artifactId>
<scope>test</scope>
<type>test-jar</type>
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/configuration/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/configuration/pom.xml b/server/container/guice/configuration/pom.xml
index f535d43..eb2672f 100644
--- a/server/container/guice/configuration/pom.xml
+++ b/server/container/guice/configuration/pom.xml
@@ -133,8 +133,16 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-filesystem-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-lifecycle-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
</dependencies>
</profile>
<profile>
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/configuration/src/main/java/org/apache/james/utils/GuiceProbe.java
----------------------------------------------------------------------
diff --git a/server/container/guice/configuration/src/main/java/org/apache/james/utils/GuiceProbe.java b/server/container/guice/configuration/src/main/java/org/apache/james/utils/GuiceProbe.java
new file mode 100644
index 0000000..4d3b520
--- /dev/null
+++ b/server/container/guice/configuration/src/main/java/org/apache/james/utils/GuiceProbe.java
@@ -0,0 +1,22 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.utils;
+
+public interface GuiceProbe {
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/configuration/src/main/java/org/apache/james/utils/PropertiesProvider.java
----------------------------------------------------------------------
diff --git a/server/container/guice/configuration/src/main/java/org/apache/james/utils/PropertiesProvider.java b/server/container/guice/configuration/src/main/java/org/apache/james/utils/PropertiesProvider.java
new file mode 100644
index 0000000..780b5ee
--- /dev/null
+++ b/server/container/guice/configuration/src/main/java/org/apache/james/utils/PropertiesProvider.java
@@ -0,0 +1,46 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.utils;
+
+import java.io.FileNotFoundException;
+
+import javax.inject.Inject;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.james.filesystem.api.FileSystem;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+
+public class PropertiesProvider {
+
+ private final FileSystem fileSystem;
+
+ @Inject
+ public PropertiesProvider(FileSystem fileSystem) {
+ this.fileSystem = fileSystem;
+ }
+
+ public PropertiesConfiguration getConfiguration(String fileName) throws FileNotFoundException, ConfigurationException {
+ Preconditions.checkArgument(!Strings.isNullOrEmpty(fileName));
+ return new PropertiesConfiguration(fileSystem.getFile(FileSystem.FILE_PROTOCOL_AND_CONF + fileName + ".properties"));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/guice-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/pom.xml b/server/container/guice/guice-common/pom.xml
index 6071182..d294ca2 100644
--- a/server/container/guice/guice-common/pom.xml
+++ b/server/container/guice/guice-common/pom.xml
@@ -181,6 +181,10 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-lmtp</artifactId>
</dependency>
<dependency>
@@ -205,10 +209,6 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>james-server-jmap</artifactId>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
<artifactId>james-server-mailets</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/guice-common/src/main/java/org/apache/james/JmapServer.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/JmapServer.java b/server/container/guice/guice-common/src/main/java/org/apache/james/JmapServer.java
deleted file mode 100644
index 218c879..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/JmapServer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james;
-
-import org.apache.james.utils.JmapGuiceProbe;
-
-public interface JmapServer {
- JmapGuiceProbe getJmapProbe();
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPCommonModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPCommonModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPCommonModule.java
deleted file mode 100644
index c6bd8a3..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPCommonModule.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.jmap;
-
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.james.jmap.api.AccessTokenManager;
-import org.apache.james.jmap.api.SimpleTokenFactory;
-import org.apache.james.jmap.api.SimpleTokenManager;
-import org.apache.james.jmap.api.access.AccessTokenRepository;
-import org.apache.james.jmap.crypto.AccessTokenManagerImpl;
-import org.apache.james.jmap.crypto.JamesSignatureHandler;
-import org.apache.james.jmap.crypto.SignatureHandler;
-import org.apache.james.jmap.crypto.SignedTokenFactory;
-import org.apache.james.jmap.crypto.SignedTokenManager;
-import org.apache.james.jmap.model.MailboxFactory;
-import org.apache.james.jmap.model.MessageContentExtractor;
-import org.apache.james.jmap.model.MessageFactory;
-import org.apache.james.jmap.model.MessagePreviewGenerator;
-import org.apache.james.jmap.send.MailFactory;
-import org.apache.james.jmap.send.MailSpool;
-import org.apache.james.jmap.utils.HeadersAuthenticationExtractor;
-import org.apache.james.mailbox.AttachmentManager;
-import org.apache.james.mailbox.store.StoreAttachmentManager;
-import org.apache.james.util.date.DefaultZonedDateTimeProvider;
-import org.apache.james.util.date.ZonedDateTimeProvider;
-import org.apache.mailet.base.AutomaticallySentMailDetector;
-import org.apache.mailet.base.AutomaticallySentMailDetectorImpl;
-
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-import com.google.inject.name.Names;
-
-public class JMAPCommonModule extends AbstractModule {
-
- private static final long DEFAULT_TOKEN_EXPIRATION_IN_MS = TimeUnit.MILLISECONDS.convert(15, TimeUnit.MINUTES);
-
- @Override
- protected void configure() {
- bind(JamesSignatureHandler.class).in(Scopes.SINGLETON);
- bind(DefaultZonedDateTimeProvider.class).in(Scopes.SINGLETON);
- bind(SignedTokenManager.class).in(Scopes.SINGLETON);
- bind(AccessTokenManagerImpl.class).in(Scopes.SINGLETON);
- bind(MailSpool.class).in(Scopes.SINGLETON);
- bind(MailFactory.class).in(Scopes.SINGLETON);
- bind(AutomaticallySentMailDetectorImpl.class).in(Scopes.SINGLETON);
- bind(MailboxFactory.class).in(Scopes.SINGLETON);
- bind(MessageFactory.class).in(Scopes.SINGLETON);
- bind(MessagePreviewGenerator.class).in(Scopes.SINGLETON);
- bind(MessageContentExtractor.class).in(Scopes.SINGLETON);
- bind(HeadersAuthenticationExtractor.class).in(Scopes.SINGLETON);
- bind(StoreAttachmentManager.class).in(Scopes.SINGLETON);
-
- bind(SignatureHandler.class).to(JamesSignatureHandler.class);
- bind(ZonedDateTimeProvider.class).to(DefaultZonedDateTimeProvider.class);
- bind(SimpleTokenManager.class).to(SignedTokenManager.class);
- bind(SimpleTokenFactory.class).to(SignedTokenFactory.class);
- bind(AutomaticallySentMailDetector.class).to(AutomaticallySentMailDetectorImpl.class);
-
- bindConstant().annotatedWith(Names.named(AccessTokenRepository.TOKEN_EXPIRATION_IN_MS)).to(DEFAULT_TOKEN_EXPIRATION_IN_MS);
- bind(AccessTokenManager.class).to(AccessTokenManagerImpl.class);
- bind(AttachmentManager.class).to(StoreAttachmentManager.class);
- }
-
- @Provides
- public List<AuthenticationStrategy> authStrategies(
- AccessTokenAuthenticationStrategy accessTokenAuthenticationStrategy,
- JWTAuthenticationStrategy jwtAuthenticationStrategy,
- QueryParameterAccessTokenAuthenticationStrategy queryParameterAuthenticationStrategy) {
-
- return ImmutableList.of(
- jwtAuthenticationStrategy,
- accessTokenAuthenticationStrategy,
- queryParameterAuthenticationStrategy);
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
deleted file mode 100644
index 7269cb1..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.jmap;
-
-import java.io.IOException;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Optional;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.commons.io.FileUtils;
-import org.apache.james.filesystem.api.FileSystem;
-import org.apache.james.jmap.mailet.VacationMailet;
-import org.apache.james.jmap.methods.RequestHandler;
-import org.apache.james.jmap.send.PostDequeueDecoratorFactory;
-import org.apache.james.jmap.utils.HtmlTextExtractor;
-import org.apache.james.jmap.utils.MailboxBasedHtmlTextExtractor;
-import org.apache.james.jmap.utils.SystemMailboxesProvider;
-import org.apache.james.jmap.utils.SystemMailboxesProviderImpl;
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.mailbox.MailboxManager;
-import org.apache.james.mailbox.MailboxManager.SearchCapabilities;
-import org.apache.james.mailetcontainer.impl.MatcherMailetPair;
-import org.apache.james.modules.server.CamelMailetContainerModule;
-import org.apache.james.queue.api.MailQueueItemDecoratorFactory;
-import org.apache.james.transport.matchers.RecipientIsLocal;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.PropertiesProvider;
-
-import com.github.fge.lambdas.Throwing;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-
-public class JMAPModule extends AbstractModule {
- private static final int DEFAULT_JMAP_PORT = 80;
-
- @Override
- protected void configure() {
- install(new JMAPCommonModule());
- install(new MethodsModule());
- bind(JMAPServer.class).in(Scopes.SINGLETON);
- bind(RequestHandler.class).in(Scopes.SINGLETON);
- bind(UploadHandler.class).in(Scopes.SINGLETON);
- bind(MailboxBasedHtmlTextExtractor.class).in(Scopes.SINGLETON);
- bind(SystemMailboxesProviderImpl.class).in(Scopes.SINGLETON);
-
- bind(HtmlTextExtractor.class).to(MailboxBasedHtmlTextExtractor.class);
- Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(RequiredCapabilitiesPrecondition.class);
-
- Multibinder<CamelMailetContainerModule.TransportProcessorCheck> transportProcessorChecks = Multibinder.newSetBinder(binder(), CamelMailetContainerModule.TransportProcessorCheck.class);
- transportProcessorChecks.addBinding().to(VacationMailetCheck.class);
-
- bind(SystemMailboxesProvider.class).to(SystemMailboxesProviderImpl.class);
- bind(MailQueueItemDecoratorFactory.class).to(PostDequeueDecoratorFactory.class).in(Scopes.SINGLETON);
- }
-
- @Provides
- @Singleton
- JMAPConfiguration provideConfiguration(PropertiesProvider propertiesProvider, FileSystem fileSystem) throws ConfigurationException, IOException{
- PropertiesConfiguration configuration = propertiesProvider.getConfiguration("jmap");
- return JMAPConfiguration.builder()
- .keystore(configuration.getString("tls.keystoreURL"))
- .secret(configuration.getString("tls.secret"))
- .jwtPublicKeyPem(loadPublicKey(fileSystem, Optional.ofNullable(configuration.getString("jwt.publickeypem.url"))))
- .port(configuration.getInt("jmap.port", DEFAULT_JMAP_PORT))
- .build();
- }
-
- private Optional<String> loadPublicKey(FileSystem fileSystem, Optional<String> jwtPublickeyPemUrl) {
- return jwtPublickeyPemUrl.map(Throwing.function(url -> FileUtils.readFileToString(fileSystem.getFile(url))));
- }
-
- @Singleton
- public static class RequiredCapabilitiesPrecondition implements ConfigurationPerformer {
-
- private final MailboxManager mailboxManager;
-
- @Inject
- public RequiredCapabilitiesPrecondition(MailboxManager mailboxManager) {
- this.mailboxManager = mailboxManager;
- }
-
- @Override
- public void initModule() {
- Preconditions.checkArgument(mailboxManager.hasCapability(MailboxManager.MailboxCapabilities.Move),
- "MOVE support in MailboxManager is required by JMAP Module");
-
- EnumSet<MailboxManager.MessageCapabilities> messageCapabilities = mailboxManager.getSupportedMessageCapabilities();
- Preconditions.checkArgument(messageCapabilities.contains(MailboxManager.MessageCapabilities.Attachment),
- "Attachment support in MailboxManager is required by JMAP Module");
- Preconditions.checkArgument(messageCapabilities.contains(MailboxManager.MessageCapabilities.UniqueID),
- "MessageIdManager is not defined by this Mailbox implementation");
-
- EnumSet<SearchCapabilities> searchCapabilities = mailboxManager.getSupportedSearchCapabilities();
- Preconditions.checkArgument(searchCapabilities.contains(MailboxManager.SearchCapabilities.MultimailboxSearch),
- "Multimailbox search in MailboxManager is required by JMAP Module");
- Preconditions.checkArgument(searchCapabilities.contains(MailboxManager.SearchCapabilities.Text),
- "Text support in MailboxManager is required by JMAP Module");
- }
-
- @Override
- public List<Class<? extends Configurable>> forClasses() {
- return ImmutableList.of();
- }
- }
-
- public static class VacationMailetCheck implements CamelMailetContainerModule.TransportProcessorCheck {
- @Override
- public void check(List<MatcherMailetPair> pairs) throws ConfigurationException {
- Preconditions.checkNotNull(pairs);
- pairs.stream()
- .filter(pair -> pair.getMailet().getClass().equals(VacationMailet.class))
- .filter(pair -> pair.getMatcher().getClass().equals(RecipientIsLocal.class))
- .findAny()
- .orElseThrow(() -> new ConfigurationException("Missing " + VacationMailet.class.getName() + " in mailets configuration (mailetcontainer -> processors -> transport)"));
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java
deleted file mode 100644
index 9feb897..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.jmap;
-
-import org.apache.james.jmap.json.ObjectMapperFactory;
-import org.apache.james.jmap.methods.GetMailboxesMethod;
-import org.apache.james.jmap.methods.GetMessageListMethod;
-import org.apache.james.jmap.methods.GetMessagesMethod;
-import org.apache.james.jmap.methods.GetVacationResponseMethod;
-import org.apache.james.jmap.methods.JmapRequestParser;
-import org.apache.james.jmap.methods.JmapRequestParserImpl;
-import org.apache.james.jmap.methods.JmapResponseWriter;
-import org.apache.james.jmap.methods.JmapResponseWriterImpl;
-import org.apache.james.jmap.methods.Method;
-import org.apache.james.jmap.methods.SetMailboxesCreationProcessor;
-import org.apache.james.jmap.methods.SetMailboxesDestructionProcessor;
-import org.apache.james.jmap.methods.SetMailboxesMethod;
-import org.apache.james.jmap.methods.SetMailboxesProcessor;
-import org.apache.james.jmap.methods.SetMailboxesUpdateProcessor;
-import org.apache.james.jmap.methods.SetMessagesCreationProcessor;
-import org.apache.james.jmap.methods.SetMessagesDestructionProcessor;
-import org.apache.james.jmap.methods.SetMessagesMethod;
-import org.apache.james.jmap.methods.SetMessagesProcessor;
-import org.apache.james.jmap.methods.SetMessagesUpdateProcessor;
-import org.apache.james.jmap.methods.SetVacationResponseMethod;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Scopes;
-import com.google.inject.multibindings.Multibinder;
-import com.google.inject.name.Names;
-
-public class MethodsModule extends AbstractModule {
-
- @Override
- protected void configure() {
- bind(JmapRequestParserImpl.class).in(Scopes.SINGLETON);
- bind(JmapResponseWriterImpl.class).in(Scopes.SINGLETON);
- bind(ObjectMapperFactory.class).in(Scopes.SINGLETON);
-
- bind(JmapRequestParser.class).to(JmapRequestParserImpl.class);
- bind(JmapResponseWriter.class).to(JmapResponseWriterImpl.class);
-
- bindConstant().annotatedWith(Names.named(GetMessageListMethod.MAXIMUM_LIMIT)).to(GetMessageListMethod.DEFAULT_MAXIMUM_LIMIT);
-
- Multibinder<Method> methods = Multibinder.newSetBinder(binder(), Method.class);
- methods.addBinding().to(GetMailboxesMethod.class);
- methods.addBinding().to(GetMessageListMethod.class);
- methods.addBinding().to(GetMessagesMethod.class);
- methods.addBinding().to(SetMessagesMethod.class);
- methods.addBinding().to(SetMailboxesMethod.class);
- methods.addBinding().to(GetVacationResponseMethod.class);
- methods.addBinding().to(SetVacationResponseMethod.class);
-
- Multibinder<SetMailboxesProcessor> setMailboxesProcessor =
- Multibinder.newSetBinder(binder(), SetMailboxesProcessor.class);
- setMailboxesProcessor.addBinding().to(SetMailboxesCreationProcessor.class);
- setMailboxesProcessor.addBinding().to(SetMailboxesUpdateProcessor.class);
- setMailboxesProcessor.addBinding().to(SetMailboxesDestructionProcessor.class);
-
- Multibinder<SetMessagesProcessor> setMessagesProcessors =
- Multibinder.newSetBinder(binder(), SetMessagesProcessor.class);
- setMessagesProcessors.addBinding().to(SetMessagesUpdateProcessor.class);
- setMessagesProcessors.addBinding().to(SetMessagesCreationProcessor.class);
- setMessagesProcessors.addBinding().to(SetMessagesDestructionProcessor.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java
deleted file mode 100644
index a04e1db..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/JMAPServerModule.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.modules.protocols;
-
-import java.security.Security;
-import java.util.List;
-
-import org.apache.james.jmap.JMAPModule;
-import org.apache.james.jmap.JMAPServer;
-import org.apache.james.jmap.crypto.JamesSignatureHandler;
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.GuiceProbe;
-import org.apache.james.utils.JmapGuiceProbe;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-
-public class JMAPServerModule extends AbstractModule {
-
- @Override
- protected void configure() {
- install(new JMAPModule());
- Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JMAPModuleConfigurationPerformer.class);
- Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(JmapGuiceProbe.class);
- }
-
- @Singleton
- public static class JMAPModuleConfigurationPerformer implements ConfigurationPerformer {
-
- private final JMAPServer server;
- private final JamesSignatureHandler signatureHandler;
-
- @Inject
- public JMAPModuleConfigurationPerformer(JMAPServer server, JamesSignatureHandler signatureHandler) {
- this.server = server;
- this.signatureHandler = signatureHandler;
- }
-
- @Override
- public void initModule() {
- try {
- signatureHandler.init();
- server.configure(null);
- registerPEMWithSecurityProvider();
- } catch (Exception e) {
- Throwables.propagate(e);
- }
- }
-
- private void registerPEMWithSecurityProvider() {
- Security.addProvider(new BouncyCastleProvider());
- }
-
- @Override
- public List<Class<? extends Configurable>> forClasses() {
- return ImmutableList.of(JMAPServer.class);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceProbe.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceProbe.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceProbe.java
deleted file mode 100644
index 4d3b520..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceProbe.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.utils;
-
-public interface GuiceProbe {
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java
index fa28cd0..ec9bcc8 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/GuiceServerProbe.java
@@ -58,7 +58,7 @@ import com.google.common.collect.Iterables;
public class GuiceServerProbe implements ExtendedServerProbe, GuiceProbe {
- private static final Logger LOGGER = LoggerFactory.getLogger(JmapGuiceProbe.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(GuiceServerProbe.class);
private final MailboxManager mailboxManager;
private final MailboxMapperFactory mailboxMapperFactory;
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/guice-common/src/main/java/org/apache/james/utils/JmapGuiceProbe.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/JmapGuiceProbe.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/JmapGuiceProbe.java
deleted file mode 100644
index 627d1c6..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/JmapGuiceProbe.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.utils;
-
-import java.util.Arrays;
-
-import javax.inject.Inject;
-
-import org.apache.james.jmap.JMAPServer;
-import org.apache.james.jmap.api.vacation.AccountId;
-import org.apache.james.jmap.api.vacation.Vacation;
-import org.apache.james.jmap.api.vacation.VacationPatch;
-import org.apache.james.jmap.api.vacation.VacationRepository;
-import org.apache.james.mailbox.MailboxListener;
-import org.apache.james.mailbox.MailboxManager;
-import org.apache.james.mailbox.MailboxSession;
-import org.apache.james.mailbox.MessageIdManager;
-import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.model.MailboxId;
-import org.apache.james.mailbox.model.MessageId;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class JmapGuiceProbe implements GuiceProbe {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(JmapGuiceProbe.class);
-
- private final VacationRepository vacationRepository;
- private final JMAPServer jmapServer;
- private final MessageIdManager messageIdManager;
- private final MailboxManager mailboxManager;
-
- @Inject
- private JmapGuiceProbe(VacationRepository vacationRepository, JMAPServer jmapServer, MessageIdManager messageIdManager, MailboxManager mailboxManager) {
- this.vacationRepository = vacationRepository;
- this.jmapServer = jmapServer;
- this.messageIdManager = messageIdManager;
- this.mailboxManager = mailboxManager;
- }
-
- public int getJmapPort() {
- return jmapServer.getPort();
- }
-
- public void addMailboxListener(MailboxListener listener) throws MailboxException {
- mailboxManager.addGlobalListener(listener, mailboxManager.createSystemSession("jmap", LOGGER));
- }
-
- public void modifyVacation(AccountId accountId, VacationPatch vacationPatch) {
- vacationRepository.modifyVacation(accountId, vacationPatch).join();
- }
-
- public Vacation retrieveVacation(AccountId accountId) {
- return vacationRepository.retrieveVacation(accountId).join();
- }
-
- public void setInMailboxes(MessageId messageId, String username, MailboxId... mailboxIds) throws MailboxException {
- MailboxSession mailboxSession = mailboxManager.createSystemSession(username, LOGGER);
- messageIdManager.setInMailboxes(messageId, Arrays.asList(mailboxIds), mailboxSession);
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/guice-common/src/main/java/org/apache/james/utils/PropertiesProvider.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/PropertiesProvider.java b/server/container/guice/guice-common/src/main/java/org/apache/james/utils/PropertiesProvider.java
deleted file mode 100644
index 780b5ee..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/utils/PropertiesProvider.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.utils;
-
-import java.io.FileNotFoundException;
-
-import javax.inject.Inject;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.james.filesystem.api.FileSystem;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-
-public class PropertiesProvider {
-
- private final FileSystem fileSystem;
-
- @Inject
- public PropertiesProvider(FileSystem fileSystem) {
- this.fileSystem = fileSystem;
- }
-
- public PropertiesConfiguration getConfiguration(String fileName) throws FileNotFoundException, ConfigurationException {
- Preconditions.checkArgument(!Strings.isNullOrEmpty(fileName));
- return new PropertiesConfiguration(fileSystem.getFile(FileSystem.FILE_PROTOCOL_AND_CONF + fileName + ".properties"));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/guice-common/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/test/java/org/apache/james/modules/TestJMAPServerModule.java b/server/container/guice/guice-common/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
deleted file mode 100644
index 6512fac..0000000
--- a/server/container/guice/guice-common/src/test/java/org/apache/james/modules/TestJMAPServerModule.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.modules;
-
-import java.io.FileNotFoundException;
-import java.util.Optional;
-
-import javax.inject.Singleton;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.jmap.JMAPConfiguration;
-import org.apache.james.jmap.methods.GetMessageListMethod;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.name.Names;
-
-public class TestJMAPServerModule extends AbstractModule{
-
- private static final String PUBLIC_PEM_KEY = "-----BEGIN PUBLIC KEY-----\n" +
- "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtlChO/nlVP27MpdkG0Bh\n" +
- "16XrMRf6M4NeyGa7j5+1UKm42IKUf3lM28oe82MqIIRyvskPc11NuzSor8HmvH8H\n" +
- "lhDs5DyJtx2qp35AT0zCqfwlaDnlDc/QDlZv1CoRZGpQk1Inyh6SbZwYpxxwh0fi\n" +
- "+d/4RpE3LBVo8wgOaXPylOlHxsDizfkL8QwXItyakBfMO6jWQRrj7/9WDhGf4Hi+\n" +
- "GQur1tPGZDl9mvCoRHjFrD5M/yypIPlfMGWFVEvV5jClNMLAQ9bYFuOc7H1fEWw6\n" +
- "U1LZUUbJW9/CH45YXz82CYqkrfbnQxqRb2iVbVjs/sHopHd1NTiCfUtwvcYJiBVj\n" +
- "kwIDAQAB\n" +
- "-----END PUBLIC KEY-----";
-
- private final int maximumLimit;
-
- public TestJMAPServerModule(int maximumLimit) {
- this.maximumLimit = maximumLimit;
- }
-
- @Override
- protected void configure() {
- bindConstant().annotatedWith(Names.named(GetMessageListMethod.MAXIMUM_LIMIT)).to(maximumLimit);
- }
-
- @Provides
- @Singleton
- JMAPConfiguration provideConfiguration() throws FileNotFoundException, ConfigurationException{
- return JMAPConfiguration.builder()
- .keystore("keystore")
- .secret("james72laBalle")
- .jwtPublicKeyPem(Optional.of(PUBLIC_PEM_KEY))
- .randomPort()
- .build();
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryMailboxModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryMailboxModule.java b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryMailboxModule.java
index 09fd4f0..5716639 100644
--- a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryMailboxModule.java
+++ b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/mailbox/MemoryMailboxModule.java
@@ -23,6 +23,7 @@ import javax.inject.Singleton;
import org.apache.james.adapter.mailbox.store.UserRepositoryAuthenticator;
import org.apache.james.adapter.mailbox.store.UserRepositoryAuthorizator;
+import org.apache.james.mailbox.AttachmentManager;
import org.apache.james.mailbox.MailboxManager;
import org.apache.james.mailbox.MailboxPathLocker;
import org.apache.james.mailbox.MessageIdManager;
@@ -47,6 +48,7 @@ import org.apache.james.mailbox.store.Authenticator;
import org.apache.james.mailbox.store.Authorizator;
import org.apache.james.mailbox.store.JVMMailboxPathLocker;
import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
+import org.apache.james.mailbox.store.StoreAttachmentManager;
import org.apache.james.mailbox.store.StoreSubscriptionManager;
import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
import org.apache.james.mailbox.store.mail.AttachmentMapperFactory;
@@ -89,6 +91,7 @@ public class MemoryMailboxModule extends AbstractModule {
bind(MessageIdManager.class).to(InMemoryMessageIdManager.class);
bind(MailboxACLResolver.class).to(UnionMailboxACLResolver.class);
bind(GroupMembershipResolver.class).to(SimpleGroupMembershipResolver.class);
+ bind(AttachmentManager.class).to(StoreAttachmentManager.class);
bind(MessageSearchIndex.class).to(SimpleMessageSearchIndex.class);
bind(TextExtractor.class).to(JsoupTextExtractor.class);
@@ -106,6 +109,7 @@ public class MemoryMailboxModule extends AbstractModule {
bind(InMemoryMessageId.Factory.class).in(Scopes.SINGLETON);
bind(InMemoryMessageIdManager.class).in(Scopes.SINGLETON);
bind(MailboxEventDispatcher.class).in(Scopes.SINGLETON);
+ bind(StoreAttachmentManager.class).in(Scopes.SINGLETON);
}
@Provides @Named(Names.MAILBOXMANAGER_NAME) @Singleton
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index f762e63..44fdf85 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -46,6 +46,17 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-jmap</artifactId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-lmtp</artifactId>
<version>3.0.0-beta6-SNAPSHOT</version>
</dependency>
@@ -88,6 +99,7 @@
<module>jpa-guice</module>
<module>onami</module>
<module>protocols/imap</module>
+ <module>protocols/jmap</module>
<module>protocols/lmtp</module>
<module>protocols/managedsieve</module>
<module>protocols/pop</module>
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/protocols/jmap/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/jmap/pom.xml b/server/container/guice/protocols/jmap/pom.xml
new file mode 100644
index 0000000..b9f9d75
--- /dev/null
+++ b/server/container/guice/protocols/jmap/pom.xml
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>james-server-guice</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>james-server-guice-jmap</artifactId>
+
+ <name>Apache James :: Server :: Guice :: Jmap</name>
+ <description>Jmap modules for Guice implementation of James server</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-mailet-base</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-mailet-base</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-mailet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-jmap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>animal-sniffer-java-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java18</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check_java_8</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/protocols/jmap/src/main/java/org/apache/james/JmapServer.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/JmapServer.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/JmapServer.java
new file mode 100644
index 0000000..218c879
--- /dev/null
+++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/JmapServer.java
@@ -0,0 +1,26 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james;
+
+import org.apache.james.utils.JmapGuiceProbe;
+
+public interface JmapServer {
+ JmapGuiceProbe getJmapProbe();
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPCommonModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPCommonModule.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPCommonModule.java
new file mode 100644
index 0000000..c9d7678
--- /dev/null
+++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPCommonModule.java
@@ -0,0 +1,91 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.jmap;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.james.jmap.api.AccessTokenManager;
+import org.apache.james.jmap.api.SimpleTokenFactory;
+import org.apache.james.jmap.api.SimpleTokenManager;
+import org.apache.james.jmap.api.access.AccessTokenRepository;
+import org.apache.james.jmap.crypto.AccessTokenManagerImpl;
+import org.apache.james.jmap.crypto.JamesSignatureHandler;
+import org.apache.james.jmap.crypto.SignatureHandler;
+import org.apache.james.jmap.crypto.SignedTokenFactory;
+import org.apache.james.jmap.crypto.SignedTokenManager;
+import org.apache.james.jmap.model.MailboxFactory;
+import org.apache.james.jmap.model.MessageContentExtractor;
+import org.apache.james.jmap.model.MessageFactory;
+import org.apache.james.jmap.model.MessagePreviewGenerator;
+import org.apache.james.jmap.send.MailFactory;
+import org.apache.james.jmap.send.MailSpool;
+import org.apache.james.jmap.utils.HeadersAuthenticationExtractor;
+import org.apache.james.util.date.DefaultZonedDateTimeProvider;
+import org.apache.james.util.date.ZonedDateTimeProvider;
+import org.apache.mailet.base.AutomaticallySentMailDetector;
+import org.apache.mailet.base.AutomaticallySentMailDetectorImpl;
+
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.name.Names;
+
+public class JMAPCommonModule extends AbstractModule {
+
+ private static final long DEFAULT_TOKEN_EXPIRATION_IN_MS = TimeUnit.MILLISECONDS.convert(15, TimeUnit.MINUTES);
+
+ @Override
+ protected void configure() {
+ bind(JamesSignatureHandler.class).in(Scopes.SINGLETON);
+ bind(DefaultZonedDateTimeProvider.class).in(Scopes.SINGLETON);
+ bind(SignedTokenManager.class).in(Scopes.SINGLETON);
+ bind(AccessTokenManagerImpl.class).in(Scopes.SINGLETON);
+ bind(MailSpool.class).in(Scopes.SINGLETON);
+ bind(MailFactory.class).in(Scopes.SINGLETON);
+ bind(AutomaticallySentMailDetectorImpl.class).in(Scopes.SINGLETON);
+ bind(MailboxFactory.class).in(Scopes.SINGLETON);
+ bind(MessageFactory.class).in(Scopes.SINGLETON);
+ bind(MessagePreviewGenerator.class).in(Scopes.SINGLETON);
+ bind(MessageContentExtractor.class).in(Scopes.SINGLETON);
+ bind(HeadersAuthenticationExtractor.class).in(Scopes.SINGLETON);
+
+ bind(SignatureHandler.class).to(JamesSignatureHandler.class);
+ bind(ZonedDateTimeProvider.class).to(DefaultZonedDateTimeProvider.class);
+ bind(SimpleTokenManager.class).to(SignedTokenManager.class);
+ bind(SimpleTokenFactory.class).to(SignedTokenFactory.class);
+ bind(AutomaticallySentMailDetector.class).to(AutomaticallySentMailDetectorImpl.class);
+
+ bindConstant().annotatedWith(Names.named(AccessTokenRepository.TOKEN_EXPIRATION_IN_MS)).to(DEFAULT_TOKEN_EXPIRATION_IN_MS);
+ bind(AccessTokenManager.class).to(AccessTokenManagerImpl.class);
+ }
+
+ @Provides
+ public List<AuthenticationStrategy> authStrategies(
+ AccessTokenAuthenticationStrategy accessTokenAuthenticationStrategy,
+ JWTAuthenticationStrategy jwtAuthenticationStrategy,
+ QueryParameterAccessTokenAuthenticationStrategy queryParameterAuthenticationStrategy) {
+
+ return ImmutableList.of(
+ jwtAuthenticationStrategy,
+ accessTokenAuthenticationStrategy,
+ queryParameterAuthenticationStrategy);
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java
new file mode 100644
index 0000000..7269cb1
--- /dev/null
+++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java
@@ -0,0 +1,142 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.jmap;
+
+import java.io.IOException;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Optional;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.io.FileUtils;
+import org.apache.james.filesystem.api.FileSystem;
+import org.apache.james.jmap.mailet.VacationMailet;
+import org.apache.james.jmap.methods.RequestHandler;
+import org.apache.james.jmap.send.PostDequeueDecoratorFactory;
+import org.apache.james.jmap.utils.HtmlTextExtractor;
+import org.apache.james.jmap.utils.MailboxBasedHtmlTextExtractor;
+import org.apache.james.jmap.utils.SystemMailboxesProvider;
+import org.apache.james.jmap.utils.SystemMailboxesProviderImpl;
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.MailboxManager.SearchCapabilities;
+import org.apache.james.mailetcontainer.impl.MatcherMailetPair;
+import org.apache.james.modules.server.CamelMailetContainerModule;
+import org.apache.james.queue.api.MailQueueItemDecoratorFactory;
+import org.apache.james.transport.matchers.RecipientIsLocal;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.PropertiesProvider;
+
+import com.github.fge.lambdas.Throwing;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class JMAPModule extends AbstractModule {
+ private static final int DEFAULT_JMAP_PORT = 80;
+
+ @Override
+ protected void configure() {
+ install(new JMAPCommonModule());
+ install(new MethodsModule());
+ bind(JMAPServer.class).in(Scopes.SINGLETON);
+ bind(RequestHandler.class).in(Scopes.SINGLETON);
+ bind(UploadHandler.class).in(Scopes.SINGLETON);
+ bind(MailboxBasedHtmlTextExtractor.class).in(Scopes.SINGLETON);
+ bind(SystemMailboxesProviderImpl.class).in(Scopes.SINGLETON);
+
+ bind(HtmlTextExtractor.class).to(MailboxBasedHtmlTextExtractor.class);
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(RequiredCapabilitiesPrecondition.class);
+
+ Multibinder<CamelMailetContainerModule.TransportProcessorCheck> transportProcessorChecks = Multibinder.newSetBinder(binder(), CamelMailetContainerModule.TransportProcessorCheck.class);
+ transportProcessorChecks.addBinding().to(VacationMailetCheck.class);
+
+ bind(SystemMailboxesProvider.class).to(SystemMailboxesProviderImpl.class);
+ bind(MailQueueItemDecoratorFactory.class).to(PostDequeueDecoratorFactory.class).in(Scopes.SINGLETON);
+ }
+
+ @Provides
+ @Singleton
+ JMAPConfiguration provideConfiguration(PropertiesProvider propertiesProvider, FileSystem fileSystem) throws ConfigurationException, IOException{
+ PropertiesConfiguration configuration = propertiesProvider.getConfiguration("jmap");
+ return JMAPConfiguration.builder()
+ .keystore(configuration.getString("tls.keystoreURL"))
+ .secret(configuration.getString("tls.secret"))
+ .jwtPublicKeyPem(loadPublicKey(fileSystem, Optional.ofNullable(configuration.getString("jwt.publickeypem.url"))))
+ .port(configuration.getInt("jmap.port", DEFAULT_JMAP_PORT))
+ .build();
+ }
+
+ private Optional<String> loadPublicKey(FileSystem fileSystem, Optional<String> jwtPublickeyPemUrl) {
+ return jwtPublickeyPemUrl.map(Throwing.function(url -> FileUtils.readFileToString(fileSystem.getFile(url))));
+ }
+
+ @Singleton
+ public static class RequiredCapabilitiesPrecondition implements ConfigurationPerformer {
+
+ private final MailboxManager mailboxManager;
+
+ @Inject
+ public RequiredCapabilitiesPrecondition(MailboxManager mailboxManager) {
+ this.mailboxManager = mailboxManager;
+ }
+
+ @Override
+ public void initModule() {
+ Preconditions.checkArgument(mailboxManager.hasCapability(MailboxManager.MailboxCapabilities.Move),
+ "MOVE support in MailboxManager is required by JMAP Module");
+
+ EnumSet<MailboxManager.MessageCapabilities> messageCapabilities = mailboxManager.getSupportedMessageCapabilities();
+ Preconditions.checkArgument(messageCapabilities.contains(MailboxManager.MessageCapabilities.Attachment),
+ "Attachment support in MailboxManager is required by JMAP Module");
+ Preconditions.checkArgument(messageCapabilities.contains(MailboxManager.MessageCapabilities.UniqueID),
+ "MessageIdManager is not defined by this Mailbox implementation");
+
+ EnumSet<SearchCapabilities> searchCapabilities = mailboxManager.getSupportedSearchCapabilities();
+ Preconditions.checkArgument(searchCapabilities.contains(MailboxManager.SearchCapabilities.MultimailboxSearch),
+ "Multimailbox search in MailboxManager is required by JMAP Module");
+ Preconditions.checkArgument(searchCapabilities.contains(MailboxManager.SearchCapabilities.Text),
+ "Text support in MailboxManager is required by JMAP Module");
+ }
+
+ @Override
+ public List<Class<? extends Configurable>> forClasses() {
+ return ImmutableList.of();
+ }
+ }
+
+ public static class VacationMailetCheck implements CamelMailetContainerModule.TransportProcessorCheck {
+ @Override
+ public void check(List<MatcherMailetPair> pairs) throws ConfigurationException {
+ Preconditions.checkNotNull(pairs);
+ pairs.stream()
+ .filter(pair -> pair.getMailet().getClass().equals(VacationMailet.class))
+ .filter(pair -> pair.getMatcher().getClass().equals(RecipientIsLocal.class))
+ .findAny()
+ .orElseThrow(() -> new ConfigurationException("Missing " + VacationMailet.class.getName() + " in mailets configuration (mailetcontainer -> processors -> transport)"));
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3d0e2ae7/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/MethodsModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/MethodsModule.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/MethodsModule.java
new file mode 100644
index 0000000..9feb897
--- /dev/null
+++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/MethodsModule.java
@@ -0,0 +1,84 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.jmap;
+
+import org.apache.james.jmap.json.ObjectMapperFactory;
+import org.apache.james.jmap.methods.GetMailboxesMethod;
+import org.apache.james.jmap.methods.GetMessageListMethod;
+import org.apache.james.jmap.methods.GetMessagesMethod;
+import org.apache.james.jmap.methods.GetVacationResponseMethod;
+import org.apache.james.jmap.methods.JmapRequestParser;
+import org.apache.james.jmap.methods.JmapRequestParserImpl;
+import org.apache.james.jmap.methods.JmapResponseWriter;
+import org.apache.james.jmap.methods.JmapResponseWriterImpl;
+import org.apache.james.jmap.methods.Method;
+import org.apache.james.jmap.methods.SetMailboxesCreationProcessor;
+import org.apache.james.jmap.methods.SetMailboxesDestructionProcessor;
+import org.apache.james.jmap.methods.SetMailboxesMethod;
+import org.apache.james.jmap.methods.SetMailboxesProcessor;
+import org.apache.james.jmap.methods.SetMailboxesUpdateProcessor;
+import org.apache.james.jmap.methods.SetMessagesCreationProcessor;
+import org.apache.james.jmap.methods.SetMessagesDestructionProcessor;
+import org.apache.james.jmap.methods.SetMessagesMethod;
+import org.apache.james.jmap.methods.SetMessagesProcessor;
+import org.apache.james.jmap.methods.SetMessagesUpdateProcessor;
+import org.apache.james.jmap.methods.SetVacationResponseMethod;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Scopes;
+import com.google.inject.multibindings.Multibinder;
+import com.google.inject.name.Names;
+
+public class MethodsModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ bind(JmapRequestParserImpl.class).in(Scopes.SINGLETON);
+ bind(JmapResponseWriterImpl.class).in(Scopes.SINGLETON);
+ bind(ObjectMapperFactory.class).in(Scopes.SINGLETON);
+
+ bind(JmapRequestParser.class).to(JmapRequestParserImpl.class);
+ bind(JmapResponseWriter.class).to(JmapResponseWriterImpl.class);
+
+ bindConstant().annotatedWith(Names.named(GetMessageListMethod.MAXIMUM_LIMIT)).to(GetMessageListMethod.DEFAULT_MAXIMUM_LIMIT);
+
+ Multibinder<Method> methods = Multibinder.newSetBinder(binder(), Method.class);
+ methods.addBinding().to(GetMailboxesMethod.class);
+ methods.addBinding().to(GetMessageListMethod.class);
+ methods.addBinding().to(GetMessagesMethod.class);
+ methods.addBinding().to(SetMessagesMethod.class);
+ methods.addBinding().to(SetMailboxesMethod.class);
+ methods.addBinding().to(GetVacationResponseMethod.class);
+ methods.addBinding().to(SetVacationResponseMethod.class);
+
+ Multibinder<SetMailboxesProcessor> setMailboxesProcessor =
+ Multibinder.newSetBinder(binder(), SetMailboxesProcessor.class);
+ setMailboxesProcessor.addBinding().to(SetMailboxesCreationProcessor.class);
+ setMailboxesProcessor.addBinding().to(SetMailboxesUpdateProcessor.class);
+ setMailboxesProcessor.addBinding().to(SetMailboxesDestructionProcessor.class);
+
+ Multibinder<SetMessagesProcessor> setMessagesProcessors =
+ Multibinder.newSetBinder(binder(), SetMessagesProcessor.class);
+ setMessagesProcessors.addBinding().to(SetMessagesUpdateProcessor.class);
+ setMessagesProcessors.addBinding().to(SetMessagesCreationProcessor.class);
+ setMessagesProcessors.addBinding().to(SetMessagesDestructionProcessor.class);
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[14/21] james-project git commit: JAMES-1902 create managedsieve
module
Posted by bt...@apache.org.
JAMES-1902 create managedsieve module
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/dc032519
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/dc032519
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/dc032519
Branch: refs/heads/master
Commit: dc0325198570bc62e14a8ed9536528183659410b
Parents: 1a986e1
Author: Matthieu Baechler <ma...@gmail.com>
Authored: Tue Dec 27 14:32:55 2016 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
server/container/guice/guice-common/pom.xml | 12 +-
.../protocols/ManageSieveServerModule.java | 77 --------
server/container/guice/pom.xml | 6 +
.../guice/protocols/managedsieve/pom.xml | 188 +++++++++++++++++++
.../protocols/ManageSieveServerModule.java | 77 ++++++++
5 files changed, 275 insertions(+), 85 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/dc032519/server/container/guice/guice-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/pom.xml b/server/container/guice/guice-common/pom.xml
index 702fade..1576d90 100644
--- a/server/container/guice/guice-common/pom.xml
+++ b/server/container/guice/guice-common/pom.xml
@@ -197,6 +197,10 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-managedsieve</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-smtp</artifactId>
</dependency>
<dependency>
@@ -237,10 +241,6 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>james-server-protocols-managesieve</artifactId>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
<artifactId>james-server-protocols-pop3</artifactId>
</dependency>
<dependency>
@@ -268,10 +268,6 @@
<artifactId>protocols-imap</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.james.protocols</groupId>
- <artifactId>protocols-managesieve</artifactId>
- </dependency>
- <dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/dc032519/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
deleted file mode 100644
index 539dba6..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.modules.protocols;
-
-import java.util.List;
-
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.managesieve.api.commands.CoreCommands;
-import org.apache.james.managesieve.core.CoreProcessor;
-import org.apache.james.managesieveserver.netty.ManageSieveServerFactory;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.ConfigurationProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-
-public class ManageSieveServerModule extends AbstractModule {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ManageSieveServerModule.class);
-
- @Override
- protected void configure() {
- bind(CoreCommands.class).to(CoreProcessor.class);
- Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(ManageSieveModuleConfigurationPerformer.class);
- }
-
- @Singleton
- public static class ManageSieveModuleConfigurationPerformer implements ConfigurationPerformer {
-
- private final ConfigurationProvider configurationProvider;
- private final ManageSieveServerFactory manageSieveServerFactory;
-
- @Inject
- public ManageSieveModuleConfigurationPerformer(ConfigurationProvider configurationProvider, ManageSieveServerFactory manageSieveServerFactory) {
- this.configurationProvider = configurationProvider;
- this.manageSieveServerFactory = manageSieveServerFactory;
- }
-
- @Override
- public void initModule() {
- try {
- manageSieveServerFactory.setLog(LOGGER);
- manageSieveServerFactory.configure(configurationProvider.getConfiguration("managesieveserver"));
- manageSieveServerFactory.init();
- } catch (Exception e) {
- Throwables.propagate(e);
- }
- }
-
- @Override
- public List<Class<? extends Configurable>> forClasses() {
- return ImmutableList.of(ManageSieveServerFactory.class);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/dc032519/server/container/guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 9cd80d5..7c712cd 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -56,6 +56,11 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-managedsieve</artifactId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-guice-pop</artifactId>
<version>3.0.0-beta6-SNAPSHOT</version>
</dependency>
@@ -78,6 +83,7 @@
<module>onami</module>
<module>protocols/imap</module>
<module>protocols/lmtp</module>
+ <module>protocols/managedsieve</module>
<module>protocols/pop</module>
<module>protocols/smtp</module>
</modules>
http://git-wip-us.apache.org/repos/asf/james-project/blob/dc032519/server/container/guice/protocols/managedsieve/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/managedsieve/pom.xml b/server/container/guice/protocols/managedsieve/pom.xml
new file mode 100644
index 0000000..6f97529
--- /dev/null
+++ b/server/container/guice/protocols/managedsieve/pom.xml
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>james-server-guice</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>james-server-guice-managedsieve</artifactId>
+
+ <name>Apache James :: Server :: Guice :: Managedsieve</name>
+ <description>Managedsieve modules for Guice implementation of James server</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-protocols-managesieve</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james.protocols</groupId>
+ <artifactId>protocols-managesieve</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>animal-sniffer-java-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java18</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check_java_8</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/dc032519/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
new file mode 100644
index 0000000..539dba6
--- /dev/null
+++ b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
@@ -0,0 +1,77 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.modules.protocols;
+
+import java.util.List;
+
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.managesieve.api.commands.CoreCommands;
+import org.apache.james.managesieve.core.CoreProcessor;
+import org.apache.james.managesieveserver.netty.ManageSieveServerFactory;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class ManageSieveServerModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ManageSieveServerModule.class);
+
+ @Override
+ protected void configure() {
+ bind(CoreCommands.class).to(CoreProcessor.class);
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(ManageSieveModuleConfigurationPerformer.class);
+ }
+
+ @Singleton
+ public static class ManageSieveModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final ManageSieveServerFactory manageSieveServerFactory;
+
+ @Inject
+ public ManageSieveModuleConfigurationPerformer(ConfigurationProvider configurationProvider, ManageSieveServerFactory manageSieveServerFactory) {
+ this.configurationProvider = configurationProvider;
+ this.manageSieveServerFactory = manageSieveServerFactory;
+ }
+
+ @Override
+ public void initModule() {
+ try {
+ manageSieveServerFactory.setLog(LOGGER);
+ manageSieveServerFactory.configure(configurationProvider.getConfiguration("managesieveserver"));
+ manageSieveServerFactory.init();
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ }
+
+ @Override
+ public List<Class<? extends Configurable>> forClasses() {
+ return ImmutableList.of(ManageSieveServerFactory.class);
+ }
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[19/21] james-project git commit: JAMES-1902 create a smtp only
project that pulls only required dependencies
Posted by bt...@apache.org.
JAMES-1902 create a smtp only project that pulls only required dependencies
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/61e1bdca
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/61e1bdca
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/61e1bdca
Branch: refs/heads/master
Commit: 61e1bdca30c8a9d21a86e5baa46b25a7787fe741
Parents: 793dae7
Author: Matthieu Baechler <ma...@gmail.com>
Authored: Mon Jan 30 11:03:49 2017 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
server/container/guice/jpa-common-guice/pom.xml | 318 ++++++++++++++++++
.../james/modules/data/JPADataModule.java | 32 ++
.../james/modules/data/JPADomainListModule.java | 77 +++++
.../data/JPARecipientRewriteTableModule.java | 78 +++++
.../modules/data/JPAUsersRepositoryModule.java | 79 +++++
server/container/guice/jpa-guice/pom.xml | 4 +
.../james/modules/data/JPADataModule.java | 32 --
.../james/modules/data/JPADomainListModule.java | 77 -----
.../data/JPARecipientRewriteTableModule.java | 78 -----
.../modules/data/JPAUsersRepositoryModule.java | 79 -----
server/container/guice/jpa-smtp/README.adoc | 40 +++
server/container/guice/jpa-smtp/pom.xml | 321 +++++++++++++++++++
.../sample-configuration/dnsservice.xml | 29 ++
.../sample-configuration/domainlist.xml | 28 ++
.../james-database.properties | 40 +++
.../sample-configuration/jmx.properties | 28 ++
.../sample-configuration/mailetcontainer.xml | 137 ++++++++
.../mailrepositorystore.xml | 34 ++
.../recipientrewritetable.xml | 27 ++
.../sample-configuration/smtpserver.xml | 105 ++++++
.../sample-configuration/usersrepository.xml | 27 ++
.../java/org/apache/james/JPAConfiguration.java | 66 ++++
.../org/apache/james/JPAJamesServerMain.java | 53 +++
.../src/main/resources/META-INF/persistence.xml | 41 +++
.../jpa-smtp/src/main/resources/logback.xml | 22 ++
.../org/apache/james/JPAJamesServerTest.java | 94 ++++++
.../james/TestJPAConfigurationModule.java | 48 +++
.../jpa-smtp/src/test/resources/dnsservice.xml | 29 ++
.../test/resources/fakemailrepositorystore.xml | 31 ++
.../guice/jpa-smtp/src/test/resources/keystore | Bin 0 -> 2245 bytes
.../src/test/resources/mailetcontainer.xml | 123 +++++++
.../src/test/resources/mailrepositorystore.xml | 31 ++
.../src/test/resources/managesieveserver.xml | 65 ++++
.../jpa-smtp/src/test/resources/smtpserver.xml | 105 ++++++
server/container/guice/pom.xml | 7 +
35 files changed, 2119 insertions(+), 266 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-common-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-common-guice/pom.xml b/server/container/guice/jpa-common-guice/pom.xml
new file mode 100644
index 0000000..34af8d0
--- /dev/null
+++ b/server/container/guice/jpa-common-guice/pom.xml
@@ -0,0 +1,318 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice</artifactId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>james-server-jpa-common-guice</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Apache James :: Server :: JPA - guice common</name>
+
+ <properties>
+ <jpa.includes>empty</jpa.includes>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/${project.artifactId}.lib</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <finalName>${project.artifactId}</finalName>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>${project.artifactId}.lib/</classpathPrefix>
+ <mainClass>org.apache.james.JPAJamesServerMain</mainClass>
+ <useUniqueVersions>false</useUniqueVersions>
+ </manifest>
+ </archive>
+ </configuration>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-james-mailbox-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-james-mailbox-jpa</artifactId>
+ <scope>test</scope>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-james-mailbox-lucene</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-data-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-common</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.1.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.jayway.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.jayway.restassured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.nurkiewicz.asyncretry</groupId>
+ <artifactId>asyncretry</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>${assertj-3.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jpa</id>
+ <properties>
+ <jpa.includes>**/*.java</jpa.includes>
+ </properties>
+ </profile>
+ <profile>
+ <id>animal-sniffer-java-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java18</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check_java_8</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/suite/*.java</exclude>
+ <exclude>**/suite/**/*.java</exclude>
+ </excludes>
+ <includes>
+ <include>${jpa.includes}</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java
new file mode 100644
index 0000000..ec8023e
--- /dev/null
+++ b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java
@@ -0,0 +1,32 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.modules.data;
+
+import com.google.inject.AbstractModule;
+
+public class JPADataModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ install(new JPAUsersRepositoryModule());
+ install(new JPADomainListModule());
+ install(new JPARecipientRewriteTableModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java
new file mode 100644
index 0000000..4bb0030
--- /dev/null
+++ b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java
@@ -0,0 +1,77 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.modules.data;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Scopes;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.domainlist.jpa.JPADomainList;
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+public class JPADomainListModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(DomainList.class);
+
+ @Override
+ public void configure() {
+ bind(JPADomainList.class).in(Scopes.SINGLETON);
+ bind(DomainList.class).to(JPADomainList.class);
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JPADomainListConfigurationPerformer.class);
+ }
+
+ @Singleton
+ public static class JPADomainListConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final JPADomainList jpaDomainList;
+
+ @Inject
+ public JPADomainListConfigurationPerformer(ConfigurationProvider configurationProvider, JPADomainList jpaDomainList) {
+ this.configurationProvider = configurationProvider;
+ this.jpaDomainList = jpaDomainList;
+ }
+
+ @Override
+ public void initModule() {
+ try {
+ jpaDomainList.setLog(LOGGER);
+ jpaDomainList.configure(configurationProvider.getConfiguration("domainlist"));
+ } catch (ConfigurationException e) {
+ Throwables.propagate(e);
+ }
+ }
+
+ @Override
+ public List<Class<? extends Configurable>> forClasses() {
+ return ImmutableList.of(JPADomainList.class);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java
new file mode 100644
index 0000000..a1f55b3
--- /dev/null
+++ b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java
@@ -0,0 +1,78 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.modules.data;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Scopes;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.rrt.api.RecipientRewriteTable;
+import org.apache.james.rrt.jpa.JPARecipientRewriteTable;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+public class JPARecipientRewriteTableModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(RecipientRewriteTable.class);
+
+ @Override
+ public void configure() {
+ bind(JPARecipientRewriteTable.class).in(Scopes.SINGLETON);
+ bind(RecipientRewriteTable.class).to(JPARecipientRewriteTable.class);
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JPARecipientRewriteTablePerformer.class);
+ }
+
+ @Singleton
+ public static class JPARecipientRewriteTablePerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final JPARecipientRewriteTable recipientRewriteTable;
+
+ @Inject
+ public JPARecipientRewriteTablePerformer(ConfigurationProvider configurationProvider, JPARecipientRewriteTable recipientRewriteTable) {
+ this.configurationProvider = configurationProvider;
+ this.recipientRewriteTable = recipientRewriteTable;
+ }
+
+ @Override
+ public void initModule() {
+ try {
+ recipientRewriteTable.setLog(LOGGER);
+ recipientRewriteTable.configure(configurationProvider.getConfiguration("recipientrewritetable"));
+ } catch (ConfigurationException e) {
+ Throwables.propagate(e);
+ }
+ }
+
+ @Override
+ public List<Class<? extends Configurable>> forClasses() {
+ return ImmutableList.of(JPARecipientRewriteTable.class);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java
new file mode 100644
index 0000000..ca26073
--- /dev/null
+++ b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java
@@ -0,0 +1,79 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james.modules.data;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Scopes;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.user.api.UsersRepository;
+import org.apache.james.user.jpa.JPAUsersRepository;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+public class JPAUsersRepositoryModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(JPAUsersRepositoryModule.class);
+
+ @Override
+ public void configure() {
+ bind(JPAUsersRepository.class).in(Scopes.SINGLETON);
+ bind(UsersRepository.class).to(JPAUsersRepository.class);
+
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JPAUsersRepositoryConfigurationPerformer.class);
+ }
+
+ @Singleton
+ public static class JPAUsersRepositoryConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final JPAUsersRepository usersRepository;
+
+ @Inject
+ public JPAUsersRepositoryConfigurationPerformer(ConfigurationProvider configurationProvider, JPAUsersRepository usersRepository) {
+ this.configurationProvider = configurationProvider;
+ this.usersRepository = usersRepository;
+ }
+
+ @Override
+ public void initModule() {
+ try {
+ usersRepository.setLog(LOGGER);
+ usersRepository.configure(configurationProvider.getConfiguration("usersrepository"));
+ } catch (ConfigurationException e) {
+ Throwables.propagate(e);
+ }
+ }
+
+ @Override
+ public List<Class<? extends Configurable>> forClasses() {
+ return ImmutableList.of(JPAUsersRepository.class);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/pom.xml b/server/container/guice/jpa-guice/pom.xml
index f02b70c..07ca6bf 100644
--- a/server/container/guice/jpa-guice/pom.xml
+++ b/server/container/guice/jpa-guice/pom.xml
@@ -226,6 +226,10 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-jpa-common-guice</artifactId>
+ </dependency>
+ <dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java
deleted file mode 100644
index ec8023e..0000000
--- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.modules.data;
-
-import com.google.inject.AbstractModule;
-
-public class JPADataModule extends AbstractModule {
-
- @Override
- protected void configure() {
- install(new JPAUsersRepositoryModule());
- install(new JPADomainListModule());
- install(new JPARecipientRewriteTableModule());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java
deleted file mode 100644
index 4bb0030..0000000
--- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.modules.data;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Scopes;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.domainlist.api.DomainList;
-import org.apache.james.domainlist.jpa.JPADomainList;
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.ConfigurationProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-public class JPADomainListModule extends AbstractModule {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(DomainList.class);
-
- @Override
- public void configure() {
- bind(JPADomainList.class).in(Scopes.SINGLETON);
- bind(DomainList.class).to(JPADomainList.class);
- Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JPADomainListConfigurationPerformer.class);
- }
-
- @Singleton
- public static class JPADomainListConfigurationPerformer implements ConfigurationPerformer {
-
- private final ConfigurationProvider configurationProvider;
- private final JPADomainList jpaDomainList;
-
- @Inject
- public JPADomainListConfigurationPerformer(ConfigurationProvider configurationProvider, JPADomainList jpaDomainList) {
- this.configurationProvider = configurationProvider;
- this.jpaDomainList = jpaDomainList;
- }
-
- @Override
- public void initModule() {
- try {
- jpaDomainList.setLog(LOGGER);
- jpaDomainList.configure(configurationProvider.getConfiguration("domainlist"));
- } catch (ConfigurationException e) {
- Throwables.propagate(e);
- }
- }
-
- @Override
- public List<Class<? extends Configurable>> forClasses() {
- return ImmutableList.of(JPADomainList.class);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java
deleted file mode 100644
index a1f55b3..0000000
--- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.modules.data;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Scopes;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.rrt.api.RecipientRewriteTable;
-import org.apache.james.rrt.jpa.JPARecipientRewriteTable;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.ConfigurationProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-public class JPARecipientRewriteTableModule extends AbstractModule {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(RecipientRewriteTable.class);
-
- @Override
- public void configure() {
- bind(JPARecipientRewriteTable.class).in(Scopes.SINGLETON);
- bind(RecipientRewriteTable.class).to(JPARecipientRewriteTable.class);
- Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JPARecipientRewriteTablePerformer.class);
- }
-
- @Singleton
- public static class JPARecipientRewriteTablePerformer implements ConfigurationPerformer {
-
- private final ConfigurationProvider configurationProvider;
- private final JPARecipientRewriteTable recipientRewriteTable;
-
- @Inject
- public JPARecipientRewriteTablePerformer(ConfigurationProvider configurationProvider, JPARecipientRewriteTable recipientRewriteTable) {
- this.configurationProvider = configurationProvider;
- this.recipientRewriteTable = recipientRewriteTable;
- }
-
- @Override
- public void initModule() {
- try {
- recipientRewriteTable.setLog(LOGGER);
- recipientRewriteTable.configure(configurationProvider.getConfiguration("recipientrewritetable"));
- } catch (ConfigurationException e) {
- Throwables.propagate(e);
- }
- }
-
- @Override
- public List<Class<? extends Configurable>> forClasses() {
- return ImmutableList.of(JPARecipientRewriteTable.class);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java
deleted file mode 100644
index ca26073..0000000
--- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.modules.data;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Scopes;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.jpa.JPAUsersRepository;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.ConfigurationProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-public class JPAUsersRepositoryModule extends AbstractModule {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(JPAUsersRepositoryModule.class);
-
- @Override
- public void configure() {
- bind(JPAUsersRepository.class).in(Scopes.SINGLETON);
- bind(UsersRepository.class).to(JPAUsersRepository.class);
-
- Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JPAUsersRepositoryConfigurationPerformer.class);
- }
-
- @Singleton
- public static class JPAUsersRepositoryConfigurationPerformer implements ConfigurationPerformer {
-
- private final ConfigurationProvider configurationProvider;
- private final JPAUsersRepository usersRepository;
-
- @Inject
- public JPAUsersRepositoryConfigurationPerformer(ConfigurationProvider configurationProvider, JPAUsersRepository usersRepository) {
- this.configurationProvider = configurationProvider;
- this.usersRepository = usersRepository;
- }
-
- @Override
- public void initModule() {
- try {
- usersRepository.setLog(LOGGER);
- usersRepository.configure(configurationProvider.getConfiguration("usersrepository"));
- } catch (ConfigurationException e) {
- Throwables.propagate(e);
- }
- }
-
- @Override
- public List<Class<? extends Configurable>> forClasses() {
- return ImmutableList.of(JPAUsersRepository.class);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/README.adoc
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/README.adoc b/server/container/guice/jpa-smtp/README.adoc
new file mode 100644
index 0000000..bedf715
--- /dev/null
+++ b/server/container/guice/jpa-smtp/README.adoc
@@ -0,0 +1,40 @@
+= Guice-JPA Module How-to
+
+== Building
+
+=== Requirements
+
+ * Java 8 SDK
+ * Docker
+ * Maven
+
+=== Building the artifacts
+
+An usual compilation using maven will produce two artifacts into target directory :
+
+ * james-server-jpa-smtp-${version}.jar
+ * james-server-jpa-smtp-${version}.lib
+
+== Running
+
+=== Requirements
+
+=== James Launch
+
+To run james, you have to create a directory containing required configuration files.
+
+A sample directory (appropriately named sample-directory) is provided with some
+default value you may need to replace.
+
+You also need to generate a keystore with the following command :
+[source]
+----
+$ keytool -genkey -alias james -keyalg RSA -keystore conf/keystore
+----
+
+Once everything is set up, you just have to run the jar with :
+
+[source]
+----
+$ java -Dworking.directory=sample-configuration -jar target/james-server-jpa-smtp-${version}.jar
+----
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/pom.xml b/server/container/guice/jpa-smtp/pom.xml
new file mode 100644
index 0000000..430fb8f
--- /dev/null
+++ b/server/container/guice/jpa-smtp/pom.xml
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-guice</artifactId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>james-server-jpa-smtp-guice</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Apache James :: Server :: JPA + SMTP - guice injection</name>
+ <description>An advanced email server - JPA backend for SMTP with guice injection</description>
+
+ <properties>
+ <jpa.includes>empty</jpa.includes>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/${project.artifactId}.lib</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <finalName>${project.artifactId}</finalName>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>${project.artifactId}.lib/</classpathPrefix>
+ <mainClass>org.apache.james.JPAJamesServerMain</mainClass>
+ <useUniqueVersions>false</useUniqueVersions>
+ </manifest>
+ </archive>
+ </configuration>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-james-backends-jpa</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-data-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-common</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-jpa-common-guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.1.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.jayway.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.jayway.restassured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.nurkiewicz.asyncretry</groupId>
+ <artifactId>asyncretry</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>${assertj-3.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jpa</id>
+ <properties>
+ <jpa.includes>**/*.java</jpa.includes>
+ </properties>
+ </profile>
+ <profile>
+ <id>animal-sniffer-java-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java18</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check_java_8</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/suite/*.java</exclude>
+ <exclude>**/suite/**/*.java</exclude>
+ </excludes>
+ <includes>
+ <include>${jpa.includes}</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/dnsservice.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/sample-configuration/dnsservice.xml b/server/container/guice/jpa-smtp/sample-configuration/dnsservice.xml
new file mode 100644
index 0000000..0978a00
--- /dev/null
+++ b/server/container/guice/jpa-smtp/sample-configuration/dnsservice.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<dnsservice>
+ <servers>
+ <server>8.8.8.8</server>
+ <server>62.210.16.6</server>
+ </servers>
+ <autodiscover>false</autodiscover>
+ <authoritative>false</authoritative>
+ <maxcachesize>50000</maxcachesize>
+</dnsservice>
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/domainlist.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/sample-configuration/domainlist.xml b/server/container/guice/jpa-smtp/sample-configuration/domainlist.xml
new file mode 100644
index 0000000..8d00118
--- /dev/null
+++ b/server/container/guice/jpa-smtp/sample-configuration/domainlist.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<domainlist class="org.apache.james.domainlist.jpa.JPADomainList">
+ <domainnames>
+ <domainname>james.apache.org</domainname>
+ </domainnames>
+ <autodetect>true</autodetect>
+ <autodetectIP>true</autodetectIP>
+ <defaultDomain>localhost</defaultDomain>
+</domainlist>
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/james-database.properties
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/sample-configuration/james-database.properties b/server/container/guice/jpa-smtp/sample-configuration/james-database.properties
new file mode 100644
index 0000000..b3ac7eb
--- /dev/null
+++ b/server/container/guice/jpa-smtp/sample-configuration/james-database.properties
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# This template file can be used as example for James Server configuration
+# DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+
+# See http://james.apache.org/server/3/config.html for usage
+
+# Use derby as default
+database.driverClassName=org.apache.derby.jdbc.EmbeddedDriver
+database.url=jdbc:derby:../var/store/derby;create=true
+database.username=app
+database.password=app
+
+# Supported adapters are:
+# DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE
+vendorAdapter.database=DERBY
+
+# Use streaming for Blobs
+# This is only supported on a limited set of databases atm. You should check if its supported by your DB before enable
+# it.
+#
+# See:
+# http://openjpa.apache.org/builds/latest/docs/manual/ref_guide_mapping_jpa.html #7.11. LOB Streaming
+#
+openjpa.streaming=false
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/jmx.properties
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/sample-configuration/jmx.properties b/server/container/guice/jpa-smtp/sample-configuration/jmx.properties
new file mode 100644
index 0000000..a1dbdf8
--- /dev/null
+++ b/server/container/guice/jpa-smtp/sample-configuration/jmx.properties
@@ -0,0 +1,28 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# This template file can be used as example for James Server configuration
+# DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+
+# This template file can be used as example for James Server configuration
+# DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+
+# See http://james.apache.org/server/3/config.html for usage
+
+jmx.address=127.0.0.1
+jmx.port=9999
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/mailetcontainer.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/sample-configuration/mailetcontainer.xml b/server/container/guice/jpa-smtp/sample-configuration/mailetcontainer.xml
new file mode 100644
index 0000000..968b59c
--- /dev/null
+++ b/server/container/guice/jpa-smtp/sample-configuration/mailetcontainer.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<mailetcontainer enableJmx="true">
+
+ <context>
+ <postmaster>postmaster@james.minet.net</postmaster>
+ </context>
+
+ <spooler>
+ <threads>20</threads>
+ </spooler>
+
+ <processors>
+ <processor state="root" enableJmx="true">
+ <mailet match="All" class="PostmasterAlias"/>
+ <mailet match="RelayLimit=30" class="Null"/>
+ <!-- Hook on sievemanager@james.linagora.com
+ Mail send to this address will get interpreted with SIEVE Manage -->
+ <mailet match="RecipientIs=sievemanager@james.linagora.com" class="ToProcessor">
+ <processor>sieve-manager-check</processor>
+ </mailet>
+ <mailet match="HasMailAttribute=spamChecked" class="ToProcessor">
+ <processor>transport</processor>
+ </mailet>
+ <mailet match="All" class="SetMailAttribute">
+ <spamChecked>true</spamChecked>
+ </mailet>
+ <mailet match="SMTPAuthSuccessful" class="ToProcessor">
+ <processor>transport</processor>
+ </mailet>
+ <mailet match="InSpammerBlacklist=query.bondedsender.org." class="ToProcessor">
+ <processor>transport</processor>
+ </mailet>
+ <!-- Check for delivery from a known spam server -->
+ <!-- This set of matchers/mailets redirect all emails from known -->
+ <!-- black holes, open relays, and spam servers to the spam processor -->
+ <!-- For this set to function properly, the spam processor must be configured. -->
+ <mailet match="InSpammerBlacklist=dnsbl.njabl.org." class="ToProcessor">
+ <processor>spam</processor>
+ <notice>550 Requested action not taken: rejected - see http://njabl.org/</notice>
+ </mailet>
+ <mailet match="All" class="ToProcessor">
+ <processor>transport</processor>
+ </mailet>
+ </processor>
+
+ <processor state="error" enableJmx="true">
+ <mailet match="All" class="Bounce"/>
+ <mailet match="All" class="ToRepository">
+ <repositoryPath>file://var/mail/error/</repositoryPath>
+ </mailet>
+ </processor>
+
+
+ <processor state="transport" enableJmx="true">
+ <mailet match="SMTPAuthSuccessful" class="SetMimeHeader">
+ <name>X-UserIsAuth</name>
+ <value>true</value>
+ </mailet>
+ <mailet match="HasMailAttribute=org.apache.james.SMIMECheckSignature" class="SetMimeHeader">
+ <name>X-WasSigned</name>
+ <value>true</value>
+ </mailet>
+ <mailet match="All" class="RecipientRewriteTable" />
+ <mailet match="RecipientIsLocal" class="LocalDelivery"/>
+ <mailet match="HostIsLocal" class="ToProcessor">
+ <processor>local-address-error</processor>
+ <notice>550 - Requested action not taken: no such user here</notice>
+ </mailet>
+ <mailet match="SMTPAuthSuccessful" class="RemoteDelivery">
+ <outgoingQueue>outgoing</outgoingQueue>
+ <delayTime>5000, 100000, 500000</delayTime>
+ <maxRetries>25</maxRetries>
+ <maxDnsProblemRetries>0</maxDnsProblemRetries>
+ <deliveryThreads>10</deliveryThreads>
+ <sendpartial>true</sendpartial>
+ <bounceProcessor>bounces</bounceProcessor>
+ </mailet>
+ <mailet match="All" class="ToProcessor">
+ <processor>relay-denied</processor>
+ </mailet>
+ </processor>
+
+ <processor state="spam" enableJmx="true">
+ <mailet match="All" class="ToRepository">
+ <repositoryPath>file://var/mail/spam/</repositoryPath>
+ </mailet>
+ </processor>
+
+ <processor state="local-address-error" enableJmx="true">
+ <mailet match="All" class="Bounce">
+ <attachment>none</attachment>
+ </mailet>
+ <mailet match="All" class="ToRepository">
+ <repositoryPath>file://var/mail/address-error/</repositoryPath>
+ </mailet>
+ </processor>
+
+ <processor state="relay-denied" enableJmx="true">
+ <mailet match="All" class="Bounce">
+ <attachment>none</attachment>
+ </mailet>
+ <mailet match="All" class="ToRepository">
+ <repositoryPath>file://var/mail/relay-denied/</repositoryPath>
+ <notice>Warning: You are sending an e-mail to a remote server. You must be authentified to perform such an operation</notice>
+ </mailet>
+ </processor>
+
+ <processor state="bounces" enableJmx="true">
+ <mailet match="All" class="DSNBounce">
+ <passThrough>false</passThrough>
+ </mailet>
+ </processor>
+ </processors>
+
+</mailetcontainer>
+
+
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/mailrepositorystore.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/sample-configuration/mailrepositorystore.xml b/server/container/guice/jpa-smtp/sample-configuration/mailrepositorystore.xml
new file mode 100644
index 0000000..acca810
--- /dev/null
+++ b/server/container/guice/jpa-smtp/sample-configuration/mailrepositorystore.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<mailrepositorystore>
+ <mailrepositories>
+ <!-- File based repositories. These repositories store all message data -->
+ <!-- in the file system. -->
+ <mailrepository class="org.apache.james.mailrepository.file.FileMailRepository">
+ <protocols>
+ <protocol>file</protocol>
+ </protocols>
+ <!-- Set if the messages should be listed sorted. False by default -->
+ <config FIFO="false" CACHEKEYS="true"/>
+ </mailrepository>
+ </mailrepositories>
+</mailrepositorystore>
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/recipientrewritetable.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/sample-configuration/recipientrewritetable.xml b/server/container/guice/jpa-smtp/sample-configuration/recipientrewritetable.xml
new file mode 100644
index 0000000..7e7f586
--- /dev/null
+++ b/server/container/guice/jpa-smtp/sample-configuration/recipientrewritetable.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<!-- The default table for storing James' RecipientRewriteTable mappings. -->
+<recipientrewritetable class="org.apache.james.rrt.jpa.JPARecipientRewriteTable">
+ <recursiveMapping>true</recursiveMapping>
+ <mappingLimit>10</mappingLimit>
+ <mapping>some@domain=some</mapping>
+</recipientrewritetable>
+
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/smtpserver.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/sample-configuration/smtpserver.xml b/server/container/guice/jpa-smtp/sample-configuration/smtpserver.xml
new file mode 100644
index 0000000..c34fcd1
--- /dev/null
+++ b/server/container/guice/jpa-smtp/sample-configuration/smtpserver.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<smtpservers>
+ <smtpserver enabled="true">
+ <jmxName>smtpserver-global</jmxName>
+ <bind>0.0.0.0:1025</bind>
+ <connectionBacklog>200</connectionBacklog>
+ <tls socketTLS="false" startTLS="false">
+ <keystore>file://conf/keystore</keystore>
+ <secret>james72laBalle</secret>
+ <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+ <algorithm>SunX509</algorithm>
+ </tls>
+ <connectiontimeout>360</connectiontimeout>
+ <connectionLimit>0</connectionLimit>
+ <connectionLimitPerIP>0</connectionLimitPerIP>
+ <authRequired>false</authRequired>
+ <authorizedAddresses>0.0.0.0/0</authorizedAddresses>
+ <verifyIdentity>true</verifyIdentity>
+ <maxmessagesize>0</maxmessagesize>
+ <addressBracketsEnforcement>true</addressBracketsEnforcement>
+ <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting>
+ <handlerchain>
+ <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+ <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+ </handlerchain>
+ </smtpserver>
+ <smtpserver enabled="true">
+ <jmxName>smtpserver-TLS</jmxName>
+ <bind>0.0.0.0:1465</bind>
+ <connectionBacklog>200</connectionBacklog>
+ <tls socketTLS="true" startTLS="false">
+ <keystore>file://conf/keystore</keystore>
+ <secret>james72laBalle</secret>
+ <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+ <algorithm>SunX509</algorithm>
+ </tls>
+ <connectiontimeout>360</connectiontimeout>
+ <connectionLimit>0</connectionLimit>
+ <connectionLimitPerIP>0</connectionLimitPerIP>
+ <!--
+ Authorize only local users
+ -->
+ <authRequired>true</authRequired>
+ <authorizedAddresses>0.0.0.0/0</authorizedAddresses>
+ <!-- Trust authenticated users -->
+ <verifyIdentity>false</verifyIdentity>
+ <maxmessagesize>0</maxmessagesize>
+ <addressBracketsEnforcement>true</addressBracketsEnforcement>
+ <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting>
+ <handlerchain>
+ <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+ <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+ </handlerchain>
+ </smtpserver>
+ <smtpserver enabled="true">
+ <jmxName>smtpserver-authenticated</jmxName>
+ <bind>0.0.0.0:1587</bind>
+ <connectionBacklog>200</connectionBacklog>
+ <tls socketTLS="false" startTLS="true">
+ <keystore>file://conf/keystore</keystore>
+ <secret>james72laBalle</secret>
+ <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+ <algorithm>SunX509</algorithm>
+ </tls>
+ <connectiontimeout>360</connectiontimeout>
+ <connectionLimit>0</connectionLimit>
+ <connectionLimitPerIP>0</connectionLimitPerIP>
+ <!--
+ Authorize only local users
+ -->
+ <authRequired>true</authRequired>
+ <authorizedAddresses>0.0.0.0/0</authorizedAddresses>
+ <!-- Trust authenticated users -->
+ <verifyIdentity>false</verifyIdentity>
+ <maxmessagesize>0</maxmessagesize>
+ <addressBracketsEnforcement>true</addressBracketsEnforcement>
+ <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting>
+ <handlerchain>
+ <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+ <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+ </handlerchain>
+ </smtpserver>
+</smtpservers>
+
+
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/usersrepository.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/sample-configuration/usersrepository.xml b/server/container/guice/jpa-smtp/sample-configuration/usersrepository.xml
new file mode 100644
index 0000000..fc76107
--- /dev/null
+++ b/server/container/guice/jpa-smtp/sample-configuration/usersrepository.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<usersrepository name="LocalUsers" class="org.apache.james.user.jpa.JPAUsersRepository">
+ <destination URL="file://users/"/>
+ <algorithm>MD5</algorithm>
+ <enableVirtualHosting>true</enableVirtualHosting>
+ <enableForwarding>true</enableForwarding>
+</usersrepository>
+
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[12/21] james-project git commit: JAMES-1902 create smtp module
Posted by bt...@apache.org.
JAMES-1902 create smtp module
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/3c5f8abf
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/3c5f8abf
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/3c5f8abf
Branch: refs/heads/master
Commit: 3c5f8abf7210e7c2657d6bba8b0f4d146f8654a7
Parents: 4b20e4d
Author: Matthieu Baechler <ma...@gmail.com>
Authored: Mon Dec 26 19:18:38 2016 +0100
Committer: benwa <bt...@linagora.com>
Committed: Tue Mar 14 18:13:55 2017 +0700
----------------------------------------------------------------------
server/container/guice/guice-common/pom.xml | 4 +
.../modules/protocols/SMTPServerModule.java | 82 ---------
server/container/guice/pom.xml | 6 +
server/container/guice/protocols/smtp/pom.xml | 184 +++++++++++++++++++
.../modules/protocols/SMTPServerModule.java | 82 +++++++++
5 files changed, 276 insertions(+), 82 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/3c5f8abf/server/container/guice/guice-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/pom.xml b/server/container/guice/guice-common/pom.xml
index 50b1bcd..7c192a5 100644
--- a/server/container/guice/guice-common/pom.xml
+++ b/server/container/guice/guice-common/pom.xml
@@ -193,6 +193,10 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-smtp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>james-server-jmap</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/3c5f8abf/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
deleted file mode 100644
index bb5f233..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.modules.protocols;
-
-import java.util.List;
-
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.smtpserver.SendMailHandler;
-import org.apache.james.smtpserver.netty.SMTPServerFactory;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.ConfigurationProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-
-public class SMTPServerModule extends AbstractModule {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(SMTPServerModule.class);
-
- @Override
- protected void configure() {
- Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(SMTPModuleConfigurationPerformer.class);
- }
-
- @Singleton
- public static class SMTPModuleConfigurationPerformer implements ConfigurationPerformer {
-
- private final ConfigurationProvider configurationProvider;
- private final SMTPServerFactory smtpServerFactory;
- private final SendMailHandler sendMailHandler;
-
- @Inject
- public SMTPModuleConfigurationPerformer(ConfigurationProvider configurationProvider,
- SMTPServerFactory smtpServerFactory,
- SendMailHandler sendMailHandler) {
- this.configurationProvider = configurationProvider;
- this.smtpServerFactory = smtpServerFactory;
- this.sendMailHandler = sendMailHandler;
- }
-
- @Override
- public void initModule() {
- try {
- smtpServerFactory.setLog(LOGGER);
- smtpServerFactory.configure(configurationProvider.getConfiguration("smtpserver"));
- smtpServerFactory.init();
- sendMailHandler.init(null);
- } catch (Exception e) {
- Throwables.propagate(e);
- }
- }
-
- @Override
- public List<Class<? extends Configurable>> forClasses() {
- return ImmutableList.of(SMTPServerFactory.class);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/3c5f8abf/server/container/guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 02084e2..cabe0ce 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -54,6 +54,11 @@
<artifactId>james-server-guice-pop</artifactId>
<version>3.0.0-beta6-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-smtp</artifactId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ </dependency>
</dependencies>
</dependencyManagement>
@@ -68,6 +73,7 @@
<module>onami</module>
<module>protocols/imap</module>
<module>protocols/pop</module>
+ <module>protocols/smtp</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/3c5f8abf/server/container/guice/protocols/smtp/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/smtp/pom.xml b/server/container/guice/protocols/smtp/pom.xml
new file mode 100644
index 0000000..2c2a556
--- /dev/null
+++ b/server/container/guice/protocols/smtp/pom.xml
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>james-server-guice</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>3.0.0-beta6-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>james-server-guice-smtp</artifactId>
+
+ <name>Apache James :: Server :: Guice :: Smtp</name>
+ <description>Smtp modules for Guice implementation of James server</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-guice-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-protocols-smtp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>animal-sniffer-java-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <signature>
+ <groupId>org.codehaus.mojo.signature</groupId>
+ <artifactId>java18</artifactId>
+ <version>1.0</version>
+ </signature>
+ </configuration>
+ <executions>
+ <execution>
+ <id>check_java_8</id>
+ <phase>test</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/3c5f8abf/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java b/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
new file mode 100644
index 0000000..bb5f233
--- /dev/null
+++ b/server/container/guice/protocols/smtp/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
@@ -0,0 +1,82 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.modules.protocols;
+
+import java.util.List;
+
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.smtpserver.SendMailHandler;
+import org.apache.james.smtpserver.netty.SMTPServerFactory;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class SMTPServerModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SMTPServerModule.class);
+
+ @Override
+ protected void configure() {
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(SMTPModuleConfigurationPerformer.class);
+ }
+
+ @Singleton
+ public static class SMTPModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final SMTPServerFactory smtpServerFactory;
+ private final SendMailHandler sendMailHandler;
+
+ @Inject
+ public SMTPModuleConfigurationPerformer(ConfigurationProvider configurationProvider,
+ SMTPServerFactory smtpServerFactory,
+ SendMailHandler sendMailHandler) {
+ this.configurationProvider = configurationProvider;
+ this.smtpServerFactory = smtpServerFactory;
+ this.sendMailHandler = sendMailHandler;
+ }
+
+ @Override
+ public void initModule() {
+ try {
+ smtpServerFactory.setLog(LOGGER);
+ smtpServerFactory.configure(configurationProvider.getConfiguration("smtpserver"));
+ smtpServerFactory.init();
+ sendMailHandler.init(null);
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ }
+
+ @Override
+ public List<Class<? extends Configurable>> forClasses() {
+ return ImmutableList.of(SMTPServerFactory.class);
+ }
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[02/21] james-project git commit: JAMES-1902 split probes to prevent
them to pull unwanted dependencies
Posted by bt...@apache.org.
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/GetMessagesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
index f1a9e55..23afc1d 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
@@ -45,6 +45,7 @@ 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.model.MessageId;
+import org.apache.james.modules.MailboxProbeImpl;
import org.apache.james.utils.JmapGuiceProbe;
import org.javatuples.Pair;
@@ -100,8 +101,8 @@ public class GetMessagesMethodStepdefs {
@Given("^the user has a message \"([^\"]*)\" in \"([^\"]*)\" and \"([^\"]*)\" mailboxes with subject \"([^\"]*)\", content \"([^\"]*)\"$")
public void appendMessageInTwoMailboxes(String messageName, String mailbox1, String mailbox2, String subject, String content) throws Throwable {
MessageId id = appendMessage(mailbox1, ContentType.noContentType(), subject, content, NO_HEADERS);
- MailboxId mailboxId1 = mainStepdefs.jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, mailbox1).getMailboxId();
- MailboxId mailboxId2 = mainStepdefs.jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, mailbox2).getMailboxId();
+ MailboxId mailboxId1 = mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, mailbox1).getMailboxId();
+ MailboxId mailboxId2 = mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).getMailbox(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, mailbox2).getMailboxId();
mainStepdefs.jmapServer.getProbe(JmapGuiceProbe.class).setInMailboxes(id, userStepdefs.lastConnectedUser, mailboxId1, mailboxId2);
messageIdsByName.put(messageName, id);
@@ -128,7 +129,7 @@ public class GetMessagesMethodStepdefs {
@Given("^the user has a message \"([^\"]*)\" in \"([^\"]*)\" mailbox, composed of a multipart with inlined text part and inlined html part$")
public void appendMessageFromFileInlinedMultipart(String messageName, String mailbox) throws Throwable {
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- MessageId id = mainStepdefs.jmapServer.serverProbe().appendMessage(userStepdefs.lastConnectedUser,
+ MessageId id = mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).appendMessage(userStepdefs.lastConnectedUser,
new MailboxPath(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, mailbox),
ClassLoader.getSystemResourceAsStream("eml/inlinedMultipart.eml"),
Date.from(dateTime.toInstant()), false, new Flags())
@@ -138,7 +139,7 @@ public class GetMessagesMethodStepdefs {
private MessageId appendMessage(String mailbox, ContentType contentType, String subject, String content, Optional<Map<String, String>> headers) throws Exception {
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- return mainStepdefs.jmapServer.serverProbe().appendMessage(userStepdefs.lastConnectedUser,
+ return mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).appendMessage(userStepdefs.lastConnectedUser,
new MailboxPath(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, mailbox),
new ByteArrayInputStream(message(contentType, subject, content, headers).getBytes(Charsets.UTF_8)),
Date.from(dateTime.toInstant()), false, new Flags()).getMessageId();
@@ -204,7 +205,7 @@ public class GetMessagesMethodStepdefs {
private void appendMessage(String messageName, String emlFileName) throws Exception {
ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z");
- MessageId id = mainStepdefs.jmapServer.serverProbe().appendMessage(userStepdefs.lastConnectedUser,
+ MessageId id = mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).appendMessage(userStepdefs.lastConnectedUser,
new MailboxPath(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, DefaultMailboxes.INBOX),
ClassLoader.getSystemResourceAsStream(emlFileName),
Date.from(dateTime.toInstant()), false, new Flags())
@@ -350,7 +351,7 @@ public class GetMessagesMethodStepdefs {
List<String> values = Splitter.on(",")
.splitToList(mailboxIds).stream()
.map(Throwing.function(name -> mainStepdefs.jmapServer
- .serverProbe()
+ .getProbe(MailboxProbeImpl.class)
.getMailbox(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, name)
.getMailboxId()
.serialize()))
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/SetMailboxesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
index 74698ad..39b7e3f 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMailboxesMethodStepdefs.java
@@ -36,6 +36,7 @@ import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.model.MailboxConstants;
import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.store.mail.model.Mailbox;
+import org.apache.james.modules.MailboxProbeImpl;
import com.github.fge.lambdas.Throwing;
import com.jayway.awaitility.Awaitility;
@@ -65,7 +66,7 @@ public class SetMailboxesMethodStepdefs {
@Given("^mailbox \"([^\"]*)\" with (\\d+) messages$")
public void mailboxWithMessages(String mailboxName, int messageCount) throws Throwable {
- mainStepdefs.jmapServer.serverProbe().createMailbox("#private", userStepdefs.lastConnectedUser, mailboxName);
+ mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).createMailbox("#private", userStepdefs.lastConnectedUser, mailboxName);
MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, mailboxName);
IntStream
.range(0, messageCount)
@@ -76,14 +77,14 @@ public class SetMailboxesMethodStepdefs {
private void appendMessage(MailboxPath mailboxPath, int i) throws MailboxException {
String content = "Subject: test" + i + "\r\n\r\n"
+ "testBody" + i;
- mainStepdefs.jmapServer.serverProbe().appendMessage(userStepdefs.lastConnectedUser, mailboxPath,
+ mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).appendMessage(userStepdefs.lastConnectedUser, mailboxPath,
new ByteArrayInputStream(content.getBytes()), new Date(), false, new Flags());
}
@When("^renaming mailbox \"([^\"]*)\" to \"([^\"]*)\"")
public void renamingMailbox(String actualMailboxName, String newMailboxName) throws Throwable {
String username = userStepdefs.lastConnectedUser;
- Mailbox mailbox = mainStepdefs.jmapServer.serverProbe().getMailbox("#private", userStepdefs.lastConnectedUser, actualMailboxName);
+ Mailbox mailbox = mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).getMailbox("#private", userStepdefs.lastConnectedUser, actualMailboxName);
String mailboxId = mailbox.getMailboxId().serialize();
String requestBody =
"[" +
@@ -108,9 +109,9 @@ public class SetMailboxesMethodStepdefs {
@When("^moving mailbox \"([^\"]*)\" to \"([^\"]*)\"$")
public void movingMailbox(String actualMailboxPath, String newParentMailboxPath) throws Throwable {
String username = userStepdefs.lastConnectedUser;
- Mailbox mailbox = mainStepdefs.jmapServer.serverProbe().getMailbox("#private", username, actualMailboxPath);
+ Mailbox mailbox = mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).getMailbox("#private", username, actualMailboxPath);
String mailboxId = mailbox.getMailboxId().serialize();
- Mailbox parent = mainStepdefs.jmapServer.serverProbe().getMailbox("#private", username, newParentMailboxPath);
+ Mailbox parent = mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).getMailbox("#private", username, newParentMailboxPath);
String parentId = parent.getMailboxId().serialize();
String requestBody =
@@ -138,7 +139,7 @@ public class SetMailboxesMethodStepdefs {
public void mailboxContainsMessages(String mailboxName, int messageCount) throws Throwable {
Duration slowPacedPollInterval = Duration.FIVE_HUNDRED_MILLISECONDS;
String username = userStepdefs.lastConnectedUser;
- Mailbox mailbox = mainStepdefs.jmapServer.serverProbe().getMailbox("#private", username, mailboxName);
+ Mailbox mailbox = mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).getMailbox("#private", username, mailboxName);
String mailboxId = mailbox.getMailboxId().serialize();
Awaitility.await().atMost(Duration.FIVE_SECONDS).pollDelay(slowPacedPollInterval).pollInterval(slowPacedPollInterval).until(() -> {
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/SetMessagesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMessagesMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMessagesMethodStepdefs.java
index 20ffcf9..3d9f7bb 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMessagesMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/SetMessagesMethodStepdefs.java
@@ -25,6 +25,7 @@ import org.apache.http.client.fluent.Request;
import org.apache.james.mailbox.model.MailboxConstants;
import org.apache.james.mailbox.model.MailboxId;
import org.apache.james.mailbox.model.MessageId;
+import org.apache.james.modules.MailboxProbeImpl;
import cucumber.api.java.en.When;
import cucumber.runtime.java.guice.ScenarioScoped;
@@ -48,7 +49,7 @@ public class SetMessagesMethodStepdefs {
String username = userStepdefs.lastConnectedUser;
MessageId messageId = getMessagesMethodStepdefs.getMessageId(message);
MailboxId mailboxId = mainStepdefs.jmapServer
- .serverProbe()
+ .getProbe(MailboxProbeImpl.class)
.getMailbox(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, mailbox)
.getMailboxId();
@@ -75,11 +76,11 @@ public class SetMessagesMethodStepdefs {
String username = userStepdefs.lastConnectedUser;
MessageId messageId = getMessagesMethodStepdefs.getMessageId(message);
MailboxId sourceMailboxId = mainStepdefs.jmapServer
- .serverProbe()
+ .getProbe(MailboxProbeImpl.class)
.getMailbox(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, sourceMailbox)
.getMailboxId();
MailboxId destinationMailboxId = mainStepdefs.jmapServer
- .serverProbe()
+ .getProbe(MailboxProbeImpl.class)
.getMailbox(MailboxConstants.USER_NAMESPACE, userStepdefs.lastConnectedUser, destinationMailbox)
.getMailboxId();
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/UserStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java
index c805105..fb0aff4 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UserStepdefs.java
@@ -30,6 +30,8 @@ import javax.inject.Inject;
import org.apache.james.jmap.HttpJmapAuthentication;
import org.apache.james.jmap.api.access.AccessToken;
import org.apache.james.mailbox.model.MailboxConstants;
+import org.apache.james.modules.MailboxProbeImpl;
+import org.apache.james.utils.DataProbeImpl;
import com.github.fge.lambdas.Throwing;
import com.google.common.base.Charsets;
@@ -60,7 +62,7 @@ public class UserStepdefs {
@Given("^a domain named \"([^\"]*)\"$")
public void createDomain(String domain) throws Exception {
- mainStepdefs.jmapServer.serverProbe().addDomain(domain);
+ mainStepdefs.jmapServer.getProbe(DataProbeImpl.class).addDomain(domain);
domains.add(domain);
}
@@ -78,7 +80,7 @@ public class UserStepdefs {
@Given("^a user \"([^\"]*)\"$")
public void createUser(String username) throws Exception {
String password = generatePassword(username);
- mainStepdefs.jmapServer.serverProbe().addUser(username, password);
+ mainStepdefs.jmapServer.getProbe(DataProbeImpl.class).addUser(username, password);
passwordByUser.put(username, password);
}
@@ -90,7 +92,7 @@ public class UserStepdefs {
@Given("^\"([^\"]*)\" has a mailbox \"([^\"]*)\"$")
public void createMailbox(String username, String mailbox) throws Throwable {
- mainStepdefs.jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, mailbox);
+ mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).createMailbox(MailboxConstants.USER_NAMESPACE, username, mailbox);
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/793dae76/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
index f6194bc..c91eec4 100644
--- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
@@ -29,6 +29,9 @@ import static org.hamcrest.Matchers.is;
import org.apache.james.CassandraJmapTestRule;
import org.apache.james.GuiceJamesServer;
+import org.apache.james.modules.MailboxProbeImpl;
+import org.apache.james.probe.DataProbe;
+import org.apache.james.utils.DataProbeImpl;
import org.apache.james.utils.WebAdminGuiceProbe;
import org.apache.james.webadmin.routes.DomainRoutes;
import org.apache.james.webadmin.routes.UserMailboxesRoutes;
@@ -56,12 +59,14 @@ public class WebAdminServerIntegrationTest {
public CassandraJmapTestRule cassandraJmapTestRule = CassandraJmapTestRule.defaultTestRule();
private GuiceJamesServer guiceJamesServer;
+ private DataProbe dataProbe;
@Before
public void setUp() throws Exception {
guiceJamesServer = cassandraJmapTestRule.jmapServer()
.overrideWith(new WebAdminConfigurationModule());
guiceJamesServer.start();
+ dataProbe = guiceJamesServer.getProbe(DataProbeImpl.class);
RestAssured.requestSpecification = new RequestSpecBuilder()
.setContentType(ContentType.JSON)
@@ -83,24 +88,24 @@ public class WebAdminServerIntegrationTest {
.then()
.statusCode(204);
- assertThat(guiceJamesServer.serverProbe().listDomains()).contains(DOMAIN);
+ assertThat(dataProbe.listDomains()).contains(DOMAIN);
}
@Test
public void deleteShouldRemoveTheGivenDomain() throws Exception {
- guiceJamesServer.serverProbe().addDomain(DOMAIN);
+ dataProbe.addDomain(DOMAIN);
when()
.delete(SPECIFIC_DOMAIN)
.then()
.statusCode(204);
- assertThat(guiceJamesServer.serverProbe().listDomains()).doesNotContain(DOMAIN);
+ assertThat(dataProbe.listDomains()).doesNotContain(DOMAIN);
}
@Test
public void postShouldAddTheUser() throws Exception {
- guiceJamesServer.serverProbe().addDomain(DOMAIN);
+ dataProbe.addDomain(DOMAIN);
given()
.body("{\"password\":\"password\"}")
@@ -109,13 +114,13 @@ public class WebAdminServerIntegrationTest {
.then()
.statusCode(204);
- assertThat(guiceJamesServer.serverProbe().listUsers()).contains(USERNAME);
+ assertThat(dataProbe.listUsers()).contains(USERNAME);
}
@Test
public void deleteShouldRemoveTheUser() throws Exception {
- guiceJamesServer.serverProbe().addDomain(DOMAIN);
- guiceJamesServer.serverProbe().addUser(USERNAME, "anyPassword");
+ dataProbe.addDomain(DOMAIN);
+ dataProbe.addUser(USERNAME, "anyPassword");
given()
.body("{\"username\":\"" + USERNAME + "\",\"password\":\"password\"}")
@@ -124,13 +129,13 @@ public class WebAdminServerIntegrationTest {
.then()
.statusCode(204);
- assertThat(guiceJamesServer.serverProbe().listUsers()).doesNotContain(USERNAME);
+ assertThat(dataProbe.listUsers()).doesNotContain(USERNAME);
}
@Test
public void getUsersShouldDisplayUsers() throws Exception {
- guiceJamesServer.serverProbe().addDomain(DOMAIN);
- guiceJamesServer.serverProbe().addUser(USERNAME, "anyPassword");
+ dataProbe.addDomain(DOMAIN);
+ dataProbe.addUser(USERNAME, "anyPassword");
when()
.get(UserRoutes.USERS)
@@ -141,29 +146,29 @@ public class WebAdminServerIntegrationTest {
@Test
public void putMailboxShouldAddAMailbox() throws Exception {
- guiceJamesServer.serverProbe().addDomain(DOMAIN);
- guiceJamesServer.serverProbe().addUser(USERNAME, "anyPassword");
+ dataProbe.addDomain(DOMAIN);
+ dataProbe.addUser(USERNAME, "anyPassword");
when()
.put(SPECIFIC_MAILBOX)
.then()
.statusCode(204);
- assertThat(guiceJamesServer.serverProbe().listUserMailboxes(USERNAME)).containsExactly(MAILBOX);
+ assertThat(guiceJamesServer.getProbe(MailboxProbeImpl.class).listUserMailboxes(USERNAME)).containsExactly(MAILBOX);
}
@Test
public void deleteMailboxShouldRemoveAMailbox() throws Exception {
- guiceJamesServer.serverProbe().addDomain(DOMAIN);
- guiceJamesServer.serverProbe().addUser(USERNAME, "anyPassword");
- guiceJamesServer.serverProbe().createMailbox("#private", USERNAME, MAILBOX);
+ dataProbe.addDomain(DOMAIN);
+ dataProbe.addUser(USERNAME, "anyPassword");
+ guiceJamesServer.getProbe(MailboxProbeImpl.class).createMailbox("#private", USERNAME, MAILBOX);
when()
.delete(SPECIFIC_MAILBOX)
.then()
.statusCode(204);
- assertThat(guiceJamesServer.serverProbe().listUserMailboxes(USERNAME)).isEmpty();
+ assertThat(guiceJamesServer.getProbe(MailboxProbeImpl.class).listUserMailboxes(USERNAME)).isEmpty();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[04/21] james-project git commit: JAMES-1902 split probes to prevent
them to pull unwanted dependencies
Posted by bt...@apache.org.
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/GetMessageListMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java
index b60906a..bf49a2f 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMessageListMethodTest.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;
@@ -70,11 +74,16 @@ public abstract class GetMessageListMethodTest {
private String username;
private String domain;
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)
@@ -85,8 +94,8 @@ public abstract class GetMessageListMethodTest {
this.domain = "domain.tld";
this.username = "username@" + domain;
String password = "password";
- jmapServer.serverProbe().addDomain(domain);
- jmapServer.serverProbe().addUser(username, password);
+ dataProbe.addDomain(domain);
+ dataProbe.addUser(username, password);
this.accessToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), username, password);
}
@@ -106,12 +115,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldNotDuplicateMessagesInSeveralMailboxes() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
- Mailbox mailbox = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- Mailbox mailbox2 = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
+ Mailbox mailbox = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ Mailbox mailbox2 = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
await();
@@ -131,11 +140,11 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListSetFlaggedFilterShouldWork() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId messageNotFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId messageFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags(Flags.Flag.FLAGGED));
await();
@@ -155,11 +164,11 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListUnsetFlaggedFilterShouldWork() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId messageNotFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId messageFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags(Flags.Flag.FLAGGED));
await();
@@ -179,11 +188,11 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListReadFilterShouldWork() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId messageNotRead = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotRead = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId messageRead = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageRead = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags(Flags.Flag.SEEN));
await();
@@ -203,11 +212,11 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListUnreadFilterShouldWork() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId messageNotRead = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotRead = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId messageRead = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageRead = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags(Flags.Flag.SEEN));
await();
@@ -227,11 +236,11 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListSetDraftFilterShouldWork() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId messageNotDraft = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotDraft = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId messageDraft = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageDraft = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags(Flags.Flag.DRAFT));
await();
@@ -251,11 +260,11 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListUnsetDraftFilterShouldWork() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId messageNotDraft = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotDraft = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId messageDraft = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageDraft = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags(Flags.Flag.DRAFT));
await();
@@ -275,11 +284,11 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListSetAnsweredFilterShouldWork() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId messageNotAnswered = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotAnswered = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId messageAnswered = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageAnswered = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags(Flags.Flag.ANSWERED));
await();
@@ -299,11 +308,11 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListUnsetAnsweredFilterShouldWork() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId messageNotAnswered = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotAnswered = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId messageAnswered = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageAnswered = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags(Flags.Flag.ANSWERED));
await();
@@ -323,15 +332,15 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListANDOperatorShouldWork() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId messageNotSeenNotFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotSeenNotFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId messageNotSeenFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotSeenFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags(Flags.Flag.FLAGGED));
- ComposedMessageId messageSeenNotFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageSeenNotFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(), false, new Flags(Flags.Flag.SEEN));
- ComposedMessageId messageSeenFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageSeenFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(), false, FlagsBuilder.builder().add(Flags.Flag.SEEN, Flags.Flag.FLAGGED).build());
await();
@@ -353,15 +362,15 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListOROperatorShouldWork() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId messageNotSeenNotFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotSeenNotFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId messageNotSeenFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotSeenFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags(Flags.Flag.FLAGGED));
- ComposedMessageId messageSeenNotFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageSeenNotFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(), false, new Flags(Flags.Flag.SEEN));
- ComposedMessageId messageSeenFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageSeenFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(), false, FlagsBuilder.builder().add(Flags.Flag.SEEN, Flags.Flag.FLAGGED).build());
await();
@@ -383,15 +392,15 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListNOTOperatorShouldWork() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId messageNotSeenNotFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotSeenNotFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId messageNotSeenFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotSeenFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags(Flags.Flag.FLAGGED));
- ComposedMessageId messageSeenNotFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageSeenNotFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(), false, new Flags(Flags.Flag.SEEN));
- ComposedMessageId messageSeenFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageSeenFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(), false, FlagsBuilder.builder().add(Flags.Flag.SEEN, Flags.Flag.FLAGGED).build());
await();
@@ -413,15 +422,15 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListNestedOperatorsShouldWork() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId messageNotSeenNotFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotSeenNotFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId messageNotSeenFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageNotSeenFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags(Flags.Flag.FLAGGED));
- ComposedMessageId messageSeenNotFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageSeenNotFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(), false, new Flags(Flags.Flag.SEEN));
- ComposedMessageId messageSeenFlagged = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId messageSeenFlagged = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(), false, FlagsBuilder.builder().add(Flags.Flag.SEEN, Flags.Flag.FLAGGED).build());
await();
@@ -472,13 +481,13 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldSupportHasAttachmentSetToTrue() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags());
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(), false, new Flags());
await();
@@ -495,13 +504,13 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldSupportHasAttachmentSetToFalse() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message1 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/twoAttachments.eml"), new Date(), false, new Flags());
- ComposedMessageId message3 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message3 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
ClassLoader.getSystemResourceAsStream("eml/oneInlinedImage.eml"), new Date(), false, new Flags());
await();
@@ -530,11 +539,11 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldReturnAllMessagesWhenSingleMailboxNoParameters() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message1 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
await();
@@ -551,12 +560,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldReturnAllMessagesWhenMultipleMailboxesAndNoParameters() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ ComposedMessageId message1 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox2"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox2"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
await();
@@ -575,19 +584,19 @@ public abstract class GetMessageListMethodTest {
public void getMessageListShouldReturnAllMessagesOfCurrentUserOnlyWhenMultipleMailboxesAndNoParameters() throws Exception {
String otherUser = "other@" + domain;
String password = "password";
- jmapServer.serverProbe().addUser(otherUser, password);
+ dataProbe.addUser(otherUser, password);
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ ComposedMessageId message1 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox2"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox2"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
await();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, otherUser, "mailbox");
- jmapServer.serverProbe().appendMessage(otherUser, new MailboxPath(MailboxConstants.USER_NAMESPACE, otherUser, "mailbox"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, otherUser, "mailbox");
+ mailboxProbe.appendMessage(otherUser, new MailboxPath(MailboxConstants.USER_NAMESPACE, otherUser, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
await();
@@ -604,12 +613,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldFilterMessagesWhenInMailboxesFilterMatches() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ ComposedMessageId message = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
await();
- MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();
+ MailboxId mailboxId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();
given()
.header("Authorization", accessToken.serialize())
@@ -624,15 +633,15 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldFilterMessagesWhenMultipleInMailboxesFilterMatches() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ ComposedMessageId message = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
await();
- MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();
- MailboxId mailboxId2 = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2").getMailboxId();
+ MailboxId mailboxId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();
+ MailboxId mailboxId2 = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2").getMailboxId();
given()
.header("Authorization", accessToken.serialize())
@@ -647,12 +656,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldFilterMessagesWhenNotInMailboxesFilterMatches() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();
+ MailboxId mailboxId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
await();
given()
@@ -668,15 +677,15 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldFilterMessagesWhenNotInMailboxesFilterMatchesTwice() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();
+ MailboxId mailboxId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox2"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox2"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- MailboxId mailbox2Id = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2").getMailboxId();
+ MailboxId mailbox2Id = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2").getMailboxId();
await();
given()
@@ -692,10 +701,10 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldFilterMessagesWhenIdenticalNotInMailboxesAndInmailboxesFilterMatch() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();
+ MailboxId mailboxId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();
await();
given()
@@ -711,12 +720,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldNotFilterMessagesWhenNotInMailboxesFilterDoesNotMatch() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ ComposedMessageId message = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
- MailboxId mailbox2Id = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2").getMailboxId();
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
+ MailboxId mailbox2Id = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2").getMailboxId();
await();
given()
@@ -732,11 +741,11 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldNotFilterMessagesWhenEmptyNotInMailboxesFilter() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ ComposedMessageId message = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
await();
given()
@@ -752,11 +761,11 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldFilterMessagesWhenInMailboxesFilterDoesntMatches() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "emptyMailbox");
- MailboxId emptyMailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "emptyMailbox").getMailboxId();
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "emptyMailbox");
+ MailboxId emptyMailboxId = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, username, "emptyMailbox").getMailboxId();
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
await();
@@ -772,12 +781,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldSortMessagesWhenSortedByDateDefault() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
LocalDate date = LocalDate.now();
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message1 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(1)), false, new Flags());
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags());
await();
@@ -794,12 +803,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldSortMessagesWhenSortedByDateAsc() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
LocalDate date = LocalDate.now();
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message1 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(1)), false, new Flags());
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags());
await();
@@ -817,12 +826,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldSupportIdSorting() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
LocalDate date = LocalDate.now();
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message1 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(1)), false, new Flags());
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags());
await();
@@ -839,12 +848,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldSortMessagesWhenSortedByDateDesc() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
LocalDate date = LocalDate.now();
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message1 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(1)), false, new Flags());
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags());
await();
@@ -885,12 +894,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldReturnAllMessagesWhenPositionIsNotGiven() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
LocalDate date = LocalDate.now();
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message1 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(1)), false, new Flags());
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags());
await();
@@ -907,12 +916,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldReturnSkipMessagesWhenPositionIsGiven() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
LocalDate date = LocalDate.now();
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(1)), false, new Flags());
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags());
await();
@@ -929,14 +938,14 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldReturnSkipMessagesWhenPositionAndLimitGiven() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
LocalDate date = LocalDate.now();
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(2)), false, new Flags());
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(1)), false, new Flags());
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test3\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags());
await();
@@ -953,12 +962,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldReturnAllMessagesWhenLimitIsNotGiven() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
LocalDate date = LocalDate.now();
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message1 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(1)), false, new Flags());
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags());
await();
@@ -975,12 +984,12 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldReturnLimitMessagesWhenLimitGiven() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
LocalDate date = LocalDate.now();
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(1)), false, new Flags());
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags());
await();
@@ -997,16 +1006,16 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldReturnLimitMessagesWithDefaultValueWhenLimitIsNotGiven() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
LocalDate date = LocalDate.now();
- ComposedMessageId message1 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message1 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(1)), false, new Flags());
- ComposedMessageId message2 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message2 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test2\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags());
- ComposedMessageId message3 = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message3 = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test3\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags());
- jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test4\r\n\r\ntestmail".getBytes()), convertToDate(date), false, new Flags());
await();
@@ -1023,10 +1032,10 @@ public abstract class GetMessageListMethodTest {
@Test
public void getMessageListShouldChainFetchingMessagesWhenAskedFor() throws Exception {
- jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
+ mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
LocalDate date = LocalDate.now();
- ComposedMessageId message = jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
+ ComposedMessageId message = mailboxProbe.appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), convertToDate(date.plusDays(1)), false, new Flags());
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/GetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
index 815cbe2..40b72a9 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
@@ -35,8 +35,10 @@ import org.apache.james.jmap.HttpJmapAuthentication;
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.probe.DataProbe;
import org.apache.james.util.date.ZonedDateTimeProvider;
import org.apache.james.utils.JmapGuiceProbe;
+import org.apache.james.utils.DataProbeImpl;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -83,9 +85,9 @@ public abstract class GetVacationResponseTest {
.setPort(jmapGuiceProbe.getJmapPort())
.build();
-
- jmapServer.serverProbe().addDomain(USERS_DOMAIN);
- jmapServer.serverProbe().addUser(USER, PASSWORD);
+ DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class);
+ dataProbe.addDomain(USERS_DOMAIN);
+ dataProbe.addUser(USER, PASSWORD);
accessToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(), USER, PASSWORD);
await();
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[18/21] james-project git commit: JAMES-1902 create a smtp only
project that pulls only required dependencies
Posted by bt...@apache.org.
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAConfiguration.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAConfiguration.java b/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAConfiguration.java
new file mode 100644
index 0000000..c0f7d76
--- /dev/null
+++ b/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAConfiguration.java
@@ -0,0 +1,66 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+package org.apache.james;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+
+public class JPAConfiguration {
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ private String driverName;
+ private String driverURL;
+
+ public Builder driverName(String driverName) {
+ this.driverName = driverName;
+ return this;
+ }
+
+ public Builder driverURL(String driverURL) {
+ this.driverURL = driverURL;
+ return this;
+ }
+
+ public JPAConfiguration build() {
+ Preconditions.checkNotNull(driverName);
+ Preconditions.checkNotNull(driverURL);
+ return new JPAConfiguration(driverName, driverURL);
+ }
+ }
+
+ private final String driverName;
+ private final String driverURL;
+
+ @VisibleForTesting JPAConfiguration(String driverName, String driverURL) {
+ this.driverName = driverName;
+ this.driverURL = driverURL;
+ }
+
+ public String getDriverName() {
+ return driverName;
+ }
+
+ public String getDriverURL() {
+ return driverURL;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java b/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
new file mode 100644
index 0000000..ce01b8d
--- /dev/null
+++ b/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
@@ -0,0 +1,53 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james;
+
+import javax.persistence.EntityManagerFactory;
+
+import org.apache.james.modules.data.JPADataModule;
+import org.apache.james.modules.protocols.ProtocolHandlerModule;
+import org.apache.james.modules.protocols.SMTPServerModule;
+import org.apache.james.modules.server.ActiveMQQueueModule;
+import org.apache.james.modules.server.JMXServerModule;
+import org.apache.james.modules.server.RawPostDequeueDecoratorModule;
+import org.apache.openjpa.persistence.OpenJPAPersistence;
+
+import com.google.inject.Module;
+import com.google.inject.util.Modules;
+
+public class JPAJamesServerMain {
+
+ public static final Module protocols = Modules.combine(
+ new ProtocolHandlerModule(),
+ new SMTPServerModule());
+
+ public static final Module jpaServerModule = Modules.combine(
+ new JPADataModule(),
+ (binder) -> binder.bind(EntityManagerFactory.class).toProvider(() -> OpenJPAPersistence.getEntityManagerFactory()),
+ new ActiveMQQueueModule(),
+ new RawPostDequeueDecoratorModule());
+
+ public static void main(String[] args) throws Exception {
+ GuiceJamesServer server = new GuiceJamesServer()
+ .combineWith(jpaServerModule, protocols, new JMXServerModule());
+ server.start();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/main/resources/META-INF/persistence.xml b/server/container/guice/jpa-smtp/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..c2d612a
--- /dev/null
+++ b/server/container/guice/jpa-smtp/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
+
+ <persistence-unit name="Global" transaction-type="RESOURCE_LOCAL">
+ <class>org.apache.james.mailbox.jpa.mail.model.JPAUserFlag</class>
+ <class>org.apache.james.mailbox.jpa.user.model.JPASubscription</class>
+ <class>org.apache.james.domainlist.jpa.model.JPADomain</class>
+ <class>org.apache.james.user.jpa.model.JPAUser</class>
+ <class>org.apache.james.rrt.jpa.model.JPARecipientRewrite</class>
+ <properties>
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+ <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=cascade, JoinForeignKeyDeleteAction=cascade"/>
+ <property name="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)"/>
+ <property name="openjpa.jdbc.QuerySQLCache" value="false"/>
+ </properties>
+
+ </persistence-unit>
+
+</persistence>
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/main/resources/logback.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/main/resources/logback.xml b/server/container/guice/jpa-smtp/src/main/resources/logback.xml
new file mode 100644
index 0000000..0e1ff22
--- /dev/null
+++ b/server/container/guice/jpa-smtp/src/main/resources/logback.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+
+ <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
+ <resetJUL>true</resetJUL>
+ </contextListener>
+
+ <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
+ <immediateFlush>false</immediateFlush>
+ </encoder>
+ </appender>
+
+ <root level="WARN">
+ <appender-ref ref="CONSOLE" />
+ </root>
+
+ <logger name="org.apache.james" level="INFO"/>
+
+
+</configuration>
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/java/org/apache/james/JPAJamesServerTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/test/java/org/apache/james/JPAJamesServerTest.java b/server/container/guice/jpa-smtp/src/test/java/org/apache/james/JPAJamesServerTest.java
new file mode 100644
index 0000000..7a22c19
--- /dev/null
+++ b/server/container/guice/jpa-smtp/src/test/java/org/apache/james/JPAJamesServerTest.java
@@ -0,0 +1,94 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.SocketChannel;
+import java.nio.charset.Charset;
+
+import javax.persistence.EntityManagerFactory;
+
+import org.apache.james.backends.jpa.JpaTestCluster;
+import org.apache.james.domainlist.jpa.model.JPADomain;
+import org.apache.james.modules.TestFilesystemModule;
+import org.apache.james.rrt.jpa.model.JPARecipientRewrite;
+import org.apache.james.user.jpa.model.JPAUser;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+public class JPAJamesServerTest {
+
+ private static final int SMTP_PORT = 1025;
+
+ private GuiceJamesServer server;
+ private SocketChannel socketChannel;
+
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @After
+ public void teardown() {
+ server.stop();
+ }
+
+ private org.apache.james.GuiceJamesServer createJamesServer() {
+ return new GuiceJamesServer()
+ .combineWith(JPAJamesServerMain.jpaServerModule, JPAJamesServerMain.protocols)
+ .overrideWith(
+ new TestFilesystemModule(temporaryFolder),
+ new TestJPAConfigurationModule(),
+ (binder) -> binder.bind(EntityManagerFactory.class)
+ .toInstance(JpaTestCluster.create(JPAUser.class, JPADomain.class, JPARecipientRewrite.class)
+ .getEntityManagerFactory()));
+ }
+
+ @Before
+ public void setup() throws Exception {
+ server = createJamesServer();
+ socketChannel = SocketChannel.open();
+ server.start();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ server.stop();
+ }
+
+ @Test
+ public void connectSMTPServerShouldSendShabangOnConnect() throws Exception {
+ socketChannel.connect(new InetSocketAddress("127.0.0.1", SMTP_PORT));
+ assertThat(getServerConnectionResponse(socketChannel)).startsWith("220 JAMES Linagora's SMTP awesome Server");
+ }
+
+ private String getServerConnectionResponse(SocketChannel socketChannel) throws IOException {
+ ByteBuffer byteBuffer = ByteBuffer.allocate(1000);
+ socketChannel.read(byteBuffer);
+ byte[] bytes = byteBuffer.array();
+ return new String(bytes, Charset.forName("UTF-8"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/java/org/apache/james/TestJPAConfigurationModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/test/java/org/apache/james/TestJPAConfigurationModule.java b/server/container/guice/jpa-smtp/src/test/java/org/apache/james/TestJPAConfigurationModule.java
new file mode 100644
index 0000000..7c064c4
--- /dev/null
+++ b/server/container/guice/jpa-smtp/src/test/java/org/apache/james/TestJPAConfigurationModule.java
@@ -0,0 +1,48 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james;
+
+import java.io.FileNotFoundException;
+
+import javax.inject.Singleton;
+
+import org.apache.commons.configuration.ConfigurationException;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+
+public class TestJPAConfigurationModule extends AbstractModule {
+
+ private static final String JDBC_EMBEDDED_URL = "jdbc:derby:memory:mailboxintegration;create=true";
+ private static final String JDBC_EMBEDDED_DRIVER = org.apache.derby.jdbc.EmbeddedDriver.class.getName();
+
+ @Override
+ protected void configure() {
+ }
+
+ @Provides
+ @Singleton
+ JPAConfiguration provideConfiguration() throws FileNotFoundException, ConfigurationException{
+ return JPAConfiguration.builder()
+ .driverName(JDBC_EMBEDDED_DRIVER)
+ .driverURL(JDBC_EMBEDDED_URL)
+ .build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/resources/dnsservice.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/test/resources/dnsservice.xml b/server/container/guice/jpa-smtp/src/test/resources/dnsservice.xml
new file mode 100644
index 0000000..0978a00
--- /dev/null
+++ b/server/container/guice/jpa-smtp/src/test/resources/dnsservice.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<dnsservice>
+ <servers>
+ <server>8.8.8.8</server>
+ <server>62.210.16.6</server>
+ </servers>
+ <autodiscover>false</autodiscover>
+ <authoritative>false</authoritative>
+ <maxcachesize>50000</maxcachesize>
+</dnsservice>
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/resources/fakemailrepositorystore.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/test/resources/fakemailrepositorystore.xml b/server/container/guice/jpa-smtp/src/test/resources/fakemailrepositorystore.xml
new file mode 100644
index 0000000..2d19a80
--- /dev/null
+++ b/server/container/guice/jpa-smtp/src/test/resources/fakemailrepositorystore.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<mailrepositorystore>
+ <mailrepositories>
+ <mailrepository class="org.apache.james.mailrepository.None">
+ <protocols>
+ <protocol>file</protocol>
+ </protocols>
+ <config FIFO="false" CACHEKEYS="true"/>
+ </mailrepository>
+ </mailrepositories>
+</mailrepositorystore>
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/resources/keystore
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/test/resources/keystore b/server/container/guice/jpa-smtp/src/test/resources/keystore
new file mode 100644
index 0000000..536a6c7
Binary files /dev/null and b/server/container/guice/jpa-smtp/src/test/resources/keystore differ
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/resources/mailetcontainer.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/test/resources/mailetcontainer.xml b/server/container/guice/jpa-smtp/src/test/resources/mailetcontainer.xml
new file mode 100644
index 0000000..c51a7fb
--- /dev/null
+++ b/server/container/guice/jpa-smtp/src/test/resources/mailetcontainer.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<mailetcontainer enableJmx="true">
+
+ <context>
+ <postmaster>postmaster@localhost</postmaster>
+ </context>
+
+ <spooler>
+ <threads>20</threads>
+ </spooler>
+
+ <processors>
+ <processor state="root" enableJmx="true">
+ <mailet match="All" class="PostmasterAlias"/>
+ <mailet match="RelayLimit=30" class="Null"/>
+
+ <mailet match="SMTPAuthSuccessful" class="ToProcessor">
+ <processor>transport</processor>
+ </mailet>
+
+ <mailet match="All" class="ToProcessor">
+ <processor>transport</processor>
+ </mailet>
+ </processor>
+
+ <processor state="error" enableJmx="true">
+ <mailet match="All" class="Bounce">
+ </mailet>
+ <mailet match="All" class="ToRepository">
+ <repositoryPath>file://var/mail/error/</repositoryPath>
+ </mailet>
+ </processor>
+
+
+ <processor state="transport" enableJmx="true">
+ <mailet match="SMTPAuthSuccessful" class="SetMimeHeader">
+ <name>X-UserIsAuth</name>
+ <value>true</value>
+ </mailet>
+ <mailet match="All" class="RemoveMimeHeader">
+ <name>bcc</name>
+ </mailet>
+ <mailet match="HasMailAttribute=org.apache.james.SMIMECheckSignature" class="SetMimeHeader">
+ <name>X-WasSigned</name>
+ <value>true</value>
+ </mailet>
+ <mailet match="All" class="RemoveMimeHeader">
+ <name>bcc</name>
+ </mailet>
+ <mailet match="All" class="RecipientRewriteTable" />
+ <!-- <mailet match="HostIsLocal" class="ToProcessor">
+ <processor>local-address-error</processor>
+ <notice>550 - Requested action not taken: no such user here</notice>
+ </mailet> -->
+ <mailet match="All" class="RemoteDelivery">
+ <outgoingQueue>outgoing</outgoingQueue>
+ <delayTime>5 minutes</delayTime>
+ <delayTime>10 minutes</delayTime>
+ <delayTime>45 minutes</delayTime>
+ <delayTime>2 hours</delayTime>
+ <delayTime>3 hours</delayTime>
+ <delayTime>6 hours</delayTime>
+ <maxRetries>0</maxRetries>
+ <maxDnsProblemRetries>0</maxDnsProblemRetries>
+ <deliveryThreads>1</deliveryThreads>
+ <sendpartial>false</sendpartial>
+ <bounceProcessor>bounces</bounceProcessor>
+ </mailet>
+ <!-- mailet match="All" class="ToProcessor">
+ <processor>relay-denied</processor>
+ </mailet-->
+ </processor>
+
+ <processor state="local-address-error" enableJmx="true">
+ <mailet match="All" class="Bounce">
+ <attachment>none</attachment>
+ <passThrough>true</passThrough>
+ <debug>true</debug>
+ </mailet>
+ <mailet match="All" class="ToRepository">
+ <repositoryPath>file://var/mail/address-error/</repositoryPath>
+ </mailet>
+ </processor>
+
+ <processor state="relay-denied" enableJmx="true">
+ <mailet match="All" class="Bounce">
+ <attachment>none</attachment>
+ </mailet>
+ <mailet match="All" class="ToRepository">
+ <repositoryPath>file://var/mail/relay-denied/</repositoryPath>
+ <notice>Warning: You are sending an e-mail to a remote server. You must be authentified to perform such an operation</notice>
+ </mailet>
+ </processor>
+
+ <processor state="bounces" enableJmx="true">
+ <mailet match="All" class="DSNBounce">
+ <passThrough>false</passThrough>
+ </mailet>
+ </processor>
+ </processors>
+
+</mailetcontainer>
+
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/resources/mailrepositorystore.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/test/resources/mailrepositorystore.xml b/server/container/guice/jpa-smtp/src/test/resources/mailrepositorystore.xml
new file mode 100644
index 0000000..3ca4a1d
--- /dev/null
+++ b/server/container/guice/jpa-smtp/src/test/resources/mailrepositorystore.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<mailrepositorystore>
+ <mailrepositories>
+ <mailrepository class="org.apache.james.mailrepository.file.FileMailRepository">
+ <protocols>
+ <protocol>file</protocol>
+ </protocols>
+ <config FIFO="false" CACHEKEYS="true"/>
+ </mailrepository>
+ </mailrepositories>
+</mailrepositorystore>
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/resources/managesieveserver.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/test/resources/managesieveserver.xml b/server/container/guice/jpa-smtp/src/test/resources/managesieveserver.xml
new file mode 100644
index 0000000..ec57e09
--- /dev/null
+++ b/server/container/guice/jpa-smtp/src/test/resources/managesieveserver.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<!--
+ This template file can be used as example for James Server configuration
+ DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+-->
+
+<!-- See http://james.apache.org/server/3/config.html for usage -->
+
+<managesieveservers>
+
+ <managesieveserver enabled="true">
+
+ <jmxName>managesieveserver</jmxName>
+
+ <bind>0.0.0.0:4190</bind>
+
+ <connectionBacklog>200</connectionBacklog>
+
+ <tls socketTLS="false" startTLS="false">
+ <!-- To create a new keystore execute:
+ keytool -genkey -alias james -keyalg RSA -keystore /path/to/james/conf/keystore
+ -->
+ <keystore>file://conf/keystore</keystore>
+ <secret>james72laBalle</secret>
+ <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+ <!-- The algorithm is optional and only needs to be specified when using something other
+ than the Sun JCE provider - You could use IbmX509 with IBM Java runtime. -->
+ <algorithm>SunX509</algorithm>
+ </tls>
+
+ <!-- connection timeout in secconds -->
+ <connectiontimeout>360</connectiontimeout>
+
+ <!-- Set the maximum simultaneous incoming connections for this service -->
+ <connectionLimit>0</connectionLimit>
+
+ <!-- Set the maximum simultaneous incoming connections per IP for this service -->
+ <connectionLimitPerIP>0</connectionLimitPerIP>
+ <maxmessagesize>0</maxmessagesize>
+ <addressBracketsEnforcement>true</addressBracketsEnforcement>
+
+ </managesieveserver>
+
+</managesieveservers>
+
+
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/resources/smtpserver.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/test/resources/smtpserver.xml b/server/container/guice/jpa-smtp/src/test/resources/smtpserver.xml
new file mode 100644
index 0000000..a3d4b8f
--- /dev/null
+++ b/server/container/guice/jpa-smtp/src/test/resources/smtpserver.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+<smtpservers>
+ <smtpserver enabled="true">
+ <jmxName>smtpserver-global</jmxName>
+ <bind>0.0.0.0:1025</bind>
+ <connectionBacklog>200</connectionBacklog>
+ <tls socketTLS="false" startTLS="false">
+ <keystore>file://conf/keystore</keystore>
+ <secret>james72laBalle</secret>
+ <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+ <algorithm>SunX509</algorithm>
+ </tls>
+ <connectiontimeout>360</connectiontimeout>
+ <connectionLimit>0</connectionLimit>
+ <connectionLimitPerIP>0</connectionLimitPerIP>
+ <authRequired>false</authRequired>
+ <authorizedAddresses>0.0.0.0/0</authorizedAddresses>
+ <verifyIdentity>true</verifyIdentity>
+ <maxmessagesize>0</maxmessagesize>
+ <addressBracketsEnforcement>true</addressBracketsEnforcement>
+ <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting>
+ <handlerchain>
+ <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+ <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+ </handlerchain>
+ </smtpserver>
+ <smtpserver enabled="true">
+ <jmxName>smtpserver-TLS</jmxName>
+ <bind>0.0.0.0:10465</bind>
+ <connectionBacklog>200</connectionBacklog>
+ <tls socketTLS="false" startTLS="false">
+ <keystore>file://conf/keystore</keystore>
+ <secret>james72laBalle</secret>
+ <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+ <algorithm>SunX509</algorithm>
+ </tls>
+ <connectiontimeout>360</connectiontimeout>
+ <connectionLimit>0</connectionLimit>
+ <connectionLimitPerIP>0</connectionLimitPerIP>
+ <!--
+ Authorize only local users
+ -->
+ <authRequired>true</authRequired>
+ <authorizedAddresses>0.0.0.0/0</authorizedAddresses>
+ <!-- Trust authenticated users -->
+ <verifyIdentity>false</verifyIdentity>
+ <maxmessagesize>0</maxmessagesize>
+ <addressBracketsEnforcement>true</addressBracketsEnforcement>
+ <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting>
+ <handlerchain>
+ <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+ <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+ </handlerchain>
+ </smtpserver>
+ <smtpserver enabled="true">
+ <jmxName>smtpserver-authenticated</jmxName>
+ <bind>0.0.0.0:1587</bind>
+ <connectionBacklog>200</connectionBacklog>
+ <tls socketTLS="false" startTLS="false">
+ <keystore>file://conf/keystore</keystore>
+ <secret>james72laBalle</secret>
+ <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+ <algorithm>SunX509</algorithm>
+ </tls>
+ <connectiontimeout>360</connectiontimeout>
+ <connectionLimit>0</connectionLimit>
+ <connectionLimitPerIP>0</connectionLimitPerIP>
+ <!--
+ Authorize only local users
+ -->
+ <authRequired>true</authRequired>
+ <authorizedAddresses>0.0.0.0/0</authorizedAddresses>
+ <!-- Trust authenticated users -->
+ <verifyIdentity>false</verifyIdentity>
+ <maxmessagesize>0</maxmessagesize>
+ <addressBracketsEnforcement>true</addressBracketsEnforcement>
+ <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting>
+ <handlerchain>
+ <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+ <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+ </handlerchain>
+ </smtpserver>
+</smtpservers>
+
+
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 5824129..76fd74e 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -90,6 +90,11 @@
<artifactId>james-server-guice-webadmin</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>james-server-jpa-common-guice</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
@@ -101,7 +106,9 @@
<module>mailbox</module>
<module>mailet</module>
<module>memory-guice</module>
+ <module>jpa-common-guice</module>
<module>jpa-guice</module>
+ <module>jpa-smtp</module>
<module>onami</module>
<module>protocols/imap</module>
<module>protocols/jmap</module>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org