Repository: james-project Updated Branches: refs/heads/master caf66abd0 -> 2b9824f70
MAILBOX:270: support setMetadata command, mpt and server support set mailbox annotation Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/2b9824f7 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/2b9824f7 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/2b9824f7 Branch: refs/heads/master Commit: 2b9824f70cb2a4bc74333622d92b2580a59ee248 Parents: ecaaf3b Author: Quynh Nguyen <qngu...@linagora.com> Authored: Thu Jun 23 14:43:57 2016 +0700 Committer: Benoit Tellier <btell...@linagora.com> Committed: Wed Jun 29 11:25:02 2016 +0700 ---------------------------------------------------------------------- .../org/apache/james/mpt/api/ImapFeatures.java | 3 +- .../cassandra/host/CassandraHostSystem.java | 7 ++- .../mpt/imapmailbox/AbstractMailboxTest.java | 4 +- .../imapmailbox/suite/MailboxAnnotation.java | 46 ++++++++++++++ .../apache/james/imap/scripts/Annotation.test | 63 ++++++++++++++++++++ .../inmemory/host/InMemoryHostSystem.java | 3 +- .../modules/mailbox/CassandraMailboxModule.java | 1 + 7 files changed, 122 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/2b9824f7/mpt/core/src/main/java/org/apache/james/mpt/api/ImapFeatures.java ---------------------------------------------------------------------- diff --git a/mpt/core/src/main/java/org/apache/james/mpt/api/ImapFeatures.java b/mpt/core/src/main/java/org/apache/james/mpt/api/ImapFeatures.java index e35f40c..4e4fec9 100644 --- a/mpt/core/src/main/java/org/apache/james/mpt/api/ImapFeatures.java +++ b/mpt/core/src/main/java/org/apache/james/mpt/api/ImapFeatures.java @@ -31,7 +31,8 @@ public class ImapFeatures { NAMESPACE_SUPPORT, MOVE_SUPPORT, USER_FLAGS_SUPPORT, - QUOTA_SUPPORT + QUOTA_SUPPORT, + ANNOTATION_SUPPORT } public static ImapFeatures of(Feature... features) { http://git-wip-us.apache.org/repos/asf/james-project/blob/2b9824f7/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java b/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java index 6c66d9f..501296f 100644 --- a/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java +++ b/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java @@ -31,6 +31,7 @@ import org.apache.james.mailbox.cassandra.CassandraMailboxSessionMapperFactory; import org.apache.james.mailbox.cassandra.mail.CassandraModSeqProvider; import org.apache.james.mailbox.cassandra.mail.CassandraUidProvider; import org.apache.james.mailbox.cassandra.modules.CassandraAclModule; +import org.apache.james.mailbox.cassandra.modules.CassandraAnnotationModule; import org.apache.james.mailbox.cassandra.modules.CassandraAttachmentModule; import org.apache.james.mailbox.cassandra.modules.CassandraMailboxCounterModule; import org.apache.james.mailbox.cassandra.modules.CassandraMailboxModule; @@ -60,7 +61,8 @@ public class CassandraHostSystem extends JamesImapHostSystem { private static final ImapFeatures IMAP_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT, Feature.MOVE_SUPPORT, Feature.USER_FLAGS_SUPPORT, - Feature.QUOTA_SUPPORT); + Feature.QUOTA_SUPPORT, + Feature.ANNOTATION_SUPPORT); private final CassandraMailboxManager mailboxManager; private final MockAuthenticator userManager; @@ -76,7 +78,8 @@ public class CassandraHostSystem extends JamesImapHostSystem { new CassandraModSeqModule(), new CassandraSubscriptionModule(), new CassandraQuotaModule(), - new CassandraAttachmentModule()); + new CassandraAttachmentModule(), + new CassandraAnnotationModule()); cassandraClusterSingleton = CassandraCluster.create(mailboxModule); userManager = new MockAuthenticator(); com.datastax.driver.core.Session session = cassandraClusterSingleton.getConf(); http://git-wip-us.apache.org/repos/asf/james-project/blob/2b9824f7/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/AbstractMailboxTest.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/AbstractMailboxTest.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/AbstractMailboxTest.java index d2f6f9d..ee695c0 100644 --- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/AbstractMailboxTest.java +++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/AbstractMailboxTest.java @@ -27,6 +27,7 @@ import org.apache.james.mpt.imapmailbox.suite.FetchBodySection; import org.apache.james.mpt.imapmailbox.suite.FetchBodyStructure; import org.apache.james.mpt.imapmailbox.suite.FetchHeaders; import org.apache.james.mpt.imapmailbox.suite.Listing; +import org.apache.james.mpt.imapmailbox.suite.MailboxAnnotation; import org.apache.james.mpt.imapmailbox.suite.Move; import org.apache.james.mpt.imapmailbox.suite.NonAuthenticatedState; import org.apache.james.mpt.imapmailbox.suite.PartialFetch; @@ -65,7 +66,8 @@ import org.junit.runners.Suite.SuiteClasses; Move.class, SelectedInbox.class, SelectedState.class, - UidSearch.class + UidSearch.class, + MailboxAnnotation.class }) public abstract class AbstractMailboxTest { http://git-wip-us.apache.org/repos/asf/james-project/blob/2b9824f7/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxAnnotation.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxAnnotation.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxAnnotation.java new file mode 100644 index 0000000..9073084 --- /dev/null +++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxAnnotation.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.mpt.imapmailbox.suite; + +import java.util.Locale; + +import javax.inject.Inject; + +import org.apache.james.mpt.api.ImapFeatures; +import org.apache.james.mpt.api.ImapHostSystem; +import org.apache.james.mpt.imapmailbox.suite.base.BaseSelectedInbox; +import org.junit.Assume; +import org.junit.Test; + +public class MailboxAnnotation extends BaseSelectedInbox { + @Inject + private static ImapHostSystem system; + + public MailboxAnnotation() throws Exception { + super(system); + } + + @Test + public void testAnnotationUS() throws Exception { + Assume.assumeTrue(system.supports(ImapFeatures.Feature.ANNOTATION_SUPPORT)); + scriptTest("Annotation", Locale.US); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/2b9824f7/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Annotation.test ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Annotation.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Annotation.test new file mode 100644 index 0000000..870b76a --- /dev/null +++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Annotation.test @@ -0,0 +1,63 @@ +################################################################ +# 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 .* ANNOTATION .* +S: a0 OK CAPABILITY completed. + +C: a1 SETMETADATA INBOX (/private/comment "My new comment") +S: a1 OK SETMETADATA completed. + +C: a2 SETMETADATA INBOX (/pri*vate/comment "My new comment") +S: a2 BAD SETMETADATA failed. Illegal arguments. + +C: a3 SETMETADATA INBOX (/private/comment NIL) +S: a3 OK SETMETADATA completed. + +C: a4 SETMETADATA INBOX (/private/comment {33} +S: \+ +C: My new comment across +C: two lines. ) +S: a4 OK SETMETADATA completed. + +C: a5 SETMETADATA INBOX (/private/comment "My new comment" /shared/comment "This one is for you!") +S: a5 OK SETMETADATA completed. + +C: a6 SETMETADATA INBOX (/private/comment " ") +S: a6 OK SETMETADATA completed. + +C: a7 SETMETADATA INBOX (/private/comment "NIL") +S: a7 OK SETMETADATA completed. + +C: a8 SETMETADATA INBOX (/private/comment ) +S: a8 BAD SETMETADATA failed. Illegal arguments. + +C: a10 SETMETADATA INBOX /private/comment "My new comment") +S: a10 BAD SETMETADATA failed. Illegal arguments. + +C: a11 SETMETADATA INBOX (/private/comment "My new comment" +S: a11 BAD SETMETADATA failed. Illegal arguments. + +C: a12 SETMETADATA INBOX (/private/comment PP") +S: a12 BAD SETMETADATA failed. Illegal arguments. + +C: a13 SETMETADATA INBOX () +S: a13 BAD SETMETADATA failed. Illegal arguments. + +C: a14 SETMETADATA INBOX (/private/comment My new comment) +S: a14 BAD SETMETADATA failed. Illegal arguments. http://git-wip-us.apache.org/repos/asf/james-project/blob/2b9824f7/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java index cd33f8f..674a68c 100644 --- a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java +++ b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/host/InMemoryHostSystem.java @@ -52,7 +52,8 @@ public class InMemoryHostSystem extends JamesImapHostSystem { private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT, Feature.MOVE_SUPPORT, Feature.USER_FLAGS_SUPPORT, - Feature.QUOTA_SUPPORT); + Feature.QUOTA_SUPPORT, + Feature.ANNOTATION_SUPPORT); private InMemoryMailboxManager mailboxManager; private MockAuthenticator userManager; http://git-wip-us.apache.org/repos/asf/james-project/blob/2b9824f7/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 6d845e0..853ce0b 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 @@ -82,6 +82,7 @@ public class CassandraMailboxModule extends AbstractModule { cassandraDataDefinitions.addBinding().to(org.apache.james.mailbox.cassandra.modules.CassandraUidModule.class); cassandraDataDefinitions.addBinding().to(org.apache.james.mailbox.cassandra.modules.CassandraModSeqModule.class); cassandraDataDefinitions.addBinding().to(org.apache.james.mailbox.cassandra.modules.CassandraAttachmentModule.class); + cassandraDataDefinitions.addBinding().to(org.apache.james.mailbox.cassandra.modules.CassandraAnnotationModule.class); Multibinder.newSetBinder(binder(), MailboxManagerDefinition.class).addBinding().to(CassandraMailboxManagerDefinition.class); } --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org