Author: eric
Date: Wed Aug 11 13:55:18 2010
New Revision: 984408
URL: http://svn.apache.org/viewvc?rev=984408&view=rev
Log:
Move JPA tests from deployment to jpa project (IMAP-187)
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/AuthenticatedStateTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ConcurrentSessionsTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/EventTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ExpungeTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchBodySectionTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchBodyStructureTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchHeadersTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/JPAHostSystem.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/JPAStressTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ListingTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/NonAuthenticatedStateTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/PartialFetchTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/RenameTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SearchTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SecurityTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectedInboxTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectedStateTest.java
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/UidSearchTest.java
Modified:
james/imap/trunk/deployment/pom.xml
james/imap/trunk/jpa/pom.xml
james/imap/trunk/parent/pom.xml
Modified: james/imap/trunk/deployment/pom.xml
URL:
http://svn.apache.org/viewvc/james/imap/trunk/deployment/pom.xml?rev=984408&r1=984407&r2=984408&view=diff
==============================================================================
--- james/imap/trunk/deployment/pom.xml (original)
+++ james/imap/trunk/deployment/pom.xml Wed Aug 11 13:55:18 2010
@@ -70,11 +70,6 @@
<artifactId>apache-james-imap-torque</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.james</groupId>
- <artifactId>apache-james-imap-jpa</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.apache.james</groupId>
<artifactId>apache-james-imap-memory</artifactId>
Modified: james/imap/trunk/jpa/pom.xml
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/pom.xml?rev=984408&r1=984407&r2=984408&view=diff
==============================================================================
--- james/imap/trunk/jpa/pom.xml (original)
+++ james/imap/trunk/jpa/pom.xml Wed Aug 11 13:55:18 2010
@@ -53,6 +53,45 @@
<dependency>
<groupId>org.apache.james</groupId>
+ <artifactId>apache-james-imap-deployment</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>apache-james-imap-message</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>apache-james-imap-processor</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>apache-james-imap-seda</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>apache-james-imap-seda</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>apache-james-imap-protocol-tester</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.james</groupId>
<artifactId>apache-mime4j</artifactId>
</dependency>
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/AuthenticatedStateTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/AuthenticatedStateTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/AuthenticatedStateTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/AuthenticatedStateTest.java
Wed Aug 11 13:55:18 2010
@@ -0,0 +1,29 @@
+/****************************************************************
+ * 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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.AuthenticatedState;
+
+public class AuthenticatedStateTest extends
+ AuthenticatedState {
+ public AuthenticatedStateTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ConcurrentSessionsTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ConcurrentSessionsTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ConcurrentSessionsTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ConcurrentSessionsTest.java
Wed Aug 11 13:55:18 2010
@@ -0,0 +1,31 @@
+/****************************************************************
+ * 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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.ConcurrentSessions;
+
+public class ConcurrentSessionsTest extends
+ ConcurrentSessions {
+
+ public ConcurrentSessionsTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/EventTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/EventTest.java?rev=984408&view=auto
==============================================================================
--- james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/EventTest.java
(added)
+++ james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/EventTest.java
Wed Aug 11 13:55:18 2010
@@ -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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.Events;
+
+public class EventTest extends Events {
+
+ public EventTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ExpungeTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ExpungeTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ExpungeTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ExpungeTest.java
Wed Aug 11 13:55:18 2010
@@ -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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.Expunge;
+
+public class ExpungeTest extends Expunge {
+
+ public ExpungeTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchBodySectionTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchBodySectionTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchBodySectionTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchBodySectionTest.java
Wed Aug 11 13:55:18 2010
@@ -0,0 +1,31 @@
+/****************************************************************
+ * 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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.FetchBodySection;
+
+public class FetchBodySectionTest extends
+ FetchBodySection {
+
+ public FetchBodySectionTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchBodyStructureTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchBodyStructureTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchBodyStructureTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchBodyStructureTest.java
Wed Aug 11 13:55:18 2010
@@ -0,0 +1,31 @@
+/****************************************************************
+ * 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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.FetchBodyStructure;
+
+public class FetchBodyStructureTest extends
+ FetchBodyStructure {
+
+ public FetchBodyStructureTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchHeadersTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchHeadersTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchHeadersTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchHeadersTest.java
Wed Aug 11 13:55:18 2010
@@ -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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.FetchHeaders;
+
+public class FetchHeadersTest extends FetchHeaders {
+
+ public FetchHeadersTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchTest.java?rev=984408&view=auto
==============================================================================
--- james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchTest.java
(added)
+++ james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/FetchTest.java
Wed Aug 11 13:55:18 2010
@@ -0,0 +1,29 @@
+/****************************************************************
+ * 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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.Fetch;
+
+public class FetchTest extends Fetch {
+
+ public FetchTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/JPAHostSystem.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/JPAHostSystem.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/JPAHostSystem.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/JPAHostSystem.java
Wed Aug 11 13:55:18 2010
@@ -0,0 +1,112 @@
+/****************************************************************
+ * 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.imap.jpa;
+
+import java.io.File;
+import java.util.HashMap;
+
+import javax.persistence.EntityManagerFactory;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.impl.SimpleLog;
+import org.apache.james.imap.encode.main.DefaultImapEncoderFactory;
+import org.apache.james.imap.functional.ImapHostSystem;
+import org.apache.james.imap.functional.InMemoryUserManager;
+import org.apache.james.imap.jpa.JPAMailboxSessionMapperFactory;
+import org.apache.james.imap.jpa.JPASubscriptionManager;
+import org.apache.james.imap.jpa.mail.model.JPAMailbox;
+import org.apache.james.imap.jpa.mail.model.JPAProperty;
+import
org.apache.james.imap.jpa.mail.model.openjpa.AbstractJPAMailboxMembership;
+import org.apache.james.imap.jpa.mail.model.openjpa.AbstractJPAMessage;
+import org.apache.james.imap.jpa.mail.model.openjpa.JPAMailboxMembership;
+import org.apache.james.imap.jpa.mail.model.openjpa.JPAMessage;
+import org.apache.james.imap.jpa.openjpa.OpenJPAMailboxManager;
+import org.apache.james.imap.jpa.user.model.JPASubscription;
+import org.apache.james.imap.mailbox.MailboxSession;
+import org.apache.james.imap.main.DefaultImapDecoderFactory;
+import org.apache.james.imap.processor.main.DefaultImapProcessorFactory;
+import org.apache.james.test.functional.HostSystem;
+import org.apache.openjpa.persistence.OpenJPAPersistence;
+
+public class JPAHostSystem extends ImapHostSystem {
+
+ public static final String META_DATA_DIRECTORY = "target/user-meta-data";
+
+ public static HostSystem build() throws Exception {
+ JPAHostSystem host = new JPAHostSystem();
+ return host;
+ }
+
+ private final OpenJPAMailboxManager mailboxManager;
+ private final InMemoryUserManager userManager;
+ private final EntityManagerFactory entityManagerFactory;
+
+ public JPAHostSystem() throws Exception {
+ HashMap<String, String> properties = new HashMap<String, String>();
+ properties.put("openjpa.ConnectionDriverName", "org.h2.Driver");
+ properties.put("openjpa.ConnectionURL",
"jdbc:h2:mem:imap;DB_CLOSE_DELAY=-1");
+ properties.put("openjpa.Log", "JDBC=WARN, SQL=WARN, Runtime=WARN");
+ properties.put("openjpa.ConnectionFactoryProperties",
"PrettyPrint=true, PrettyPrintLineLength=72");
+ properties.put("openjpa.jdbc.SynchronizeMappings",
"buildSchema(ForeignKeys=true)");
+ properties.put("openjpa.MetaDataFactory",
"jpa(Types=org.apache.james.imap.jpa.mail.model.JPAHeader;" +
+ JPAMailbox.class.getName() + ";" +
+ AbstractJPAMailboxMembership.class.getName() + ";" +
+ JPAMailboxMembership.class.getName() + ";" +
+ AbstractJPAMessage.class.getName() + ";" +
+ JPAMessage.class.getName() + ";" +
+ JPAProperty.class.getName() + ";" +
+ JPASubscription.class.getName() + ")");
+ userManager = new InMemoryUserManager();
+ entityManagerFactory =
OpenJPAPersistence.getEntityManagerFactory(properties);
+ JPAMailboxSessionMapperFactory mf = new
JPAMailboxSessionMapperFactory(entityManagerFactory);
+ mailboxManager = new OpenJPAMailboxManager(mf, userManager, new
JPASubscriptionManager(mf));
+
+ final DefaultImapProcessorFactory defaultImapProcessorFactory = new
DefaultImapProcessorFactory();
+ resetUserMetaData();
+ defaultImapProcessorFactory.configure(mailboxManager);
+ configure(new DefaultImapDecoderFactory().buildImapDecoder(),
+ new DefaultImapEncoderFactory().buildImapEncoder(),
+ defaultImapProcessorFactory.buildImapProcessor());
+ }
+
+ public boolean addUser(String user, String password) {
+ userManager.addUser(user, password);
+ return true;
+ }
+
+ public void resetData() throws Exception {
+ resetUserMetaData();
+ MailboxSession session = mailboxManager.createSystemSession("test",
new SimpleLog("TestLog"));
+ mailboxManager.startProcessingRequest(session);
+ mailboxManager.deleteEverything(session);
+ mailboxManager.endProcessingRequest(session);
+ mailboxManager.logout(session, false);
+
+ }
+
+ public void resetUserMetaData() throws Exception {
+ File dir = new File(META_DATA_DIRECTORY);
+ if (dir.exists()) {
+ FileUtils.deleteDirectory(dir);
+ }
+ dir.mkdirs();
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/JPAStressTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/JPAStressTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/JPAStressTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/JPAStressTest.java
Wed Aug 11 13:55:18 2010
@@ -0,0 +1,108 @@
+/****************************************************************
+ * 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.imap.jpa;
+
+import java.util.HashMap;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+
+import org.apache.commons.logging.impl.SimpleLog;
+import org.apache.james.imap.functional.AbstractStressTest;
+import org.apache.james.imap.jpa.JPAMailboxSessionMapperFactory;
+import org.apache.james.imap.jpa.JPASubscriptionManager;
+import org.apache.james.imap.jpa.mail.model.JPAMailbox;
+import org.apache.james.imap.jpa.mail.model.JPAProperty;
+import
org.apache.james.imap.jpa.mail.model.openjpa.AbstractJPAMailboxMembership;
+import org.apache.james.imap.jpa.mail.model.openjpa.AbstractJPAMessage;
+import org.apache.james.imap.jpa.mail.model.openjpa.JPAMailboxMembership;
+import org.apache.james.imap.jpa.mail.model.openjpa.JPAMessage;
+import org.apache.james.imap.jpa.openjpa.OpenJPAMailboxManager;
+import org.apache.james.imap.jpa.user.model.JPASubscription;
+import org.apache.james.imap.mailbox.MailboxException;
+import org.apache.james.imap.mailbox.MailboxSession;
+import org.apache.james.imap.store.StoreMailboxManager;
+import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.junit.After;
+import org.junit.Before;
+
+/**
+ * Proof of bug https://issues.apache.org/jira/browse/IMAP-137
+ */
+public class JPAStressTest extends AbstractStressTest{
+
+
+ private OpenJPAMailboxManager mailboxManager;
+ private long locktimeout = 60000;
+ private EntityManagerFactory entityManagerFactory;
+
+ @Before
+ public void setUp() {
+ HashMap<String, String> properties = new HashMap<String, String>();
+ properties.put("openjpa.ConnectionDriverName", "org.h2.Driver");
+ properties.put("openjpa.ConnectionURL",
"jdbc:h2:mem:imap;DB_CLOSE_DELAY=-1");
+ properties.put("openjpa.Log", "JDBC=WARN, SQL=WARN, Runtime=WARN");
+ properties.put("openjpa.ConnectionFactoryProperties",
"PrettyPrint=true, PrettyPrintLineLength=72");
+ properties.put("openjpa.jdbc.SynchronizeMappings",
"buildSchema(ForeignKeys=true)");
+ properties.put("openjpa.MetaDataFactory",
"jpa(Types=org.apache.james.imap.jpa.mail.model.JPAHeader;" +
+ JPAMailbox.class.getName() + ";" +
+ AbstractJPAMailboxMembership.class.getName() + ";" +
+ JPAMailboxMembership.class.getName() + ";" +
+ AbstractJPAMessage.class.getName() + ";" +
+ JPAMessage.class.getName() + ";" +
+ JPAProperty.class.getName() + ";" +
+ JPASubscription.class.getName() + ")");
+ properties.put("openjpa.LockTimeout", locktimeout + "");
+
+ entityManagerFactory =
OpenJPAPersistence.getEntityManagerFactory(properties);
+ JPAMailboxSessionMapperFactory mf = new
JPAMailboxSessionMapperFactory(entityManagerFactory);
+ mailboxManager = new OpenJPAMailboxManager(mf, null, new
JPASubscriptionManager(mf));
+
+ // Set the lock timeout via SQL because of a bug in openJPA
+ // https://issues.apache.org/jira/browse/OPENJPA-1656
+ setH2LockTimeout();
+ }
+
+
+ private void setH2LockTimeout() {
+ EntityManager manager = entityManagerFactory.createEntityManager();
+ manager.getTransaction().begin();
+ manager.createNativeQuery("SET DEFAULT_LOCK_TIMEOUT " +
locktimeout).executeUpdate();
+ manager.getTransaction().commit();
+ manager.close();
+ }
+
+
+ @After
+ public void tearDown() {
+ MailboxSession session = mailboxManager.createSystemSession("test",
new SimpleLog("Test"));
+ try {
+ mailboxManager.deleteEverything(session);
+ } catch (MailboxException e) {
+ e.printStackTrace();
+ }
+ session.close();
+ }
+
+ @Override
+ protected StoreMailboxManager<?> getMailboxManager() {
+ return mailboxManager;
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ListingTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ListingTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ListingTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/ListingTest.java
Wed Aug 11 13:55:18 2010
@@ -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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.Listing;
+
+public class ListingTest extends Listing {
+
+ public ListingTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/NonAuthenticatedStateTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/NonAuthenticatedStateTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/NonAuthenticatedStateTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/NonAuthenticatedStateTest.java
Wed Aug 11 13:55:18 2010
@@ -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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.NonAuthenticatedState;
+
+public class NonAuthenticatedStateTest extends
+ NonAuthenticatedState {
+
+ public NonAuthenticatedStateTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/PartialFetchTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/PartialFetchTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/PartialFetchTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/PartialFetchTest.java
Wed Aug 11 13:55:18 2010
@@ -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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.PartialFetch;
+
+public class PartialFetchTest extends PartialFetch {
+
+ public PartialFetchTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/RenameTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/RenameTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/RenameTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/RenameTest.java
Wed Aug 11 13:55:18 2010
@@ -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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.Rename;
+
+public class RenameTest extends Rename {
+
+ public RenameTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SearchTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SearchTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SearchTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SearchTest.java
Wed Aug 11 13:55:18 2010
@@ -0,0 +1,29 @@
+/****************************************************************
+ * 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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.Search;
+
+public class SearchTest extends Search {
+
+ public SearchTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SecurityTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SecurityTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SecurityTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SecurityTest.java
Wed Aug 11 13:55:18 2010
@@ -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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.Security;
+
+public class SecurityTest extends Security {
+
+ public SecurityTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectTest.java
Wed Aug 11 13:55:18 2010
@@ -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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.Select;
+
+public class SelectTest extends Select {
+
+ public SelectTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectedInboxTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectedInboxTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectedInboxTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectedInboxTest.java
Wed Aug 11 13:55:18 2010
@@ -0,0 +1,29 @@
+/****************************************************************
+ * 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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.SelectedInbox;
+
+public class SelectedInboxTest extends SelectedInbox {
+
+ public SelectedInboxTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectedStateTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectedStateTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectedStateTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/SelectedStateTest.java
Wed Aug 11 13:55:18 2010
@@ -0,0 +1,29 @@
+/****************************************************************
+ * 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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.SelectedState;
+
+public class SelectedStateTest extends SelectedState {
+
+ public SelectedStateTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+}
Added:
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/UidSearchTest.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/UidSearchTest.java?rev=984408&view=auto
==============================================================================
---
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/UidSearchTest.java
(added)
+++
james/imap/trunk/jpa/src/test/java/org/apache/james/imap/jpa/UidSearchTest.java
Wed Aug 11 13:55:18 2010
@@ -0,0 +1,29 @@
+/****************************************************************
+ * 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.imap.jpa;
+
+import org.apache.james.imap.functional.suite.UidSearch;
+
+public class UidSearchTest extends UidSearch {
+
+ public UidSearchTest() throws Exception {
+ super(JPAHostSystem.build());
+ }
+}
Modified: james/imap/trunk/parent/pom.xml
URL:
http://svn.apache.org/viewvc/james/imap/trunk/parent/pom.xml?rev=984408&r1=984407&r2=984408&view=diff
==============================================================================
--- james/imap/trunk/parent/pom.xml (original)
+++ james/imap/trunk/parent/pom.xml Wed Aug 11 13:55:18 2010
@@ -270,6 +270,13 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>apache-james-imap-deployment</artifactId>
+ <version>${pom.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
<!--
END Modules
-->
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]