james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject svn commit: r1687799 - in /james/mpt/trunk/impl/imap-mailbox: core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ core/src/main/resources/org/apache/james/imap/scripts/aclIntegration/ cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/
Date Fri, 26 Jun 2015 16:21:07 GMT
Author: btellier
Date: Fri Jun 26 16:21:07 2015
New Revision: 1687799

URL: http://svn.apache.org/r1687799
Log:
MPT-14 ACL integration tests : SELECT EXAMINE CLOSE

Added:
    james/mpt/trunk/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java
    james/mpt/trunk/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/aclIntegration/
    james/mpt/trunk/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/aclIntegration/ACLIntegrationRightR.test
    james/mpt/trunk/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/aclIntegration/ACLIntegrationWithoutRightR.test
Modified:
    james/mpt/trunk/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/CyrusMailboxTest.java

Added: james/mpt/trunk/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java
URL: http://svn.apache.org/viewvc/james/mpt/trunk/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java?rev=1687799&view=auto
==============================================================================
--- james/mpt/trunk/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java
(added)
+++ james/mpt/trunk/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java
Fri Jun 26 16:21:07 2015
@@ -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.                                           *
+ ****************************************************************/
+
+package org.apache.james.mpt.imapmailbox.suite;
+
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.model.SimpleMailboxACL;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.GrantRightsOnHost;
+import org.apache.james.mpt.imapmailbox.suite.base.BaseImapProtocol;
+import org.junit.Test;
+
+import javax.inject.Inject;
+import java.util.Locale;
+
+public class ACLIntegration extends BaseImapProtocol {
+    public static final String OTHER_USER_NAME = "Boby";
+    public static final String OTHER_USER_PASSWORD = "password";
+    public static final MailboxPath OTHER_USER_MAILBOX = new MailboxPath("#prinvate", OTHER_USER_NAME,
"");
+    @Inject
+    private static ImapHostSystem system;
+    @Inject
+    private GrantRightsOnHost grantRightsOnHost;
+
+    public ACLIntegration() throws Exception {
+        super(system);
+    }
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        system.addUser(OTHER_USER_NAME, OTHER_USER_PASSWORD);
+    }
+
+    @Test
+    public void rightRShouldBeSufficientToPerformStatusSelectCloseExamineUS() throws Exception
{
+        grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("r"));
+        scriptTest("aclIntegration/ACLIntegrationRightR", Locale.US);
+    }
+
+    @Test
+    public void rightRShouldBeNeededToPerformStatusSelectCloseExamineUS() throws Exception
{
+        grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("lswipkxtecda"));
+        scriptTest("aclIntegration/ACLIntegrationWithoutRightR", Locale.US);
+    }
+
+}

Added: james/mpt/trunk/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/aclIntegration/ACLIntegrationRightR.test
URL: http://svn.apache.org/viewvc/james/mpt/trunk/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/aclIntegration/ACLIntegrationRightR.test?rev=1687799&view=auto
==============================================================================
--- james/mpt/trunk/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/aclIntegration/ACLIntegrationRightR.test
(added)
+++ james/mpt/trunk/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/aclIntegration/ACLIntegrationRightR.test
Fri Jun 26 16:21:07 2015
@@ -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.                                           #
+################################################################
+
+C: a000 LOGIN imapuser password
+S: \* OK IMAP4rev1 Server ready
+S: a000 OK .*
+
+C: a001 MYRIGHTS user.Boby
+S: \* MYRIGHTS user.Boby r
+S: a001 OK Completed
+
+# Right "r" is sufficient to perform a SELECT
+C: a002 SELECT user.Boby
+S: \* 0 EXISTS
+S: \* 0 RECENT
+S: \* FLAGS \(\\Answered \\Flagged \\Draft \\Deleted \\Seen\)
+S: \* OK \[PERMANENTFLAGS \(\)\] Ok
+S: \* OK \[UIDVALIDITY .*
+S: \* OK \[UIDNEXT 1\] Ok
+S: \* OK \[HIGHESTMODSEQ 2\] Ok
+S: \* OK \[URLMECH INTERNAL\] Ok
+S: a002 OK \[READ-ONLY\] Completed
+
+# Close the selected mailbox.
+C: a003 CLOSE
+S: a003 OK Completed
+
+# Right "r" is sufficient to perform a STATUS
+C: a004 STATUS user.Boby (UIDNEXT MESSAGES)
+S: \* STATUS user.Boby \(MESSAGES 0 UIDNEXT 1\)
+S: a004 OK Completed
+
+# Right "r" is sufficient to perform a EXAMINE
+C: a005 EXAMINE user.Boby
+S: \* 0 EXISTS
+S: \* 0 RECENT
+S: \* FLAGS \(\\Answered \\Flagged \\Draft \\Deleted \\Seen\)
+S: \* OK \[PERMANENTFLAGS \(\)\] Ok
+S: \* OK \[UIDVALIDITY .*
+S: \* OK \[UIDNEXT 1\] Ok
+S: \* OK \[HIGHESTMODSEQ 2\] Ok
+S: \* OK \[URLMECH INTERNAL\] Ok
+S: a005 OK \[READ-ONLY\] Completed
\ No newline at end of file

Added: james/mpt/trunk/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/aclIntegration/ACLIntegrationWithoutRightR.test
URL: http://svn.apache.org/viewvc/james/mpt/trunk/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/aclIntegration/ACLIntegrationWithoutRightR.test?rev=1687799&view=auto
==============================================================================
--- james/mpt/trunk/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/aclIntegration/ACLIntegrationWithoutRightR.test
(added)
+++ james/mpt/trunk/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/aclIntegration/ACLIntegrationWithoutRightR.test
Fri Jun 26 16:21:07 2015
@@ -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.                                           #
+################################################################
+
+C: a000 LOGIN imapuser password
+S: \* OK IMAP4rev1 Server ready
+S: a000 OK .*
+
+C: a001 MYRIGHTS user.Boby
+S: \* MYRIGHTS user.Boby lswipkxtecda
+S: a001 OK Completed
+
+# Right "r" is Needed to perform a SELECT
+C: a002 SELECT user.Boby
+S: a002 NO Permission denied
+
+# Right "r" is needed to perform a STATUS
+C: a003 STATUS user.Boby (UIDNEXT MESSAGES)
+S: a003 NO Permission denied
+
+# Right "r" is sufficient to perform a EXAMINE
+C: a004 EXAMINE user.Boby
+S: a004 NO Permission denied
\ No newline at end of file

Modified: james/mpt/trunk/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/CyrusMailboxTest.java
URL: http://svn.apache.org/viewvc/james/mpt/trunk/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/CyrusMailboxTest.java?rev=1687799&r1=1687798&r2=1687799&view=diff
==============================================================================
--- james/mpt/trunk/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/CyrusMailboxTest.java
(original)
+++ james/mpt/trunk/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/CyrusMailboxTest.java
Fri Jun 26 16:21:07 2015
@@ -20,6 +20,7 @@
 package org.apache.james.mpt.imapmailbox.cyrus;
 
 import org.apache.james.mpt.imapmailbox.suite.ACLCommands;
+import org.apache.james.mpt.imapmailbox.suite.ACLIntegration;
 import org.apache.onami.test.OnamiSuite;
 import org.apache.onami.test.annotation.GuiceModules;
 import org.junit.runner.RunWith;
@@ -27,7 +28,8 @@ import org.junit.runners.Suite.SuiteClas
 
 @RunWith(OnamiSuite.class)
 @SuiteClasses({
-    ACLCommands.class
+    ACLCommands.class,
+    ACLIntegration.class
 //    AuthenticatedState.class,
 //    ConcurrentSessions.class,
 //    Events.class,



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


Mime
View raw message