[jboss-cvs] JBossAS SVN: r101939 - in branches/JBPAPP_4_2_0_GA_CP/ejb3: src/main/org/jboss/ejb3 and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Mar 5 05:04:39 EST 2010


Author: jaikiran
Date: 2010-03-05 05:04:38 -0500 (Fri, 05 Mar 2010)
New Revision: 101939

Added:
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ear/
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ear/application.xml
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ear/jboss-app.xml
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ejb2/
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ejb2/ejb-jar.xml
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ejb2/jboss.xml
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2EJB.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2Home.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestEJB.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestHome.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceBean.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceMBean.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceRemote.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/unit/
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/unit/JavaENCUnitTestCase.java
Modified:
   branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java
Log:
JBPAPP-933 Wrapped the EJB3 container classloader in a DelegatingClassLoader so that each container has its own classloader (although it would end up delegating to the same parent). This way the ENCFactory will create the java:comp namespace for each EJB3 container against the individual DelegatingClassLoader instead of the parent CL

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml	2010-03-05 09:41:59 UTC (rev 101938)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml	2010-03-05 10:04:38 UTC (rev 101939)
@@ -4080,7 +4080,30 @@
 			</fileset>
 		</jar>
 	</target>
-
+    
+    <target name="jbpapp933" depends="compile-classes">
+        <mkdir dir="${build.lib}"/>
+        
+        <jar jarfile="${build.lib}/jbpapp933-ejb2.jar">
+            <metainf dir="${resources}/test/jbpapp933/ejb2"/>
+            <fileset dir="${build.classes}">
+                <include name="org/jboss/ejb3/test/jbpapp933/ejb2/**.class"/>
+            </fileset>
+        </jar>
+        
+        <jar jarfile="${build.lib}/jbpapp933-ejb3.jar">
+            
+            <fileset dir="${build.classes}">
+                <include name="org/jboss/ejb3/test/jbpapp933/ejb3/**.class"/>
+            </fileset>
+        </jar>
+        
+        <jar jarfile="${build.lib}/jbpapp933.ear">
+            <metainf dir="${resources}/test/jbpapp933/ear"/>
+            <fileset dir="${build.lib}" includes="jbpapp933-*.jar"/>
+        </jar>
+    </target>
+    
 	<target name="jars" depends="ejbthree1090, mdbsessionpoolclear, ejbthree1092, removedislocal, statelesscreation, defaultremotebindings, localfromremote, clusteredjms, entityoptimisticlocking, concurrentnaming, propertyreplacement, persistenceunits, invalidtxmdb, descriptortypo, libdeployment, homeinterface, servicexmbean, arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
       circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440, 
       ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree724, ejbthree751, ejbthree785, ejbthree832,
@@ -4097,6 +4120,7 @@
    	ejbthree1504,
       ejbthree1876,
       jbpapp584,
+      jbpapp933,
       jbpapp999,
       jbpapp1186,
       jbpapp1224,
@@ -4775,6 +4799,9 @@
 		<antcall target="test" inheritRefs="true">
 			<param name="test" value="jbpapp584"/>
 		</antcall>
+	    <antcall target="test" inheritRefs="true">
+	        <param name="test" value="jbpapp933"/>
+	    </antcall>	    
 		<antcall target="test" inheritRefs="true">
 			<param name="test" value="jbpapp999"/>
 		</antcall>

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java	2010-03-05 09:41:59 UTC (rev 101938)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/main/org/jboss/ejb3/Ejb3AnnotationHandler.java	2010-03-05 10:04:38 UTC (rev 101939)
@@ -37,6 +37,7 @@
 import org.jboss.ejb3.stateful.StatefulContainer;
 import org.jboss.ejb3.stateless.StatelessContainer;
 import org.jboss.logging.Logger;
+import org.jboss.util.loading.DelegatingClassLoader;
 
 import javax.ejb.TransactionAttribute;
 import javax.ejb.TransactionAttributeType;
@@ -203,7 +204,7 @@
          throw new RuntimeException("No container configured with name '"
                  + containerName + "''");
 
-      return new ServiceContainer(deployment.getMbeanServer(), di.getClassLoader(), className,
+      return new ServiceContainer(deployment.getMbeanServer(), new DelegatingClassLoader(di.getClassLoader()), className,
               ejbNames.get(ejbIndex), (AspectManager) domain.getManager(), ctxProperties,
               di.getInterceptorInfoRepository(), deployment);
 
@@ -219,7 +220,7 @@
                  + containerName + "''");
 
       return new ConsumerContainer(ejbNames.get(ejbIndex), (AspectManager) domain.getManager(),
-              di.getClassLoader(), className, ctxProperties,
+            new DelegatingClassLoader(di.getClassLoader()), className, ctxProperties,
               di.getInterceptorInfoRepository(), deployment);
 
    }
@@ -233,7 +234,7 @@
          throw new RuntimeException("No container configured with name '"
                  + containerName + "''");
 
-      return new StatefulContainer(di.getClassLoader(), className,
+      return new StatefulContainer(new DelegatingClassLoader(di.getClassLoader()), className,
               ejbNames.get(ejbIndex), (AspectManager) domain.getManager(), ctxProperties,
               di.getInterceptorInfoRepository(), deployment);
 
@@ -249,7 +250,7 @@
          throw new RuntimeException("No container configured with name '"
                  + containerName + "''");
 
-      return new StatelessContainer(di.getClassLoader(), className,
+      return new StatelessContainer(new DelegatingClassLoader(di.getClassLoader()), className,
               ejbNames.get(ejbIndex), (AspectManager) domain.getManager(),
               ctxProperties, di.getInterceptorInfoRepository(),
               deployment);
@@ -281,7 +282,7 @@
          throw new RuntimeException("No container configured with name '"
                  + containerName + "''");
 
-      MDB container = new MDB(ejbNames.get(ejbIndex), (AspectManager) domain.getManager(), di.getClassLoader(), className,
+      MDB container = new MDB(ejbNames.get(ejbIndex), (AspectManager) domain.getManager(), new DelegatingClassLoader(di.getClassLoader()), className,
               ctxProperties, di.getInterceptorInfoRepository(), deployment);
 
       return container;

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ear/application.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ear/application.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ear/application.xml	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application xmlns="http://java.sun.com/xml/ns/javaee" 
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
+             version="5">
+    
+   <display-name>JBPAPP-933</display-name>
+   
+   <module>
+      <ejb>jbpapp933-ejb3.jar</ejb>
+   </module>
+   
+   <module>
+      <ejb>jbpapp933-ejb2.jar</ejb>
+   </module>
+</application>

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ear/jboss-app.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ear/jboss-app.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ear/jboss-app.xml	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,3 @@
+<jboss-app>
+   <module-order>strict</module-order>
+</jboss-app> 
\ No newline at end of file

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ejb2/ejb-jar.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ejb2/ejb-jar.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ejb2/ejb-jar.xml	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+<ejb-jar>
+   <enterprise-beans>
+      <!-- Define two EJB 2 SLSBs with some environment entries -->
+      <session>
+         <description>SLSB2.1</description>
+         <display-name>SLSB2.1</display-name>
+
+         <ejb-name>SLSB21TestEJB</ejb-name>
+
+         <home>org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21TestHome</home>
+         <remote>org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21Test</remote>
+         <ejb-class>org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21TestEJB</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+
+         <env-entry>
+            <env-entry-name>Description</env-entry-name>
+            <env-entry-type>java.lang.String</env-entry-type>
+            <env-entry-value>number 1</env-entry-value>
+         </env-entry>
+         <resource-ref>
+            <res-ref-name>DefaultDS</res-ref-name>
+            <res-type>javax.sql.DataSource</res-type>
+            <res-auth>Container</res-auth>
+         </resource-ref>
+      </session>
+
+      <session>
+         <description>SLSB2.1.2</description>
+         <display-name>SLSB2.1.2</display-name>
+
+         <ejb-name>SLSB21Test2EJB</ejb-name>
+
+         <home>org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21TestHome</home>
+         <remote>org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21Test</remote>
+         <ejb-class>org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21TestEJB</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+
+         <env-entry>
+            <!-- make sure this is the same name as in SLSB21TestEJB, to enforce overlap -->
+            <env-entry-name>Description</env-entry-name>
+            <env-entry-type>java.lang.String</env-entry-type>
+            <env-entry-value>number 2</env-entry-value>
+         </env-entry>
+         <resource-ref>
+            <res-ref-name>DefaultDS</res-ref-name>
+            <res-type>javax.sql.DataSource</res-type>
+            <res-auth>Container</res-auth>
+         </resource-ref>
+      </session>
+   </enterprise-beans>
+</ejb-jar>

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ejb2/jboss.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ejb2/jboss.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/resources/test/jbpapp933/ejb2/jboss.xml	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
+<jboss>
+   <enterprise-beans> 
+      <session>
+         <ejb-name>SLSB21Test2EJB</ejb-name>
+         <jndi-name>SLSB21Test2</jndi-name>
+         <resource-ref>
+            <res-ref-name>DefaultDS</res-ref-name>
+            <jndi-name>java:/DefaultDS</jndi-name>
+         </resource-ref>
+      </session>
+      <session>
+         <ejb-name>SLSB21TestEJB</ejb-name>
+         <jndi-name>SLSB21Test</jndi-name>
+         <resource-ref>
+            <res-ref-name>DefaultDS</res-ref-name>
+            <jndi-name>java:/DefaultDS</jndi-name>
+         </resource-ref>
+      </session>
+   </enterprise-beans>
+</jboss>
\ No newline at end of file

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test.java	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbpapp933.ejb2;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="mailto:dstephan at redhat.com">David Stephan</a>
+ * @version $Revision: $
+ */
+public interface SLSB21Test extends EJBObject
+{
+   String getDescription() throws RemoteException;
+}

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2.java	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbpapp933.ejb2;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="mailto:dstephan at redhat.com">David Stephan</a>
+ * @version $Revision: $
+ */
+public interface SLSB21Test2 extends EJBObject
+{
+}

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2EJB.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2EJB.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2EJB.java	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbpapp933.ejb2;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+/**
+ * @author <a href="mailto:dstephan at redhat.com">David Stephan</a>
+ * @version $Revision: $
+ */
+public class SLSB21Test2EJB implements SessionBean
+{
+	private static final long serialVersionUID = 1L;
+
+	public void ejbCreate() throws CreateException
+	{
+
+	}
+
+	public void ejbActivate() throws EJBException, RemoteException
+	{
+		// TODO Auto-generated method stub
+
+	}
+
+	public void ejbPassivate() throws EJBException, RemoteException
+	{
+		// TODO Auto-generated method stub
+
+	}
+
+	public void ejbRemove() throws EJBException, RemoteException
+	{
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException
+	{
+		// TODO Auto-generated method stub
+
+	}
+}
\ No newline at end of file

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2Home.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2Home.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21Test2Home.java	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbpapp933.ejb2;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * @author <a href="mailto:dstephan at redhat.com">David Stephan</a>
+ * @version $Revision: $
+ */
+public interface SLSB21Test2Home extends EJBHome
+{
+	public static final String COMP_NAME = "java:comp/env/ejb/SLSB21Test2";
+	public static final String JNDI_NAME = "SLSB21Test2EJB";
+
+	public SLSB21Test2 create() throws CreateException, RemoteException;
+
+}

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestEJB.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestEJB.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestEJB.java	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbpapp933.ejb2;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+/**
+ * @author <a href="mailto:dstephan at redhat.com">David Stephan</a>
+ * @version $Revision: $
+ */
+public class SLSB21TestEJB implements SessionBean
+{
+	private static final long serialVersionUID = 1L;
+	
+	private SessionContext ctx;
+
+	public void ejbCreate() throws CreateException
+	{
+
+	}
+
+	public void ejbActivate() throws EJBException, RemoteException
+	{
+		// TODO Auto-generated method stub
+
+	}
+
+	public void ejbPassivate() throws EJBException, RemoteException
+	{
+		// TODO Auto-generated method stub
+
+	}
+
+	public void ejbRemove() throws EJBException, RemoteException
+	{
+		// TODO Auto-generated method stub
+
+	}
+
+	public String getDescription() throws RemoteException
+	{
+	   return (String) ctx.lookup("java:comp/env/Description");
+	}
+	
+	public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
+	{
+		this.ctx = ctx;
+	}
+}
\ No newline at end of file

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestHome.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestHome.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb2/SLSB21TestHome.java	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbpapp933.ejb2;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * @author <a href="mailto:dstephan at redhat.com">David Stephan</a>
+ * @version $Revision: $
+ */
+public interface SLSB21TestHome extends EJBHome
+{
+	public static final String COMP_NAME = "java:comp/env/ejb/SLSB21Test";
+	public static final String JNDI_NAME = "SLSB21TestEJB";
+
+	public SLSB21Test create() throws CreateException, RemoteException;
+
+}

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceBean.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceBean.java	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbpapp933.ejb3;
+
+import javax.naming.InitialContext;
+
+import org.jboss.annotation.ejb.Management;
+import org.jboss.annotation.ejb.Service;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Service
+ at Management(TestServiceMBean.class)
+public class TestServiceBean implements TestServiceMBean, TestServiceRemote
+{
+   private boolean started = false;
+   
+   public void start() throws Exception
+   {
+      new InitialContext().lookup("java:comp/env");
+      started = true;
+   }
+   
+   public boolean hasStarted()
+   {
+      return started;
+   }
+}

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceMBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceMBean.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceMBean.java	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbpapp933.ejb3;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface TestServiceMBean
+{
+   void start() throws Exception;
+}

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceRemote.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceRemote.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/ejb3/TestServiceRemote.java	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbpapp933.ejb3;
+
+import javax.ejb.Remote;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Remote
+public interface TestServiceRemote
+{
+   boolean hasStarted();
+}

Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/unit/JavaENCUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/unit/JavaENCUnitTestCase.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/jbpapp933/unit/JavaENCUnitTestCase.java	2010-03-05 10:04:38 UTC (rev 101939)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbpapp933.unit;
+
+import javax.naming.NameNotFoundException;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21Test;
+import org.jboss.ejb3.test.jbpapp933.ejb2.SLSB21TestHome;
+import org.jboss.ejb3.test.jbpapp933.ejb3.TestServiceRemote;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class JavaENCUnitTestCase extends JBossTestCase
+{
+   /**
+    * @param name
+    */
+   public JavaENCUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * java:comp/env/SLSB21TestEJB has been bound to different entries, let's see.
+    */
+   public void testOverlap1() throws Exception
+   {
+      SLSB21TestHome home = (SLSB21TestHome) getInitialContext().lookup("SLSB21Test");
+      SLSB21Test bean = home.create();
+      String actual = bean.getDescription();
+      assertEquals("number 1", actual);
+   }
+   
+   public void testOverlap2() throws Exception
+   {
+      try
+      {
+         SLSB21TestHome home = (SLSB21TestHome) getInitialContext().lookup("SLSB21Test2");
+         SLSB21Test bean = home.create();
+         String actual = bean.getDescription();
+         assertEquals("number 2", actual);
+      }
+      catch(NameNotFoundException e)
+      {
+         // if we can't find SLSB21Test2 then the test has failed,
+         // because the most likely cause is java:comp/env already bound.
+         fail(e.getMessage());
+      }
+   }
+   
+   public void testService() throws Exception
+   {
+      TestServiceRemote bean = (TestServiceRemote) getInitialContext().lookup("jbpapp933/TestServiceBean/remote");
+      assertTrue(bean.hasStarted());
+   }
+   
+   public void testServerFound() throws Exception
+   {
+      serverFound();
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(JavaENCUnitTestCase.class, "jbpapp933.ear");
+   }
+}




More information about the jboss-cvs-commits mailing list