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/06/14 05:44:40 UTC

[5/5] james-project git commit: JAMES-2055 Add MPT test on configurable capabilities

JAMES-2055 Add MPT test on configurable capabilities


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

Branch: refs/heads/master
Commit: 28cfa6d6f3cafb64f85a77bbd15d17438a929382
Parents: 1fa2d62
Author: Antoine Duprat <ad...@linagora.com>
Authored: Mon Jun 12 14:41:41 2017 +0200
Committer: benwa <bt...@linagora.com>
Committed: Wed Jun 14 12:43:41 2017 +0700

----------------------------------------------------------------------
 .../apache/james/mpt/api/ImapHostSystem.java    |  1 -
 .../james/mpt/host/ExternalHostSystem.java      |  1 -
 .../james/mpt/host/JamesImapHostSystem.java     |  6 ++-
 .../james/mpt/imapmailbox/suite/Condstore.java  | 57 ++++++++++++++++++++
 .../james/imap/scripts/CondstoreDisable.test    | 25 +++++++++
 .../james/imap/scripts/CondstoreEnable.test     | 25 +++++++++
 .../inmemory/InMemoryMailboxTest.java           |  2 +
 .../inmemory/InMemoryMailboxTestModule.java     |  6 ++-
 8 files changed, 118 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/28cfa6d6/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java b/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
index dbff398..472b227 100644
--- a/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
+++ b/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
@@ -28,5 +28,4 @@ public interface ImapHostSystem extends HostSystem {
     void createMailbox(MailboxPath mailboxPath) throws Exception;
 
     void setQuotaLimits(long maxMessageQuota, long maxStorageQuota) throws Exception;
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/28cfa6d6/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java b/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
index 1b3d6a1..be59cb3 100644
--- a/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
+++ b/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
@@ -112,5 +112,4 @@ public class ExternalHostSystem extends ExternalSessionFactory implements ImapHo
     public void setQuotaLimits(long maxMessageQuota, long maxStorageQuota) throws Exception {
         throw new NotImplementedException();
     }
-    
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/28cfa6d6/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
index 149209a..e5eb9c4 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
@@ -27,6 +27,7 @@ import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.configuration.plist.PropertyListConfiguration;
 import org.apache.james.adapter.mailbox.store.UserRepositoryAuthenticator;
 import org.apache.james.adapter.mailbox.store.UserRepositoryAuthorizator;
+import org.apache.james.imap.api.ImapConfiguration;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.decode.ImapDecoder;
 import org.apache.james.imap.decode.main.ImapRequestStreamHandler;
@@ -159,5 +160,8 @@ public abstract class JamesImapHostSystem implements ImapHostSystem {
         configuration.addProperty("administratorId", "imapuser");
         return configuration;
     }
-    
+
+    public void configure(ImapConfiguration imapConfiguration) {
+        processor.configure(imapConfiguration);
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/28cfa6d6/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Condstore.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Condstore.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Condstore.java
new file mode 100644
index 0000000..73caef5
--- /dev/null
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Condstore.java
@@ -0,0 +1,57 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.suite;
+
+import java.util.Locale;
+
+import javax.inject.Inject;
+
+import org.apache.james.imap.api.ImapConfiguration;
+import org.apache.james.mpt.host.JamesImapHostSystem;
+import org.apache.james.mpt.imapmailbox.suite.base.BaseAuthenticatedState;
+import org.junit.Test;
+
+public class Condstore extends BaseAuthenticatedState {
+
+    @Inject
+    private static JamesImapHostSystem system;
+
+    public Condstore() throws Exception {
+        super(system);
+    }
+
+    @Test
+    public void condstoreShouldBeDisableByDefault() throws Exception {
+        system.configure(ImapConfiguration.builder().build());
+        scriptTest("CondstoreDisable", Locale.US);
+    }
+
+    @Test
+    public void condstoreShouldBeDisableWhenGivenAndFalse() throws Exception {
+        system.configure(ImapConfiguration.builder().isCondstoreEnable(false).build());
+        scriptTest("CondstoreDisable", Locale.US);
+    }
+
+    @Test
+    public void condstoreShouldBeEnableWhenGivenAndTrue() throws Exception {
+        system.configure(ImapConfiguration.builder().isCondstoreEnable(true).build());
+        scriptTest("CondstoreEnable", Locale.US);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/28cfa6d6/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/CondstoreDisable.test
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/CondstoreDisable.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/CondstoreDisable.test
new file mode 100644
index 0000000..3db4cb0
--- /dev/null
+++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/CondstoreDisable.test
@@ -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.                                           #
+################################################################
+C: A0 CAPABILITY
+S: \* CAPABILITY NAMESPACE QUOTA IMAP4rev1 QRESYNC UNSELECT WITHIN SASL-IR ACL ENABLE SEARCHRES UIDPLUS CHILDREN AUTH=PLAIN LITERAL\+ MOVE ANNOTATION ESEARCH IDLE I18NLEVEL\=1
+S: A0 OK CAPABILITY completed.
+
+C: A1 ENABLE CONDSTORE
+S: \* ENABLED
+S: A1 OK ENABLE completed.

http://git-wip-us.apache.org/repos/asf/james-project/blob/28cfa6d6/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/CondstoreEnable.test
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/CondstoreEnable.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/CondstoreEnable.test
new file mode 100644
index 0000000..937988a
--- /dev/null
+++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/CondstoreEnable.test
@@ -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.                                           #
+################################################################
+C: A0 CAPABILITY
+S: \* CAPABILITY .* CONDSTORE .*
+S: A0 OK CAPABILITY completed.
+
+C: A1 ENABLE CONDSTORE
+S: \* ENABLED CONDSTORE
+S: A1 OK ENABLE completed.

http://git-wip-us.apache.org/repos/asf/james-project/blob/28cfa6d6/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryMailboxTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryMailboxTest.java b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryMailboxTest.java
index 7c909d0..57f71dc 100644
--- a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryMailboxTest.java
+++ b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryMailboxTest.java
@@ -22,6 +22,7 @@ import org.apache.james.mpt.imapmailbox.AbstractMailboxTest;
 import org.apache.james.mpt.imapmailbox.suite.AuthenticatePlain;
 import org.apache.james.mpt.imapmailbox.suite.AuthenticatedState;
 import org.apache.james.mpt.imapmailbox.suite.ConcurrentSessions;
+import org.apache.james.mpt.imapmailbox.suite.Condstore;
 import org.apache.james.mpt.imapmailbox.suite.Events;
 import org.apache.james.mpt.imapmailbox.suite.Expunge;
 import org.apache.james.mpt.imapmailbox.suite.Fetch;
@@ -51,6 +52,7 @@ import org.junit.runners.Suite.SuiteClasses;
     AuthenticatedState.class,
     AuthenticatePlain.class,
     ConcurrentSessions.class,
+    Condstore.class,
     Events.class,
     Expunge.class,
     Fetch.class,

http://git-wip-us.apache.org/repos/asf/james-project/blob/28cfa6d6/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryMailboxTestModule.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryMailboxTestModule.java b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryMailboxTestModule.java
index 59f09b6..06d70f6 100644
--- a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryMailboxTestModule.java
+++ b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryMailboxTestModule.java
@@ -20,6 +20,7 @@ package org.apache.james.mpt.imapmailbox.inmemory;
 
 import org.apache.james.mpt.api.HostSystem;
 import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.host.JamesImapHostSystem;
 import org.apache.james.mpt.imapmailbox.inmemory.host.InMemoryHostSystem;
 
 import com.google.inject.AbstractModule;
@@ -30,12 +31,13 @@ public class InMemoryMailboxTestModule extends AbstractModule {
 
     @Override
     protected void configure() {
-        bind(HostSystem.class).to(ImapHostSystem.class);
+        bind(HostSystem.class).to(JamesImapHostSystem.class);
+        bind(ImapHostSystem.class).to(JamesImapHostSystem.class);
     }
 
     @Provides
     @Singleton
-    public ImapHostSystem provideHostSystem() throws Exception {
+    public JamesImapHostSystem provideHostSystem() throws Exception {
         return InMemoryHostSystem.build();
     }
 


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