cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r501901 - in /cayenne/main/trunk: ./ itests/itest-common/ itests/itest-common/src/main/java/org/apache/cayenne/itest/jpa/ itests/jpa-chapter3/src/test/java/org/apache/cayenne/jpa/itest/ch3/
Date Wed, 31 Jan 2007 17:12:29 GMT
Author: aadamchik
Date: Wed Jan 31 09:12:23 2007
New Revision: 501901

URL: http://svn.apache.org/viewvc?view=rev&rev=501901
Log:
initial attempts to do in-container testing with openejb container

Added:
    cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/jpa/ContainerEntityManagerCase.java
Modified:
    cayenne/main/trunk/itests/itest-common/pom.xml
    cayenne/main/trunk/itests/jpa-chapter3/src/test/java/org/apache/cayenne/jpa/itest/ch3/_3_1_1_EntityManagerTest.java
    cayenne/main/trunk/pom.xml

Modified: cayenne/main/trunk/itests/itest-common/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/itest-common/pom.xml?view=diff&rev=501901&r1=501900&r2=501901
==============================================================================
--- cayenne/main/trunk/itests/itest-common/pom.xml (original)
+++ cayenne/main/trunk/itests/itest-common/pom.xml Wed Jan 31 09:12:23 2007
@@ -7,9 +7,9 @@
 	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
-
+	
+	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
@@ -50,6 +50,18 @@
 		<dependency>
 			<groupId>hsqldb</groupId>
 			<artifactId>hsqldb</artifactId>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.openejb</groupId>
+			<artifactId>openejb-core</artifactId>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.geronimo.modules</groupId>
+			<artifactId>geronimo-transaction-jta11</artifactId>
 			<scope>compile</scope>
 		</dependency>
 	</dependencies>

Added: cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/jpa/ContainerEntityManagerCase.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/jpa/ContainerEntityManagerCase.java?view=auto&rev=501901
==============================================================================
--- cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/jpa/ContainerEntityManagerCase.java
(added)
+++ cayenne/main/trunk/itests/itest-common/src/main/java/org/apache/cayenne/itest/jpa/ContainerEntityManagerCase.java
Wed Jan 31 09:12:23 2007
@@ -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.cayenne.itest.jpa;
+
+import java.util.Properties;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.transaction.TransactionSynchronizationRegistry;
+
+import org.apache.geronimo.transaction.jta11.GeronimoTransactionManagerJTA11;
+import org.apache.openejb.persistence.JtaEntityManager;
+import org.apache.openejb.persistence.JtaEntityManagerRegistry;
+
+public class ContainerEntityManagerCase extends JpaTestCase {
+
+    protected EntityManager entityManager;
+
+    @Override
+    protected void setUp() throws Exception {
+
+        TransactionSynchronizationRegistry tm = new GeronimoTransactionManagerJTA11();
+        EntityManagerFactory factory = ItestSetup
+                .getInstance()
+                .createEntityManagerFactory();
+        JtaEntityManagerRegistry registry = new JtaEntityManagerRegistry(tm);
+        entityManager = new JtaEntityManager(registry, factory, new Properties(), false);
+    }
+
+    public EntityManager getEntityManager() {
+        return entityManager;
+    }
+}

Modified: cayenne/main/trunk/itests/jpa-chapter3/src/test/java/org/apache/cayenne/jpa/itest/ch3/_3_1_1_EntityManagerTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/itests/jpa-chapter3/src/test/java/org/apache/cayenne/jpa/itest/ch3/_3_1_1_EntityManagerTest.java?view=diff&rev=501901&r1=501900&r2=501901
==============================================================================
--- cayenne/main/trunk/itests/jpa-chapter3/src/test/java/org/apache/cayenne/jpa/itest/ch3/_3_1_1_EntityManagerTest.java
(original)
+++ cayenne/main/trunk/itests/jpa-chapter3/src/test/java/org/apache/cayenne/jpa/itest/ch3/_3_1_1_EntityManagerTest.java
Wed Jan 31 09:12:23 2007
@@ -87,14 +87,6 @@
         fail("Must have thrown on EntityExists condition.");
     }
 
-    // TODO: andrus, 1/3/2007 - implement - need to emulate the container environment
-    public void _testPersistTransactionRequiredException() {
-        // throws TransactionRequiredException if invoked on a
-        // container-managed entity manager of type
-        // PersistenceContextType.TRANSACTION and there is
-        // no transaction.
-    }
-
     // TODO: andrus, 1/3/2007 - this fails with Null ObjectId exception
     public void _testMerge() throws Exception {
         getDbHelper().deleteAll("SimpleEntity");

Modified: cayenne/main/trunk/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/pom.xml?view=diff&rev=501901&r1=501900&r2=501901
==============================================================================
--- cayenne/main/trunk/pom.xml (original)
+++ cayenne/main/trunk/pom.xml Wed Jan 31 09:12:23 2007
@@ -372,7 +372,21 @@
 				<artifactId>geronimo-jpa_3.0_spec</artifactId>
 				<version>1.0</version>
 			</dependency>
+			
+			<dependency>
+				<groupId>org.apache.geronimo.modules</groupId>
+				<artifactId>geronimo-transaction-jta11</artifactId>
+				<version>2.0-SNAPSHOT</version>
+				<scope>test</scope>
+			</dependency>
 
+			<dependency>
+				<groupId>org.apache.openejb</groupId>
+				<artifactId>openejb-core</artifactId>
+				<version>3.0-incubating-SNAPSHOT</version>
+				<scope>test</scope>
+			</dependency>
+			
 			<dependency>
 				<groupId>mockrunner</groupId>
 				<artifactId>mockrunner</artifactId>



Mime
View raw message