Author: btellier
Date: Thu Dec 17 15:00:13 2015
New Revision: 1720584
URL: http://svn.apache.org/viewvc?rev=1720584&view=rev
Log:
JAMES-1618 DELETESCRIPT should be MPT tested
Added:
james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/DeleteScriptTest.java
james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/deletescript.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/LineToCoreToLine.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/ManageSieveProcessor.java
Added:
james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/DeleteScriptTest.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/DeleteScriptTest.java?rev=1720584&view=auto
==============================================================================
---
james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/DeleteScriptTest.java
(added)
+++
james/project/trunk/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/DeleteScriptTest.java
Thu Dec 17 15:00:13 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 DeleteScriptTest extends ManageSieveMPTTest {
+
+ @Inject
+ private static ManageSieveHostSystem hostSystem;
+
+ public DeleteScriptTest() throws Exception {
+ super(hostSystem);
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Test
+ public void deleteScriptShouldWork() throws Exception {
+ scriptTest("deletescript", Locale.US);
+ }
+}
Added:
james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/deletescript.test
URL:
http://svn.apache.org/viewvc/james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/deletescript.test?rev=1720584&view=auto
==============================================================================
---
james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/deletescript.test
(added)
+++
james/project/trunk/mpt/impl/managesieve/core/src/main/resources/org/apache/james/managesieve/scripts/deletescript.test
Thu Dec 17 15:00:13 2015
@@ -0,0 +1,78 @@
+################################################################
+# 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: DELETESCRIPT
+S: NO "Missing argument: script name"
+
+C: DELETESCRIPT "foo"
+S: NO
+
+C: AUTHENTICATE "PLAIN"
+S: \+ ""
+C: user password
+S: OK authentication successfull
+
+C: DELETESCRIPT "foo"
+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: GETSCRIPT "mysievescript"
+S: \{97\}
+S: require \["fileinto"\];
+S:
+S: if envelope :contains "to" "tmartin\+sent" \{
+S: fileinto "INBOX.sent";
+S: \}
+S: OK
+
+C: DELETESCRIPT "mysievescript"
+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: GETSCRIPT "mysievescript"
+S: \{97\}
+S: require \["fileinto"\];
+S:
+S: if envelope :contains "to" "tmartin\+sent" \{
+S: fileinto "INBOX.sent";
+S: \}
+S: OK
+
+C: SETACTIVE "mysievescript"
+S: OK
+
+C: DELETESCRIPT "mysievescript"
+S: NO \(ACTIVE\) "You may not delete an active script"
\ 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=1720584&r1=1720583&r2=1720584&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:00:13 2015
@@ -21,6 +21,7 @@ package org.apache.james.mpt.managesieve
import org.apache.james.mpt.testsuite.AuthenticateTest;
import org.apache.james.mpt.testsuite.CapabilityTest;
+import org.apache.james.mpt.testsuite.DeleteScriptTest;
import org.apache.james.mpt.testsuite.GetScriptTest;
import org.apache.james.mpt.testsuite.HaveSpaceTest;
import org.apache.james.mpt.testsuite.LogoutTest;
@@ -46,7 +47,8 @@ import org.junit.runners.Suite;
HaveSpaceTest.class,
PutScriptTest.class,
SetActiveTest.class,
- GetScriptTest.class
+ GetScriptTest.class,
+ DeleteScriptTest.class
})
public class ManageSieveFileTest {
}
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=1720584&r1=1720583&r2=1720584&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 15:00:13 2015
@@ -141,6 +141,7 @@ public class LineToCoreToLine {
public String deleteScript(Session session, String args) {
try {
+ System.out.println("Yoloooooooo");
lineToCore.deleteScript(session, args);
} catch (AuthenticationRequiredException ex) {
return "NO";
@@ -149,6 +150,7 @@ public class LineToCoreToLine {
} catch (IsActiveException ex) {
return "NO (ACTIVE) \"You may not delete an active script\"";
} catch (ArgumentException ex) {
+ ex.printStackTrace();
return "NO \"" + ex.getMessage() + "\"";
}
return "OK";
Modified:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/ManageSieveProcessor.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/ManageSieveProcessor.java?rev=1720584&r1=1720583&r2=1720584&view=diff
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/ManageSieveProcessor.java
(original)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/ManageSieveProcessor.java
Thu Dec 17 15:00:13 2015
@@ -91,7 +91,7 @@ public class ManageSieveProcessor {
} else if (command.equals(CHECKSCRIPT)) {
return lineToCoreToLine.checkScript(session, arguments);
} else if (command.equals(DELETESCRIPT)) {
- return lineToCoreToLine.checkScript(session, arguments);
+ return lineToCoreToLine.deleteScript(session, arguments);
} else if (command.equals(GETACTIVE)) {
return lineToCoreToLine.getActive(session, arguments);
} else if (command.equals(GETSCRIPT)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]