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

[04/21] james-project git commit: MPT-39 finally remove this crazy static injection with onami

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileNoopTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileNoopTest.java b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileNoopTest.java
new file mode 100644
index 0000000..1dc4571
--- /dev/null
+++ b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileNoopTest.java
@@ -0,0 +1,51 @@
+/****************************************************************
+ * 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.managesieve.file;
+
+import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.testsuite.NoopTest;
+import org.junit.After;
+import org.junit.Before;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class FileNoopTest extends NoopTest {
+
+    private ManageSieveHostSystem system;
+
+    @Before
+    public void setUp() throws Exception {
+        Injector injector = Guice.createInjector(new FileModule());
+        system = injector.getInstance(ManageSieveHostSystem.class);
+        system.beforeTest();
+        super.setUp();
+    }
+    
+    @Override
+    protected ManageSieveHostSystem createManageSieveHostSystem() {
+        return system;
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        system.afterTest();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FilePutScriptTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FilePutScriptTest.java b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FilePutScriptTest.java
new file mode 100644
index 0000000..50a72bc
--- /dev/null
+++ b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FilePutScriptTest.java
@@ -0,0 +1,51 @@
+/****************************************************************
+ * 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.managesieve.file;
+
+import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.testsuite.PutScriptTest;
+import org.junit.After;
+import org.junit.Before;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class FilePutScriptTest extends PutScriptTest {
+
+    private ManageSieveHostSystem system;
+
+    @Before
+    public void setUp() throws Exception {
+        Injector injector = Guice.createInjector(new FileModule());
+        system = injector.getInstance(ManageSieveHostSystem.class);
+        system.beforeTest();
+        super.setUp();
+    }
+    
+    @Override
+    protected ManageSieveHostSystem createManageSieveHostSystem() {
+        return system;
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        system.afterTest();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileRenameScriptTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileRenameScriptTest.java b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileRenameScriptTest.java
new file mode 100644
index 0000000..35bf256
--- /dev/null
+++ b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileRenameScriptTest.java
@@ -0,0 +1,51 @@
+/****************************************************************
+ * 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.managesieve.file;
+
+import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.testsuite.RenameScriptTest;
+import org.junit.After;
+import org.junit.Before;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class FileRenameScriptTest extends RenameScriptTest {
+
+    private ManageSieveHostSystem system;
+
+    @Before
+    public void setUp() throws Exception {
+        Injector injector = Guice.createInjector(new FileModule());
+        system = injector.getInstance(ManageSieveHostSystem.class);
+        system.beforeTest();
+        super.setUp();
+    }
+    
+    @Override
+    protected ManageSieveHostSystem createManageSieveHostSystem() {
+        return system;
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        system.afterTest();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileSetActiveTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileSetActiveTest.java b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileSetActiveTest.java
new file mode 100644
index 0000000..3ec799a
--- /dev/null
+++ b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileSetActiveTest.java
@@ -0,0 +1,51 @@
+/****************************************************************
+ * 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.managesieve.file;
+
+import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.testsuite.SetActiveTest;
+import org.junit.After;
+import org.junit.Before;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class FileSetActiveTest extends SetActiveTest {
+
+    private ManageSieveHostSystem system;
+
+    @Before
+    public void setUp() throws Exception {
+        Injector injector = Guice.createInjector(new FileModule());
+        system = injector.getInstance(ManageSieveHostSystem.class);
+        system.beforeTest();
+        super.setUp();
+    }
+    
+    @Override
+    protected ManageSieveHostSystem createManageSieveHostSystem() {
+        return system;
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        system.afterTest();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileStartTlsTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileStartTlsTest.java b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileStartTlsTest.java
new file mode 100644
index 0000000..d37365f
--- /dev/null
+++ b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileStartTlsTest.java
@@ -0,0 +1,51 @@
+/****************************************************************
+ * 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.managesieve.file;
+
+import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.testsuite.StartTlsTest;
+import org.junit.After;
+import org.junit.Before;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class FileStartTlsTest extends StartTlsTest {
+
+    private ManageSieveHostSystem system;
+
+    @Before
+    public void setUp() throws Exception {
+        Injector injector = Guice.createInjector(new FileModule());
+        system = injector.getInstance(ManageSieveHostSystem.class);
+        system.beforeTest();
+        super.setUp();
+    }
+    
+    @Override
+    protected ManageSieveHostSystem createManageSieveHostSystem() {
+        return system;
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        system.afterTest();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileUnauthenticatedTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileUnauthenticatedTest.java b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileUnauthenticatedTest.java
new file mode 100644
index 0000000..1f6eeab
--- /dev/null
+++ b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/FileUnauthenticatedTest.java
@@ -0,0 +1,51 @@
+/****************************************************************
+ * 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.managesieve.file;
+
+import org.apache.james.mpt.host.ManageSieveHostSystem;
+import org.apache.james.mpt.testsuite.UnauthenticatedTest;
+import org.junit.After;
+import org.junit.Before;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class FileUnauthenticatedTest extends UnauthenticatedTest {
+
+    private ManageSieveHostSystem system;
+
+    @Before
+    public void setUp() throws Exception {
+        Injector injector = Guice.createInjector(new FileModule());
+        system = injector.getInstance(ManageSieveHostSystem.class);
+        system.beforeTest();
+        super.setUp();
+    }
+    
+    @Override
+    protected ManageSieveHostSystem createManageSieveHostSystem() {
+        return system;
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        system.afterTest();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/ManageSieveFileTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/ManageSieveFileTest.java b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/ManageSieveFileTest.java
deleted file mode 100644
index 9b98838..0000000
--- a/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/ManageSieveFileTest.java
+++ /dev/null
@@ -1,60 +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.managesieve.file;
-
-import org.apache.james.mpt.onami.test.OnamiSuite;
-import org.apache.james.mpt.onami.test.annotation.GuiceModules;
-import org.apache.james.mpt.testsuite.AuthenticateTest;
-import org.apache.james.mpt.testsuite.CapabilityTest;
-import org.apache.james.mpt.testsuite.CheckScriptTest;
-import org.apache.james.mpt.testsuite.DeleteScriptTest;
-import org.apache.james.mpt.testsuite.GetScriptTest;
-import org.apache.james.mpt.testsuite.HaveSpaceTest;
-import org.apache.james.mpt.testsuite.ListScriptsTest;
-import org.apache.james.mpt.testsuite.LogoutTest;
-import org.apache.james.mpt.testsuite.NoopTest;
-import org.apache.james.mpt.testsuite.PutScriptTest;
-import org.apache.james.mpt.testsuite.RenameScriptTest;
-import org.apache.james.mpt.testsuite.SetActiveTest;
-import org.apache.james.mpt.testsuite.StartTlsTest;
-import org.apache.james.mpt.testsuite.UnauthenticatedTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@GuiceModules({ FileModule.class })
-@RunWith(OnamiSuite.class)
-@Suite.SuiteClasses({
-    NoopTest.class,
-    UnauthenticatedTest.class,
-    LogoutTest.class,
-    AuthenticateTest.class,
-    StartTlsTest.class,
-    CapabilityTest.class,
-    HaveSpaceTest.class,
-    PutScriptTest.class,
-    SetActiveTest.class,
-    GetScriptTest.class,
-    DeleteScriptTest.class,
-    RenameScriptTest.class,
-    CheckScriptTest.class,
-    ListScriptsTest.class
-})
-public class ManageSieveFileTest {
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/smtp/cassandra/pom.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/pom.xml b/mpt/impl/smtp/cassandra/pom.xml
index 48b9cb1..caa3fd2 100644
--- a/mpt/impl/smtp/cassandra/pom.xml
+++ b/mpt/impl/smtp/cassandra/pom.xml
@@ -177,10 +177,6 @@
                 </dependency>
                 <dependency>
                     <groupId>org.apache.james</groupId>
-                    <artifactId>apache-james-mpt-onami-test</artifactId>
-                </dependency>
-                <dependency>
-                    <groupId>org.apache.james</groupId>
                     <artifactId>james-server-cassandra-guice</artifactId>
                 </dependency>
                 <dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/CassandraForwardSmtpTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/CassandraForwardSmtpTest.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/CassandraForwardSmtpTest.java
new file mode 100644
index 0000000..0cda129
--- /dev/null
+++ b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/CassandraForwardSmtpTest.java
@@ -0,0 +1,49 @@
+/****************************************************************
+ * 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.smtp;
+
+import org.junit.After;
+import org.junit.Before;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class CassandraForwardSmtpTest extends ForwardSmtpTest {
+
+    private SmtpHostSystem system;
+
+    @Before
+    public void setUp() throws Exception {
+        Injector injector = Guice.createInjector(new SmtpTestModule(SmtpTestModule.Port.SMTP));
+        system = injector.getInstance(SmtpHostSystem.class);
+        system.beforeTest();
+        super.setUp();
+    }
+    
+    @Override
+    protected SmtpHostSystem createSmtpHostSystem() {
+        return system;
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        system.afterTest();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/CassandraSmtpStarttlsCommandTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/CassandraSmtpStarttlsCommandTest.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/CassandraSmtpStarttlsCommandTest.java
new file mode 100644
index 0000000..d807faf
--- /dev/null
+++ b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/CassandraSmtpStarttlsCommandTest.java
@@ -0,0 +1,49 @@
+/****************************************************************
+ * 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.smtp;
+
+import org.junit.After;
+import org.junit.Before;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class CassandraSmtpStarttlsCommandTest extends SmtpStarttlsCommandTest {
+
+    private SmtpHostSystem system;
+
+    @Before
+    public void setUp() throws Exception {
+        Injector injector = Guice.createInjector(new SmtpTestModule(SmtpTestModule.Port.SMTP_START_TTLS));
+        system = injector.getInstance(SmtpHostSystem.class);
+        system.beforeTest();
+        super.setUp();
+    }
+    
+    @Override
+    protected SmtpHostSystem createSmtpHostSystem() {
+        return system;
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        system.afterTest();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTest.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTest.java
deleted file mode 100644
index 5a7beea..0000000
--- a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTest.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.smtp;
-
-import org.apache.james.mpt.onami.test.OnamiSuite;
-import org.apache.james.mpt.onami.test.annotation.GuiceModules;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(OnamiSuite.class)
-@Suite.SuiteClasses({
-    ForwardSmtpTest.class
-})
-@GuiceModules({ SmtpTestModule.class })
-public class SmtpTest {
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTestModule.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTestModule.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTestModule.java
index 923c854..e86db9d 100644
--- a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTestModule.java
+++ b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/SmtpTestModule.java
@@ -24,9 +24,26 @@ import com.google.inject.AbstractModule;
 
 public class SmtpTestModule extends AbstractModule {
 
+    enum Port {
+        SMTP(1025),
+        SMTP_START_TTLS(1587);
+        
+        private int port;
+
+        Port(int port) {
+            this.port = port;
+        }
+    }
+    
+    private Port smtpPort;
+
+    public SmtpTestModule(Port smtpPort) {
+        this.smtpPort = smtpPort;
+    }
+    
     @Override
     protected void configure() {
-        bind(SmtpHostSystem.class).toInstance(new CassandraJamesSmtpHostSystem(1025));
+        bind(SmtpHostSystem.class).toInstance(new CassandraJamesSmtpHostSystem(smtpPort.port));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/StarttlsSmtpTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/StarttlsSmtpTest.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/StarttlsSmtpTest.java
deleted file mode 100644
index 376579f..0000000
--- a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/StarttlsSmtpTest.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.smtp;
-
-import org.apache.james.mpt.onami.test.OnamiSuite;
-import org.apache.james.mpt.onami.test.annotation.GuiceModules;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(OnamiSuite.class)
-@Suite.SuiteClasses({
-    SmtpStarttlsCommandTest.class
-})
-@GuiceModules({ StarttlsSmtpTestModule.class })
-public class StarttlsSmtpTest {
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/StarttlsSmtpTestModule.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/StarttlsSmtpTestModule.java b/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/StarttlsSmtpTestModule.java
deleted file mode 100644
index 88b44d5..0000000
--- a/mpt/impl/smtp/cassandra/src/test/java/org/apache/james/mpt/smtp/StarttlsSmtpTestModule.java
+++ /dev/null
@@ -1,32 +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.smtp;
-
-import org.apache.james.mpt.smtp.host.CassandraJamesSmtpHostSystem;
-
-import com.google.inject.AbstractModule;
-
-public class StarttlsSmtpTestModule extends AbstractModule {
-
-    @Override
-    protected void configure() {
-        bind(SmtpHostSystem.class).toInstance(new CassandraJamesSmtpHostSystem(1587));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/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 c6e8814..fdc47e7 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
@@ -26,8 +26,6 @@ import static org.hamcrest.Matchers.equalTo;
 import java.net.InetAddress;
 import java.util.Locale;
 
-import javax.inject.Inject;
-
 import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
 import org.apache.james.util.streams.SwarmGenericContainer;
 import org.junit.Before;
@@ -42,7 +40,7 @@ import com.jayway.restassured.RestAssured;
 import com.jayway.restassured.builder.RequestSpecBuilder;
 import com.jayway.restassured.http.ContentType;
 
-public class ForwardSmtpTest {
+public abstract class ForwardSmtpTest {
 
     public static final String USER = "bob";
     public static final String DOMAIN = "mydomain.tld";
@@ -56,20 +54,21 @@ public class ForwardSmtpTest {
     @Rule
     public final RuleChain chain = RuleChain.outerRule(folder).around(fakeSmtp);
 
-    @Inject
-    private static SmtpHostSystem hostSystem;
-
-    private SimpleScriptedTestProtocol scriptedTest;
+    protected abstract SmtpHostSystem createSmtpHostSystem();
     
-    public ForwardSmtpTest() throws Exception {
+    private SmtpHostSystem hostSystem;
+    private SimpleScriptedTestProtocol scriptedTest;
+
+    @Before
+    public void setUp() throws Exception {
+        hostSystem = createSmtpHostSystem();
+
         scriptedTest = new SimpleScriptedTestProtocol("/org/apache/james/smtp/scripts/", hostSystem)
                 .withLocale(Locale.US)
                 .withUser(USER_AT_DOMAIN, PASSWORD);
-    }
 
-    @Before
-    public void setUp() throws Exception {
         InetAddress containerIp = InetAddresses.forString(fakeSmtp.getIp());
+        
         hostSystem.getInMemoryDnsService()
             .registerRecord("yopmail.com", containerIp, "yopmail.com");
         hostSystem.addAddressMapping(USER, DOMAIN, "ray@yopmail.com");

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/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 e667886..efc3a28 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
@@ -20,15 +20,14 @@ package org.apache.james.mpt.smtp;
 
 import java.util.Locale;
 
-import javax.inject.Inject;
-
 import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.RuleChain;
 import org.junit.rules.TemporaryFolder;
 
-public class SmtpStarttlsCommandTest {
+public abstract class SmtpStarttlsCommandTest {
 
     public static final String USER = "bob";
     public static final String DOMAIN = "mydomain.tld";
@@ -40,12 +39,14 @@ public class SmtpStarttlsCommandTest {
     @Rule
     public final RuleChain chain = RuleChain.outerRule(folder);
 
-    @Inject
-    private static SmtpHostSystem hostSystem;
+    protected abstract SmtpHostSystem createSmtpHostSystem();
     
+    private SmtpHostSystem hostSystem;
     private SimpleScriptedTestProtocol scriptedTest;
 
-    public SmtpStarttlsCommandTest() throws Exception {
+    @Before
+    public void setUp() throws Exception {
+        hostSystem = createSmtpHostSystem();
         String scriptDir = "/org/apache/james/smtp/scripts/";
         scriptedTest = new SimpleScriptedTestProtocol(scriptDir, hostSystem)
                 .withLocale(Locale.US)

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/onami-test/pom.xml
----------------------------------------------------------------------
diff --git a/mpt/onami-test/pom.xml b/mpt/onami-test/pom.xml
deleted file mode 100644
index 46a2856..0000000
--- a/mpt/onami-test/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <artifactId>apache-james-mpt</artifactId>
-        <groupId>org.apache.james</groupId>
-        <version>3.1.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>apache-james-mpt-onami-test</artifactId>
-    <packaging>jar</packaging>
-
-    <name>Apache James :: MPT :: Onami-test</name>
-    <description>MPT tooling from Onami project</description>
-
-    <dependencies>
-        <dependency>
-            <groupId>com.google.inject</groupId>
-            <artifactId>guice</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymock</artifactId>
-            <version>3.2</version>
-            <scope>provided</scope>
-            <optional>true</optional>
-        </dependency>
-
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-            <version>16.0.1</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-core</artifactId>
-            <version>1.9.5</version>
-            <scope>provided</scope>
-            <optional>true</optional>
-        </dependency>
-
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/GuiceMockModule.java
----------------------------------------------------------------------
diff --git a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/GuiceMockModule.java b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/GuiceMockModule.java
deleted file mode 100644
index b88aa67..0000000
--- a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/GuiceMockModule.java
+++ /dev/null
@@ -1,157 +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.onami.test;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.james.mpt.onami.test.annotation.Mock;
-
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Multimap;
-import com.google.inject.AbstractModule;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Names;
-
-/**
- * <p>
- * This class creates the binding for all mock objects found.
- * </p>
- * <p>
- * Method {@link GuiceMockModule#configure()} creates a binding for each {@link Mock} annotation found. The binding will
- * be created <b>if and only if</b> there is no types conflict between {@link Mock} caught.
- * <p>
- * <p>
- * <b>A type conflict</b> is detected if two or more field are annotated with the same {@link Mock} and no different
- * {@link Mock#annotatedWith} parameter are specified, or two o more equals {@link Mock#annotatedWith} parameter are
- * specified for the same type field.
- * </p>
- * <p>
- * If a conflict is detected the binding will not create for the conflicted type, moreover the field will be injected
- * into the test class.
- * </p>
- */
-public class GuiceMockModule extends AbstractModule {
-
-    private static final Logger LOGGER = Logger.getLogger(GuiceMockModule.class.getName());
-
-    final Map<Field, Object> mockedFields;
-
-    /**
-     * Costructor.
-     *
-     * @param mockedFields the map of mock fileds.
-     */
-
-    public GuiceMockModule(final Map<Field, Object> mockedFields) {
-        this.mockedFields = mockedFields;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    protected void configure() {
-        final Multimap<Type, Field> fieldsByType = HashMultimap.create();
-
-        for (final Entry<Field, Object> entry : this.mockedFields.entrySet()) {
-            fieldsByType.put(entry.getKey().getGenericType(), entry.getKey());
-        }
-
-        for (final Type type : fieldsByType.keySet()) {
-            final Collection<Field> fields = fieldsByType.get(type);
-
-            boolean isTypeConflicts = false;
-            if (fields.size() != 1) {
-                isTypeConflicts = checkTypeConflict(fields);
-            }
-
-            checkState(!isTypeConflicts, "   Found multiple annotation @%s for type: %s; binding skipped!.",
-                Mock.class.getSimpleName(), type);
-            for (final Field field : fields) {
-                @SuppressWarnings("rawtypes")
-                final TypeLiteral literal = TypeLiteral.get(type);
-                final Mock annoBy = field.getAnnotation(Mock.class);
-                final Object mock = this.mockedFields.get(field);
-                if (annoBy.annotatedWith() != Mock.NoAnnotation.class) {
-                    bind(literal).annotatedWith(annoBy.annotatedWith()).toInstance(mock);
-                } else if (!"".equals(annoBy.namedWith())) {
-                    bind(literal).annotatedWith(Names.named(annoBy.namedWith())).toInstance(mock);
-                } else {
-                    bind(literal).toInstance(mock);
-                }
-                if (LOGGER.isLoggable(Level.FINER)) {
-                    LOGGER.finer("    Created binding for: " + type + " " + annoBy);
-                }
-            }
-        }
-    }
-
-    /**
-     * @param fields
-     * @return
-     */
-    private boolean checkTypeConflict(Collection<Field> fields) {
-        final List<Class<?>> listAnnotatedType = new ArrayList<Class<?>>();
-        final List<String> listNamedType = new ArrayList<String>();
-        int numOfSimpleType = 0;
-
-        for (Field field : fields) {
-            final Mock annoBy = field.getAnnotation(Mock.class);
-
-            if (annoBy.annotatedWith() == Mock.NoAnnotation.class && "".equals(annoBy.namedWith())) {
-                numOfSimpleType++;
-            }
-            if (numOfSimpleType > 1) {
-                LOGGER.finer("Found multiple simple type");
-                return true;
-            }
-
-            if (annoBy.annotatedWith() != Mock.NoAnnotation.class) {
-                if (!listAnnotatedType.contains(annoBy.annotatedWith())) {
-                    listAnnotatedType.add(annoBy.annotatedWith());
-                } else {
-                    // found two fields with same annotation
-                    LOGGER.finer("Found multiple annotatedBy type");
-                    return true;
-                }
-            }
-
-            if (!"".equals(annoBy.namedWith())) {
-                if (!listNamedType.contains(annoBy.namedWith())) {
-                    listNamedType.add(annoBy.namedWith());
-                } else {
-                    // found two fields with same named annotation
-                    LOGGER.finer("Found multiple namedWith type");
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/MockEngineFactory.java
----------------------------------------------------------------------
diff --git a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/MockEngineFactory.java b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/MockEngineFactory.java
deleted file mode 100644
index 37d64ca..0000000
--- a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/MockEngineFactory.java
+++ /dev/null
@@ -1,62 +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.onami.test;
-
-import org.apache.james.mpt.onami.test.annotation.MockType;
-import org.apache.james.mpt.onami.test.mock.MockEngine;
-import org.apache.james.mpt.onami.test.mock.framework.EasyMockFramework;
-import org.apache.james.mpt.onami.test.mock.framework.MockitoFramework;
-
-/**
- * Factory class to create the mock framework.
- *
- * @see org.apache.onami.test.annotation.MockFramework
- */
-final class MockEngineFactory {
-
-    /**
-     * Hidden constructor, this class must not be instantiated directly.
-     */
-    private MockEngineFactory() {
-        // do nothing
-    }
-
-    /**
-     * Mock factory constructor. <br>
-     * Supported framewors: <li> {@link MockType}.EASY_MOCK <li> {@link MockType}.MOCKITO <br>
-     *
-     * @param type of mock framework to create.
-     * @return An instance of mock framework.
-     * @see MockType
-     */
-    public static MockEngine getMockEngine(MockType type) {
-        switch (type) {
-            case EASY_MOCK:
-                return new EasyMockFramework();
-
-            case MOCKITO:
-                return new MockitoFramework();
-
-            default:
-                throw new IllegalArgumentException("Unrecognized MockType '" + type.name() + "'");
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiRunner.java
----------------------------------------------------------------------
diff --git a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiRunner.java b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiRunner.java
deleted file mode 100644
index 78ae0a5..0000000
--- a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiRunner.java
+++ /dev/null
@@ -1,451 +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.onami.test;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.james.mpt.onami.test.annotation.GuiceModules;
-import org.apache.james.mpt.onami.test.annotation.GuiceProvidedModules;
-import org.apache.james.mpt.onami.test.annotation.Mock;
-import org.apache.james.mpt.onami.test.annotation.MockFramework;
-import org.apache.james.mpt.onami.test.annotation.MockType;
-import org.apache.james.mpt.onami.test.guice.MockTypeListener;
-import org.apache.james.mpt.onami.test.handler.GuiceInjectableClassHandler;
-import org.apache.james.mpt.onami.test.handler.GuiceModuleHandler;
-import org.apache.james.mpt.onami.test.handler.GuiceProvidedModuleHandler;
-import org.apache.james.mpt.onami.test.handler.MockFrameworkHandler;
-import org.apache.james.mpt.onami.test.handler.MockHandler;
-import org.apache.james.mpt.onami.test.mock.MockEngine;
-import org.apache.james.mpt.onami.test.reflection.ClassVisitor;
-import org.apache.james.mpt.onami.test.reflection.HandleException;
-import org.junit.runner.notification.RunNotifier;
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-import com.google.inject.matcher.Matchers;
-import com.google.inject.util.Modules;
-
-/**
- * <p>
- * It's a {@link BlockJUnit4ClassRunner} runner.
- * </p>
- * <p>
- * This class creates a Google Guice {@link Injector} configured by {@link GuiceModules} annotation (only fr modules
- * with default constructor) and {@link GuiceProvidedModules} annotation and {@link Mock}.
- * </p>
- * <p>
- * <b>Example #1:</b> <br>
- * <p>
- * <pre>
- *
- * &#064;org.junit.runner.RunWith( OnamiRunner.class )
- * &#064;GuiceModules( SimpleModule.class )
- * public class AcmeTestCase
- * {
- *
- *     &#064;GuiceProvidedModules
- *     static public Module getProperties()
- *     {
- *         ...
- *         return Modules.combine(new ComplexModule( loadProperies() ), ...  );
- *     }
- *
- * </pre>
- * <p>
- * </p>
- * <p>
- * <b>Example #2:</b> <br>
- * <p>
- * <pre>
- *
- * &#064;org.junit.runner.RunWith( OnamiRunner.class )
- * public class AcmeTestCase
- *     extends com.google.inject.AbstractModule
- * {
- *
- *     public void configure()
- *     {
- *         // Configure your proper modules
- *         ...
- *         bind( Service.class ).annotatedWith( TestAnnotation.class ).to( ServiceTestImpl.class );
- *         ...
- *     }
- *
- *     &#064;Mock
- *     private AnotherService serviceMock;
- *
- *     &#064;Inject
- *     private Service serviceTest;
- *
- *     &#064;org.junit.Test
- *     public void test()
- *     {
- *         assertNotNull( serviceMock );
- *         assertNotNull( serviceTest );
- *     }
- * </pre>
- * <p>
- * </p>
- *
- * @see GuiceMockModule
- */
-public class OnamiRunner extends BlockJUnit4ClassRunner {
-
-    private static final Logger LOGGER = Logger.getLogger(OnamiRunner.class.getName());
-
-    private Injector injector;
-
-    private final List<Module> allModules;
-
-    private final Map<Field, Object> mocked = new HashMap<Field, Object>(1);
-
-    private MockType mockFramework = MockType.EASY_MOCK;
-
-    /**
-     * OnamiRunner constructor to create the core JUnice class.
-     *
-     * @param klass The test case class to run.
-     * @throws org.junit.runners.model.InitializationError if any error occurs.
-     * @see org.junit.runner.RunWith
-     */
-    public OnamiRunner(Class<?> klass)
-        throws InitializationError {
-        super(klass);
-
-        try {
-            if (LOGGER.isLoggable(Level.FINER)) {
-                LOGGER.finer("Inizializing injector for test class: " + klass.getName());
-            }
-
-            this.allModules = inizializeInjector(klass);
-
-            if (LOGGER.isLoggable(Level.FINER)) {
-                LOGGER.finer("done...");
-            }
-        } catch (Exception e) {
-            final List<Throwable> throwables = new LinkedList<Throwable>();
-            throwables.add(e);
-            throw new InitializationError(throwables);
-        }
-    }
-
-    /**
-     * OnamiRunner constructor to create the runner needed
-     * by the OnamiSuite class.
-     *
-     * @param suite The suite test case class to run.
-     * @param test  The test case class to run.
-     * @throws org.junit.runners.model.InitializationError if any error occurs.
-     * @see org.junit.runner.RunWith
-     */
-    public OnamiRunner(Class<?> suite, Class<?> test)
-        throws InitializationError {
-        super(test);
-
-        try {
-            if (LOGGER.isLoggable(Level.FINER)) {
-                LOGGER.finer("Inizializing injector for test class: " + test.getName());
-            }
-
-            this.allModules = inizializeInjector(suite, test);
-
-            if (LOGGER.isLoggable(Level.FINER)) {
-                LOGGER.finer("done...");
-            }
-        } catch (Exception e) {
-            final List<Throwable> throwables = new LinkedList<Throwable>();
-            throwables.add(e);
-            throw new InitializationError(throwables);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void run(final RunNotifier notifier) {
-        if (LOGGER.isLoggable(Level.FINER)) {
-            LOGGER.finer(" ### Run test case: " + getTestClass().getJavaClass() + " ### ");
-            LOGGER.finer(" #### Creating injector ####");
-        }
-
-        this.injector = createInjector(allModules);
-        super.run(notifier);
-        this.flush();
-
-        if (LOGGER.isLoggable(Level.FINER)) {
-            LOGGER.finer(" ### End test case: " + getTestClass().getJavaClass().getName() + " ### ");
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    private void flush() {
-        this.injector = null;
-        this.allModules.clear();
-        this.mocked.clear();
-    }
-
-    @Override
-    protected void runChild(FrameworkMethod method, RunNotifier notifier) {
-        if (LOGGER.isLoggable(Level.FINER)) {
-            LOGGER.finer(" +++ invoke test method: " + method.getName() + " +++ ");
-        }
-
-        super.runChild(method, notifier);
-        resetAllResetAfterMocks();
-
-        if (LOGGER.isLoggable(Level.FINER)) {
-            LOGGER.finer(" --- end test method: " + method.getName() + " --- ");
-        }
-    }
-
-    /**
-     * Creates test instance via Google-Guice to inject all not-static dependencies.
-     *
-     * @return The instance of the test case.
-     * @throws Exception when an error occurs.
-     */
-    @Override
-    protected Object createTest()
-        throws Exception {
-        if (LOGGER.isLoggable(Level.FINER)) {
-            LOGGER.finer(" Create and inject test class: " + getTestClass().getJavaClass());
-        }
-        return this.injector.getInstance(getTestClass().getJavaClass());
-    }
-
-    /**
-     * Shortcut to create the Injector given a list of Modules.
-     *
-     * @param modules the list of modules have to be load
-     * @return an Injector instance built using the input Module list
-     */
-    protected Injector createInjector(List<Module> modules) {
-        return Guice.createInjector(modules);
-    }
-
-    /**
-     * This method collects modules from {@link GuiceModules}, {@link GuiceProvidedModules}, {@link Mock}
-     * and {@ OnamiSuite}.
-     *
-     * @param <T>   whatever input type is accepted
-     * @param suite the input suite to be analyzed
-     * @param test  the input class has to be analyzed
-     * @return a List of Guice Modules built after input class analysis.
-     * @throws IllegalAccessException when a n error occurs.
-     * @throws InstantiationException when a n error occurs.
-     * @throws HandleException        when a n error occurs.
-     */
-    protected <T> List<Module> inizializeInjector(Class<?> suite, Class<T> test)
-        throws HandleException, InstantiationException, IllegalAccessException {
-        final List<Module> modules = inizializeInjector(test);
-        Module m = visitClass(suite);
-        if (m != null) {
-            modules.add(m);
-        }
-        return modules;
-    }
-
-    /**
-     * This method collects modules from {@link GuiceModules}, {@link GuiceProvidedModules}, {@link Mock}.
-     *
-     * @param <T>   whatever input type is accepted
-     * @param clazz the input class has to be analyzed
-     * @return a List of Guice Modules built after input class analysis.
-     * @throws IllegalAccessException when a n error occurs.
-     * @throws InstantiationException when a n error occurs.
-     * @throws HandleException        when a n error occurs.
-     */
-    protected <T> List<Module> inizializeInjector(Class<T> clazz)
-        throws HandleException, InstantiationException, IllegalAccessException {
-        final List<Module> modules = new ArrayList<Module>();
-        Module m = visitClass(clazz);
-        if (m != null) {
-            modules.add(m);
-        }
-        return modules;
-    }
-
-    private void resetAllResetAfterMocks() {
-        for (Entry<Field, Object> entry : mocked.entrySet()) {
-            final Mock mockAnnotation = entry.getKey().getAnnotation(Mock.class);
-            if (mockAnnotation.resetAfter()) {
-                MockEngine mockEngine = MockEngineFactory.getMockEngine(mockFramework);
-                mockEngine.resetMock(entry.getValue());
-            }
-        }
-    }
-
-    /**
-     * @throws HandleException
-     * @throws IllegalAccessException
-     * @throws InstantiationException
-     */
-    private <T> Module visitClass(final Class<T> clazz)
-        throws HandleException, InstantiationException, IllegalAccessException {
-        try {
-            if (LOGGER.isLoggable(Level.FINER)) {
-                LOGGER.finer("  Start introspecting class: " + clazz.getName());
-            }
-            final List<Module> allModules = new ArrayList<Module>();
-
-            // Setup the handlers
-            final GuiceProvidedModuleHandler guiceProvidedModuleHandler = new GuiceProvidedModuleHandler();
-            final GuiceModuleHandler guiceModuleHandler = new GuiceModuleHandler();
-            final GuiceInjectableClassHandler<Inject> guiceInjectableClassHandler = new GuiceInjectableClassHandler<com.google.inject.Inject>();
-            final GuiceInjectableClassHandler<javax.inject.Inject> jsr330InjectableClassHandler = new GuiceInjectableClassHandler<javax.inject.Inject>();
-
-            final MockHandler mockHandler = new MockHandler();
-            final MockFrameworkHandler mockFrameworkHandler = new MockFrameworkHandler();
-
-            // Visit class and super-classes
-            new ClassVisitor()
-                .registerHandler(GuiceProvidedModules.class, guiceProvidedModuleHandler)
-                .registerHandler(GuiceModules.class, guiceModuleHandler)
-                .registerHandler(Mock.class, mockHandler)
-                .registerHandler(MockFramework.class, mockFrameworkHandler)
-                .registerHandler(com.google.inject.Inject.class, guiceInjectableClassHandler)
-                .registerHandler(javax.inject.Inject.class, jsr330InjectableClassHandler)
-                .visit(clazz);
-
-            // Retrieve mock framework
-            if (mockFrameworkHandler.getMockType() != null) {
-                this.mockFramework = mockFrameworkHandler.getMockType();
-            }
-
-            // retrieve the modules founded
-            allModules.addAll(guiceProvidedModuleHandler.getModules());
-            allModules.addAll(guiceModuleHandler.getModules());
-            MockEngine engine = MockEngineFactory.getMockEngine(this.mockFramework);
-            this.mocked.putAll(mockHandler.getMockedObject(engine));
-            if (!this.mocked.isEmpty()) {
-                // Replace all real module binding with Mocked moduled.
-                Module m = Modules.override(allModules).with(new GuiceMockModule(this.mocked));
-                allModules.clear();
-                allModules.add(m);
-            }
-
-            // Add only clasess that have got the Inject annotation
-            final Class<?>[] guiceInjectableClasses = guiceInjectableClassHandler.getClasses();
-            final Class<?>[] jsr330InjectableClasses = jsr330InjectableClassHandler.getClasses();
-
-            final AbstractModule statcInjector = new AbstractModule() {
-                @Override
-                protected void configure() {
-                    // inject all STATIC dependencies
-                    if (guiceInjectableClasses.length != 0) {
-                        requestStaticInjection(guiceInjectableClasses);
-                    }
-
-                    if (jsr330InjectableClasses.length != 0) {
-                        requestStaticInjection(jsr330InjectableClasses);
-                    }
-
-
-                }
-            };
-            if (guiceInjectableClasses.length != 0 || jsr330InjectableClasses.length != 0) {
-                allModules.add(statcInjector);
-            }
-
-            // Check if the class is itself a Google Module.
-            if (Module.class.isAssignableFrom(getTestClass().getJavaClass())) {
-                if (LOGGER.isLoggable(Level.FINER)) {
-                    LOGGER.finer("   creating module from test class " + getTestClass().getJavaClass());
-                }
-                final Module classModule = (Module) getTestClass().getJavaClass().newInstance();
-                allModules.add(classModule);
-            }
-
-            // create MockTypeListenerModule
-            if (this.mocked.size() != 0) {
-                final AbstractModule mockTypeListenerModule = new AbstractModule() {
-                    @Override
-                    protected void configure() {
-                        bindListener(Matchers.any(), new MockTypeListener(mocked));
-                    }
-                };
-
-                // BEGIN patch for issue: google-guice: #452
-                for (Entry<Field, Object> entry : mocked.entrySet()) {
-                    final Field field = entry.getKey();
-                    final Object mock = entry.getValue();
-                    if (Modifier.isStatic(field.getModifiers())) {
-                        if (LOGGER.isLoggable(Level.FINER)) {
-                            LOGGER.finer("   inject static mock field: " + field.getName());
-                        }
-
-                        AccessController.doPrivileged(new PrivilegedAction<Void>() {
-
-                            public Void run() {
-                                field.setAccessible(true);
-                                return null;
-                            }
-
-                        });
-                        field.set(field.getDeclaringClass(), mock);
-                    }
-                }
-                // END patch for issue: google-guice: #452
-
-                allModules.add(mockTypeListenerModule);
-            }
-
-            if (allModules.size() != 0) {
-                if (LOGGER.isLoggable(Level.FINER)) {
-                    StringBuilder builder = new StringBuilder();
-                    builder.append(" Collected modules: ");
-                    builder.append("\n");
-                    for (Module module : allModules) {
-                        builder.append("    ").append(module);
-                        builder.append("\n");
-                    }
-                    LOGGER.finer(builder.toString());
-                }
-                return Modules.combine(allModules);
-            }
-            return null;
-        } finally {
-            if (LOGGER.isLoggable(Level.FINER)) {
-                LOGGER.finer(" ...done");
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiSuite.java
----------------------------------------------------------------------
diff --git a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiSuite.java b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiSuite.java
deleted file mode 100644
index 977f8ff..0000000
--- a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/OnamiSuite.java
+++ /dev/null
@@ -1,409 +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.onami.test;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.james.mpt.onami.test.annotation.GuiceModules;
-import org.apache.james.mpt.onami.test.annotation.GuiceProvidedModules;
-import org.apache.james.mpt.onami.test.annotation.Mock;
-import org.apache.james.mpt.onami.test.annotation.MockFramework;
-import org.apache.james.mpt.onami.test.annotation.MockType;
-import org.apache.james.mpt.onami.test.guice.MockTypeListener;
-import org.apache.james.mpt.onami.test.handler.GuiceInjectableClassHandler;
-import org.apache.james.mpt.onami.test.handler.GuiceModuleHandler;
-import org.apache.james.mpt.onami.test.handler.GuiceProvidedModuleHandler;
-import org.apache.james.mpt.onami.test.handler.MockFrameworkHandler;
-import org.apache.james.mpt.onami.test.handler.MockHandler;
-import org.apache.james.mpt.onami.test.mock.MockEngine;
-import org.apache.james.mpt.onami.test.reflection.ClassVisitor;
-import org.apache.james.mpt.onami.test.reflection.HandleException;
-import org.junit.runner.Runner;
-import org.junit.runner.notification.RunNotifier;
-import org.junit.runners.Suite;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.RunnerBuilder;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-import com.google.inject.matcher.Matchers;
-import com.google.inject.util.Modules;
-
-/**
- * <p>
- * It's a {@link Suite} runner.
- * </p>
- * <p>
- * This class creates a Google Guice {@link Injector} configured by {@link GuiceModules} annotation (only fr modules
- * with default constructor) and {@link GuiceProvidedModules} annotation and {@link Mock}.
- * </p>
- * <p>
- * <b>Example #1:</b> <br>
- * <p>
- * <pre>
- *
- * &#064;org.junit.runner.RunWith( OnamiSuite.class )
- * &#064;GuiceModules( SimpleModule.class )
- * &#064;SuiteClasses({ .class })
- * public class AcmeTestCase
- * {
- *
- *     &#064;GuiceProvidedModules
- *     static public Module getProperties()
- *     {
- *         ...
- *         return Modules.combine(new ComplexModule( loadProperies() ), ...  );
- *     }
- *
- * </pre>
- * <p>
- * </p>
- * <p>
- * <b>Example #2:</b> <br>
- * <p>
- * <pre>
- *
- * &#064;org.junit.runner.RunWith( OnamiSuite.class )
- * public class AcmeTestCase
- *     extends com.google.inject.AbstractModule
- * {
- *
- *     public void configure()
- *     {
- *         // Configure your proper modules
- *         ...
- *         bind( Service.class ).annotatedWith( TestAnnotation.class ).to( ServiceTestImpl.class );
- *         ...
- *     }
- *
- *     &#064;Mock
- *     private AnotherService serviceMock;
- *
- *     &#064;Inject
- *     private Service serviceTest;
- *
- *     &#064;org.junit.Test
- *     public void test()
- *     {
- *         assertNotNull( serviceMock );
- *         assertNotNull( serviceTest );
- *     }
- * </pre>
- * <p>
- * </p>
- *
- * @see GuiceMockModule
- */
-public class OnamiSuite extends Suite {
-
-    private static final Logger LOGGER = Logger.getLogger(OnamiSuite.class.getName());
-
-    private final List<Module> allModules;
-
-    private final Map<Field, Object> mocked = new HashMap<Field, Object>(1);
-
-    private MockType mockFramework = MockType.EASY_MOCK;
-
-    private static Class<?>[] getAnnotatedClasses(Class<?> klass) throws InitializationError {
-        SuiteClasses annotation = klass.getAnnotation(SuiteClasses.class);
-        if (annotation == null)
-            throw new InitializationError(String.format("class '%s' must have a SuiteClasses annotation", klass.getName()));
-        return annotation.value();
-    }
-
-    /**
-     * OnamiRunner constructor to create the core JUnice class.
-     *
-     * @param klass The test case class to run.
-     * @throws org.junit.runners.model.InitializationError if any error occurs.
-     * @see org.junit.runner.RunWith
-     */
-    public OnamiSuite(Class<?> klass, RunnerBuilder builder)
-        throws InitializationError {
-        this(builder, klass, getAnnotatedClasses(klass));
-
-    }
-
-    /**
-     * Called by this class and subclasses once the classes making up the suite have been determined
-     *
-     * @param builder      builds runners for classes in the suite
-     * @param klass        the root of the suite
-     * @param suiteClasses the classes in the suite
-     * @throws InitializationError
-     */
-    protected OnamiSuite(RunnerBuilder builder, Class<?> suite, Class<?>[] suiteClasses)
-        throws InitializationError {
-        super(suite, runners(suite, suiteClasses));
-        try {
-            if (LOGGER.isLoggable(Level.FINER)) {
-                LOGGER.finer("Inizializing injector for siote class: " + suite.getName());
-            }
-
-            this.allModules = inizializeInjector(suite);
-
-            if (LOGGER.isLoggable(Level.FINER)) {
-                LOGGER.finer("done...");
-            }
-        } catch (Exception e) {
-            final List<Throwable> throwables = new LinkedList<Throwable>();
-            throwables.add(e);
-            throw new InitializationError(throwables);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void run(final RunNotifier notifier) {
-        if (LOGGER.isLoggable(Level.FINER)) {
-            LOGGER.finer(" ### Run test case: " + getTestClass().getJavaClass() + " ### ");
-            LOGGER.finer(" #### Creating injector ####");
-        }
-
-        createInjector(allModules);
-        super.run(notifier);
-        this.flush();
-
-        if (LOGGER.isLoggable(Level.FINER)) {
-            LOGGER.finer(" ### End test case: " + getTestClass().getJavaClass().getName() + " ### ");
-        }
-    }
-
-    private static List<Runner> runners(Class<?> suite, Class<?>[] children) throws InitializationError {
-        ArrayList<Runner> runners = new ArrayList<Runner>();
-        for (Class<?> each : children) {
-            Runner childRunner = new OnamiRunner(suite, each);
-            if (childRunner != null)
-                runners.add(childRunner);
-        }
-        return runners;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    private void flush() {
-        this.allModules.clear();
-        this.mocked.clear();
-    }
-
-    @Override
-    protected void runChild(Runner runner, RunNotifier notifier) {
-        if (LOGGER.isLoggable(Level.FINER)) {
-            LOGGER.finer(" +++ invoke runner: " + runner + " +++ ");
-        }
-
-        super.runChild(runner, notifier);
-        resetAllResetAfterMocks();
-
-        if (LOGGER.isLoggable(Level.FINER)) {
-            LOGGER.finer(" --- end runner: " + runner + " --- ");
-        }
-    }
-
-    /**
-     * Shortcut to create the Injector given a list of Modules.
-     *
-     * @param modules the list of modules have to be load
-     * @return an Injector instance built using the input Module list
-     */
-    protected Injector createInjector(List<Module> modules) {
-        return Guice.createInjector(modules);
-    }
-
-    /**
-     * This method collects modules from {@link GuiceModules}, {@link GuiceProvidedModules}, {@link Mock}.
-     *
-     * @param <T>   whatever input type is accepted
-     * @param clazz the input class has to be analyzed
-     * @return a List of Guice Modules built after input class analysis.
-     * @throws IllegalAccessException when a n error occurs.
-     * @throws InstantiationException when a n error occurs.
-     * @throws HandleException        when a n error occurs.
-     */
-    protected <T> List<Module> inizializeInjector(Class<T> clazz)
-        throws HandleException, InstantiationException, IllegalAccessException {
-        final List<Module> modules = new ArrayList<Module>();
-        Module m = visitClass(clazz);
-        if (m != null) {
-            modules.add(m);
-        }
-        return modules;
-    }
-
-    private void resetAllResetAfterMocks() {
-        for (Entry<Field, Object> entry : mocked.entrySet()) {
-            final Mock mockAnnotation = entry.getKey().getAnnotation(Mock.class);
-            if (mockAnnotation.resetAfter()) {
-                MockEngine mockEngine = MockEngineFactory.getMockEngine(mockFramework);
-                mockEngine.resetMock(entry.getValue());
-            }
-        }
-    }
-
-    /**
-     * @throws HandleException
-     * @throws IllegalAccessException
-     * @throws InstantiationException
-     */
-    private <T> Module visitClass(final Class<T> clazz)
-        throws HandleException, InstantiationException, IllegalAccessException {
-        try {
-            if (LOGGER.isLoggable(Level.FINER)) {
-                LOGGER.finer("  Start introspecting class: " + clazz.getName());
-            }
-            final List<Module> allModules = new ArrayList<Module>();
-
-            // Setup the handlers
-            final GuiceProvidedModuleHandler guiceProvidedModuleHandler = new GuiceProvidedModuleHandler();
-            final GuiceModuleHandler guiceModuleHandler = new GuiceModuleHandler();
-            final GuiceInjectableClassHandler<Inject> guiceInjectableClassHandler = new GuiceInjectableClassHandler<Inject>();
-            final GuiceInjectableClassHandler<javax.inject.Inject> jsr330InjectableClassHandler = new GuiceInjectableClassHandler<javax.inject.Inject>();
-
-            final MockHandler mockHandler = new MockHandler();
-            final MockFrameworkHandler mockFrameworkHandler = new MockFrameworkHandler();
-
-            // Visit class and super-classes
-            new ClassVisitor()
-                .registerHandler(GuiceProvidedModules.class, guiceProvidedModuleHandler)
-                .registerHandler(GuiceModules.class, guiceModuleHandler)
-                .registerHandler(Mock.class, mockHandler)
-                .registerHandler(MockFramework.class, mockFrameworkHandler)
-                .registerHandler(Inject.class, guiceInjectableClassHandler)
-                .registerHandler(javax.inject.Inject.class, jsr330InjectableClassHandler)
-                .visit(clazz);
-
-            // Retrieve mock framework
-            if (mockFrameworkHandler.getMockType() != null) {
-                this.mockFramework = mockFrameworkHandler.getMockType();
-            }
-
-            // retrieve the modules founded
-            allModules.addAll(guiceProvidedModuleHandler.getModules());
-            allModules.addAll(guiceModuleHandler.getModules());
-            MockEngine engine = MockEngineFactory.getMockEngine(this.mockFramework);
-            this.mocked.putAll(mockHandler.getMockedObject(engine));
-            if (!this.mocked.isEmpty()) {
-                // Replace all real module binding with Mocked moduled.
-                Module m = Modules.override(allModules).with(new GuiceMockModule(this.mocked));
-                allModules.clear();
-                allModules.add(m);
-            }
-
-            // Add only clasess that have got the Inject annotation
-            final Class<?>[] guiceInjectableClasses = guiceInjectableClassHandler.getClasses();
-            final Class<?>[] jsr330InjectableClasses = jsr330InjectableClassHandler.getClasses();
-
-            final AbstractModule statcInjector = new AbstractModule() {
-                @Override
-                protected void configure() {
-                    // inject all STATIC dependencies
-                    if (guiceInjectableClasses.length != 0) {
-                        requestStaticInjection(guiceInjectableClasses);
-                    }
-
-                    if (jsr330InjectableClasses.length != 0) {
-                        requestStaticInjection(jsr330InjectableClasses);
-                    }
-                }
-            };
-            if (guiceInjectableClasses.length != 0 || jsr330InjectableClasses.length != 0) {
-                allModules.add(statcInjector);
-            }
-
-            // Check if the class is itself a Google Module.
-            if (Module.class.isAssignableFrom(getTestClass().getJavaClass())) {
-                if (LOGGER.isLoggable(Level.FINER)) {
-                    LOGGER.finer("   creating module from test class " + getTestClass().getJavaClass());
-                }
-                final Module classModule = (Module) getTestClass().getJavaClass().newInstance();
-                allModules.add(classModule);
-            }
-
-            // create MockTypeListenerModule
-            if (this.mocked.size() != 0) {
-                final AbstractModule mockTypeListenerModule = new AbstractModule() {
-                    @Override
-                    protected void configure() {
-                        bindListener(Matchers.any(), new MockTypeListener(mocked));
-                    }
-                };
-
-                // BEGIN patch for issue: google-guice: #452
-                for (Entry<Field, Object> entry : mocked.entrySet()) {
-                    final Field field = entry.getKey();
-                    final Object mock = entry.getValue();
-                    if (Modifier.isStatic(field.getModifiers())) {
-                        if (LOGGER.isLoggable(Level.FINER)) {
-                            LOGGER.finer("   inject static mock field: " + field.getName());
-                        }
-                        AccessController.doPrivileged(new PrivilegedAction<Void>() {
-
-                            public Void run() {
-                                field.setAccessible(true);
-                                return null;
-                            }
-
-                        });
-                        field.set(field.getDeclaringClass(), mock);
-                    }
-                }
-                // END patch for issue: google-guice: #452
-                allModules.add(mockTypeListenerModule);
-            }
-
-            if (allModules.size() != 0) {
-                if (LOGGER.isLoggable(Level.FINER)) {
-                    StringBuilder builder = new StringBuilder();
-                    builder.append(" Collected modules: ");
-                    builder.append("\n");
-                    for (Module module : allModules) {
-                        builder.append("    ").append(module);
-                        builder.append("\n");
-                    }
-                    LOGGER.finer(builder.toString());
-                }
-                return Modules.combine(allModules);
-            }
-            return null;
-        } finally {
-            if (LOGGER.isLoggable(Level.FINER)) {
-                LOGGER.finer(" ...done");
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/78cf06ab/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceModules.java
----------------------------------------------------------------------
diff --git a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceModules.java b/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceModules.java
deleted file mode 100644
index 075f552..0000000
--- a/mpt/onami-test/src/main/java/org/apache/james/mpt/onami/test/annotation/GuiceModules.java
+++ /dev/null
@@ -1,41 +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.onami.test.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import com.google.inject.Module;
-
-/**
- * Annotate your class to define a list of Google Guice {@link Module} whit default constructor.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface GuiceModules {
-
-    /**
-     * List of Google Guice {@link Module}.
-     */
-    Class<? extends Module>[] value();
-
-}


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