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/04/26 11:51:14 UTC

[05/12] james-project git commit: JAMES-2008 Remove all JUNIT contracts usages for Mailbox manager tests

http://git-wip-us.apache.org/repos/asf/james-project/blob/a9fdb1c4/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerStressTest.java
----------------------------------------------------------------------
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerStressTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerStressTest.java
new file mode 100644
index 0000000..e2ef938
--- /dev/null
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerStressTest.java
@@ -0,0 +1,43 @@
+/****************************************************************
+ * 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.mailbox.maildir;
+
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.MailboxManagerStressTest;
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
+
+import com.google.common.base.Throwables;
+
+public class FullUserMaildirMailboxManagerStressTest extends MailboxManagerStressTest {
+    @Rule
+    public TemporaryFolder tmpFolder = new TemporaryFolder();
+    
+    @Override
+    protected MailboxManager provideManager() {
+        try {
+            return MaildirMailboxManagerProvider.createMailboxManager("/%fulluser", tmpFolder);
+        } catch (Exception e) {
+            throw Throwables.propagate(e);
+        }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a9fdb1c4/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.java
new file mode 100644
index 0000000..d6140b8
--- /dev/null
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/FullUserMaildirMailboxManagerTest.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.mailbox.maildir;
+
+import java.io.UnsupportedEncodingException;
+
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.MailboxManagerTest;
+import org.apache.james.mailbox.exception.MailboxException;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
+
+import com.google.common.base.Throwables;
+
+public class FullUserMaildirMailboxManagerTest extends MailboxManagerTest {
+
+    @Rule
+    public TemporaryFolder tmpFolder = new TemporaryFolder();
+
+    @Override
+    protected MailboxManager provideMailboxManager() {
+        try {
+            return MaildirMailboxManagerProvider.createMailboxManager("/%fulluser", tmpFolder);
+        } catch (Exception e) {
+            throw Throwables.propagate(e);
+        }
+    }
+
+    @Ignore("https://issues.apache.org/jira/browse/MAILBOX-292")
+    @Override
+    public void createMailboxShouldReturnRightId() throws MailboxException, UnsupportedEncodingException {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a9fdb1c4/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
new file mode 100644
index 0000000..cfe91bb
--- /dev/null
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
@@ -0,0 +1,54 @@
+/****************************************************************
+ * 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.mailbox.maildir;
+
+import java.io.IOException;
+
+import org.apache.james.mailbox.acl.GroupMembershipResolver;
+import org.apache.james.mailbox.acl.MailboxACLResolver;
+import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
+import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.store.Authenticator;
+import org.apache.james.mailbox.store.Authorizator;
+import org.apache.james.mailbox.store.JVMMailboxPathLocker;
+import org.apache.james.mailbox.store.StoreMailboxManager;
+import org.apache.james.mailbox.store.mail.model.DefaultMessageId;
+import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
+import org.junit.rules.TemporaryFolder;
+
+public class MaildirMailboxManagerProvider {
+    public static StoreMailboxManager createMailboxManager(String configuration, TemporaryFolder temporaryFolder) throws MailboxException, IOException {
+        MaildirStore store = new MaildirStore(temporaryFolder.newFolder().getPath() + configuration, new JVMMailboxPathLocker());
+        MaildirMailboxSessionMapperFactory mf = new MaildirMailboxSessionMapperFactory(store);
+
+        MailboxACLResolver aclResolver = new UnionMailboxACLResolver();
+        GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver();
+        MessageParser messageParser = new MessageParser();
+
+        Authenticator noAuthenticator = null;
+        Authorizator noAuthorizator = null;
+        StoreMailboxManager manager = new StoreMailboxManager(mf, noAuthenticator, noAuthorizator, new JVMMailboxPathLocker(), aclResolver,
+            groupMembershipResolver, messageParser, new DefaultMessageId.Factory());
+        manager.init();
+
+        return manager;
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a9fdb1c4/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerTests.java
----------------------------------------------------------------------
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerTests.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerTests.java
deleted file mode 100644
index 85875b0..0000000
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerTests.java
+++ /dev/null
@@ -1,163 +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.mailbox.maildir;
-
-import java.io.IOException;
-
-import org.apache.james.mailbox.MailboxManager;
-import org.apache.james.mailbox.MailboxManagerTest;
-import org.apache.james.mailbox.acl.GroupMembershipResolver;
-import org.apache.james.mailbox.acl.MailboxACLResolver;
-import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
-import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
-import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.store.Authenticator;
-import org.apache.james.mailbox.store.Authorizator;
-import org.apache.james.mailbox.store.JVMMailboxPathLocker;
-import org.apache.james.mailbox.store.StoreMailboxManager;
-import org.apache.james.mailbox.store.mail.model.DefaultMessageId;
-import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite.SuiteClasses;
-import org.xenei.junit.contract.Contract;
-import org.xenei.junit.contract.ContractImpl;
-import org.xenei.junit.contract.ContractSuite;
-import org.xenei.junit.contract.IProducer;
-
-import com.google.common.base.Throwables;
-
-@SuiteClasses({
-    MaildirMailboxManagerTests.DomainUser.class,
-    MaildirMailboxManagerTests.User.class,
-    MaildirMailboxManagerTests.FullUser.class})
-
-public class MaildirMailboxManagerTests {
-
-    public static abstract class MaildirMailboxManagerTest<T extends MailboxManager> extends MailboxManagerTest<T> {
-        protected StoreMailboxManager createMailboxManager(String configuration, TemporaryFolder temporaryFolder) throws MailboxException, IOException {
-            MaildirStore store = new MaildirStore(temporaryFolder.newFolder().getPath() + configuration, new JVMMailboxPathLocker());
-            MaildirMailboxSessionMapperFactory mf = new MaildirMailboxSessionMapperFactory(store);
-            
-            MailboxACLResolver aclResolver = new UnionMailboxACLResolver();
-            GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver();
-            MessageParser messageParser = new MessageParser();
-
-            Authenticator noAuthenticator = null;
-            Authorizator noAuthorizator = null;
-            StoreMailboxManager manager = new StoreMailboxManager(mf, noAuthenticator, noAuthorizator, new JVMMailboxPathLocker(), aclResolver, 
-                    groupMembershipResolver, messageParser, new DefaultMessageId.Factory());
-            manager.init();
-
-            return manager;
-        }
-
-    }
-
-    @RunWith(ContractSuite.class)
-    @ContractImpl(StoreMailboxManager.class)
-    public static class DomainUser extends MaildirMailboxManagerTest<StoreMailboxManager> {
-        @Rule public TemporaryFolder tmpFolder = new TemporaryFolder();
-
-        private IProducer<StoreMailboxManager> producer = new IProducer<StoreMailboxManager>() {
-
-            @Override
-            public StoreMailboxManager newInstance() {
-                try {
-                    tmpFolder.create();
-                    return createMailboxManager("/%domain/%user", tmpFolder);
-                } catch (Exception e) {
-                    throw Throwables.propagate(e);
-                }
-            }
-
-            @Override
-            public void cleanUp() {
-                tmpFolder.delete();
-            }
-        };
-
-        @Contract.Inject
-        public IProducer<StoreMailboxManager> getProducer() {
-            return producer;
-        }
-    }
-    
-    @Ignore
-    @RunWith(ContractSuite.class)
-    @ContractImpl(StoreMailboxManager.class)
-    public static class User extends MaildirMailboxManagerTest<StoreMailboxManager> {
-        @Rule public TemporaryFolder tmpFolder = new TemporaryFolder();
-
-        private IProducer<StoreMailboxManager> producer = new IProducer<StoreMailboxManager>() {
-
-            @Override
-            public StoreMailboxManager newInstance() {
-                try {
-                    tmpFolder.create();
-                    return createMailboxManager("/%user", tmpFolder);
-                } catch (Exception e) {
-                    throw Throwables.propagate(e);
-                }
-            }
-
-            @Override
-            public void cleanUp() {
-                tmpFolder.delete();
-            }
-        };
-
-        @Contract.Inject
-        public IProducer<StoreMailboxManager> getProducer() {
-            return producer;
-        }
-    }
-
-    @RunWith(ContractSuite.class)
-    @ContractImpl(StoreMailboxManager.class)
-    public static class FullUser extends MaildirMailboxManagerTest<StoreMailboxManager> {
-        @Rule public TemporaryFolder tmpFolder = new TemporaryFolder();
-
-        private IProducer<StoreMailboxManager> producer = new IProducer<StoreMailboxManager>() {
-
-            @Override
-            public StoreMailboxManager newInstance() {
-                try {
-                    tmpFolder.create();
-                    return createMailboxManager("/%fulluser", tmpFolder);
-                } catch (Exception e) {
-                    throw Throwables.propagate(e);
-                }
-            }
-
-            @Override
-            public void cleanUp() {
-                tmpFolder.delete();
-            }
-        };
-
-        @Contract.Inject
-        public IProducer<StoreMailboxManager> getProducer() {
-            return producer;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a9fdb1c4/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/UserMaildirMailboxManagerStressTest.java
----------------------------------------------------------------------
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/UserMaildirMailboxManagerStressTest.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/UserMaildirMailboxManagerStressTest.java
new file mode 100644
index 0000000..f7c8479
--- /dev/null
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/UserMaildirMailboxManagerStressTest.java
@@ -0,0 +1,43 @@
+/****************************************************************
+ * 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.mailbox.maildir;
+
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.MailboxManagerStressTest;
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
+
+import com.google.common.base.Throwables;
+
+public class UserMaildirMailboxManagerStressTest extends MailboxManagerStressTest {
+    @Rule
+    public TemporaryFolder tmpFolder = new TemporaryFolder();
+    
+    @Override
+    protected MailboxManager provideManager() {
+        try {
+            return MaildirMailboxManagerProvider.createMailboxManager("/%user", tmpFolder);
+        } catch (Exception e) {
+            throw Throwables.propagate(e);
+        }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a9fdb1c4/mailbox/memory/pom.xml
----------------------------------------------------------------------
diff --git a/mailbox/memory/pom.xml b/mailbox/memory/pom.xml
index 8ba5cec..4e6ac3b 100644
--- a/mailbox/memory/pom.xml
+++ b/mailbox/memory/pom.xml
@@ -95,11 +95,6 @@
             <artifactId>jsoup</artifactId>
             <version>1.9.2</version>
         </dependency>
-        <dependency>
-            <groupId>org.xenei</groupId>
-            <artifactId>junit-contracts</artifactId>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/james-project/blob/a9fdb1c4/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManagerTest.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManagerTest.java
deleted file mode 100644
index 885d4e1..0000000
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManagerTest.java
+++ /dev/null
@@ -1,77 +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.mailbox.inmemory;
-
-import org.apache.james.mailbox.acl.GroupMembershipResolver;
-import org.apache.james.mailbox.acl.MailboxACLResolver;
-import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
-import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
-import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.model.MessageId;
-import org.apache.james.mailbox.store.FakeAuthenticator;
-import org.apache.james.mailbox.store.FakeAuthorizator;
-import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
-import org.junit.runner.RunWith;
-import org.xenei.junit.contract.Contract;
-import org.xenei.junit.contract.ContractImpl;
-import org.xenei.junit.contract.ContractSuite;
-import org.xenei.junit.contract.IProducer;
-
-import com.google.common.base.Throwables;
-
-@RunWith(ContractSuite.class)
-@ContractImpl(InMemoryMailboxManager.class)
-public class InMemoryMailboxManagerTest {
-    private static final int LIMIT_ANNOTATIONS = 3;
-    private static final int LIMIT_ANNOTATION_SIZE = 30;
-
-    private IProducer<InMemoryMailboxManager> producer = new IProducer<InMemoryMailboxManager>() {
-
-        @Override
-        public InMemoryMailboxManager newInstance() {
-            MailboxACLResolver aclResolver = new UnionMailboxACLResolver();
-            GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver();
-            MessageParser messageParser = new MessageParser();
-
-            InMemoryMailboxSessionMapperFactory mailboxSessionMapperFactory = new InMemoryMailboxSessionMapperFactory();
-            MessageId.Factory messageIdFactory = new InMemoryMessageId.Factory();
-            InMemoryMailboxManager mailboxManager = new InMemoryMailboxManager(mailboxSessionMapperFactory, new FakeAuthenticator(), FakeAuthorizator.defaultReject(),
-                    aclResolver, groupMembershipResolver, messageParser, messageIdFactory, LIMIT_ANNOTATIONS, LIMIT_ANNOTATION_SIZE);
-
-            try {
-                mailboxManager.init();
-            } catch (MailboxException e) {
-                throw Throwables.propagate(e);
-            }
-
-            return mailboxManager;
-        }
-
-        @Override
-        public void cleanUp() {
-        }
-    };
-
-    @Contract.Inject
-    public IProducer<InMemoryMailboxManager> getProducer() {
-        return producer;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a9fdb1c4/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerProvider.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerProvider.java
new file mode 100644
index 0000000..5cb7e2f
--- /dev/null
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerProvider.java
@@ -0,0 +1,58 @@
+/****************************************************************
+ * 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.mailbox.inmemory;
+
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.acl.GroupMembershipResolver;
+import org.apache.james.mailbox.acl.MailboxACLResolver;
+import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
+import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.MessageId;
+import org.apache.james.mailbox.store.FakeAuthenticator;
+import org.apache.james.mailbox.store.FakeAuthorizator;
+import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
+
+import com.google.common.base.Throwables;
+
+public class MemoryMailboxManagerProvider {
+    private static final int LIMIT_ANNOTATIONS = 3;
+    private static final int LIMIT_ANNOTATION_SIZE = 30;
+
+    public static MailboxManager provideMailboxManager() {
+        MailboxACLResolver aclResolver = new UnionMailboxACLResolver();
+        GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver();
+        MessageParser messageParser = new MessageParser();
+
+        InMemoryMailboxSessionMapperFactory mailboxSessionMapperFactory = new InMemoryMailboxSessionMapperFactory();
+        MessageId.Factory messageIdFactory = new InMemoryMessageId.Factory();
+        InMemoryMailboxManager mailboxManager = new InMemoryMailboxManager(mailboxSessionMapperFactory, new FakeAuthenticator(), FakeAuthorizator.defaultReject(),
+            aclResolver, groupMembershipResolver, messageParser, messageIdFactory, LIMIT_ANNOTATIONS, LIMIT_ANNOTATION_SIZE);
+
+        try {
+            mailboxManager.init();
+        } catch (MailboxException e) {
+            throw Throwables.propagate(e);
+        }
+
+        return mailboxManager;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a9fdb1c4/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerStressTest.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerStressTest.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerStressTest.java
new file mode 100644
index 0000000..2f23939
--- /dev/null
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerStressTest.java
@@ -0,0 +1,30 @@
+/****************************************************************
+ * 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.mailbox.inmemory;
+
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.MailboxManagerStressTest;
+
+public class MemoryMailboxManagerStressTest extends MailboxManagerStressTest {
+    @Override
+    protected MailboxManager provideManager() {
+        return MemoryMailboxManagerProvider.provideMailboxManager();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a9fdb1c4/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerTest.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerTest.java
new file mode 100644
index 0000000..9d77ed4
--- /dev/null
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerTest.java
@@ -0,0 +1,30 @@
+/****************************************************************
+ * 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.mailbox.inmemory;
+
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.MailboxManagerTest;
+
+public class MemoryMailboxManagerTest extends MailboxManagerTest {
+    @Override
+    protected MailboxManager provideMailboxManager() {
+        return MemoryMailboxManagerProvider.provideMailboxManager();
+    }
+}


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