james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject svn commit: r1720577 - in /james/project/trunk: mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/ mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/ mpt/impl/managesieve/file/src/test/java/org/apach...
Date Thu, 17 Dec 2015 14:56:52 GMT
Author: btellier
Date: Thu Dec 17 14:56:52 2015
New Revision: 1720577

URL: http://svn.apache.org/viewvc?rev=1720577&view=rev
Log:
JAMES-1618 CAPABILITY command should be RFC-5804 compliant

Added:
    james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CapabilityTest.java
    james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/capability.test
Modified:
    james/project/trunk/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/ManageSieveFileTest.java
    james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/CoreProcessor.java
    james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCoreToLine.java
    james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/managesieve/core/CoreProcessorTestCase.java

Added: james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CapabilityTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CapabilityTest.java?rev=1720577&view=auto
==============================================================================
--- james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CapabilityTest.java
(added)
+++ james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CapabilityTest.java
Thu Dec 17 14:56:52 2015
@@ -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.mpt.testsuite;
+
+import com.google.inject.Inject;
+import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.Locale;
+
+public class CapabilityTest extends ManageSieveMPTTest {
+
+    @Inject
+    private static ManageSieveHostSystem hostSystem;
+
+    public CapabilityTest() throws Exception {
+        super(hostSystem);
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+    }
+
+    @Test
+    public void capabilityShouldWork() throws Exception {
+        scriptTest("capability", Locale.US);
+    }
+}

Added: james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/capability.test
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/capability.test?rev=1720577&view=auto
==============================================================================
--- james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/capability.test
(added)
+++ james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/capability.test
Thu Dec 17 14:56:52 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: CAPABILITY
+S: "SASL" "PLAIN"
+S: "SIEVE" "log reject fileinto i;ascii-numeric envelope body"
+S: "IMPLEMENTATION" "Apache ManageSieve v1.0"
+S: "VERSION" "1.0"
+S: OK
+
+C: AUTHENTICATE "PLAIN"
+S: \+ ""
+C:  user password
+S: OK authentication successfull
+
+C: CAPABILITY
+S: "OWNER" "user"
+S: "SASL" "PLAIN"
+S: "SIEVE" "log reject fileinto i;ascii-numeric envelope body"
+S: "IMPLEMENTATION" "Apache ManageSieve v1.0"
+S: "VERSION" "1.0"
+S: OK
\ No newline at end of file

Modified: james/project/trunk/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/ManageSieveFileTest.java
URL: http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/ManageSieveFileTest.java?rev=1720577&r1=1720576&r2=1720577&view=diff
==============================================================================
--- james/project/trunk/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/ManageSieveFileTest.java
(original)
+++ james/project/trunk/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/ManageSieveFileTest.java
Thu Dec 17 14:56:52 2015
@@ -20,6 +20,7 @@
 package org.apache.james.mpt.managesieve.file;
 
 import org.apache.james.mpt.testsuite.AuthenticateTest;
+import org.apache.james.mpt.testsuite.CapabilityTest;
 import org.apache.james.mpt.testsuite.LogoutTest;
 import org.apache.james.mpt.testsuite.NoopTest;
 import org.apache.james.mpt.testsuite.StartTlsTest;
@@ -36,7 +37,8 @@ import org.junit.runners.Suite;
     UnauthenticatedTest.class,
     LogoutTest.class,
     AuthenticateTest.class,
-    StartTlsTest.class
+    StartTlsTest.class,
+    CapabilityTest.class
 })
 public class ManageSieveFileTest {
 }

Modified: james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/CoreProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/CoreProcessor.java?rev=1720577&r1=1720576&r2=1720577&view=diff
==============================================================================
--- james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/CoreProcessor.java
(original)
+++ james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/CoreProcessor.java
Thu Dec 17 14:56:52 2015
@@ -306,7 +306,6 @@ public class CoreProcessor implements Co
         if (!extensions.isEmpty()) {
             capabilitiesBase.put(Capabilities.SIEVE, extensions);
         }
-        capabilitiesBase.put(Capabilities.GETACTIVE, null);
         return capabilitiesBase;
     }
 

Modified: james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCoreToLine.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCoreToLine.java?rev=1720577&r1=1720576&r2=1720577&view=diff
==============================================================================
--- james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCoreToLine.java
(original)
+++ james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCoreToLine.java
Thu Dec 17 14:56:52 2015
@@ -60,10 +60,16 @@ public class LineToCoreToLine {
             Set<Entry<Capabilities, String>> entries = lineToCore.capability(session,
args).entrySet();
             StringBuilder builder = new StringBuilder();
             for (Entry<Capabilities, String> entry : entries) {
-                builder.append(entry.getKey().toString())
-                    .append(' ')
-                    .append(entry.getValue() == null ? "" : entry.getValue())
-                    .append("\r\n");
+                builder.append('\"')
+                    .append(entry.getKey().toString())
+                    .append('\"');
+                if (entry.getValue() != null) {
+                    builder.append(' ')
+                        .append('\"')
+                        .append(entry.getValue() == null ? "" : entry.getValue())
+                        .append('\"');
+                }
+                builder.append("\r\n");
             }
             builder.append("OK");
             return builder.toString();

Modified: james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/managesieve/core/CoreProcessorTestCase.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/managesieve/core/CoreProcessorTestCase.java?rev=1720577&r1=1720576&r2=1720577&view=diff
==============================================================================
--- james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/managesieve/core/CoreProcessorTestCase.java
(original)
+++ james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/managesieve/core/CoreProcessorTestCase.java
Thu Dec 17 14:56:52 2015
@@ -86,8 +86,7 @@ public class CoreProcessorTestCase {
         assertThat(core.capability(session)).containsEntry(Capabilities.IMPLEMENTATION, CoreProcessor.IMPLEMENTATION_DESCRIPTION)
             .containsEntry(Capabilities.VERSION, CoreProcessor.MANAGE_SIEVE_VERSION)
             .containsEntry(Capabilities.SIEVE, "a b c")
-            .containsEntry(Capabilities.SASL, Authenticate.SupportedMechanism.PLAIN.toString())
-            .containsKey(Capabilities.GETACTIVE);
+            .containsEntry(Capabilities.SASL, Authenticate.SupportedMechanism.PLAIN.toString());
     }
 
     @Test
@@ -104,8 +103,7 @@ public class CoreProcessorTestCase {
             .containsEntry(Capabilities.VERSION, CoreProcessor.MANAGE_SIEVE_VERSION)
             .containsEntry(Capabilities.SIEVE, "a b c")
             .containsEntry(Capabilities.OWNER, USER)
-            .containsEntry(Capabilities.SASL, Authenticate.SupportedMechanism.PLAIN.toString())
-            .containsKey(Capabilities.GETACTIVE);
+            .containsEntry(Capabilities.SASL, Authenticate.SupportedMechanism.PLAIN.toString());
     }
 
     @Test(expected = AuthenticationRequiredException.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