[jboss-cvs] JBossAS SVN: r59525 - in trunk/ejb3: src/resources/test and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 11 08:31:16 EST 2007


Author: wolfc
Date: 2007-01-11 08:31:06 -0500 (Thu, 11 Jan 2007)
New Revision: 59525

Added:
   trunk/ejb3/src/resources/test/ejbthree832/
   trunk/ejb3/src/resources/test/ejbthree832/META-INF/
   trunk/ejb3/src/resources/test/ejbthree832/META-INF/persistence.xml
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/EntityTest.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/EntityTestBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/Person.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/unit/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/unit/EntityTestCase.java
Modified:
   trunk/ejb3/build-test.xml
Log:
EJBTHREE-832: unit test

Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml	2007-01-11 13:22:49 UTC (rev 59524)
+++ trunk/ejb3/build-test.xml	2007-01-11 13:31:06 UTC (rev 59525)
@@ -1813,6 +1813,22 @@
       </jar>
    </target>
 
+   <target name="ejbthree832"
+      description="Builds all jar files."
+      depends="compile-classes">
+
+      <mkdir dir="${build.lib}"/>
+
+      <jar jarfile="${build.lib}/ejbthree832.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/ejbthree832/*.class"/>
+         </fileset>
+         <fileset dir="${resources}/test/ejbthree832">
+            <include name="META-INF/persistence.xml"/>
+         </fileset>
+      </jar>
+   </target>
+   
    <target name="jaxws"
       description="Builds a simple jar."
       depends="compile-classes">
@@ -3657,6 +3673,9 @@
       <antcall target="test" inheritRefs="true">
          <param name="test" value="ejbthree751"/>
       </antcall>
+      <antcall target="test" inheritRefs="true">
+         <param name="test" value="ejbthree832"/>
+      </antcall>
    </target>
 
    <target name="entity-tests" depends="init" description="Execute all tests">

Added: trunk/ejb3/src/resources/test/ejbthree832/META-INF/persistence.xml
===================================================================
--- trunk/ejb3/src/resources/test/ejbthree832/META-INF/persistence.xml	2007-01-11 13:22:49 UTC (rev 59524)
+++ trunk/ejb3/src/resources/test/ejbthree832/META-INF/persistence.xml	2007-01-11 13:31:06 UTC (rev 59525)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence>
+   <persistence-unit name="tempdb" transaction-type="JTA">
+      <jta-data-source>java:/DefaultDS</jta-data-source>
+      <properties>
+          <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+          <property name="hibernate.cache.provider_class" value="org.hibernate.cache.OptimisticTreeCacheProvider"/>
+      </properties>
+   </persistence-unit>
+</persistence>

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/EntityTest.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/EntityTest.java	2007-01-11 13:22:49 UTC (rev 59524)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/EntityTest.java	2007-01-11 13:31:06 UTC (rev 59525)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbthree832;
+
+import javax.ejb.Remote;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Remote
+public interface EntityTest
+{
+   void test1();
+}
\ No newline at end of file

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/EntityTestBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/EntityTestBean.java	2007-01-11 13:22:49 UTC (rev 59524)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/EntityTestBean.java	2007-01-11 13:31:06 UTC (rev 59525)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbthree832;
+
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateless
+public class EntityTestBean implements EntityTest
+{
+   @PersistenceContext
+   private EntityManager em;
+   
+   /* (non-Javadoc)
+    * @see org.jboss.ejb3.test.ejbthree832.EntityTest#test1()
+    */
+   public void test1()
+   {
+      Person person = new Person("Emmanuel");
+      em.persist(person);
+      
+      person = new Person("Gavin");
+      em.persist(person);
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/Person.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/Person.java	2007-01-11 13:22:49 UTC (rev 59524)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/Person.java	2007-01-11 13:31:06 UTC (rev 59525)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbthree832;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Entity
+public class Person
+{
+   private Long id;
+   private String name;
+   
+   public Person()
+   {
+      
+   }
+   
+   public Person(String name)
+   {
+      setName(name);
+   }
+   
+   @Id
+   public Long getId()
+   {
+      return id;
+   }
+   
+   public void setId(Long id)
+   {
+      this.id = id;
+   }
+   
+   public String getName()
+   {
+      return name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/unit/EntityTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/unit/EntityTestCase.java	2007-01-11 13:22:49 UTC (rev 59524)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree832/unit/EntityTestCase.java	2007-01-11 13:31:06 UTC (rev 59525)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbthree832.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree832.EntityTest;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class EntityTestCase extends JBossTestCase
+{
+
+   public EntityTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void test1() throws Exception
+   {
+      EntityTest test = (EntityTest) this.getInitialContext().lookup("EntityTestBean/remote");
+      test.test1();
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(EntityTestCase.class, "ejbthree832.jar");
+   }
+
+}




More information about the jboss-cvs-commits mailing list