geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r471686 - in /geronimo/sandbox/javaee5/itests-jee5/jpa: ejb/ ejb/src/main/java/org/apache/geronimo/itest/ ejb/src/main/resources/META-INF/ war/src/main/java/org/apache/geronimo/itest/
Date Mon, 06 Nov 2006 10:35:30 GMT
Author: djencks
Date: Mon Nov  6 02:35:29 2006
New Revision: 471686

URL: http://svn.apache.org/viewvc?view=rev&rev=471686
Log:
GERONIMO-2460 simple app managed jpa test

Modified:
    geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/pom.xml
    geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/java/org/apache/geronimo/itest/TestSession.java
    geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/java/org/apache/geronimo/itest/TestSessionBean.java
    geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/resources/META-INF/openejb-jar.xml
    geronimo/sandbox/javaee5/itests-jee5/jpa/war/src/main/java/org/apache/geronimo/itest/TestServlet.java

Modified: geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/pom.xml?view=diff&rev=471686&r1=471685&r2=471686
==============================================================================
--- geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/pom.xml (original)
+++ geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/pom.xml Mon Nov  6 02:35:29 2006
@@ -13,7 +13,6 @@
     <url>http://maven.apache.org</url>
     <build>
         <plugins>
-<!--
             <plugin>
               <artifactId>maven-antrun-plugin</artifactId>
               <executions>
@@ -45,7 +44,6 @@
                 </execution>
               </executions>
             </plugin>
--->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-ejb-plugin</artifactId>

Modified: geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/java/org/apache/geronimo/itest/TestSession.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/java/org/apache/geronimo/itest/TestSession.java?view=diff&rev=471686&r1=471685&r2=471686
==============================================================================
--- geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/java/org/apache/geronimo/itest/TestSession.java
(original)
+++ geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/java/org/apache/geronimo/itest/TestSession.java
Mon Nov  6 02:35:29 2006
@@ -18,8 +18,10 @@
 package org.apache.geronimo.itest;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public interface TestSession  extends javax.ejb.EJBObject {
     void testEntityManager();
+    
+    void testEntityManagerFactory();
 }

Modified: geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/java/org/apache/geronimo/itest/TestSessionBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/java/org/apache/geronimo/itest/TestSessionBean.java?view=diff&rev=471686&r1=471685&r2=471686
==============================================================================
--- geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/java/org/apache/geronimo/itest/TestSessionBean.java
(original)
+++ geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/java/org/apache/geronimo/itest/TestSessionBean.java
Mon Nov  6 02:35:29 2006
@@ -22,11 +22,12 @@
 import javax.ejb.SessionContext;
 import javax.naming.InitialContext;
 import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
 
 import org.apache.geronimo.itest.jpa.AllFieldTypes;
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class TestSessionBean implements SessionBean {
 
@@ -39,6 +40,22 @@
             AllFieldTypes allFieldTypes = new AllFieldTypes();
             entityManager.persist(allFieldTypes);
             System.out.println("saved object");
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("Could not access entity manager");
+        }
+    }
+
+    public void testEntityManagerFactory() {
+        try {
+            EntityManagerFactory entityManagerFactory = (EntityManagerFactory) new InitialContext().lookup("java:comp/env/jpa/testEMF");
+            System.out.println("Accessed entity manager factory");
+            EntityManager entityManager = entityManagerFactory.createEntityManager();
+            AllFieldTypes allFieldTypes = new AllFieldTypes();
+            entityManager.persist(allFieldTypes);
+            System.out.println("saved object");
+            entityManager.close();
+            System.out.println("Closed entity manager");
         } catch (Exception e) {
             e.printStackTrace();
             System.out.println("Could not access entity manager");

Modified: geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/resources/META-INF/openejb-jar.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/resources/META-INF/openejb-jar.xml?view=diff&rev=471686&r1=471685&r2=471686
==============================================================================
--- geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/resources/META-INF/openejb-jar.xml
(original)
+++ geronimo/sandbox/javaee5/itests-jee5/jpa/ejb/src/main/resources/META-INF/openejb-jar.xml
Mon Nov  6 02:35:29 2006
@@ -46,6 +46,10 @@
                 <persistence-unit-name>test-unit</persistence-unit-name>
                 <persistence-context-type>transaction-scoped</persistence-context-type>
             </persistence-context-ref>
+            <entity-manager-factory-ref>
+                <entity-manager-factory-ref-name>jpa/testEMF</entity-manager-factory-ref-name>
+                <persistence-unit-name>test-unit</persistence-unit-name>
+            </entity-manager-factory-ref>
         </session>
     </enterprise-beans>
 

Modified: geronimo/sandbox/javaee5/itests-jee5/jpa/war/src/main/java/org/apache/geronimo/itest/TestServlet.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/itests-jee5/jpa/war/src/main/java/org/apache/geronimo/itest/TestServlet.java?view=diff&rev=471686&r1=471685&r2=471686
==============================================================================
--- geronimo/sandbox/javaee5/itests-jee5/jpa/war/src/main/java/org/apache/geronimo/itest/TestServlet.java
(original)
+++ geronimo/sandbox/javaee5/itests-jee5/jpa/war/src/main/java/org/apache/geronimo/itest/TestServlet.java
Mon Nov  6 02:35:29 2006
@@ -30,7 +30,7 @@
 
 
 /**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
  */
 public class TestServlet extends HttpServlet {
 
@@ -44,7 +44,9 @@
             InitialContext ctx = new InitialContext();
             TestSessionHome home = (TestSessionHome)ctx.lookup("java:comp/env/TestSession");
             home.create().testEntityManager();
-            httpServletResponse.getOutputStream().print("Test Servlet looked up java:comp/env/TestSession");
+            httpServletResponse.getOutputStream().print("Test Servlet container managed entity
manager test OK");
+            home.create().testEntityManagerFactory();
+            httpServletResponse.getOutputStream().print("Test Servlet app managed entity
manager factory test OK");
         } catch (NamingException e) {
             System.out.print("Exception:");
             e.printStackTrace();



Mime
View raw message