Author: btellier
Date: Thu Dec 17 15:01:05 2015
New Revision: 1720585
URL: http://svn.apache.org/viewvc?rev=1720585&view=rev
Log:
JAMES-1618 RENAMESCRIPT should be RFC-5804 compliant
Added:
james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/RenameScriptTest.java
james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/renamescript.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/transcode/LineToCore.java
Added:
james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/RenameScriptTest.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/RenameScriptTest.java?rev=1720585&view=auto
==============================================================================
---
james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/RenameScriptTest.java
(added)
+++
james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/RenameScriptTest.java
Thu Dec 17 15:01:05 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 RenameScriptTest extends ManageSieveMPTTest {
+
+ @Inject
+ private static ManageSieveHostSystem hostSystem;
+
+ public RenameScriptTest() throws Exception {
+ super(hostSystem);
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Test
+ public void renameScriptShouldWork() throws Exception {
+ scriptTest("renamescript", Locale.US);
+ }
+}
Added:
james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/renamescript.test
URL:
http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/renamescript.test?rev=1720585&view=auto
==============================================================================
---
james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/renamescript.test
(added)
+++
james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/renamescript.test
Thu Dec 17 15:01:05 2015
@@ -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. #
+################################################################
+
+C: RENAMESCRIPT
+S: NO "Missing argument: old script name"
+
+C: RENAMESCRIPT "foo"
+S: NO "Missing argument: new script name"
+
+C: RENAMESCRIPT "foo" "bar"
+S: NO
+
+C: AUTHENTICATE "PLAIN"
+S: \+ ""
+C: user password
+S: OK authentication successfull
+
+C: PUTSCRIPT "mysievescript" {110+}
+C: require ["fileinto"];
+C:
+C: if envelope :contains "to" "tmartin+sent" {
+C: fileinto "INBOX.sent";
+C: }
+S: OK
+
+C: GETSCRIPT "mysievescript"
+S: \{97\}
+S: require \["fileinto"\];
+S:
+S: if envelope :contains "to" "tmartin\+sent" \{
+S: fileinto "INBOX.sent";
+S: \}
+S: OK
+
+C: RENAMESCRIPT "mysievescript" "mysievescriptbis"
+S: OK
+
+C: GETSCRIPT "mysievescriptbis"
+S: \{97\}
+S: require \["fileinto"\];
+S:
+S: if envelope :contains "to" "tmartin\+sent" \{
+S: fileinto "INBOX.sent";
+S: \}
+S: OK
+
+C: GETSCRIPT "mysievescript"
+S: NO \(NONEXISTENT\) "There is no script by that name"
+
+C: PUTSCRIPT "mysievescript" {110+}
+C: require ["fileinto"];
+C:
+C: if envelope :contains "to" "tmartin+sent" {
+C: fileinto "INBOX.sent";
+C: }
+S: OK
+
+C: RENAMESCRIPT "mysievescript" "mysievescriptbis"
+S: NO \(ALREADYEXISTS\) "A script with that name already exists"
+
+
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=1720585&r1=1720584&r2=1720585&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 15:01:05 2015
@@ -27,6 +27,7 @@ import org.apache.james.mpt.testsuite.Ha
import org.apache.james.mpt.testsuite.LogoutTest;
import org.apache.james.mpt.testsuite.NoopTest;
import org.apache.james.mpt.testsuite.PutScriptTest;
+import org.apache.james.mpt.testsuite.RenameScriptTest;
import org.apache.james.mpt.testsuite.SetActiveTest;
import org.apache.james.mpt.testsuite.StartTlsTest;
import org.apache.james.mpt.testsuite.UnauthenticatedTest;
@@ -48,7 +49,8 @@ import org.junit.runners.Suite;
PutScriptTest.class,
SetActiveTest.class,
GetScriptTest.class,
- DeleteScriptTest.class
+ DeleteScriptTest.class,
+ RenameScriptTest.class
})
public class ManageSieveFileTest {
}
Modified:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCore.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCore.java?rev=1720585&r1=1720584&r2=1720585&view=diff
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCore.java
(original)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCore.java
Thu Dec 17 15:01:05 2015
@@ -194,7 +194,7 @@ public class LineToCore{
if (scanner.hasNext()) {
throw new ArgumentException("Too many arguments: " +
scanner.next());
}
- core.renameScript(session, oldName, newName);
+ core.renameScript(session, ParserUtils.unquote(oldName),
ParserUtils.unquote(newName));
}
public void setActive(Session session, String args) throws
AuthenticationRequiredException, ScriptNotFoundException, ArgumentException,
UserNotFoundException, StorageException {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]