james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [12/21] james-project git commit: MPT-39 remove crazy abstract test class hierarchy
Date Fri, 07 Jul 2017 08:24:26 GMT
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/Fetch.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Fetch.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Fetch.java
index f083caa..988fe8e 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Fetch.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Fetch.java
@@ -24,135 +24,201 @@ 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 Fetch extends BaseSelectedState {
+public class Fetch implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public Fetch() 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 testFetchEnvelopeUS() throws Exception {
-        scriptTest("FetchEnvelope", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchEnvelope");
     }
 
     @Test
     public void testFetchEnvelopeIT() throws Exception {
-        scriptTest("FetchEnvelope", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchEnvelope");
     }
 
     @Test
     public void testFetchEnvelopeKOREA() throws Exception {
-        scriptTest("FetchEnvelope", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchEnvelope");
     }
 
     @Test
     public void testFetchTextUS() throws Exception {
-        scriptTest("FetchText", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchText");
     }
 
     @Test
     public void testFetchBodyNoSectionUS() throws Exception {
-        scriptTest("FetchBodyNoSection", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchBodyNoSection");
     }
 
     @Test
     public void testFetchTextIT() throws Exception {
-        scriptTest("FetchText", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchText");
     }
 
     @Test
     public void testFetchBodyNoSectionIT() throws Exception {
-        scriptTest("FetchBodyNoSection", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchBodyNoSection");
     }
 
     @Test
     public void testFetchTextKOREA() throws Exception {
-        scriptTest("FetchText", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchText");
     }
 
     @Test
     public void testFetchBodyNoSectionKOREA() throws Exception {
-        scriptTest("FetchBodyNoSection", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchBodyNoSection");
     }
 
     @Test
     public void testFetchRFC822US() throws Exception {
-        scriptTest("FetchRFC822", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchRFC822");
     }
 
     @Test
     public void testFetchRFC822TextUS() throws Exception {
-        scriptTest("FetchRFC822Text", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchRFC822Text");
     }
 
     @Test
     public void testFetchRFC822HeaderUS() throws Exception {
-        scriptTest("FetchRFC822Header", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchRFC822Header");
     }
 
     @Test
     public void testFetchRFC822KOREA() throws Exception {
-        scriptTest("FetchRFC822", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchRFC822");
     }
 
     @Test
     public void testFetchRFC822TextKOREA() throws Exception {
-        scriptTest("FetchRFC822Text", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchRFC822Text");
     }
 
     @Test
     public void testFetchRFC822HeaderKOREA() throws Exception {
-        scriptTest("FetchRFC822Header", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchRFC822Header");
     }
 
     @Test
     public void testFetchRFC822ITALY() throws Exception {
-        scriptTest("FetchRFC822", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchRFC822");
     }
 
     @Test
     public void testFetchRFC822TextITALY() throws Exception {
-        scriptTest("FetchRFC822Text", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchRFC822Text");
     }
 
     @Test
     public void testFetchRFC822HeaderITALY() throws Exception {
-        scriptTest("FetchRFC822Header", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchRFC822Header");
     }
 
     @Test
     public void testFetchInternalDateUS() throws Exception {
-        scriptTest("FetchInternalDate", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchInternalDate");
     }
 
     @Test
     public void testFetchInternalDateITALY() throws Exception {
-        scriptTest("FetchInternalDate", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchInternalDate");
     }
 
     @Test
     public void testFetchInternalDateKOREA() throws Exception {
-        scriptTest("FetchInternalDate", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchInternalDate");
     }
 
     @Test
     public void testFetchFetchRfcMixedUS() throws Exception {
-        scriptTest("FetchRFC822Mixed", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchRFC822Mixed");
     }
 
     @Test
     public void testFetchFetchRfcMixedKOREA() throws Exception {
-        scriptTest("FetchRFC822Mixed", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchRFC822Mixed");
     }
 
     @Test
     public void testFetchFetchRfcMixedITALY() throws Exception {
-        scriptTest("FetchRFC822Mixed", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchRFC822Mixed");
     }
 }

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/FetchBodySection.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/FetchBodySection.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/FetchBodySection.java
index e9f8b91..1e5a355 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/FetchBodySection.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/FetchBodySection.java
@@ -24,60 +24,95 @@ 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 FetchBodySection extends BaseSelectedState {
+public class FetchBodySection implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public FetchBodySection() 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 testFetchMultipartAlternativeUS() throws Exception {
-        scriptTest("FetchMultipartAlternative", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchMultipartAlternative");
     }
 
     @Test
     public void testFetchMultipartAlternativeITALY() throws Exception {
-        scriptTest("FetchMultipartAlternative", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchMultipartAlternative");
     }
 
     @Test
     public void testFetchMultipartAlternativeKOREA() throws Exception {
-        scriptTest("FetchMultipartAlternative", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchMultipartAlternative");
     }
 
     @Test
     public void testFetchMultipartMixedUS() throws Exception {
-        scriptTest("FetchMultipartMixed", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchMultipartMixed");
     }
 
     @Test
     public void testFetchMultipartMixedITALY() throws Exception {
-        scriptTest("FetchMultipartMixed", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchMultipartMixed");
     }
 
     @Test
     public void testFetchMultipartMixedKOREA() throws Exception {
-        scriptTest("FetchMultipartMixed", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchMultipartMixed");
     }
 
     @Test
     public void testFetchMultipartMixedComplexUS() throws Exception {
-        scriptTest("FetchMultipartMixedComplex", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchMultipartMixedComplex");
     }
 
     @Test
     public void testFetchMultipartMixedComplexITALY() throws Exception {
-        scriptTest("FetchMultipartMixedComplex", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchMultipartMixedComplex");
     }
 
     @Test
     public void testFetchMultipartMixedComplexKOREA() throws Exception {
-        scriptTest("FetchMultipartMixedComplex", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchMultipartMixedComplex");
     }
 }

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/FetchBodyStructure.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/FetchBodyStructure.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/FetchBodyStructure.java
index 3fa2fd3..19596a6 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/FetchBodyStructure.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/FetchBodyStructure.java
@@ -24,75 +24,117 @@ 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 FetchBodyStructure extends BaseSelectedState {
+public class FetchBodyStructure implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public FetchBodyStructure() 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 testFetchFetchSimpleBodyStructureUS() throws Exception {
-        scriptTest("FetchSimpleBodyStructure", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchSimpleBodyStructure");
     }
 
     @Test
     public void testFetchFetchSimpleBodyStructureKOREA() throws Exception {
-        scriptTest("FetchSimpleBodyStructure", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchSimpleBodyStructure");
     }
 
     @Test
     public void testFetchFetchSimpleBodyStructureITALY() throws Exception {
-        scriptTest("FetchSimpleBodyStructure", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchSimpleBodyStructure");
     }
 
     @Test
     public void testFetchFetchMultipartBodyStructureUS() throws Exception {
-        scriptTest("FetchMultipartBodyStructure", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchMultipartBodyStructure");
     }
 
     @Test
     public void testFetchFetchMultipartBodyStructureKOREA() throws Exception {
-        scriptTest("FetchMultipartBodyStructure", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchMultipartBodyStructure");
     }
 
     @Test
     public void testFetchFetchMultipartBodyStructureITALY() throws Exception {
-        scriptTest("FetchMultipartBodyStructure", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchMultipartBodyStructure");
     }
 
     @Test
     public void testFetchStructureEmbeddedUS() throws Exception {
-        scriptTest("FetchStructureEmbedded", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchStructureEmbedded");
     }
 
     @Test
     public void testFetchStructureEmbeddedITALY() throws Exception {
-        scriptTest("FetchStructureEmbedded", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchStructureEmbedded");
     }
 
     @Test
     public void testFetchStructureEmbeddedKOREA() throws Exception {
-        scriptTest("FetchStructureEmbedded", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchStructureEmbedded");
     }
 
     @Test
     public void testFetchStructureComplexUS() throws Exception {
-        scriptTest("FetchStructureComplex", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchStructureComplex");
     }
 
     @Test
     public void testFetchStructureComplexITALY() throws Exception {
-        scriptTest("FetchStructureComplex", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchStructureComplex");
     }
 
     @Test
     public void testFetchStructureComplexKOREA() throws Exception {
-        scriptTest("FetchStructureComplex", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchStructureComplex");
     }
 }

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/FetchHeaders.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/FetchHeaders.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/FetchHeaders.java
index 21da09a..c434359 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/FetchHeaders.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/FetchHeaders.java
@@ -24,45 +24,75 @@ 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 FetchHeaders extends BaseSelectedState {
+public class FetchHeaders implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public FetchHeaders() 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 testFetchHeaderFieldsUS() throws Exception {
-        scriptTest("FetchHeaderFields", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchHeaderFields");
     }
 
     @Test
     public void testFetchHeaderFieldsITALY() throws Exception {
-        scriptTest("FetchHeaderFields", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchHeaderFields");
     }
 
     @Test
     public void testFetchHeaderFieldsKOREA() throws Exception {
-        scriptTest("FetchHeaderFields", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchHeaderFields");
     }
 
     @Test
     public void testFetchHeaderFieldsNotUS() throws Exception {
-        scriptTest("FetchHeaderFieldsNot", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchHeaderFieldsNot");
     }
 
     @Test
     public void testFetchHeaderFieldsNotITALY() throws Exception {
-        scriptTest("FetchHeaderFieldsNot", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchHeaderFieldsNot");
     }
 
     @Test
     public void testFetchHeaderFieldsNotKOREA() throws Exception {
-        scriptTest("FetchHeaderFieldsNot", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchHeaderFieldsNot");
     }
 }

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/Listing.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Listing.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Listing.java
index 8d661ec..847974b 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Listing.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Listing.java
@@ -24,45 +24,72 @@ 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 Listing extends BaseAuthenticatedState {
+public class Listing implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public Listing() 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 testListPlusUS() throws Exception {
-        scriptTest("ListPlus", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("ListPlus");
     }
     
     @Test
     public void testListPercentWildcardUS() throws Exception {
-        scriptTest("ListPercentWildcard", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("ListPercentWildcard");
     }
 
     @Test
     public void testListPlusKOREA() throws Exception {
-        scriptTest("ListPlus", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("ListPlus");
     }
     
     @Test
     public void testListPercentWildcardKOREA() throws Exception {
-        scriptTest("ListPercentWildcard", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("ListPercentWildcard");
     }
     
     @Test
     public void testListPlusITALY() throws Exception {
-        scriptTest("ListPlus", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("ListPlus");
     }
     
     @Test
     public void testListPercentWildcardITALY() throws Exception {
-        scriptTest("ListPercentWildcard", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("ListPercentWildcard");
     }
 }

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/MailboxAnnotation.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxAnnotation.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxAnnotation.java
index 94211c4..3798cbe 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxAnnotation.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxAnnotation.java
@@ -26,36 +26,55 @@ import javax.inject.Inject;
 
 import org.apache.james.mpt.api.ImapFeatures;
 import org.apache.james.mpt.api.ImapHostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseSelectedInbox;
+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 MailboxAnnotation extends BaseSelectedInbox {
+public class MailboxAnnotation implements ImapTestConstants {
+
     @Inject
     private static ImapHostSystem system;
-
-    public MailboxAnnotation() throws Exception {
-        super(system);
-    }
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @Before
-    public void setup() throws Exception {
+    public void setUp() throws Exception {
         Assume.assumeTrue(system.supports(ImapFeatures.Feature.ANNOTATION_SUPPORT));
+        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 testAnnotationUS() throws Exception {
-        scriptTest("Annotation", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Annotation");
     }
 
     @Test
     public void testAnnotationWithLimitationUS() throws Exception {
-        scriptTest("AnnotationWithLimitation", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("AnnotationWithLimitation");
     }
 
     @Test
     public void testAnnotationWithBinaryValue() throws Exception {
-        scriptTest("AnnotationWithBinaryData", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("AnnotationWithBinaryData");
     }
 }

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/MailboxWithLongNameError.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxWithLongNameError.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxWithLongNameError.java
index 84ac78d..b0fda10 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxWithLongNameError.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxWithLongNameError.java
@@ -24,20 +24,39 @@ import java.util.Locale;
 import javax.inject.Inject;
 
 import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseSelectedInbox;
+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 MailboxWithLongNameError extends BaseSelectedInbox {
+public class MailboxWithLongNameError implements ImapTestConstants {
     @Inject
     private static HostSystem system;
-
-    public MailboxWithLongNameError() 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 testWithLongMailboxNameUS() throws Exception {
-        scriptTest("CreateErrorWithLongName", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("CreateErrorWithLongName");
     }
 
 }

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/MailboxWithLongNameSuccess.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxWithLongNameSuccess.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxWithLongNameSuccess.java
index 1ec3907..ad040d0 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxWithLongNameSuccess.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/MailboxWithLongNameSuccess.java
@@ -24,20 +24,34 @@ import java.util.Locale;
 import javax.inject.Inject;
 
 import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseSelectedInbox;
+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 MailboxWithLongNameSuccess extends BaseSelectedInbox {
+public class MailboxWithLongNameSuccess implements ImapTestConstants {
     @Inject
     private static HostSystem system;
 
-    public MailboxWithLongNameSuccess() 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);
     }
-
+    
     @Test
     public void testWithLongMailboxNameUS() throws Exception {
-        scriptTest("CreateSuccessWithLongName", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("CreateSuccessWithLongName");
     }
 
 }

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/Move.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Move.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Move.java
index e72998c..7d1208c 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Move.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Move.java
@@ -25,23 +25,43 @@ import javax.inject.Inject;
 
 import org.apache.james.mpt.api.ImapFeatures;
 import org.apache.james.mpt.api.ImapHostSystem;
-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.Assume;
+import org.junit.Before;
 import org.junit.Test;
 
-public class Move  extends BaseSelectedState {
+public class Move implements ImapTestConstants {
 
     @Inject
     private static ImapHostSystem system;
 
-    public Move() 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 moveShouldWork() throws Exception {
         Assume.assumeTrue(system.supports(ImapFeatures.Feature.MOVE_SUPPORT));
-        scriptTest("Move", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Move");
     }
 
 }

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/NonAuthenticatedState.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/NonAuthenticatedState.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/NonAuthenticatedState.java
index 51a99b4..306c448 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/NonAuthenticatedState.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/NonAuthenticatedState.java
@@ -24,120 +24,177 @@ import java.util.Locale;
 import javax.inject.Inject;
 
 import org.apache.james.mpt.api.HostSystem;
-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 NonAuthenticatedState extends BaseNonAuthenticatedState {
+public class NonAuthenticatedState implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public NonAuthenticatedState() 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
     public void testNoopUS() throws Exception {
-        scriptTest("Noop", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Noop");
     }
 
     @Test
     public void testLogoutUS() throws Exception {
-        scriptTest("Logout", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Logout");
     }
 
     @Test
     public void testCapabilityUS() throws Exception {
-        scriptTest("Capability", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Capability");
     }
 
     @Test
     public void testLoginUS() throws Exception {
-        scriptTest("Login", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Login");
     }
 
     @Test
     public void testValidAuthenticatedUS() throws Exception {
-        scriptTest("ValidAuthenticated", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("ValidAuthenticated");
     }
 
     @Test
     public void testValidSelectedUS() throws Exception {
-        scriptTest("ValidSelected", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("ValidSelected");
     }
 
     @Test
     public void testAuthenticateUS() throws Exception {
-        scriptTest("Authenticate", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Authenticate");
     }
 
     @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 testLoginITALY() throws Exception {
-        scriptTest("Login", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Login");
     }
 
     @Test
     public void testValidAuthenticatedITALY() throws Exception {
-        scriptTest("ValidAuthenticated", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("ValidAuthenticated");
     }
 
     @Test
     public void testValidSelectedITALY() throws Exception {
-        scriptTest("ValidSelected", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("ValidSelected");
     }
 
     @Test
     public void testAuthenticateITALY() throws Exception {
-        scriptTest("Authenticate", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Authenticate");
     }
 
     @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 testLoginKOREA() throws Exception {
-        scriptTest("Login", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Login");
     }
 
     @Test
     public void testValidAuthenticatedKOREA() throws Exception {
-        scriptTest("ValidAuthenticated", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("ValidAuthenticated");
     }
 
     @Test
     public void testValidSelectedKOREA() throws Exception {
-        scriptTest("ValidSelected", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("ValidSelected");
     }
 
     @Test
     public void testAuthenticateKOREA() throws Exception {
-        scriptTest("Authenticate", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Authenticate");
     }
 }

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/PartialFetch.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/PartialFetch.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/PartialFetch.java
index 99bc55e..02b0456 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/PartialFetch.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/PartialFetch.java
@@ -24,75 +24,117 @@ 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 PartialFetch extends BaseSelectedState {
+public class PartialFetch implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public PartialFetch() 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 testBodyPartialFetchUS() throws Exception {
-        scriptTest("BodyPartialFetch", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("BodyPartialFetch");
     }
 
     @Test
     public void testBodyPartialFetchIT() throws Exception {
-        scriptTest("BodyPartialFetch", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("BodyPartialFetch");
     }
 
     @Test
     public void testBodyPartialFetchKO() throws Exception {
-        scriptTest("BodyPartialFetch", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("BodyPartialFetch");
     }
 
     @Test
     public void testTextPartialFetchUS() throws Exception {
-        scriptTest("TextPartialFetch", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("TextPartialFetch");
     }
 
     @Test
     public void testTextPartialFetchKO() throws Exception {
-        scriptTest("TextPartialFetch", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("TextPartialFetch");
     }
 
     @Test
     public void testTextPartialFetchIT() throws Exception {
-        scriptTest("TextPartialFetch", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("TextPartialFetch");
     }
 
     @Test
     public void testMimePartialFetchUS() throws Exception {
-        scriptTest("MimePartialFetch", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("MimePartialFetch");
     }
 
     @Test
     public void testMimePartialFetchIT() throws Exception {
-        scriptTest("MimePartialFetch", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("MimePartialFetch");
     }
 
     @Test
     public void testMimePartialFetchKO() throws Exception {
-        scriptTest("MimePartialFetch", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("MimePartialFetch");
     }
 
     @Test
     public void testHeaderPartialFetchUS() throws Exception {
-        scriptTest("HeaderPartialFetch", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("HeaderPartialFetch");
     }
 
     @Test
     public void testHeaderPartialFetchIT() throws Exception {
-        scriptTest("HeaderPartialFetch", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("HeaderPartialFetch");
     }
 
     @Test
     public void testHeaderPartialFetchKO() throws Exception {
-        scriptTest("HeaderPartialFetch", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("HeaderPartialFetch");
     }
 }

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/QuotaTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/QuotaTest.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/QuotaTest.java
index e1ef008..34b35c2 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/QuotaTest.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/QuotaTest.java
@@ -19,16 +19,21 @@
 
 package org.apache.james.mpt.imapmailbox.suite;
 
+import java.util.Locale;
+
+import javax.inject.Inject;
+
 import org.apache.james.mpt.api.ImapFeatures;
 import org.apache.james.mpt.api.ImapHostSystem;
-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.Assume;
+import org.junit.Before;
 import org.junit.Test;
 
-import javax.inject.Inject;
-import java.util.Locale;
-
-public class QuotaTest extends BaseSelectedState {
+public class QuotaTest implements ImapTestConstants {
 
     private static final int MAX_MESSAGE_QUOTA = 4096;
     private static final long MAX_STORAGE_QUOTA = 5 * 1024L * 1024L * 1024L;
@@ -36,16 +41,30 @@ public class QuotaTest extends BaseSelectedState {
     @Inject
     private static ImapHostSystem system;
 
-    public QuotaTest() throws Exception {
-        super(system);
+    
+    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
+
+    @Before
+    public void setUp() throws Exception {
+        Assume.assumeTrue(system.supports(ImapFeatures.Feature.QUOTA_SUPPORT));
+        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 testQuotaScript() throws Exception {
-        Assume.assumeTrue(system.supports(ImapFeatures.Feature.QUOTA_SUPPORT));
-
         system.setQuotaLimits(MAX_MESSAGE_QUOTA, MAX_STORAGE_QUOTA);
-
-        scriptTest("Quota", Locale.CANADA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.CANADA)
+            .run("Quota");
     }
 }

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/Rename.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Rename.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Rename.java
index 12bb14b..517c3e9 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Rename.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Rename.java
@@ -24,60 +24,96 @@ 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 Rename extends BaseSelectedState {
+public class Rename implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public Rename() 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 testRenameUS() throws Exception {
-        scriptTest("Rename", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Rename");
     }
     
     @Test
     public void testRenameKOREA() throws Exception {
-        scriptTest("Rename", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Rename");
     }
 
     @Test
     public void testRenameITALY() throws Exception {
-        scriptTest("Rename", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Rename");
     }
 
     @Test
     public void testRenameHierarchyUS() throws Exception {
-        scriptTest("RenameHierarchy", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("RenameHierarchy");
     }
 
     @Test
     public void testRenameHierarchyKO() throws Exception {
-        scriptTest("RenameHierarchy", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("RenameHierarchy");
     }
 
     @Test
     public void testRenameHierarchyIT() throws Exception {
-        scriptTest("RenameHierarchy", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("RenameHierarchy");
     }
 
     @Test
     public void testRenameSelectedUS() throws Exception {
-        scriptTest("RenameSelected", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("RenameSelected");
     }
 
     @Test
     public void testRenameSelectedIT() throws Exception {
-        scriptTest("RenameSelected", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("RenameSelected");
     }
 
     @Test
     public void testRenameSelectedKO() throws Exception {
-        scriptTest("RenameSelected", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("RenameSelected");
     }
 }

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/Search.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Search.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Search.java
index 6a5ba4b..22cb785 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Search.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Search.java
@@ -24,45 +24,73 @@ 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 Search extends BaseAuthenticatedState {
+public class Search implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public Search() 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("SearchAtoms", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SearchAtoms");
     }
 
     @Test
     public void testSearchAtomsITALY() throws Exception {
-        scriptTest("SearchAtoms", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("SearchAtoms");
     }
 
     @Test
     public void testSearchAtomsKOREA() throws Exception {
-        scriptTest("SearchAtoms", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("SearchAtoms");
     }
 
     @Test
     public void testSearchCombinationsUS() throws Exception {
-        scriptTest("SearchCombinations", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SearchCombinations");
     }
 
     @Test
     public void testSearchCombinationsITALY() throws Exception {
-        scriptTest("SearchCombinations", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("SearchCombinations");
     }
 
     @Test
     public void testSearchCombinationsKOREA() throws Exception {
-        scriptTest("SearchCombinations", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("SearchCombinations");
     }
 }

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/Security.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Security.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Security.java
index ae93fe6..0628c11 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Security.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Security.java
@@ -24,125 +24,185 @@ 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.After;
+import org.junit.Before;
 import org.junit.Test;
 
-public class Security extends BaseImapProtocol {
+public class Security implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public Security() 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 accessingOtherPeopleNamespaceShouldBeDenied() throws Exception {
-        scriptTest("SharedMailbox", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SharedMailbox");
     }
 
     @Test
     public void testLoginThreeStrikesUS() throws Exception {
-        scriptTest("LoginThreeStrikes", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("LoginThreeStrikes");
     }
 
     @Test
     public void testLoginThreeStrikesKOREA() throws Exception {
-        scriptTest("LoginThreeStrikes", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("LoginThreeStrikes");
     }
 
     @Test
     public void testLoginThreeStrikesITALY() throws Exception {
-        scriptTest("LoginThreeStrikes", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("LoginThreeStrikes");
     }
 
     @Test
     public void testBadTagUS() throws Exception {
-        scriptTest("BadTag", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("BadTag");
     }
 
     @Test
     public void testBadTagKOREA() throws Exception {
-        scriptTest("BadTag", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("BadTag");
     }
 
     @Test
     public void testBadTagITALY() throws Exception {
-        scriptTest("BadTag", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("BadTag");
     }
 
     @Test
     public void testNoTagUS() throws Exception {
-        scriptTest("NoTag", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("NoTag");
     }
 
     @Test
     public void testNoTagKOREA() throws Exception {
-        scriptTest("NoTag", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("NoTag");
     }
 
     @Test
     public void testNoTagITALY() throws Exception {
-        scriptTest("NoTag", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("NoTag");
     }
 
     @Test
     public void testIllegalTagUS() throws Exception {
-        scriptTest("IllegalTag", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("IllegalTag");
     }
 
     @Test
     public void testIllegalTagKOREA() throws Exception {
-        scriptTest("IllegalTag", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("IllegalTag");
     }
 
     @Test
     public void testIllegalTagITALY() throws Exception {
-        scriptTest("IllegalTag", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("IllegalTag");
     }
 
     @Test
     public void testJustTagUS() throws Exception {
-        scriptTest("JustTag", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("JustTag");
     }
 
     @Test
     public void testJustTagKOREA() throws Exception {
-        scriptTest("JustTag", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("JustTag");
     }
 
     @Test
     public void testJustTagITALY() throws Exception {
-        scriptTest("JustTag", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("JustTag");
     }
 
     @Test
     public void testNoCommandUS() throws Exception {
-        scriptTest("NoCommand", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("NoCommand");
     }
 
     @Test
     public void testNoCommandKOREA() throws Exception {
-        scriptTest("NoCommand", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("NoCommand");
     }
 
     @Test
     public void testNoCommandITALY() throws Exception {
-        scriptTest("NoCommand", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("NoCommand");
     }
 
     @Test
     public void testBogusCommandUS() throws Exception {
-        scriptTest("BogusCommand", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("BogusCommand");
     }
 
     @Test
     public void testBogusCommandKOREA() throws Exception {
-        scriptTest("BogusCommand", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("BogusCommand");
     }
 
     @Test
     public void testNoBogusITALY() throws Exception {
-        scriptTest("BogusCommand", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("BogusCommand");
     }
 }

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/Select.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Select.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Select.java
index 9fe7217..411ef76 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Select.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Select.java
@@ -24,30 +24,52 @@ 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 Select extends BaseAuthenticatedState {
+public class Select implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public Select() 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 testSelectUnseenUS() throws Exception {
-        scriptTest("SelectUnseen", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SelectUnseen");
     }
 
     @Test
     public void testSelectUnseenKOREA() throws Exception {
-        scriptTest("SelectUnseen", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("SelectUnseen");
     }
 
     @Test
     public void testSelectUnseenITALY() throws Exception {
-        scriptTest("SelectUnseen", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("SelectUnseen");
     }
 }

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/SelectedInbox.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/SelectedInbox.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/SelectedInbox.java
index 1bddd69..5cdc63a 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/SelectedInbox.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/SelectedInbox.java
@@ -24,226 +24,327 @@ import java.util.Locale;
 import javax.inject.Inject;
 
 import org.apache.james.mpt.api.HostSystem;
-import org.apache.james.mpt.imapmailbox.suite.base.BaseSelectedInbox;
+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 SelectedInbox extends BaseSelectedInbox {
+public class SelectedInbox implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public SelectedInbox() 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.selectInbox(simpleScriptedTestProtocol);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        system.afterTest();
     }
 
     @Test
     public void testValidNonAuthenticatedUS() throws Exception {
-        scriptTest("ValidNonAuthenticated", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("ValidNonAuthenticated");
     }
 
     @Test
     public void testCapabilityUS() throws Exception {
-        scriptTest("Capability", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Capability");
     }
 
     @Test
     public void testNoopUS() throws Exception {
-        scriptTest("Noop", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Noop");
     }
 
     @Test
     public void testLogoutUS() throws Exception {
-        scriptTest("Logout", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Logout");
     }
 
     @Test
     public void testCreateUS() throws Exception {
-        scriptTest("Create", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Create");
     }
 
     @Test
     public void testExamineEmptyUS() throws Exception {
-        scriptTest("ExamineEmpty", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("ExamineEmpty");
     }
 
     @Test
     public void testSelectEmptyUS() throws Exception {
-        scriptTest("SelectEmpty", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SelectEmpty");
     }
 
     @Test
     public void testListNamespaceUS() throws Exception {
-        scriptTest("ListNamespace", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("ListNamespace");
     }
 
     @Test
     public void testListMailboxesUS() throws Exception {
-        scriptTest("ListMailboxes", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("ListMailboxes");
     }
 
     @Test
     public void testStatusUS() throws Exception {
-        scriptTest("Status", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Status");
     }
 
     @Test
     public void testStringArgsUS() throws Exception {
-        scriptTest("StringArgs", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("StringArgs");
     }
 
     @Test
     public void testSubscribeUS() throws Exception {
-        scriptTest("Subscribe", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Subscribe");
     }
 
     @Test
     public void testAppendUS() throws Exception {
-        scriptTest("Append", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Append");
     }
 
     @Test
     public void testDeleteUS() throws Exception {
-        scriptTest("Delete", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Delete");
     }
 
     @Test
     public void testValidNonAuthenticatedITALY() throws Exception {
-        scriptTest("ValidNonAuthenticated", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("ValidNonAuthenticated");
     }
 
     @Test
     public void testCapabilityITALY() throws Exception {
-        scriptTest("Capability", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Capability");
     }
 
     @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 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 testStringArgsITALY() throws Exception {
-        scriptTest("StringArgs", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("StringArgs");
     }
 
     @Test
     public void testSubscribeITALY() throws Exception {
-        scriptTest("Subscribe", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Subscribe");
     }
 
     @Test
     public void testAppendITALY() throws Exception {
-        scriptTest("Append", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Append");
     }
 
     @Test
     public void testDeleteITALY() throws Exception {
-        scriptTest("Delete", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Delete");
     }
 
     @Test
     public void testValidNonAuthenticatedKOREA() throws Exception {
-        scriptTest("ValidNonAuthenticated", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("ValidNonAuthenticated");
     }
 
     @Test
     public void testCapabilityKOREA() throws Exception {
-        scriptTest("Capability", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Capability");
     }
 
     @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 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 testStringArgsKOREA() throws Exception {
-        scriptTest("StringArgs", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("StringArgs");
     }
 
     @Test
     public void testSubscribeKOREA() throws Exception {
-        scriptTest("Subscribe", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Subscribe");
     }
 
     @Test
     public void testAppendKOREA() throws Exception {
-        scriptTest("Append", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Append");
     }
 
     @Test
     public void testDeleteKOREA() throws Exception {
-        scriptTest("Delete", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Delete");
     }
 
 }

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/SelectedState.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/SelectedState.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/SelectedState.java
index 5ac6172..bc30f44 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/SelectedState.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/SelectedState.java
@@ -24,165 +24,243 @@ 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 SelectedState extends BaseSelectedState {
+public class SelectedState implements ImapTestConstants {
 
     @Inject
     private static HostSystem system;
     
-    public SelectedState() 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 testCheckUS() throws Exception {
-        scriptTest("Check", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Check");
     }
 
     @Test
     public void testExpungeUS() throws Exception {
-        scriptTest("Expunge", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Expunge");
     }
 
     @Test
     public void testSearchUS() throws Exception {
-        scriptTest("Search", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Search");
     }
 
     @Test
     public void testFetchSingleMessageUS() throws Exception {
-        scriptTest("FetchSingleMessage", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchSingleMessage");
     }
 
     @Test
     public void testFetchMultipleMessagesUS() throws Exception {
-        scriptTest("FetchMultipleMessages", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchMultipleMessages");
     }
 
     @Test
     public void testFetchPeekUS() throws Exception {
-        scriptTest("FetchPeek", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("FetchPeek");
     }
 
     @Test
     public void testStoreUS() throws Exception {
-        scriptTest("Store", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Store");
     }
 
     @Test
     public void testCopyUS() throws Exception {
-        scriptTest("Copy", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Copy");
     }
 
     @Test
     public void testUidUS() throws Exception {
-        scriptTest("Uid", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("Uid");
     }
 
     @Test
     public void testCheckITALY() throws Exception {
-        scriptTest("Check", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Check");
     }
 
     @Test
     public void testExpungeITALY() throws Exception {
-        scriptTest("Expunge", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Expunge");
     }
 
     @Test
     public void testSearchITALY() throws Exception {
-        scriptTest("Search", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Search");
     }
 
     @Test
     public void testFetchSingleMessageITALY() throws Exception {
-        scriptTest("FetchSingleMessage", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchSingleMessage");
     }
 
     @Test
     public void testFetchMultipleMessagesITALY() throws Exception {
-        scriptTest("FetchMultipleMessages", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchMultipleMessages");
     }
 
     @Test
     public void testFetchPeekITALY() throws Exception {
-        scriptTest("FetchPeek", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("FetchPeek");
     }
 
     @Test
     public void testStoreITALY() throws Exception {
-        scriptTest("Store", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Store");
     }
 
     @Test
     public void testCopyITALY() throws Exception {
-        scriptTest("Copy", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Copy");
     }
 
     @Test
     public void testUidITALY() throws Exception {
-        scriptTest("Uid", Locale.ITALY);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.ITALY)
+            .run("Uid");
     }
 
     @Test
     public void testCheckKOREA() throws Exception {
-        scriptTest("Check", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Check");
     }
 
     @Test
     public void testExpungeKOREA() throws Exception {
-        scriptTest("Expunge", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Expunge");
     }
 
     @Test
     public void testSearchKOREA() throws Exception {
-        scriptTest("Search", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Search");
     }
 
     @Test
     public void testFetchSingleMessageKOREA() throws Exception {
-        scriptTest("FetchSingleMessage", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchSingleMessage");
     }
 
     @Test
     public void testFetchMultipleMessagesKOREA() throws Exception {
-        scriptTest("FetchMultipleMessages", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchMultipleMessages");
     }
 
     @Test
     public void testFetchPeekKOREA() throws Exception {
-        scriptTest("FetchPeek", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("FetchPeek");
     }
 
     @Test
     public void testStoreKOREA() throws Exception {
-        scriptTest("Store", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Store");
     }
 
     @Test
     public void testCopyKOREA() throws Exception {
-        scriptTest("Copy", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Copy");
     }
 
     @Test
     public void testUidKOREA() throws Exception {
-        scriptTest("Uid", Locale.KOREA);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.KOREA)
+            .run("Uid");
     }
     
     @Test
     public void testNamespaceUS() throws Exception {
-        scriptTest("Namespace", Locale.US);
+        simpleScriptedTestProtocol
+            .withLocale(Locale.US)
+            .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");
     }
 }


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


Mime
View raw message