[jboss-cvs] JBossAS SVN: r58189 - in trunk/ejb3: . src/resources/test src/resources/test/ear src/resources/test/ear/earlib src/resources/test/ear/earlib/META-INF src/resources/test/ear/ejbref src/resources/test/ear/ejbref/META-INF src/test/org/jboss/ejb3/test src/test/org/jboss/ejb3/test/ear src/test/org/jboss/ejb3/test/ear/unit

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 7 15:16:55 EST 2006


Author: bill.burke at jboss.com
Date: 2006-11-07 15:16:53 -0500 (Tue, 07 Nov 2006)
New Revision: 58189

Added:
   trunk/ejb3/src/resources/test/ear/
   trunk/ejb3/src/resources/test/ear/earlib/
   trunk/ejb3/src/resources/test/ear/earlib/META-INF/
   trunk/ejb3/src/resources/test/ear/earlib/META-INF/persistence.xml
   trunk/ejb3/src/resources/test/ear/ejbref/
   trunk/ejb3/src/resources/test/ear/ejbref/META-INF/
   trunk/ejb3/src/resources/test/ear/ejbref/META-INF/persistence.xml
   trunk/ejb3/src/test/org/jboss/ejb3/test/ear/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ear/Facade.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ear/FacadeBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ear/LibEntity.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ear/ReferencedEntity.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/ear/unit/
   trunk/ejb3/src/test/org/jboss/ejb3/test/ear/unit/EarUnitTestCase.java
Modified:
   trunk/ejb3/build-test.xml
Log:
test for scanned .ear file

Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml	2006-11-07 20:15:06 UTC (rev 58188)
+++ trunk/ejb3/build-test.xml	2006-11-07 20:16:53 UTC (rev 58189)
@@ -609,6 +609,47 @@
       </jar>
    </target>
 
+   <target name="ear"
+      description="Builds all jar files."
+      depends="compile-classes">
+
+      <mkdir dir="${build.lib}"/>
+
+      <jar jarfile="${build.lib}/ear-session.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/ear/Facade*.class"/>
+         </fileset>
+         <fileset dir="${resources}/test/ear/ejbref">
+            <include name="META-INF/persistence.xml"/>
+         </fileset>
+      </jar>
+
+      <jar jarfile="${build.lib}/earpu.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/ear/LibEntity.class"/>
+         </fileset>
+         <fileset dir="${resources}/test/ear/earlib">
+            <include name="META-INF/persistence.xml"/>
+         </fileset>
+      </jar>
+
+      <jar jarfile="${build.lib}/ref.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/ear/ReferencedEntity.class"/>
+         </fileset>
+      </jar>
+      <zip zipfile="${build.lib}/ear-test.ear">
+         <zipfileset dir="${build.lib}">
+            <include name="ear-session.jar"/>
+         </zipfileset>
+         <zipfileset dir="${build.lib}" prefix="lib">
+            <include name="ref.jar"/>
+            <include name="earpu.jar"/>
+         </zipfileset>
+      </zip>
+
+   </target>
+
    <target name="dependency"
       description="Builds all jar files."
       depends="compile-classes">
@@ -2709,7 +2750,7 @@
    </target>
    
    <target name="jars" depends="arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
-      circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ejbthree440, 
+      circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440, 
       ejbthree454, ejbthree653, ejbthree670, aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, 
       securitydomain, enventry, 
       jms/managed, naming, bmt, jca/inflowmdb, pool, jms, security, reference21_30, factory, dd/web, txexceptions, 
@@ -3455,6 +3496,9 @@
          <param name="test" value="factory"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
+         <param name="test" value="ear"/>
+      </antcall>
+      <antcall target="test" inheritRefs="true">
          <param name="test" value="factoryxml"/>
       </antcall>
       <antcall target="test" inheritRefs="true">

Added: trunk/ejb3/src/resources/test/ear/earlib/META-INF/persistence.xml
===================================================================
--- trunk/ejb3/src/resources/test/ear/earlib/META-INF/persistence.xml	2006-11-07 20:15:06 UTC (rev 58188)
+++ trunk/ejb3/src/resources/test/ear/earlib/META-INF/persistence.xml	2006-11-07 20:16:53 UTC (rev 58189)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence>
+   <persistence-unit name="earlib">
+      <jta-data-source>java:/DefaultDS</jta-data-source>
+      <properties>
+         <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+      </properties>
+   </persistence-unit>
+</persistence>

Added: trunk/ejb3/src/resources/test/ear/ejbref/META-INF/persistence.xml
===================================================================
--- trunk/ejb3/src/resources/test/ear/ejbref/META-INF/persistence.xml	2006-11-07 20:15:06 UTC (rev 58188)
+++ trunk/ejb3/src/resources/test/ear/ejbref/META-INF/persistence.xml	2006-11-07 20:16:53 UTC (rev 58189)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence>
+   <persistence-unit name="ejbref">
+      <jta-data-source>java:/DefaultDS</jta-data-source>
+      <class>org.jboss.ejb3.test.ear.ReferencedEntity</class>
+      <properties>
+         <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+      </properties>
+   </persistence-unit>
+</persistence>

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ear/Facade.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ear/Facade.java	2006-11-07 20:15:06 UTC (rev 58188)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ear/Facade.java	2006-11-07 20:16:53 UTC (rev 58189)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., 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.ear;
+
+import javax.ejb.Remote;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+ at Remote
+public interface Facade
+{
+   void testEarLib();
+
+   void testReferencedEntity();
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ear/FacadeBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ear/FacadeBean.java	2006-11-07 20:15:06 UTC (rev 58188)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ear/FacadeBean.java	2006-11-07 20:16:53 UTC (rev 58189)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., 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.ear;
+
+import javax.ejb.Stateless;
+import javax.persistence.PersistenceContext;
+import javax.persistence.EntityManager;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+ at Stateless
+public class FacadeBean implements Facade
+{
+   @PersistenceContext(unitName="earlib")
+   EntityManager earlib;
+
+   @PersistenceContext(unitName="ejbref")
+   EntityManager ejbref;
+
+   public void testEarLib()
+   {
+      LibEntity entity = new LibEntity();
+      earlib.persist(entity);
+   }
+
+   public void testReferencedEntity()
+   {
+      ReferencedEntity ref = new ReferencedEntity();
+      ejbref.persist(ref);
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ear/LibEntity.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ear/LibEntity.java	2006-11-07 20:15:06 UTC (rev 58188)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ear/LibEntity.java	2006-11-07 20:16:53 UTC (rev 58189)
@@ -0,0 +1,49 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., 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.ear;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+
+/**
+ * entity in ear/lib/.jar file
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+ at Entity
+public class LibEntity
+{
+   private int id;
+
+   @Id @GeneratedValue
+   public int getId()
+   {
+      return id;
+   }
+
+   public void setId(int id)
+   {
+      this.id = id;
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ear/ReferencedEntity.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ear/ReferencedEntity.java	2006-11-07 20:15:06 UTC (rev 58188)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ear/ReferencedEntity.java	2006-11-07 20:16:53 UTC (rev 58189)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., 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.ear;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+
+/**
+ * in EAR/lib directory and referenced by another PU
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+ at Entity
+public class ReferencedEntity
+{
+   private int id;
+
+   @Id
+   @GeneratedValue
+   public int getId()
+   {
+      return id;
+   }
+
+   public void setId(int id)
+   {
+      this.id = id;
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ear/unit/EarUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ear/unit/EarUnitTestCase.java	2006-11-07 20:15:06 UTC (rev 58188)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ear/unit/EarUnitTestCase.java	2006-11-07 20:16:53 UTC (rev 58189)
@@ -0,0 +1,75 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., 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.ear.unit;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.ejb3.test.factory.Session1;
+import org.jboss.ejb3.test.factory.Session2;
+import org.jboss.ejb3.test.factory.MyService;
+import org.jboss.ejb3.test.factory.Util;
+import org.jboss.ejb3.test.factory.Stateful1;
+import org.jboss.ejb3.test.factory.Entity1;
+import org.jboss.ejb3.test.factory.Entity2;
+import org.jboss.ejb3.test.factory.unit.FactoryUnitTestCase;
+import org.jboss.ejb3.test.ear.Facade;
+import junit.framework.Test;
+
+/**
+ * Sample client for the jboss container.
+ *
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Id: FactoryUnitTestCase.java 58110 2006-11-04 08:34:21Z scott.stark at jboss.org $
+ */
+
+public class EarUnitTestCase
+        extends JBossTestCase
+{
+   org.jboss.logging.Logger log = getLog();
+
+   static boolean deployed = false;
+   static int test = 0;
+
+   public EarUnitTestCase(String name)
+   {
+
+      super(name);
+
+   }
+
+   public void testEarLib() throws Exception
+   {
+      Facade facade = (Facade)getInitialContext().lookup("ear-test/FacadeBean/remote");
+      facade.testEarLib();
+   }
+
+   public void testReferencedEntity() throws Exception
+   {
+      Facade facade = (Facade)getInitialContext().lookup("ear-test/FacadeBean/remote");
+      facade.testReferencedEntity();
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(EarUnitTestCase.class, "ear-test.ear");
+   }
+
+}




More information about the jboss-cvs-commits mailing list