You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ad...@apache.org on 2017/07/07 08:24:27 UTC
[13/21] james-project git commit: MPT-39 remove crazy abstract test
class hierarchy
MPT-39 remove crazy abstract test class hierarchy
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/986df60d
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/986df60d
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/986df60d
Branch: refs/heads/master
Commit: 986df60d3ebdbba3239a00810d427267c80d5921
Parents: 46cd28e
Author: Matthieu Baechler <ma...@apache.org>
Authored: Wed Jun 21 16:52:13 2017 +0200
Committer: Matthieu Baechler <ma...@apache.org>
Committed: Thu Jul 6 10:32:17 2017 -0400
----------------------------------------------------------------------
.../script/AbstractProtocolTestFramework.java | 115 ---------
.../AbstractSimpleScriptedTestProtocol.java | 111 ---------
.../mpt/script/SimpleScriptedTestProtocol.java | 181 ++++++++++++++
.../mpt/imapmailbox/suite/ACLCommands.java | 51 ++--
.../mpt/imapmailbox/suite/ACLIntegration.java | 89 +++----
.../imapmailbox/suite/AuthenticatePlain.java | 33 ++-
.../imapmailbox/suite/AuthenticatedState.java | 234 +++++++++++++------
.../imapmailbox/suite/ConcurrentSessions.java | 115 ++++++---
.../james/mpt/imapmailbox/suite/Condstore.java | 25 +-
.../james/mpt/imapmailbox/suite/Copy.java | 22 +-
.../imapmailbox/suite/DeploymentValidation.java | 29 ++-
.../james/mpt/imapmailbox/suite/Events.java | 37 ++-
.../james/mpt/imapmailbox/suite/Expunge.java | 38 ++-
.../james/mpt/imapmailbox/suite/Fetch.java | 122 +++++++---
.../mpt/imapmailbox/suite/FetchBodySection.java | 61 +++--
.../imapmailbox/suite/FetchBodyStructure.java | 74 ++++--
.../mpt/imapmailbox/suite/FetchHeaders.java | 50 +++-
.../james/mpt/imapmailbox/suite/Listing.java | 47 +++-
.../imapmailbox/suite/MailboxAnnotation.java | 39 +++-
.../suite/MailboxWithLongNameError.java | 31 ++-
.../suite/MailboxWithLongNameSuccess.java | 26 ++-
.../james/mpt/imapmailbox/suite/Move.java | 30 ++-
.../suite/NonAuthenticatedState.java | 107 +++++++--
.../mpt/imapmailbox/suite/PartialFetch.java | 74 ++++--
.../james/mpt/imapmailbox/suite/QuotaTest.java | 41 +++-
.../james/mpt/imapmailbox/suite/Rename.java | 62 +++--
.../james/mpt/imapmailbox/suite/Search.java | 48 +++-
.../james/mpt/imapmailbox/suite/Security.java | 112 ++++++---
.../james/mpt/imapmailbox/suite/Select.java | 36 ++-
.../mpt/imapmailbox/suite/SelectedInbox.java | 193 +++++++++++----
.../mpt/imapmailbox/suite/SelectedState.java | 146 +++++++++---
.../james/mpt/imapmailbox/suite/UidSearch.java | 48 +++-
.../mpt/imapmailbox/suite/UidSearchOnIndex.java | 31 ++-
.../mpt/imapmailbox/suite/UserFlagsSupport.java | 31 ++-
.../suite/base/BaseAuthenticatedState.java | 85 -------
.../suite/base/BaseImapProtocol.java | 39 ----
.../suite/base/BaseNonAuthenticatedState.java | 59 -----
.../suite/base/BaseSelectedInbox.java | 75 ------
.../suite/base/BaseSelectedState.java | 64 -----
.../suite/base/BasicImapCommands.java | 68 ++++++
.../james/mpt/testsuite/AuthenticateTest.java | 29 ++-
.../james/mpt/testsuite/CapabilityTest.java | 29 ++-
.../james/mpt/testsuite/CheckScriptTest.java | 24 +-
.../james/mpt/testsuite/DeleteScriptTest.java | 31 ++-
.../james/mpt/testsuite/GetScriptTest.java | 29 ++-
.../james/mpt/testsuite/HaveSpaceTest.java | 29 ++-
.../james/mpt/testsuite/ListScriptsTest.java | 29 ++-
.../apache/james/mpt/testsuite/LogoutTest.java | 31 ++-
.../james/mpt/testsuite/ManageSieveMPTTest.java | 33 ---
.../apache/james/mpt/testsuite/NoopTest.java | 33 ++-
.../james/mpt/testsuite/PutScriptTest.java | 29 ++-
.../james/mpt/testsuite/RenameScriptTest.java | 29 ++-
.../james/mpt/testsuite/SetActiveTest.java | 29 ++-
.../james/mpt/testsuite/StartTlsTest.java | 29 ++-
.../mpt/testsuite/UnauthenticatedTest.java | 29 ++-
.../apache/james/mpt/smtp/ForwardSmtpTest.java | 13 +-
.../james/mpt/smtp/SmtpStarttlsCommandTest.java | 30 ++-
57 files changed, 2138 insertions(+), 1226 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractProtocolTestFramework.java
----------------------------------------------------------------------
diff --git a/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractProtocolTestFramework.java b/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractProtocolTestFramework.java
deleted file mode 100644
index 3d2ac5d..0000000
--- a/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractProtocolTestFramework.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************
- * 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.script;
-
-import org.apache.james.mpt.Runner;
-import org.apache.james.mpt.api.Continuation;
-import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.api.Session;
-import org.apache.james.mpt.protocol.ProtocolSession;
-
-/**
- * Abstract Protocol Test is the root of all of the scripted test cases. It
- * provides basic functionality for running a protocol session as a JUnit test,
- * and failing if exceptions are thrown. To create a test which reads the entire
- * protocol session from a single protocol definition file, use the
- * {@link AbstractSimpleScriptedTestProtocol}.
- *
- * @author Darrell DeBoer
- * @author Andrew C. Oliver
- */
-public abstract class AbstractProtocolTestFramework {
-
- /** The Protocol session which is run before the testElements */
- protected ProtocolSession preElements = new ProtocolSession();
-
- /** The Protocol session which contains the tests elements */
- protected ProtocolSession testElements = new ProtocolSession();
-
- /** The Protocol session which is run after the testElements. */
- protected ProtocolSession postElements = new ProtocolSession();
-
- protected final Runner runner;
- private final HostSystem hostSystem;
-
- private final String userName;
- private final String password;
-
- public AbstractProtocolTestFramework(HostSystem hostSystem, String userName, String password) {
- this.hostSystem = hostSystem;
- this.userName = userName;
- this.password = password;
- runner = new Runner();
- }
-
- protected void setUp() throws Exception {
- hostSystem.beforeTest();
- hostSystem.addUser(userName, password);
- }
-
- protected void tearDown() throws Exception {
- hostSystem.afterTest();
- }
-
- /**
- * <p>
- * Runs the pre,test and post protocol sessions against a local copy of the
- * Server. This is useful for rapid development and debugging.
- * </p>
- * Instead of sending requests to a socket connected to a running instance
- * of James, this method uses the {@link HostSystem} to simplify testing.
- * One mock instance is required per protocol session/connection.
- */
- protected void runSessions() throws Exception {
- class SessionContinuation implements Continuation {
-
- public ProtocolSession session;
-
- public void doContinue() {
- if (session != null) {
- session.doContinue();
- }
- }
-
- }
- SessionContinuation continuation = new SessionContinuation();
-
- Session[] sessions = new Session[testElements.getSessionCount()];
-
- for (int i = 0; i < sessions.length; i++) {
- sessions[i] = hostSystem.newSession(continuation);
- sessions[i].start();
- }
- try {
- continuation.session = preElements;
- preElements.runSessions(sessions);
- continuation.session = testElements;
- testElements.runSessions(sessions);
- continuation.session = postElements;
- postElements.runSessions(sessions);
- }
- finally {
- for (Session session : sessions) {
- session.stop();
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractSimpleScriptedTestProtocol.java
----------------------------------------------------------------------
diff --git a/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractSimpleScriptedTestProtocol.java b/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractSimpleScriptedTestProtocol.java
deleted file mode 100644
index f761f00..0000000
--- a/mpt/core/src/main/java/org/apache/james/mpt/script/AbstractSimpleScriptedTestProtocol.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************
- * 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.script;
-
-import java.io.InputStream;
-import java.util.Locale;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.protocol.FileProtocolSessionBuilder;
-import org.apache.james.mpt.protocol.ProtocolSession;
-import org.junit.After;
-
-/**
- * A Protocol test which reads the test protocol session from a file. The file
- * read is taken as "<test-name>.test", where <test-name> is the value passed
- * into the constructor. Subclasses of this test can set up {@link #preElements}
- * and {@link #postElements} for extra elements not defined in the protocol
- * session file.
- */
-public abstract class AbstractSimpleScriptedTestProtocol extends AbstractProtocolTestFramework {
-
- private static final Locale BASE_DEFAULT_LOCALE = Locale.getDefault();
-
- private final FileProtocolSessionBuilder builder = new FileProtocolSessionBuilder();
- private final String scriptDirectory;
-
- /**
- * Sets up a SimpleFileProtocolTest which reads the protocol session from a
- * file of name "<fileName>.test". This file should be available in the
- * classloader in the same location as this test class.
- *
- * @param scriptDirectory
- * name of the directory containing the scripts to be run
- * @param fileName
- * The name of the file to read protocol elements from.
- * @throws Exception
- */
- public AbstractSimpleScriptedTestProtocol(HostSystem hostSystem, String userName, String password,
- String scriptDirectory) throws Exception {
- super(hostSystem, userName, password);
- this.scriptDirectory = scriptDirectory;
- }
-
- @After
- public void tearDown() throws Exception {
- super.tearDown();
- Locale.setDefault(BASE_DEFAULT_LOCALE);
- }
-
- /**
- * Reads test elements from the protocol session file and adds them to the
- * {@link #testElements} ProtocolSession. Then calls {@link #runSessions}.
- *
- * @param locale
- * execute the test using this locale
- */
- protected void scriptTest(String fileName, Locale locale) throws Exception {
- Locale.setDefault(locale);
- addTestFile(fileName + ".test", testElements);
- runSessions();
- }
-
- /**
- * Finds the protocol session file identified by the test name, and builds
- * protocol elements from it. All elements from the definition file are
- * added to the supplied ProtocolSession.
- *
- * @param fileName
- * The name of the file to read
- * @param session
- * The ProtocolSession to add elements to.
- */
- protected void addTestFile(String fileName, ProtocolSession session) throws Exception {
-
- fileName = scriptDirectory + fileName;
-
- // Need to find local resource.
- InputStream is = this.getClass().getResourceAsStream(fileName);
-
- if (is == null) {
- throw new Exception("Test Resource '" + fileName + "' not found.");
- }
-
- try {
- builder.addProtocolLinesFromStream(is, session, fileName);
- }
- finally {
- IOUtils.closeQuietly(is);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/core/src/main/java/org/apache/james/mpt/script/SimpleScriptedTestProtocol.java
----------------------------------------------------------------------
diff --git a/mpt/core/src/main/java/org/apache/james/mpt/script/SimpleScriptedTestProtocol.java b/mpt/core/src/main/java/org/apache/james/mpt/script/SimpleScriptedTestProtocol.java
new file mode 100644
index 0000000..f412df6
--- /dev/null
+++ b/mpt/core/src/main/java/org/apache/james/mpt/script/SimpleScriptedTestProtocol.java
@@ -0,0 +1,181 @@
+/****************************************************************
+ * 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.script;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.james.mpt.api.Continuation;
+import org.apache.james.mpt.api.HostSystem;
+import org.apache.james.mpt.api.Session;
+import org.apache.james.mpt.protocol.FileProtocolSessionBuilder;
+import org.apache.james.mpt.protocol.ProtocolSession;
+
+public final class SimpleScriptedTestProtocol {
+
+ private final FileProtocolSessionBuilder builder = new FileProtocolSessionBuilder();
+ private final String scriptDirectory;
+
+ /** The Protocol session which is run before the testElements */
+ private ProtocolSession preElements = new ProtocolSession();
+
+ /** The Protocol session which contains the tests elements */
+ private ProtocolSession testElements = new ProtocolSession();
+
+ /** The Protocol session which is run after the testElements. */
+ private ProtocolSession postElements = new ProtocolSession();
+
+ private Locale locale;
+ private HostSystem hostSystem;
+ private Map<String, String> users;
+
+ public SimpleScriptedTestProtocol(String scriptDirectory, HostSystem hostSystem) throws Exception {
+ this.scriptDirectory = scriptDirectory;
+ this.hostSystem = hostSystem;
+ this.locale = Locale.getDefault();
+ this.users = new HashMap<String, String>();
+ }
+
+ public SimpleScriptedTestProtocol withLocale(Locale locale) {
+ this.locale = locale;
+ return this;
+ }
+
+ public SimpleScriptedTestProtocol withUser(String userAtDomain, String password) {
+ users.put(userAtDomain, password);
+ return this;
+ }
+
+ public ProtocolSession preElements() {
+ return preElements;
+ }
+
+ public ProtocolSession testElements() {
+ return testElements;
+ }
+
+ public ProtocolSession postElements() {
+ return postElements;
+ }
+
+ /**
+ * Reads test elements from the protocol session file and adds them to the
+ * {@link #testElements} ProtocolSession. Then calls {@link #runSessions}.
+ * @param locale
+ * execute the test using this locale
+ */
+ public void run(String fileName) throws Exception {
+ createUsers();
+ Locale previousLocale = Locale.getDefault();
+ try {
+ Locale.setDefault(locale);
+ addTestFile(fileName + ".test", testElements);
+ runSessions(hostSystem);
+ } finally {
+ Locale.setDefault(previousLocale);
+ }
+ }
+
+
+ private void createUsers() throws Exception {
+ for (Entry<String, String> user: users.entrySet()) {
+ hostSystem.addUser(user.getKey(), user.getValue());
+ }
+ }
+
+ /**
+ * <p>
+ * Runs the pre,test and post protocol sessions against a local copy of the
+ * Server. This is useful for rapid development and debugging.
+ * </p>
+ * Instead of sending requests to a socket connected to a running instance
+ * of James, this method uses the {@link HostSystem} to simplify testing.
+ * One mock instance is required per protocol session/connection.
+ */
+ private void runSessions(HostSystem hostSystem) throws Exception {
+ class SessionContinuation implements Continuation {
+
+ public ProtocolSession session;
+
+ public void doContinue() {
+ if (session != null) {
+ session.doContinue();
+ }
+ }
+
+ }
+ SessionContinuation continuation = new SessionContinuation();
+
+ Session[] sessions = new Session[testElements.getSessionCount()];
+
+ for (int i = 0; i < sessions.length; i++) {
+ sessions[i] = hostSystem.newSession(continuation);
+ sessions[i].start();
+ }
+ try {
+ continuation.session = preElements;
+ preElements.runSessions(sessions);
+ continuation.session = testElements;
+ testElements.runSessions(sessions);
+ continuation.session = postElements;
+ postElements.runSessions(sessions);
+ }
+ finally {
+ for (Session session : sessions) {
+ session.stop();
+ }
+ }
+ }
+
+ /**
+ * Finds the protocol session file identified by the test name, and builds
+ * protocol elements from it. All elements from the definition file are
+ * added to the supplied ProtocolSession.
+ *
+ * @param fileName
+ * The name of the file to read
+ * @param session
+ * The ProtocolSession to add elements to.
+ */
+ public void addTestFile(String fileName, ProtocolSession session) throws Exception {
+
+ fileName = scriptDirectory + fileName;
+
+ // Need to find local resource.
+ InputStream is = this.getClass().getResourceAsStream(fileName);
+
+ if (is == null) {
+ throw new Exception("Test Resource '" + fileName + "' not found.");
+ }
+
+ try {
+ builder.addProtocolLinesFromStream(is, session, fileName);
+ }
+ finally {
+ IOUtils.closeQuietly(is);
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLCommands.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLCommands.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLCommands.java
index 8ff42f3..2fd93d2 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLCommands.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLCommands.java
@@ -19,68 +19,85 @@
package org.apache.james.mpt.imapmailbox.suite;
+import java.util.Locale;
+
+import javax.inject.Inject;
+
import org.apache.james.mailbox.model.MailboxACL;
import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.model.SimpleMailboxACL;
import org.apache.james.mpt.api.HostSystem;
import org.apache.james.mpt.imapmailbox.GrantRightsOnHost;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseImapProtocol;
+import org.apache.james.mpt.imapmailbox.ImapTestConstants;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.Before;
import org.junit.Test;
-import javax.inject.Inject;
-import java.util.Locale;
-
-public class ACLCommands extends BaseImapProtocol {
+public class ACLCommands implements ImapTestConstants {
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("#private", OTHER_USER_NAME, "") ;
- private final MailboxACL.MailboxACLRights readWriteSeenRight;
@Inject
private static HostSystem system;
+
@Inject
private GrantRightsOnHost grantRightsOnHost;
- public ACLCommands() throws Exception {
- super(system);
+ private MailboxACL.MailboxACLRights readWriteSeenRight;
+ private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
+
+ @Before
+ public void setUp() throws Exception {
+ simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
+ .withUser(TO_ADDRESS, PASSWORD)
+ .withLocale(Locale.US);
readWriteSeenRight = new SimpleMailboxACL.Rfc4314Rights("rsw");
}
@Test
public void testACLCommandsOwnerUS() throws Exception {
- scriptTest("ACLCommandsOnOwner", Locale.US);
+ simpleScriptedTestProtocol.run("ACLCommandsOnOwner");
}
@Test
public void testACLCommandsOtherUserUS() throws Exception {
- system.addUser(OTHER_USER_NAME, OTHER_USER_PASSWORD);
+ simpleScriptedTestProtocol
+ .withUser(OTHER_USER_NAME, OTHER_USER_PASSWORD);
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, readWriteSeenRight);
- scriptTest("ACLCommandsOnOtherUser", Locale.US);
+ simpleScriptedTestProtocol.run("ACLCommandsOnOtherUser");
}
@Test
public void testACLCommandsOwnerKorea() throws Exception {
- scriptTest("ACLCommandsOnOwner", Locale.KOREA);
+ simpleScriptedTestProtocol.withLocale(Locale.KOREA);
+ simpleScriptedTestProtocol.run("ACLCommandsOnOwner");
}
@Test
public void testACLCommandsOtherUserKorea() throws Exception {
- system.addUser(OTHER_USER_NAME, OTHER_USER_PASSWORD);
+ simpleScriptedTestProtocol
+ .withUser(OTHER_USER_NAME, OTHER_USER_PASSWORD)
+ .withLocale(Locale.KOREA);
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, readWriteSeenRight);
- scriptTest("ACLCommandsOnOtherUser", Locale.KOREA);
+ simpleScriptedTestProtocol.run("ACLCommandsOnOtherUser");
}
@Test
public void testACLCommandsOwnerItaly() throws Exception {
- scriptTest("ACLCommandsOnOwner", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY);
+ simpleScriptedTestProtocol.run("ACLCommandsOnOwner");
}
@Test
public void testACLCommandsOtherUserItaly() throws Exception {
- system.addUser(OTHER_USER_NAME, OTHER_USER_PASSWORD);
+ simpleScriptedTestProtocol
+ .withUser(OTHER_USER_NAME, OTHER_USER_PASSWORD)
+ .withLocale(Locale.ITALY);
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, readWriteSeenRight);
- scriptTest("ACLCommandsOnOtherUser", Locale.ITALY);
+ simpleScriptedTestProtocol.run("ACLCommandsOnOtherUser");
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java
index 165a230..c31a5fd 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java
@@ -19,18 +19,21 @@
package org.apache.james.mpt.imapmailbox.suite;
+import java.util.Locale;
+
+import javax.inject.Inject;
+
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.ImapTestConstants;
import org.apache.james.mpt.imapmailbox.MailboxMessageAppender;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseImapProtocol;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.Before;
import org.junit.Test;
-import javax.inject.Inject;
-import java.util.Locale;
-
-public class ACLIntegration extends BaseImapProtocol {
+public class ACLIntegration implements ImapTestConstants {
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("#private", OTHER_USER_NAME, "");
@@ -43,64 +46,64 @@ public class ACLIntegration extends BaseImapProtocol {
@Inject
private MailboxMessageAppender mailboxMessageAppender;
- public ACLIntegration() throws Exception {
- super(system);
- }
+ private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
- @Override
+ @Before
public void setUp() throws Exception {
- super.setUp();
- system.addUser(OTHER_USER_NAME, OTHER_USER_PASSWORD);
+ simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
+ .withUser(TO_ADDRESS, PASSWORD)
+ .withUser(OTHER_USER_NAME, OTHER_USER_PASSWORD)
+ .withLocale(Locale.US);
}
-
+
@Test
public void rightRShouldBeSufficientToPerformStatusSelectCloseExamineUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("r"));
- scriptTest("aclIntegration/ACLIntegrationRightR", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightR");
}
@Test
public void rightRShouldBeNeededToPerformStatusSelectCloseExamineUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("lswipkxtecda"));
- scriptTest("aclIntegration/ACLIntegrationWithoutRightR", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationWithoutRightR");
}
@Test
public void rightLShouldBeSufficientToPerformListUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("l"));
- scriptTest("aclIntegration/ACLIntegrationRightL", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightL");
}
@Test
public void rightLShouldBeNeededToPerformListLsubSubscribeUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rswipkxtecda"));
- scriptTest("aclIntegration/ACLIntegrationWithoutRightL", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationWithoutRightL");
}
@Test
public void rightAShouldBeSufficientToManageACLUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("a"));
- scriptTest("aclIntegration/ACLIntegrationRightA", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightA");
}
@Test
public void rightAShouldBeNeededToManageACLUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rswipkxtecdl"));
- scriptTest("aclIntegration/ACLIntegrationWithoutRightA", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationWithoutRightA");
}
@Test
public void rightXOnOriginShouldBeSufficientToRenameAMailboxUS() throws Exception {
system.createMailbox(new MailboxPath("#private","Boby","test"));
grantRightsOnHost.grantRights(new MailboxPath("#private", OTHER_USER_NAME, "test"), USER, new SimpleMailboxACL.Rfc4314Rights("x"));
- scriptTest("aclIntegration/ACLIntegrationRightX", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightX");
}
@Test
public void rightXOnOriginShouldBeNeededToRenameAMailboxUS() throws Exception {
system.createMailbox(new MailboxPath("#private","Boby","test"));
grantRightsOnHost.grantRights(new MailboxPath("#private", OTHER_USER_NAME, "test"), USER, new SimpleMailboxACL.Rfc4314Rights("rswipktela"));
- scriptTest("aclIntegration/ACLIntegrationWithoutRightX", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationWithoutRightX");
}
@Test
@@ -109,7 +112,7 @@ public class ACLIntegration extends BaseImapProtocol {
system.createMailbox(newMailbox);
grantRightsOnHost.grantRights(newMailbox, USER, new SimpleMailboxACL.Rfc4314Rights("x"));
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("k"));
- scriptTest("aclIntegration/ACLIntegrationRightK", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightK");
}
@Test
@@ -118,146 +121,146 @@ public class ACLIntegration extends BaseImapProtocol {
system.createMailbox(newMailbox);
grantRightsOnHost.grantRights(newMailbox, USER, new SimpleMailboxACL.Rfc4314Rights("x"));
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rswipxtela"));
- scriptTest("aclIntegration/ACLIntegrationWithoutRightK", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationWithoutRightK");
}
@Test
public void rightREShouldBeSufficientToPerformExpungeUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("re"));
- scriptTest("aclIntegration/ACLIntegrationRightRE", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightRE");
}
@Test
public void rightEShouldBeNeededToPerformExpungeUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rswipxtclak"));
- scriptTest("aclIntegration/ACLIntegrationWithoutRightE", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationWithoutRightE");
}
@Test
public void rightIShouldBeSufficientToPerformAppendUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("ri"));
- scriptTest("aclIntegration/ACLIntegrationRightI", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightI");
}
@Test
public void rightIShouldBeNeededToPerformAppendUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rswepxtcdlak"));
- scriptTest("aclIntegration/ACLIntegrationWithoutRightI", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationWithoutRightI");
}
@Test
public void rightISShouldBeSufficientToPerformAppendOfSeenMessageUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("ris"));
- scriptTest("aclIntegration/ACLIntegrationRightIS", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightIS");
}
@Test
public void rightITShouldBeSufficientToPerformAppendOfDeletedMessageUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rit"));
- scriptTest("aclIntegration/ACLIntegrationRightIT", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightIT");
}
@Test
public void rightIWShouldBeSufficientToPerformAppendOfDeletedMessageUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("riw"));
- scriptTest("aclIntegration/ACLIntegrationRightIW", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightIW");
}
@Test
public void rightRSShouldBeSufficientToPerformStoreAndFetchOnSeenMessageUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rs"));
mailboxMessageAppender.fillMailbox(OTHER_USER_MAILBOX);
- scriptTest("aclIntegration/ACLIntegrationRightRS", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightRS");
}
@Test
public void rightSShouldBeNeededToPerformStoreAndFetchOnSeenMessageUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rwipxtcdlake"));
mailboxMessageAppender.fillMailbox(OTHER_USER_MAILBOX);
- scriptTest("aclIntegration/ACLIntegrationWithoutRightS", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationWithoutRightS");
}
@Test
public void rightRWShouldBeSufficientToPerformStoreOnFlaggedMessageUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rw"));
mailboxMessageAppender.fillMailbox(OTHER_USER_MAILBOX);
- scriptTest("aclIntegration/ACLIntegrationRightRW", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightRW");
}
@Test
public void rightWShouldBeNeededToPerformStoreOnFlaggedMessageUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rsipxtcdlake"));
mailboxMessageAppender.fillMailbox(OTHER_USER_MAILBOX);
- scriptTest("aclIntegration/ACLIntegrationWithoutRightW", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationWithoutRightW");
}
@Test
public void rightRTShouldBeSufficientToPerformStoreOnDeletedMessageUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rt"));
mailboxMessageAppender.fillMailbox(OTHER_USER_MAILBOX);
- scriptTest("aclIntegration/ACLIntegrationRightRT", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationRightRT");
}
@Test
public void rightTShouldBeNeededToPerformStoreOnFlaggedMessageUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rwipxslake"));
mailboxMessageAppender.fillMailbox(OTHER_USER_MAILBOX);
- scriptTest("aclIntegration/ACLIntegrationWithoutRightT", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationWithoutRightT");
}
@Test
public void rightIShouldBeSufficientToPerformCopyUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("i"));
mailboxMessageAppender.fillMailbox(MY_INBOX);
- scriptTest("aclIntegration/ACLIntegrationCopyI", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationCopyI");
}
@Test
public void rightIShouldBeNeededToPerformCopyUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rswpxtcdlake"));
mailboxMessageAppender.fillMailbox(MY_INBOX);
- scriptTest("aclIntegration/ACLIntegrationCopyWithoutI", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationCopyWithoutI");
}
@Test
public void rightIShouldBeSufficientToPerformOfSeenMessagesCopyUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("ris"));
mailboxMessageAppender.fillMailbox(MY_INBOX);
- scriptTest("aclIntegration/ACLIntegrationCopyIS", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationCopyIS");
}
@Test
public void rightSShouldBeNeededToPerformCopyOfSeenMessageUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("riwpxtcdlake"));
mailboxMessageAppender.fillMailbox(MY_INBOX);
- scriptTest("aclIntegration/ACLIntegrationCopyWithoutS", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationCopyWithoutS");
}
@Test
public void rightIWShouldBeSufficientToPerformOfFlaggedMessagesCopyUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("riw"));
mailboxMessageAppender.fillMailbox(MY_INBOX);
- scriptTest("aclIntegration/ACLIntegrationCopyIW", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationCopyIW");
}
@Test
public void rightWShouldBeNeededToPerformCopyOfFlaggedMessageUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rispxtcdlake"));
mailboxMessageAppender.fillMailbox(MY_INBOX);
- scriptTest("aclIntegration/ACLIntegrationCopyWithoutW", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationCopyWithoutW");
}
@Test
public void rightITShouldBeSufficientToPerformOfDeletedMessagesCopyUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rit"));
mailboxMessageAppender.fillMailbox(MY_INBOX);
- scriptTest("aclIntegration/ACLIntegrationCopyIT", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationCopyIT");
}
@Test
public void rightTShouldBeNeededToPerformCopyOfDeletedMessageUS() throws Exception {
grantRightsOnHost.grantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rispxwlake"));
mailboxMessageAppender.fillMailbox(MY_INBOX);
- scriptTest("aclIntegration/ACLIntegrationCopyWithoutT", Locale.US);
+ simpleScriptedTestProtocol.run("aclIntegration/ACLIntegrationCopyWithoutT");
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatePlain.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatePlain.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatePlain.java
index 6f241bb..b11eca8 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatePlain.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatePlain.java
@@ -26,16 +26,31 @@ import javax.inject.Inject;
import org.apache.james.mailbox.model.MailboxConstants;
import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mpt.api.ImapHostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseNonAuthenticatedState;
+import org.apache.james.mpt.imapmailbox.ImapTestConstants;
+import org.apache.james.mpt.imapmailbox.suite.base.BasicImapCommands;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
-public class AuthenticatePlain extends BaseNonAuthenticatedState {
+public class AuthenticatePlain implements ImapTestConstants {
@Inject
private static ImapHostSystem system;
- public AuthenticatePlain() throws Exception {
- super(system);
+ private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
+
+ @Before
+ public void setUp() throws Exception {
+ simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
+ .withUser(USER, PASSWORD)
+ .withLocale(Locale.US);
+ BasicImapCommands.welcome(simpleScriptedTestProtocol);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ system.afterTest();
}
@Test
@@ -43,7 +58,7 @@ public class AuthenticatePlain extends BaseNonAuthenticatedState {
system.addUser("delegate", "123456");
system.createMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, "delegate", "delegate"));
system.createMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, "imapuser", "imapuser"));
- scriptTest("AuthenticatePlain", Locale.US);
+ simpleScriptedTestProtocol.run("AuthenticatePlain");
}
@Test
@@ -51,7 +66,9 @@ public class AuthenticatePlain extends BaseNonAuthenticatedState {
system.addUser("delegate", "123456");
system.createMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, "delegate", "delegate"));
system.createMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, "imapuser", "imapuser"));
- scriptTest("AuthenticatePlain", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("AuthenticatePlain");
}
@Test
@@ -59,6 +76,8 @@ public class AuthenticatePlain extends BaseNonAuthenticatedState {
system.addUser("delegate", "123456");
system.createMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, "delegate", "delegate"));
system.createMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE, "imapuser", "imapuser"));
- scriptTest("AuthenticatePlain", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("AuthenticatePlain");
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatedState.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatedState.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatedState.java
index c6680e1..45bafa6 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatedState.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/AuthenticatedState.java
@@ -26,341 +26,441 @@ import javax.inject.Inject;
import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mpt.api.ImapFeatures.Feature;
import org.apache.james.mpt.api.ImapHostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseAuthenticatedState;
+import org.apache.james.mpt.imapmailbox.suite.base.BasicImapCommands;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
import org.junit.Assume;
+import org.junit.Before;
import org.junit.Test;
-public class AuthenticatedState extends BaseAuthenticatedState {
+public class AuthenticatedState extends BasicImapCommands {
@Inject
private static ImapHostSystem system;
- public AuthenticatedState() throws Exception {
- super(system);
+ private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
+
+ @Before
+ public void setUp() throws Exception {
+ simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
+ .withUser(USER, PASSWORD)
+ .withLocale(Locale.US);
+ BasicImapCommands.welcome(simpleScriptedTestProtocol);
+ BasicImapCommands.authenticate(simpleScriptedTestProtocol);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ system.afterTest();
}
@Test
public void testNoopUS() throws Exception {
- scriptTest("Noop", Locale.US);
+ simpleScriptedTestProtocol.run("Noop");
}
@Test
public void testLogoutUS() throws Exception {
- scriptTest("Logout", Locale.US);
+ simpleScriptedTestProtocol.run("Logout");
}
@Test
public void testCapabilityUS() throws Exception {
- scriptTest("Capability", Locale.US);
+ simpleScriptedTestProtocol.run("Capability");
}
@Test
public void testAppendExamineInboxUS() throws Exception {
- scriptTest("AppendExamineInbox", Locale.US);
+ simpleScriptedTestProtocol.run("AppendExamineInbox");
}
@Test
public void testAppendSelectInboxUS() throws Exception {
- scriptTest("AppendSelectInbox", Locale.US);
+ simpleScriptedTestProtocol.run("AppendSelectInbox");
}
@Test
public void testCreateUS() throws Exception {
- scriptTest("Create", Locale.US);
+ simpleScriptedTestProtocol.run("Create");
}
@Test
public void testExamineEmptyUS() throws Exception {
- scriptTest("ExamineEmpty", Locale.US);
+ simpleScriptedTestProtocol.run("ExamineEmpty");
}
@Test
public void testSelectEmptyUS() throws Exception {
- scriptTest("SelectEmpty", Locale.US);
+ simpleScriptedTestProtocol.run("SelectEmpty");
}
@Test
public void testListNamespaceUS() throws Exception {
- scriptTest("ListNamespace", Locale.US);
+ simpleScriptedTestProtocol.run("ListNamespace");
}
@Test
public void testListMailboxesUS() throws Exception {
- scriptTest("ListMailboxes", Locale.US);
+ simpleScriptedTestProtocol.run("ListMailboxes");
}
@Test
public void testStatusUS() throws Exception {
- scriptTest("Status", Locale.US);
+ simpleScriptedTestProtocol.run("Status");
}
@Test
public void testSubscribeUS() throws Exception {
- scriptTest("Subscribe", Locale.US);
+ simpleScriptedTestProtocol.run("Subscribe");
}
@Test
public void testDeleteUS() throws Exception {
- scriptTest("Delete", Locale.US);
+ simpleScriptedTestProtocol.run("Delete");
}
@Test
public void testAppendUS() throws Exception {
- scriptTest("Append", Locale.US);
+ simpleScriptedTestProtocol.run("Append");
}
@Test
public void testAppendExpungeUS() throws Exception {
- scriptTest("AppendExpunge", Locale.US);
+ simpleScriptedTestProtocol.run("AppendExpunge");
}
@Test
public void testSelectAppendUS() throws Exception {
- scriptTest("SelectAppend", Locale.US);
+ simpleScriptedTestProtocol.run("SelectAppend");
}
@Test
public void testStringArgsUS() throws Exception {
- scriptTest("StringArgs", Locale.US);
+ simpleScriptedTestProtocol.run("StringArgs");
}
@Test
public void testValidNonAuthenticatedUS() throws Exception {
- scriptTest("ValidNonAuthenticated", Locale.US);
+ simpleScriptedTestProtocol.run("ValidNonAuthenticated");
}
@Test
public void testNoopITALY() throws Exception {
- scriptTest("Noop", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("Noop");
}
@Test
public void testLogoutITALY() throws Exception {
- scriptTest("Logout", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY).run("Logout");
}
@Test
public void testCapabilityITALY() throws Exception {
- scriptTest("Capability", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("Capability");
}
@Test
public void testAppendExamineInboxITALY() throws Exception {
- scriptTest("AppendExamineInbox", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("AppendExamineInbox");
}
@Test
public void testAppendSelectInboxITALY() throws Exception {
- scriptTest("AppendSelectInbox", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("AppendSelectInbox");
}
@Test
public void testCreateITALY() throws Exception {
- scriptTest("Create", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("Create");
}
@Test
public void testExamineEmptyITALY() throws Exception {
- scriptTest("ExamineEmpty", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ExamineEmpty");
}
@Test
public void testSelectEmptyITALY() throws Exception {
- scriptTest("SelectEmpty", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("SelectEmpty");
}
@Test
public void testListNamespaceITALY() throws Exception {
- scriptTest("ListNamespace", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ListNamespace");
}
@Test
public void testListMailboxesITALY() throws Exception {
- scriptTest("ListMailboxes", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ListMailboxes");
}
@Test
public void testStatusITALY() throws Exception {
- scriptTest("Status", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("Status");
}
@Test
public void testSubscribeITALY() throws Exception {
- scriptTest("Subscribe", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("Subscribe");
}
@Test
public void testDeleteITALY() throws Exception {
- scriptTest("Delete", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("Delete");
}
@Test
public void testAppendITALY() throws Exception {
- scriptTest("Append", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("Append");
}
@Test
public void testAppendExpungeITALY() throws Exception {
- scriptTest("AppendExpunge", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("AppendExpunge");
}
@Test
public void testSelectAppendITALY() throws Exception {
- scriptTest("SelectAppend", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("SelectAppend");
}
@Test
public void testStringArgsITALY() throws Exception {
- scriptTest("StringArgs", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("StringArgs");
}
@Test
public void testValidNonAuthenticatedITALY() throws Exception {
- scriptTest("ValidNonAuthenticated", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ValidNonAuthenticated");
}
@Test
public void testNoopKOREA() throws Exception {
- scriptTest("Noop", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("Noop");
}
@Test
public void testLogoutKOREA() throws Exception {
- scriptTest("Logout", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("Logout");
}
@Test
public void testCapabilityKOREA() throws Exception {
- scriptTest("Capability", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("Capability");
}
@Test
public void testAppendExamineInboxKOREA() throws Exception {
- scriptTest("AppendExamineInbox", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("AppendExamineInbox");
}
@Test
public void testAppendSelectInboxKOREA() throws Exception {
- scriptTest("AppendSelectInbox", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("AppendSelectInbox");
}
@Test
public void testCreateKOREA() throws Exception {
- scriptTest("Create", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("Create");
}
@Test
public void testExamineEmptyKOREA() throws Exception {
- scriptTest("ExamineEmpty", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ExamineEmpty");
}
@Test
public void testSelectEmptyKOREA() throws Exception {
- scriptTest("SelectEmpty", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("SelectEmpty");
}
@Test
public void testListNamespaceKOREA() throws Exception {
- scriptTest("ListNamespace", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ListNamespace");
}
@Test
public void testListMailboxesKOREA() throws Exception {
- scriptTest("ListMailboxes", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ListMailboxes");
}
@Test
public void testStatusKOREA() throws Exception {
- scriptTest("Status", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("Status");
}
@Test
public void testSubscribeKOREA() throws Exception {
- scriptTest("Subscribe", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("Subscribe");
}
@Test
public void testDeleteKOREA() throws Exception {
- scriptTest("Delete", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("Delete");
}
@Test
public void testAppendKOREA() throws Exception {
- scriptTest("Append", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("Append");
}
@Test
public void testAppendExpungeKOREA() throws Exception {
- scriptTest("AppendExpunge", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("AppendExpunge");
}
@Test
public void testSelectAppendKOREA() throws Exception {
- scriptTest("SelectAppend", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("SelectAppend");
}
@Test
public void testStringArgsKOREA() throws Exception {
- scriptTest("StringArgs", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("StringArgs");
}
@Test
public void testValidNonAuthenticatedKOREA() throws Exception {
- scriptTest("ValidNonAuthenticated", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ValidNonAuthenticated");
}
@Test
public void testNamespaceUS() throws Exception {
- scriptTest("Namespace", Locale.US);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("Namespace");
}
@Test
public void testNamespaceITALY() throws Exception {
- scriptTest("Namespace", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("Namespace");
}
@Test
public void testNamespaceKOREA() throws Exception {
- scriptTest("Namespace", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("Namespace");
}
@Test
public void listShouldNotListMailboxWithOtherNamspaceUS() throws Exception {
Assume.assumeTrue(system.supports(Feature.NAMESPACE_SUPPORT));
system.createMailbox(new MailboxPath("#namespace", USER, "Other"));
- scriptTest("ListMailboxes", Locale.US);
+ simpleScriptedTestProtocol.run("ListMailboxes");
}
@Test
public void listShouldNotListMailboxWithOtherNamspaceITALY() throws Exception {
Assume.assumeTrue(system.supports(Feature.NAMESPACE_SUPPORT));
system.createMailbox(new MailboxPath("#namespace", USER, "Other"));
- scriptTest("ListMailboxes", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ListMailboxes");
}
@Test
public void listShouldNotListMailboxWithOtherNamspaceKOREA() throws Exception {
Assume.assumeTrue(system.supports(Feature.NAMESPACE_SUPPORT));
system.createMailbox(new MailboxPath("#namespace", USER, "Other"));
- scriptTest("ListMailboxes", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ListMailboxes");
}
@Test
public void listShouldNotListMailboxWithOtherUserUS() throws Exception {
system.createMailbox(new MailboxPath("#namespace", USER + "2", "Other"));
- scriptTest("ListMailboxes", Locale.US);
+ simpleScriptedTestProtocol.run("ListMailboxes");
}
@Test
public void listShouldNotListMailboxWithOtherUserITALY() throws Exception {
system.createMailbox(new MailboxPath("#namespace", USER + "2", "Other"));
- scriptTest("ListMailboxes", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ListMailboxes");
}
@Test
public void listShouldNotListMailboxWithOtherUserKOREA() throws Exception {
system.createMailbox(new MailboxPath("#namespace", USER + "2", "Other"));
- scriptTest("ListMailboxes", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ListMailboxes");
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ConcurrentSessions.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ConcurrentSessions.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ConcurrentSessions.java
index 4a55ed1..6945e94 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ConcurrentSessions.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ConcurrentSessions.java
@@ -24,130 +24,191 @@ import java.util.Locale;
import javax.inject.Inject;
import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseAuthenticatedState;
+import org.apache.james.mpt.imapmailbox.ImapTestConstants;
+import org.apache.james.mpt.imapmailbox.suite.base.BasicImapCommands;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
-public class ConcurrentSessions extends BaseAuthenticatedState {
+public class ConcurrentSessions implements ImapTestConstants {
@Inject
private static HostSystem system;
- public ConcurrentSessions() throws Exception {
- super(system);
+ private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
+
+ @Before
+ public void setUp() throws Exception {
+ simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
+ .withUser(USER, PASSWORD);
+ BasicImapCommands.welcome(simpleScriptedTestProtocol);
+ BasicImapCommands.authenticate(simpleScriptedTestProtocol);
}
+ @After
+ public void tearDown() throws Exception {
+ system.afterTest();
+ }
+
@Test
public void testConcurrentExpungeResponseUS() throws Exception {
- scriptTest("ConcurrentExpungeResponse", Locale.US);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.US)
+ .run("ConcurrentExpungeResponse");
}
@Test
public void testConcurrentExpungeResponseITALY() throws Exception {
- scriptTest("ConcurrentExpungeResponse", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ConcurrentExpungeResponse");
}
@Test
public void testConcurrentExpungeResponseKOREA() throws Exception {
- scriptTest("ConcurrentExpungeResponse", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ConcurrentExpungeResponse");
}
@Test
public void testConcurrentCrossExpungeUS() throws Exception {
- scriptTest("ConcurrentCrossExpunge", Locale.US);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.US)
+ .run("ConcurrentCrossExpunge");
}
@Test
public void testConcurrentCrossExpungeITALY() throws Exception {
- scriptTest("ConcurrentCrossExpunge", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ConcurrentCrossExpunge");
}
@Test
public void testConcurrentCrossExpungeKOREA() throws Exception {
- scriptTest("ConcurrentCrossExpunge", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ConcurrentCrossExpunge");
}
@Test
public void testConcurrentRenameSelectedSubUS() throws Exception {
- scriptTest("ConcurrentRenameSelectedSub", Locale.US);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.US)
+ .run("ConcurrentRenameSelectedSub");
}
@Test
public void testConcurrentExistsResponseUS() throws Exception {
- scriptTest("ConcurrentExistsResponse", Locale.US);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.US)
+ .run("ConcurrentExistsResponse");
}
@Test
public void testConcurrentDeleteSelectedUS() throws Exception {
- scriptTest("ConcurrentDeleteSelected", Locale.US);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.US)
+ .run("ConcurrentDeleteSelected");
}
@Test
public void testConcurrentFetchResponseUS() throws Exception {
- scriptTest("ConcurrentFetchResponse", Locale.US);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.US)
+ .run("ConcurrentFetchResponse");
}
@Test
public void testConcurrentRenameSelectedUS() throws Exception {
- scriptTest("ConcurrentRenameSelected", Locale.US);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.US)
+ .run("ConcurrentRenameSelected");
}
@Test
public void testConcurrentRenameSelectedSubKOREA() throws Exception {
- scriptTest("ConcurrentRenameSelectedSub", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ConcurrentRenameSelectedSub");
}
@Test
public void testConcurrentExistsResponseKOREA() throws Exception {
- scriptTest("ConcurrentExistsResponse", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ConcurrentExistsResponse");
}
@Test
public void testConcurrentDeleteSelectedKOREA() throws Exception {
- scriptTest("ConcurrentDeleteSelected", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ConcurrentDeleteSelected");
}
@Test
public void testConcurrentFetchResponseKOREA() throws Exception {
- scriptTest("ConcurrentFetchResponse", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ConcurrentFetchResponse");
}
@Test
public void testConcurrentRenameSelectedKOREA() throws Exception {
- scriptTest("ConcurrentRenameSelected", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ConcurrentRenameSelected");
}
@Test
public void testConcurrentRenameSelectedSubITALY() throws Exception {
- scriptTest("ConcurrentRenameSelectedSub", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ConcurrentRenameSelectedSub");
}
@Test
public void testConcurrentExistsResponseITALY() throws Exception {
- scriptTest("ConcurrentExistsResponse", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ConcurrentExistsResponse");
}
@Test
public void testConcurrentDeleteSelectedITALY() throws Exception {
- scriptTest("ConcurrentDeleteSelected", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ConcurrentDeleteSelected");
}
@Test
public void testConcurrentFetchResponseITALY() throws Exception {
- scriptTest("ConcurrentFetchResponse", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ConcurrentFetchResponse");
}
@Test
public void testConcurrentRenameSelectedITALY() throws Exception {
- scriptTest("ConcurrentRenameSelected", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ConcurrentRenameSelected");
}
@Test
public void expungeShouldNotBreakUIDToMSNMapping() throws Exception {
- scriptTest("ConcurrentExpungeUIDToMSNMapping", Locale.US);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.US)
+ .run("ConcurrentExpungeUIDToMSNMapping");
}
@Test
public void appendShouldNotBreakUIDToMSNMapping() throws Exception {
- scriptTest("ConcurrentAppendUIDToMSNMapping", Locale.US);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.US)
+ .run("ConcurrentAppendUIDToMSNMapping");
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Condstore.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Condstore.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Condstore.java
index 73caef5..0336638 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Condstore.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Condstore.java
@@ -25,33 +25,44 @@ import javax.inject.Inject;
import org.apache.james.imap.api.ImapConfiguration;
import org.apache.james.mpt.host.JamesImapHostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseAuthenticatedState;
+import org.apache.james.mpt.imapmailbox.ImapTestConstants;
+import org.apache.james.mpt.imapmailbox.suite.base.BasicImapCommands;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.Before;
import org.junit.Test;
-public class Condstore extends BaseAuthenticatedState {
+public class Condstore implements ImapTestConstants {
@Inject
private static JamesImapHostSystem system;
- public Condstore() throws Exception {
- super(system);
+ private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
+
+ @Before
+ public void setUp() throws Exception {
+ simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
+ .withUser(TO_ADDRESS, PASSWORD)
+ .withLocale(Locale.US);
+ BasicImapCommands.welcome(simpleScriptedTestProtocol);
+ BasicImapCommands.authenticate(simpleScriptedTestProtocol);
}
+
@Test
public void condstoreShouldBeDisableByDefault() throws Exception {
system.configure(ImapConfiguration.builder().build());
- scriptTest("CondstoreDisable", Locale.US);
+ simpleScriptedTestProtocol.run("CondstoreDisable");
}
@Test
public void condstoreShouldBeDisableWhenGivenAndFalse() throws Exception {
system.configure(ImapConfiguration.builder().isCondstoreEnable(false).build());
- scriptTest("CondstoreDisable", Locale.US);
+ simpleScriptedTestProtocol.run("CondstoreDisable");
}
@Test
public void condstoreShouldBeEnableWhenGivenAndTrue() throws Exception {
system.configure(ImapConfiguration.builder().isCondstoreEnable(true).build());
- scriptTest("CondstoreEnable", Locale.US);
+ simpleScriptedTestProtocol.run("CondstoreEnable");
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Copy.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Copy.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Copy.java
index 339be7f..81f62f9 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Copy.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Copy.java
@@ -24,20 +24,30 @@ import java.util.Locale;
import javax.inject.Inject;
import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseSelectedState;
+import org.apache.james.mpt.imapmailbox.ImapTestConstants;
+import org.apache.james.mpt.imapmailbox.suite.base.BasicImapCommands;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.Before;
import org.junit.Test;
-public class Copy extends BaseSelectedState {
+public class Copy implements ImapTestConstants {
@Inject
private static HostSystem system;
- public Copy() throws Exception {
- super(system);
- }
+ private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
+ @Before
+ public void setUp() throws Exception {
+ simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
+ .withUser(USER, PASSWORD)
+ .withLocale(Locale.US);
+ BasicImapCommands.welcome(simpleScriptedTestProtocol);
+ BasicImapCommands.authenticate(simpleScriptedTestProtocol);
+ }
+
@Test
public void copyCommandShouldRespectTheRFC() throws Exception {
- scriptTest("Copy", Locale.US);
+ simpleScriptedTestProtocol.run("Copy");
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/DeploymentValidation.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/DeploymentValidation.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/DeploymentValidation.java
index 304709d..b92ac5f 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/DeploymentValidation.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/DeploymentValidation.java
@@ -19,33 +19,40 @@
package org.apache.james.mpt.imapmailbox.suite;
-import javax.inject.Inject;
import java.util.Locale;
+import javax.inject.Inject;
+
import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseImapProtocol;
+import org.apache.james.mpt.imapmailbox.ImapTestConstants;
+import org.apache.james.mpt.imapmailbox.suite.base.BasicImapCommands;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.Before;
import org.junit.Test;
-public class DeploymentValidation extends BaseImapProtocol {
+public class DeploymentValidation implements ImapTestConstants {
public static final String DOMAIN = "domain";
- public static final String USER = "imapuser@" + DOMAIN;
@Inject
private static HostSystem system;
+ public static final String USER = "imapuser";
+ public static final String PASSWORD = "password";
- public DeploymentValidation() throws Exception {
- super(system);
- }
+ private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
- @Override
+ @Before
public void setUp() throws Exception {
-
+ simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
+ .withUser(USER + "@" + DOMAIN, PASSWORD)
+ .withLocale(Locale.US);
+ BasicImapCommands.welcome(simpleScriptedTestProtocol);
+ BasicImapCommands.authenticate(simpleScriptedTestProtocol);
}
-
+
@Test
public void validateDeployment() throws Exception {
- scriptTest("ValidateDeployment", Locale.US);
+ simpleScriptedTestProtocol.run("ValidateDeployment");
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Events.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Events.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Events.java
index 4f220e7..e0470b9 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Events.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Events.java
@@ -24,30 +24,53 @@ import java.util.Locale;
import javax.inject.Inject;
import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseSelectedState;
+import org.apache.james.mpt.imapmailbox.ImapTestConstants;
+import org.apache.james.mpt.imapmailbox.suite.base.BasicImapCommands;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
-public class Events extends BaseSelectedState {
+public class Events implements ImapTestConstants {
@Inject
private static HostSystem system;
- public Events() throws Exception {
- super(system);
+ private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
+
+ @Before
+ public void setUp() throws Exception {
+ simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
+ .withUser(USER, PASSWORD)
+ .withLocale(Locale.US);
+ BasicImapCommands.welcome(simpleScriptedTestProtocol);
+ BasicImapCommands.authenticate(simpleScriptedTestProtocol);
+ BasicImapCommands.prepareMailbox(simpleScriptedTestProtocol);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ system.afterTest();
}
@Test
public void testAppendToSelectedUS() throws Exception {
- scriptTest("AppendToSelected", Locale.US);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.US)
+ .run("AppendToSelected");
}
@Test
public void testAppendToSelectedKOREA() throws Exception {
- scriptTest("AppendToSelected", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("AppendToSelected");
}
@Test
public void testAppendToSelectedITALY() throws Exception {
- scriptTest("AppendToSelected", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("AppendToSelected");
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Expunge.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Expunge.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Expunge.java
index 4cba7ac..87787f6 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Expunge.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Expunge.java
@@ -24,30 +24,54 @@ import java.util.Locale;
import javax.inject.Inject;
import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseSelectedState;
+import org.apache.james.mpt.imapmailbox.ImapTestConstants;
+import org.apache.james.mpt.imapmailbox.suite.base.BasicImapCommands;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
-public class Expunge extends BaseSelectedState {
+public class Expunge implements ImapTestConstants {
@Inject
private static HostSystem system;
- public Expunge() throws Exception {
- super(system);
+
+ private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
+
+ @Before
+ public void setUp() throws Exception {
+ simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
+ .withUser(USER, PASSWORD)
+ .withLocale(Locale.US);
+ BasicImapCommands.welcome(simpleScriptedTestProtocol);
+ BasicImapCommands.authenticate(simpleScriptedTestProtocol);
+ BasicImapCommands.prepareMailbox(simpleScriptedTestProtocol);
}
+ @After
+ public void tearDown() throws Exception {
+ system.afterTest();
+ }
+
@Test
public void testBasicExpungeUS() throws Exception {
- scriptTest("ExpungeBasics", Locale.US);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.US)
+ .run("ExpungeBasics");
}
@Test
public void testBasicExpungeIT() throws Exception {
- scriptTest("ExpungeBasics", Locale.ITALY);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.ITALY)
+ .run("ExpungeBasics");
}
@Test
public void testBasicExpungeKO() throws Exception {
- scriptTest("ExpungeBasics", Locale.KOREA);
+ simpleScriptedTestProtocol
+ .withLocale(Locale.KOREA)
+ .run("ExpungeBasics");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org