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:25 UTC

[11/21] james-project git commit: MPT-39 remove crazy abstract test class hierarchy

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/UidSearch.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/UidSearch.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/UidSearch.java
index 99481ed..5e1d5e1 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/UidSearch.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/UidSearch.java
@@ -24,46 +24,74 @@ 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 UidSearch extends BaseAuthenticatedState {
+public class UidSearch implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public UidSearch() 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 testSearchAtomsUS() throws Exception {
-        scriptTest("UidSearchAtoms", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("UidSearchAtoms");
     }
 
     @Test
     public void testSearchAtomsITALY() throws Exception {
-        scriptTest("UidSearchAtoms", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("UidSearchAtoms");
     }
 
     @Test
     public void testSearchAtomsKOREA() throws Exception {
-        scriptTest("UidSearchAtoms", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("UidSearchAtoms");
     }
 
     @Test
     public void testSearchCombinationsUS() throws Exception {
-        scriptTest("UidSearchCombinations", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("UidSearchCombinations");
     }
 
     @Test
     public void testSearchCombinationsITALY() throws Exception {
-        scriptTest("UidSearchCombinations", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("UidSearchCombinations");
     }
 
     @Test
     public void testSearchCombinationsKOREA() throws Exception {
-        scriptTest("UidSearchCombinations", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("UidSearchCombinations");
     }
 }
 

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/UidSearchOnIndex.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/UidSearchOnIndex.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/UidSearchOnIndex.java
index 25c1026..1029027 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/UidSearchOnIndex.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/UidSearchOnIndex.java
@@ -19,25 +19,38 @@
 
 package org.apache.james.mpt.imapmailbox.suite;
 
-import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseAuthenticatedState;
-import org.junit.Test;
+import java.util.Locale;
 
 import javax.inject.Inject;
-import java.util.Locale;
 
-public class UidSearchOnIndex extends BaseAuthenticatedState {
+import org.apache.james.mpt.api.HostSystem;
+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 UidSearchOnIndex implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
 
-    public UidSearchOnIndex() 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 testSearchAtomsUS() throws Exception {
-        scriptTest("UidSearchAtomsIndexer", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("UidSearchAtomsIndexer");
     }
 
 }

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/UserFlagsSupport.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/UserFlagsSupport.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/UserFlagsSupport.java
index 917f9af..b0c832e 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/UserFlagsSupport.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/UserFlagsSupport.java
@@ -19,28 +19,47 @@
 
 package org.apache.james.mpt.imapmailbox.suite;
 
-import com.google.inject.Inject;
 import java.util.Locale;
 
 import org.apache.james.mpt.api.ImapFeatures;
 import org.apache.james.mpt.api.ImapHostSystem;
-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.Assume;
+import org.junit.Before;
 import org.junit.Test;
 
-public class UserFlagsSupport extends BaseAuthenticatedState {
+import com.google.inject.Inject;
+
+public class UserFlagsSupport implements ImapTestConstants {
 
     @Inject
     private static ImapHostSystem system;
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
-    public UserFlagsSupport() throws Exception {
-        super(system);
+    @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 testUserFlagsSupport() throws Exception {
         Assume.assumeTrue(system.supports(ImapFeatures.Feature.USER_FLAGS_SUPPORT));
-        scriptTest("UserFlagsSupport", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("UserFlagsSupport");
     }
 
 }

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/base/BaseAuthenticatedState.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseAuthenticatedState.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseAuthenticatedState.java
deleted file mode 100644
index 624306d..0000000
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseAuthenticatedState.java
+++ /dev/null
@@ -1,85 +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.imapmailbox.suite.base;
-
-import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.imapmailbox.ImapTestConstants;
-import org.junit.Before;
-
-/**
- * <p>
- * Runs tests for commands valid in the AUTHENTICATED state. A login session
- * precedes the execution of the test elements.
- * </p>
- * <p>
- * Suggested tests:
- * </p>
- * <ul>
- * <li>ValidSelected</li>
- * <li>ValidNonAuthenticated</li>
- * <li>Capability</li>
- * <li>Noop</li>
- * <li>Logout</li>
- * <li>AppendExamineInbox</li>
- * <li>AppendSelectInbox</li>
- * <li>Create</li>
- * <li>ExamineEmpty</li>
- * <li>SelectEmpty</li>
- * <li>ListNamespace</li>
- * <li>ListMailboxes</li>
- * <li>Status</li>
- * <li>Subscribe</li>
- * <li>Delete</li>
- * <li>Append</li>
- * <li>Compound:
- * <ul>
- * <li>AppendExpunge</li>
- * <li>SelectAppend</li>
- * <li>StringArgs</li>
- * </ul>
- * </li>
- * </ul>
- * </p>
- */
-public class BaseAuthenticatedState extends
-        BaseImapProtocol implements ImapTestConstants {
-    public BaseAuthenticatedState(HostSystem hostSystem) throws Exception {
-        super(hostSystem);
-    }
-
-    /**
-     * Sets up {@link #preElements} with a welcome message and login
-     * request/response.
-     * 
-     * @throws Exception
-     */
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        addTestFile("Welcome.test", preElements);
-        addLogin(USER, PASSWORD);
-    }
-
-    protected void addLogin(String username, String password) {
-        preElements.CL("a001 LOGIN " + username + " " + password);
-        preElements.SL("a001 OK .*",
-                "BaseAuthenticatedState.java:83");
-    }
-}

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/base/BaseImapProtocol.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseImapProtocol.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseImapProtocol.java
deleted file mode 100644
index edb277c..0000000
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseImapProtocol.java
+++ /dev/null
@@ -1,39 +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.imapmailbox.suite.base;
-
-import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.imapmailbox.ImapTestConstants;
-import org.apache.james.mpt.script.AbstractSimpleScriptedTestProtocol;
-import org.junit.Before;
-
-/**
- * Specialise the protocol test framework for IMAP.
- */
-public class BaseImapProtocol extends AbstractSimpleScriptedTestProtocol implements ImapTestConstants {
-
-    public BaseImapProtocol(HostSystem hostSystem) throws Exception {
-        super(hostSystem, USER, PASSWORD, "/org/apache/james/imap/scripts/");
-    }
-
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-}

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/base/BaseNonAuthenticatedState.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseNonAuthenticatedState.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseNonAuthenticatedState.java
deleted file mode 100644
index 46dda12..0000000
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseNonAuthenticatedState.java
+++ /dev/null
@@ -1,59 +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.imapmailbox.suite.base;
-
-import org.apache.james.mpt.api.HostSystem;
-import org.junit.Before;
-
-/**
- * <p>
- * Runs tests for commands valid in the NON_AUTHENTICATED state. A welcome
- * message precedes the execution of the test elements.
- * </p>
- * <p>
- * Recommended test scripts:
- * </p>
- * <ul>
- * <li>ValidAuthenticated</li>
- * <li>ValidSelected</li>
- * <li>Capability</li>
- * <li>Noop</li>
- * <li>Logout</li>
- * <li>Authenticate</li>
- * <li>Login</li>
- * </ul>
- */
-public class BaseNonAuthenticatedState extends BaseImapProtocol {
-    public BaseNonAuthenticatedState(HostSystem system) throws Exception {
-        super(system);
-    }
-
-    /**
-     * Adds a welcome message to the {@link #preElements}.
-     * 
-     * @throws Exception
-     */
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-
-        addTestFile("Welcome.test", preElements);
-    }
-}

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/base/BaseSelectedInbox.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseSelectedInbox.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseSelectedInbox.java
deleted file mode 100644
index c48c382..0000000
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseSelectedInbox.java
+++ /dev/null
@@ -1,75 +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.imapmailbox.suite.base;
-
-import org.apache.james.mpt.api.HostSystem;
-
-/**
- * <p>
- * Tests commands which are valid in AUTHENTICATED and NONAUTHENTICATED by
- * running them in the SELECTED state. Many commands function identically, while
- * others are invalid in this state.
- * </p>
- * <p>
- * Recommended scripts:
- * </p>
- * <ul>
- * <li>ValidNonAuthenticated</li>
- * <li>Capability</li>
- * <li>Noop</li>
- * <li>Logout</li>
- * <li>Create</li>
- * <li>ExamineEmpty</li>
- * <li>SelectEmpty</li>
- * <li>ListNamespace</li>
- * <li>ListMailboxes</li>
- * <li>Status</li>
- * <li>StringArgs</li>
- * <li>Subscribe</li>
- * <li>Append</li>
- * <li>Delete</li>
- * </ul>
- * 
- * @author Darrell DeBoer <da...@apache.org>
- * 
- * @version $Revision: 560719 $
- */
-public class BaseSelectedInbox extends BaseAuthenticatedState {
-    public BaseSelectedInbox(HostSystem system) throws Exception {
-        super(system);
-    }
-
-    /**
-     * Superclass sets up welcome message and login session in
-     * {@link #preElements}. A "SELECT INBOX" session is then added to these
-     * elements.
-     * 
-     * @throws Exception
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-        addTestFile("SelectInbox.test", preElements);
-    }
-
-    protected void addCloseInbox() {
-        postElements.CL("a CLOSE");
-        postElements.SL(".*", "AbstractBaseTestSelectedInbox.java:76");
-    }
-}

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/base/BaseSelectedState.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseSelectedState.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseSelectedState.java
deleted file mode 100644
index 66a07b7..0000000
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BaseSelectedState.java
+++ /dev/null
@@ -1,64 +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.imapmailbox.suite.base;
-
-import org.apache.james.mpt.api.HostSystem;
-import org.junit.Before;
-
-/**
- * <p>
- * Runs tests for commands valid only in the SELECTED state. A login session and
- * setup of a "seleted" mailbox precedes the execution of the test elements.
- * </p>
- * <p>
- * Recommended scripts:
- * </p>
- * <ul>
- * <li>Check"</li>
- * <li>Expunge"</li>
- * <li>Search"</li>
- * <li>FetchSingleMessage"</li>
- * <li>FetchMultipleMessages"</li>
- * <li>FetchPeek"</li>
- * <li>Store"</li>
- * <li>Copy"</li>
- * <li>Uid"</li>
- * </ul>
- */
-public class BaseSelectedState extends BaseAuthenticatedState {
-    
-    public BaseSelectedState(HostSystem system) throws Exception {
-        super(system);
-    }
-
-    /**
-     * Superclass sets up welcome message and login session in
-     * {@link #preElements}. A "SELECT INBOX" session is then added to these
-     * elements.
-     * 
-     * @throws Exception
-     */
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        addTestFile("SelectedStateSetup.test", preElements);
-        addTestFile("SelectedStateCleanup.test", postElements);
-    }
-}

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/base/BasicImapCommands.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BasicImapCommands.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BasicImapCommands.java
new file mode 100644
index 0000000..9d508b0
--- /dev/null
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/base/BasicImapCommands.java
@@ -0,0 +1,68 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.mpt.imapmailbox.suite.base;
+
+import org.apache.james.mpt.api.ProtocolInteractor;
+import org.apache.james.mpt.imapmailbox.ImapTestConstants;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+
+
+public class BasicImapCommands implements ImapTestConstants {
+    
+    public static void welcome(SimpleScriptedTestProtocol scriptedTestProtocol) {
+        scriptedTestProtocol.preElements().SL("\\* OK IMAP4rev1 Server ready", "BaseAuthenticatedState.java:32");
+    }
+    
+    public static void authenticate(SimpleScriptedTestProtocol scriptedTestProtocol) {
+        addLogin(scriptedTestProtocol.preElements(), USER, PASSWORD);
+    }
+
+
+    private static void addLogin(ProtocolInteractor preElements, String username, String password) {
+        preElements.CL("a001 LOGIN " + username + " " + password);
+        preElements.SL("a001 OK .*", "BaseAuthenticatedState.java:53");
+    }
+    
+    public static void selectInbox(SimpleScriptedTestProtocol scriptedTestProtocol) {
+        ProtocolInteractor preElements = scriptedTestProtocol.preElements();
+        
+        preElements.CL("abcd SELECT inbox");
+        preElements.SL("\\* FLAGS \\(\\\\Answered \\\\Deleted \\\\Draft \\\\Flagged \\\\Seen\\)", "BasicImapCommands");
+        preElements.SL("\\* \\d+ EXISTS", "BasicImapCommands");
+        preElements.SL("\\* \\d+ RECENT", "BasicImapCommands");
+        preElements.SL("\\* OK \\[UIDVALIDITY \\d+\\].*", "BasicImapCommands");
+        preElements.SL("\\* OK \\[PERMANENTFLAGS \\(\\\\Answered \\\\Deleted \\\\Draft \\\\Flagged \\\\\\Seen( \\\\\\*)?\\)\\].*", "BasicImapCommands");
+        preElements.SL("\\* OK \\[HIGHESTMODSEQ \\d+\\].*", "BasicImapCommands");
+        preElements.SL("\\* OK \\[UIDNEXT 1\\].*", "BasicImapCommands");
+        preElements.SL("abcd OK \\[READ-WRITE\\] SELECT completed.", "BasicImapCommands");
+        
+        addCloseInbox(scriptedTestProtocol.postElements());
+    }
+    
+    private static void addCloseInbox(ProtocolInteractor postElements) {
+        postElements.CL("a CLOSE");
+        postElements.SL(".*", "AbstractBaseTestSelectedInbox.java:76");
+    }
+    
+    public static void prepareMailbox(SimpleScriptedTestProtocol scriptedTestProtocol) throws Exception {
+        scriptedTestProtocol.addTestFile("SelectedStateSetup.test", scriptedTestProtocol.preElements());
+        scriptedTestProtocol.addTestFile("SelectedStateCleanup.test", scriptedTestProtocol.postElements());
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/AuthenticateTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/AuthenticateTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/AuthenticateTest.java
index 11aaa46..d802f72 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/AuthenticateTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/AuthenticateTest.java
@@ -19,29 +19,42 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class AuthenticateTest extends ManageSieveMPTTest {
+public class AuthenticateTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public AuthenticateTest() throws Exception {
-        super(hostSystem);
-    }
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
     }
 
     @Test
     public void authenticateShouldWork() throws Exception {
-        scriptTest("authenticate", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("authenticate");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CapabilityTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CapabilityTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CapabilityTest.java
index 3da29d8..f8a2fbd 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CapabilityTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CapabilityTest.java
@@ -19,29 +19,42 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class CapabilityTest extends ManageSieveMPTTest {
+public class CapabilityTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public CapabilityTest() throws Exception {
-        super(hostSystem);
-    }
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
     }
 
     @Test
     public void capabilityShouldWork() throws Exception {
-        scriptTest("capability", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("capability");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CheckScriptTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CheckScriptTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CheckScriptTest.java
index dc8877c..9363f67 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CheckScriptTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/CheckScriptTest.java
@@ -21,27 +21,39 @@ package org.apache.james.mpt.testsuite;
 
 import com.google.inject.Inject;
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
 import java.util.Locale;
 
-public class CheckScriptTest extends ManageSieveMPTTest {
+public class CheckScriptTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public CheckScriptTest() throws Exception {
-        super(hostSystem);
-    }
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
     }
 
     @Test
     public void checkScriptShouldWork() throws Exception {
-        scriptTest("checkscript", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("checkscript");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/DeleteScriptTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/DeleteScriptTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/DeleteScriptTest.java
index dcc3b2c..cdc7b53 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/DeleteScriptTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/DeleteScriptTest.java
@@ -19,29 +19,42 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class DeleteScriptTest extends ManageSieveMPTTest {
+public class DeleteScriptTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
-
-    public DeleteScriptTest() throws Exception {
-        super(hostSystem);
-    }
+    
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
     }
 
     @Test
     public void deleteScriptShouldWork() throws Exception {
-        scriptTest("deletescript", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("deletescript");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/GetScriptTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/GetScriptTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/GetScriptTest.java
index aa67817..d302af4 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/GetScriptTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/GetScriptTest.java
@@ -19,29 +19,42 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class GetScriptTest extends ManageSieveMPTTest {
+public class GetScriptTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public GetScriptTest() throws Exception {
-        super(hostSystem);
-    }
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
     }
 
     @Test
     public void getScriptShouldWork() throws Exception {
-        scriptTest("getscript", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("getscript");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/HaveSpaceTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/HaveSpaceTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/HaveSpaceTest.java
index b14bd13..213b012 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/HaveSpaceTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/HaveSpaceTest.java
@@ -19,31 +19,44 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class HaveSpaceTest extends ManageSieveMPTTest {
+public class HaveSpaceTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public HaveSpaceTest() throws Exception {
-        super(hostSystem);
-    }
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
         hostSystem.setMaxQuota(USER, 50);
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
     }
 
     @Test
     public void haveSpaceShouldWork() throws Exception {
-        scriptTest("havespace", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("havespace");
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/ListScriptsTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/ListScriptsTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/ListScriptsTest.java
index d568034..d27b3c9 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/ListScriptsTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/ListScriptsTest.java
@@ -19,29 +19,42 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class ListScriptsTest extends ManageSieveMPTTest {
+public class ListScriptsTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public ListScriptsTest() throws Exception {
-        super(hostSystem);
-    }
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
     }
 
     @Test
     public void listScriptsShouldWork() throws Exception {
-        scriptTest("listscripts", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("listscripts");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/LogoutTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/LogoutTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/LogoutTest.java
index e51a50e..64b5079 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/LogoutTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/LogoutTest.java
@@ -19,23 +19,42 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class LogoutTest extends ManageSieveMPTTest {
+public class LogoutTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public LogoutTest() throws Exception {
-        super(hostSystem);
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
+
+    @Before
+    public void setUp() throws Exception {
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
     }
 
     @Test
     public void logoutShouldWork() throws Exception {
-        scriptTest("logout", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("logout");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/ManageSieveMPTTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/ManageSieveMPTTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/ManageSieveMPTTest.java
deleted file mode 100644
index fc21957..0000000
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/ManageSieveMPTTest.java
+++ /dev/null
@@ -1,33 +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.testsuite;
-
-import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.script.AbstractSimpleScriptedTestProtocol;
-
-public class ManageSieveMPTTest extends AbstractSimpleScriptedTestProtocol {
-
-    public static final String USER = "user";
-    public static final String PASSWORD = "password";
-
-    public ManageSieveMPTTest(HostSystem hostSystem) throws Exception {
-        super(hostSystem, USER, PASSWORD, "/org/apache/james/managesieve/scripts/");
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/NoopTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/NoopTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/NoopTest.java
index 53d8559..e881477 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/NoopTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/NoopTest.java
@@ -19,24 +19,43 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class NoopTest extends ManageSieveMPTTest {
+public class NoopTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public NoopTest() throws Exception {
-        super(hostSystem);
-    }
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
+    @Before
+    public void setUp() throws Exception {
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
+    }
+    
     @Test
     public void noopShouldWork() throws Exception {
-        scriptTest("noop", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("noop");
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/PutScriptTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/PutScriptTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/PutScriptTest.java
index be9010f..5337fcd 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/PutScriptTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/PutScriptTest.java
@@ -19,29 +19,42 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class PutScriptTest extends ManageSieveMPTTest {
+public class PutScriptTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public PutScriptTest() throws Exception {
-        super(hostSystem);
-    }
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
     }
 
     @Test
     public void putScriptShouldWork() throws Exception {
-        scriptTest("putscript", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("putscript");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/RenameScriptTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/RenameScriptTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/RenameScriptTest.java
index 44b44dc..e1c6cb4 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/RenameScriptTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/RenameScriptTest.java
@@ -19,29 +19,42 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class RenameScriptTest extends ManageSieveMPTTest {
+public class RenameScriptTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public RenameScriptTest() throws Exception {
-        super(hostSystem);
-    }
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
     }
 
     @Test
     public void renameScriptShouldWork() throws Exception {
-        scriptTest("renamescript", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("renamescript");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/SetActiveTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/SetActiveTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/SetActiveTest.java
index 1edad93..9a3f044 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/SetActiveTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/SetActiveTest.java
@@ -19,29 +19,42 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class SetActiveTest extends ManageSieveMPTTest {
+public class SetActiveTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public SetActiveTest() throws Exception {
-        super(hostSystem);
-    }
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
     }
 
     @Test
     public void setActiveShouldWork() throws Exception {
-        scriptTest("setactive", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("setactive");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/StartTlsTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/StartTlsTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/StartTlsTest.java
index 140ac7a..ac61a1d 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/StartTlsTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/StartTlsTest.java
@@ -19,29 +19,42 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class StartTlsTest extends ManageSieveMPTTest {
+public class StartTlsTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public StartTlsTest() throws Exception {
-        super(hostSystem);
-    }
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
     }
 
     @Test
     public void startTlsShouldWork() throws Exception {
-        scriptTest("starttls", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("starttls");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/UnauthenticatedTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/UnauthenticatedTest.java b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/UnauthenticatedTest.java
index b909d23..aa1f64f 100644
--- a/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/UnauthenticatedTest.java
+++ b/mpt/impl/managesieve/core/src/main/java/org/apache/james/mpt/testsuite/UnauthenticatedTest.java
@@ -19,30 +19,43 @@
 
 package org.apache.james.mpt.testsuite;
 
-import com.google.inject.Inject;
+import java.util.Locale;
+
 import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Locale;
+import com.google.inject.Inject;
 
-public class UnauthenticatedTest extends ManageSieveMPTTest {
+public class UnauthenticatedTest {
 
     @Inject
     private static ManageSieveHostSystem hostSystem;
 
-    public UnauthenticatedTest() throws Exception {
-        super(hostSystem);
-    }
+    public static final String USER = "user";
+    public static final String PASSWORD = "password";
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
+        simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/managesieve/scripts/", hostSystem)
+                .withUser(USER, PASSWORD)
+                .withLocale(Locale.US);
     }
 
+    @After
+    public void tearDown() throws Exception {
+        hostSystem.afterTest();
+    }
+    
     @Test
     public void unauthenticatedCommandShouldWork() throws Exception {
-        scriptTest("unauthenticate", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("unauthenticate");
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java b/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java
index cb8ca5f..c6e8814 100644
--- a/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java
+++ b/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/ForwardSmtpTest.java
@@ -28,7 +28,7 @@ import java.util.Locale;
 
 import javax.inject.Inject;
 
-import org.apache.james.mpt.script.AbstractSimpleScriptedTestProtocol;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
 import org.apache.james.util.streams.SwarmGenericContainer;
 import org.junit.Before;
 import org.junit.Rule;
@@ -42,7 +42,7 @@ import com.jayway.restassured.RestAssured;
 import com.jayway.restassured.builder.RequestSpecBuilder;
 import com.jayway.restassured.http.ContentType;
 
-public class ForwardSmtpTest extends AbstractSimpleScriptedTestProtocol {
+public class ForwardSmtpTest {
 
     public static final String USER = "bob";
     public static final String DOMAIN = "mydomain.tld";
@@ -59,13 +59,16 @@ public class ForwardSmtpTest extends AbstractSimpleScriptedTestProtocol {
     @Inject
     private static SmtpHostSystem hostSystem;
 
+    private SimpleScriptedTestProtocol scriptedTest;
+    
     public ForwardSmtpTest() throws Exception {
-        super(hostSystem, USER_AT_DOMAIN, PASSWORD, "/org/apache/james/smtp/scripts/");
+        scriptedTest = new SimpleScriptedTestProtocol("/org/apache/james/smtp/scripts/", hostSystem)
+                .withLocale(Locale.US)
+                .withUser(USER_AT_DOMAIN, PASSWORD);
     }
 
     @Before
     public void setUp() throws Exception {
-        super.setUp();
         InetAddress containerIp = InetAddresses.forString(fakeSmtp.getIp());
         hostSystem.getInMemoryDnsService()
             .registerRecord("yopmail.com", containerIp, "yopmail.com");
@@ -82,7 +85,7 @@ public class ForwardSmtpTest extends AbstractSimpleScriptedTestProtocol {
 
     @Test
     public void forwardingAnEmailShouldWork() throws Exception {
-        scriptTest("helo", Locale.US);
+        scriptedTest.run("helo");
 
         when()
             .get("/api/email")

http://git-wip-us.apache.org/repos/asf/james-project/blob/986df60d/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/SmtpStarttlsCommandTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/SmtpStarttlsCommandTest.java b/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/SmtpStarttlsCommandTest.java
index 764cdc9..e667886 100644
--- a/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/SmtpStarttlsCommandTest.java
+++ b/mpt/impl/smtp/core/src/main/java/org/apache/james/mpt/smtp/SmtpStarttlsCommandTest.java
@@ -22,14 +22,13 @@ import java.util.Locale;
 
 import javax.inject.Inject;
 
-import org.apache.james.mpt.script.AbstractSimpleScriptedTestProtocol;
-import org.junit.Before;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.RuleChain;
 import org.junit.rules.TemporaryFolder;
 
-public class SmtpStarttlsCommandTest extends AbstractSimpleScriptedTestProtocol {
+public class SmtpStarttlsCommandTest {
 
     public static final String USER = "bob";
     public static final String DOMAIN = "mydomain.tld";
@@ -43,41 +42,40 @@ public class SmtpStarttlsCommandTest extends AbstractSimpleScriptedTestProtocol
 
     @Inject
     private static SmtpHostSystem hostSystem;
+    
+    private SimpleScriptedTestProtocol scriptedTest;
 
     public SmtpStarttlsCommandTest() throws Exception {
-        super(hostSystem, USER_AT_DOMAIN, PASSWORD, "/org/apache/james/smtp/scripts/");
-    }
-
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
+        String scriptDir = "/org/apache/james/smtp/scripts/";
+        scriptedTest = new SimpleScriptedTestProtocol(scriptDir, hostSystem)
+                .withLocale(Locale.US)
+                .withUser(USER_AT_DOMAIN, PASSWORD);
     }
 
     @Test
     public void starttlsShouldWork() throws Exception {
-        scriptTest("starttls", Locale.US);
+        scriptedTest.run("starttls");
     }
 
     @Test
     public void starttlsShouldBeRejectedWhenFollowedByCommand() throws Exception {
-        scriptTest("starttls_with_injection", Locale.US);
+        scriptedTest.run("starttls_with_injection");
     }
 
     @Test
     public void shouldNotRejectContentWithStartTls() throws Exception {
-        scriptTest("data_with_starttls", Locale.US);
+        scriptedTest.run("data_with_starttls");
     }
 
 
     @Test
     public void shouldNotRejectRcptWithStartTls() throws Exception {
-        hostSystem.addUser("starttls@mydomain.tld", PASSWORD);
-
-        scriptTest("rcpt_with_starttls", Locale.US);
+        scriptedTest.withUser("starttls@mydomain.tld", PASSWORD);
+        scriptedTest.run("rcpt_with_starttls");
     }
 
     @Test
     public void shouldNotRejectContentStartsWithStartTls() throws Exception {
-        scriptTest("data_starts_with_starttls", Locale.US);
+        scriptedTest.run("data_starts_with_starttls");
     }
 }


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