[jboss-cvs] JBossAS SVN: r59688 - in branches/JBoss_4_0_2_CP/testsuite: src/main/org/jboss/test and 21 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jan 17 10:39:21 EST 2007
Author: tom.elrod at jboss.com
Date: 2007-01-17 10:39:20 -0500 (Wed, 17 Jan 2007)
New Revision: 59688
Added:
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/ejb/
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/ejb/a/
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/ejb/a/SessionAEJB.java
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/ejb/b/
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/ejb/b/SessionBEJB.java
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/a/
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/a/SessionA.java
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/a/SessionAHome.java
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/b/
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/b/SessionB.java
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/b/SessionBHome.java
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/dto/
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/dto/SimpleRequestDTO.java
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/dto/SimpleResponseDTO.java
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/readme.txt
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/test/
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/test/ScopedBUnitTestCase.java
branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/test/ScopedUnitTestCase.java
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ear/
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ear/META-INF/
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ear/META-INF/application.xml
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ear/META-INF/jboss-app.xml
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ejb/
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ejb/META-INF/
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ejb/META-INF/ejb-jar.xml
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ejb/META-INF/jboss.xml
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ear/
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ear/META-INF/
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ear/META-INF/application.xml
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ear/META-INF/jboss-app.xml
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ejb/
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ejb/META-INF/
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ejb/META-INF/ejb-jar.xml
branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ejb/META-INF/jboss.xml
Modified:
branches/JBoss_4_0_2_CP/testsuite/imports/test-jars.xml
Log:
JBAS-3198 - adding scoped deployments with pooled invoker classloader testcase to 4.0.2.CP branch
Modified: branches/JBoss_4_0_2_CP/testsuite/imports/test-jars.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/imports/test-jars.xml 2007-01-17 15:29:15 UTC (rev 59687)
+++ branches/JBoss_4_0_2_CP/testsuite/imports/test-jars.xml 2007-01-17 15:39:20 UTC (rev 59688)
@@ -58,6 +58,7 @@
_jars-proxycompiler,
_jars-readahead,
_jars-retry,
+ _jars-scoped,
_jars-security,
_jars-testbean,
_jars-testbeancluster,
@@ -96,7 +97,7 @@
<include name="junit/framework/*"/>
<include name="junit/runner/*"/>
</patternset>
-
+
<!-- aop test -->
<target name="_jars-aop">
<mkdir dir="${build.lib}"/>
@@ -1075,7 +1076,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1119,7 +1120,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1135,7 +1136,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1160,7 +1161,7 @@
<include name="**/*.*"/>
</fileset>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1175,7 +1176,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1190,7 +1191,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1205,7 +1206,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1220,7 +1221,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1235,7 +1236,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1250,7 +1251,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1275,7 +1276,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1289,7 +1290,7 @@
<include name="**/*.*"/>
</fileset>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1314,7 +1315,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1333,7 +1334,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1348,7 +1349,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
@@ -1373,7 +1374,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
</target>
@@ -1415,7 +1416,7 @@
<include name="org/jboss/test/util/ejb/*"/>
</fileset>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
<!-- build a duplicate cts.jar with new home bindings -->
@@ -1773,11 +1774,102 @@
<include name="**/*.*"/>
</fileset>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
</target>
+ <!-- isolation test -->
+ <target name="_jars-scoped">
+ <mkdir dir="${build.lib}"/>
+
+ <mkdir dir="${build.lib}/scopedA.ear"/>
+ <mkdir dir="${build.lib}/scopedA.ear/scopedA.jar"/>
+ <copy todir="${build.lib}/scopedA.ear/scopedA.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/scoped/ejb/a/**"/>
+ <include name="org/jboss/test/scoped/interfaces/**"/>
+ <include name="org/jboss/test/util/Debug.class"/>
+ <exclude name="**/SimpleResponseDTO*"/>
+ </fileset>
+ <fileset dir="${build.resources}/scoped/a/ejb">
+ <include name="META-INF/*.xml"/>
+ </fileset>
+ </copy>
+
+ <copy todir="${build.lib}/scopedA.ear">
+ <fileset dir="${build.resources}/scoped/a/ear">
+ <include name="META-INF/*.xml"/>
+ </fileset>
+ </copy>
+
+ <mkdir dir="${build.lib}/scopedB.ear"/>
+ <mkdir dir="${build.lib}/scopedB.ear/scopedB.jar"/>
+ <copy todir="${build.lib}/scopedB.ear/scopedB.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/scoped/ejb/b/**"/>
+ <include name="org/jboss/test/scoped/interfaces/**"/>
+ <include name="org/jboss/test/util/Debug.class"/>
+ <exclude name="**/SimpleResponseDTO*"/>
+ </fileset>
+ <fileset dir="${build.resources}/scoped/b/ejb">
+ <include name="META-INF/*.xml"/>
+ </fileset>
+ </copy>
+
+ <copy todir="${build.lib}/scopedB.ear">
+ <fileset dir="${build.resources}/scoped/b/ear">
+ <include name="META-INF/*.xml"/>
+ </fileset>
+ </copy>
+
+ <!-- build scopedA.jar -->
+ <!--<jar destfile="${build.lib}/scopedA.jar">-->
+ <!--<fileset dir="${build.classes}">-->
+ <!--<include name="org/jboss/test/scoped/ejb/a/**"/>-->
+ <!--<include name="org/jboss/test/scoped/interfaces/**"/>-->
+ <!--<include name="org/jboss/test/util/Debug.class"/>-->
+ <!--</fileset>-->
+ <!--<fileset dir="${build.resources}/scoped/a/ejb">-->
+ <!--<include name="META-INF/*.xml"/>-->
+ <!--</fileset>-->
+ <!--</jar>-->
+
+ <!-- build scopedB.jar -->
+ <!--<jar destfile="${build.lib}/scopedB.jar">-->
+ <!--<fileset dir="${build.classes}">-->
+ <!--<include name="org/jboss/test/scoped/ejb/b/**"/>-->
+ <!--<include name="org/jboss/test/scoped/interfaces/**"/>-->
+ <!--<include name="org/jboss/test/util/Debug.class"/>-->
+ <!--</fileset>-->
+ <!--<fileset dir="${build.resources}/scoped/b/ejb">-->
+ <!--<include name="META-INF/*.xml"/>-->
+ <!--</fileset>-->
+ <!--</jar>-->
+
+ <!-- build scopedA.ear -->
+ <!--<jar destfile="${build.lib}/scopedA.ear">-->
+ <!--<fileset dir="${build.lib}">-->
+ <!--<include name="scopedA.jar"/>-->
+ <!--</fileset>-->
+ <!--<fileset dir="${build.resources}/scoped/a/ear">-->
+ <!--<include name="META-INF/*.xml"/>-->
+ <!--</fileset>-->
+ <!--</jar>-->
+
+ <!-- build scopedB.ear -->
+ <!--<jar destfile="${build.lib}/scopedB.ear">-->
+ <!--<fileset dir="${build.lib}">-->
+ <!--<include name="scopedB.jar"/>-->
+ <!--</fileset>-->
+ <!--<fileset dir="${build.resources}/scoped/b/ear">-->
+ <!--<include name="META-INF/*.xml"/>-->
+ <!--</fileset>-->
+ <!--</jar>-->
+
+ </target>
+
+
<!-- foe-deployer test -->
<target name="_jars-foedeployer">
<mkdir dir="${build.lib}"/>
@@ -2764,7 +2856,7 @@
<include name="org/jboss/test/jmx/conf/**"/>
</fileset>
</jar>
-
+
<jar destfile="${build.lib}/testdeploya.sar">
<fileset dir="${build.classes}">
<include name="org/jboss/test/jmx/mbeana/**"/>
@@ -2829,7 +2921,7 @@
<include name="org/jboss/test/jmx/proxy/*.class"/>
</fileset>
</jar>
-
+
<!-- ExternalClass ear including a sar and util jar -->
<jar destfile="${build.lib}/external.sar"
manifest="${build.resources}/jmx/loading/ext/manifest.mf">
@@ -3229,7 +3321,7 @@
<include name="org/jboss/test/jmx/xmbean/XMLAttributePersistenceManagerTestService.class"/>
</fileset>
</jar>
-
+
<!-- xmbean AVC generation from wrapped standard mbean impl -->
<jar jarfile="${build.lib}/listener-xmbean.sar">
<metainf dir="${build.resources}/jmx/xmbean/listener/META-INF"/>
@@ -3488,7 +3580,7 @@
<zipfileset src="${junitejb.junitejb.lib}/junitejb.jar"
includes="net/**/*.*"/>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
</jar>
</target>
@@ -3514,7 +3606,7 @@
<include name="*.properties"/>
</zipfileset>
<zipfileset src="${junit.junit.lib}/junit.jar">
- <patternset refid="ejbrunner.set"/>
+ <patternset refid="ejbrunner.set"/>
</zipfileset>
<fileset dir="${build.resources}/naming/jar">
<include name="META-INF/*.xml"/>
@@ -4680,7 +4772,7 @@
<include name="webservices.xml"/>
</webinf>
</war>
-
+
<!-- ws4ee-contextroot -->
<jar destfile="${build.lib}/ws4ee-contextmodule.jar" manifest="${build.etc}/manifest.mf">
<fileset dir="${build.classes}">
@@ -4825,7 +4917,7 @@
<include name="org/jboss/test/webservice/handlerflow/HelloFeedbackServlet.class"/>
<include name="org/jboss/test/webservice/handlerflow/HandlerBase.class"/>
<!-- With UseJBossWebLoader=false the static state in HandlerTracker can only live
- in the jar, which must be deployed first
+ in the jar, which must be deployed first
<include name="org/jboss/test/webservice/handlerflow/HandlerTracker.class"/>
-->
<include name="org/jboss/test/webservice/handlerflow/ServerHandler1.class"/>
@@ -5270,8 +5362,8 @@
<metainf dir="${source.resources}/webservice/jbws1034/WEB-INF">
<include name="jaxrpc-mapping.xml"/>
</metainf>
- </jar>
-
+ </jar>
+
<!-- ws4ee-jbws349 -->
<war warfile="${build.lib}/ws4ee-jbws349.war" webxml="${build.resources}/webservice/jbws349/WEB-INF/web.xml">
<classes dir="${build.classes}">
@@ -5299,7 +5391,7 @@
<include name="wsdl/**"/>
</metainf>
</jar>
-
+
<!-- ws4ee-marshall-doclit -->
<jar destfile="${build.lib}/ws4ee-marshall-doclit.jar" manifest="${build.etc}/manifest.mf">
<fileset dir="${build.classes}">
Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/ejb/a/SessionAEJB.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/ejb/a/SessionAEJB.java (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/ejb/a/SessionAEJB.java 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,96 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.test.scoped.ejb.a;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.util.Debug;
+import org.jboss.test.scoped.interfaces.dto.SimpleResponseDTO;
+import org.jboss.test.scoped.interfaces.dto.SimpleRequestDTO;
+
+import javax.ejb.SessionBean;
+import javax.ejb.EJBException;
+import javax.ejb.CreateException;
+import javax.ejb.SessionContext;
+import javax.naming.InitialContext;
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:tom at jboss.org">Tom Elrod</a>
+ */
+public class SessionAEJB implements SessionBean
+{
+ private static final long serialVersionUID = 1L;
+
+ public SessionAEJB()
+ {
+ super();
+ }
+
+
+ public SimpleResponseDTO runSimpleTest(SimpleRequestDTO requestDTO)
+ {
+
+ try
+ {
+ SimpleResponseDTO rsDTO = new SimpleResponseDTO();
+ rsDTO.setFirstName(requestDTO.getFirstName().toUpperCase());
+ rsDTO.setLastName(requestDTO.getLastName().toUpperCase());
+ System.out.println("Got firstname: " + requestDTO.getFirstName());
+ System.out.println("Got lastname:" + requestDTO.getLastName());
+ return rsDTO;
+ }
+ catch (Throwable t)
+ {
+ Logger logger=Logger.getLogger(this.getClass());
+ logger.error(t);
+
+ SimpleResponseDTO rsDTO = new SimpleResponseDTO();
+
+ return rsDTO;
+ }
+ }
+
+ public String stringTest(String request) throws java.rmi.RemoteException
+ {
+ return request.toUpperCase();
+ }
+
+ public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbCreate() throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbRemove() throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbActivate() throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbPassivate() throws EJBException, RemoteException
+ {
+ }
+ }
Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/ejb/b/SessionBEJB.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/ejb/b/SessionBEJB.java (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/ejb/b/SessionBEJB.java 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,93 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.test.scoped.ejb.b;
+
+import org.jboss.test.scoped.interfaces.dto.SimpleResponseDTO;
+import org.jboss.test.scoped.interfaces.dto.SimpleRequestDTO;
+import org.jboss.logging.Logger;
+
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.ejb.EJBException;
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:tom at jboss.org">Tom Elrod</a>
+ */
+public class SessionBEJB implements SessionBean
+{
+ private static final long serialVersionUID = 2L;
+
+ public SessionBEJB()
+ {
+ super();
+ }
+
+
+ public SimpleResponseDTO runSimpleTest(SimpleRequestDTO requestDTO)
+ {
+
+ try
+ {
+ SimpleResponseDTO rsDTO = new SimpleResponseDTO();
+ rsDTO.setFirstName(requestDTO.getFirstName().toUpperCase());
+ rsDTO.setLastName(requestDTO.getLastName().toUpperCase());
+ System.out.println("Got firstname: " + requestDTO.getFirstName());
+ System.out.println("Got lastname:" + requestDTO.getLastName());
+ return rsDTO;
+ }
+ catch (Throwable t)
+ {
+ Logger logger=Logger.getLogger(this.getClass());
+ logger.error(t);
+
+ SimpleResponseDTO rsDTO = new SimpleResponseDTO();
+
+ return rsDTO;
+ }
+ }
+
+ public String stringTest(String request) throws java.rmi.RemoteException
+ {
+ return request.toUpperCase();
+ }
+
+ public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbCreate() throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbRemove() throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbActivate() throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbPassivate() throws EJBException, RemoteException
+ {
+ }
+ }
Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/a/SessionA.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/a/SessionA.java (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/a/SessionA.java 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,36 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.test.scoped.interfaces.a;
+
+import org.jboss.test.scoped.interfaces.dto.SimpleResponseDTO;
+import org.jboss.test.scoped.interfaces.dto.SimpleRequestDTO;
+
+import javax.ejb.EJBObject;
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
+ */
+public interface SessionA extends EJBObject
+{
+ public SimpleResponseDTO runSimpleTest(SimpleRequestDTO requestDTO) throws RemoteException;
+}
\ No newline at end of file
Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/a/SessionAHome.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/a/SessionAHome.java (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/a/SessionAHome.java 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,35 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.test.scoped.interfaces.a;
+
+
+import javax.ejb.EJBHome;
+import javax.ejb.CreateException;
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
+ */
+public interface SessionAHome extends EJBHome
+{
+ SessionA create() throws CreateException, RemoteException;
+}
Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/b/SessionB.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/b/SessionB.java (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/b/SessionB.java 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,36 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.test.scoped.interfaces.b;
+
+import org.jboss.test.scoped.interfaces.dto.SimpleResponseDTO;
+import org.jboss.test.scoped.interfaces.dto.SimpleRequestDTO;
+
+import javax.ejb.EJBObject;
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
+ */
+public interface SessionB extends EJBObject
+{
+ public SimpleResponseDTO runSimpleTest(SimpleRequestDTO requestDTO) throws RemoteException;
+}
\ No newline at end of file
Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/b/SessionBHome.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/b/SessionBHome.java (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/b/SessionBHome.java 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,36 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.test.scoped.interfaces.b;
+
+import org.jboss.test.scoped.interfaces.a.SessionA;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
+ */
+public interface SessionBHome extends EJBHome
+{
+ SessionB create() throws CreateException, RemoteException;
+}
Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/dto/SimpleRequestDTO.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/dto/SimpleRequestDTO.java (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/dto/SimpleRequestDTO.java 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,61 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.test.scoped.interfaces.dto;
+
+import java.io.Serializable;
+import java.util.Random;
+
+/**
+ * @author <a href="mailto:tom at jboss.org">Tom Elrod</a>
+ */
+public class SimpleRequestDTO implements Serializable
+{
+ private static final long serialVersionUID = 2L;
+
+ private String firstName;
+ private String lastName;
+
+ public SimpleRequestDTO()
+ {
+ }
+
+
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public String getLastName()
+ {
+ return lastName;
+ }
+
+ public void setFirstName(String firstName)
+ {
+ this.firstName = firstName;
+ }
+
+ public void setLastName(String lastName)
+ {
+ this.lastName = lastName;
+ }
+}
Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/dto/SimpleResponseDTO.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/dto/SimpleResponseDTO.java (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/interfaces/dto/SimpleResponseDTO.java 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,41 @@
+package org.jboss.test.scoped.interfaces.dto;
+
+import java.io.Serializable;
+import java.util.Random;
+
+public class SimpleResponseDTO implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+// private static final long serialVersionUID = new Random().nextLong();
+
+ private String firstName;
+ private String lastName;
+
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public String getLastName()
+ {
+ return lastName;
+ }
+
+ public void setFirstName(String firstName)
+ {
+ this.firstName = firstName;
+ }
+
+ public void setLastName(String lastName)
+ {
+ this.lastName = lastName;
+ }
+
+ public SimpleResponseDTO()
+ {
+
+
+ }
+
+
+}
\ No newline at end of file
Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/readme.txt
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/readme.txt (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/readme.txt 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,15 @@
+This test is for JBAS-3198. The bug that is being tested for is when using two scoped ejb deployments and
+the pooled invoker, the OptimizedObjectInputStream was caching the class definitions when loaded in a static
+cache without regard to which classloader the class was originally loaded from. Therefore, if ejbA made a call
+and loaded class Foo (with serialVersionUID = 1L) and then ejbB tried to load class Foo (which would have
+a serialVerionUID = 2L), the first Foo class loaded (i.e. serialVersionUID = 1L) would be retreived from the
+cache and used instead of loading the correct class.
+
+For the tests themselves, have created two ejb deployments, A and B, which are both scoped deployments.
+Both return SimpleResponseDTO. The test clients (ScopedUnitTestCase and ScopedBUnitTestCase) use
+javassist to create a new copy of the SimpleResponseDTO class (one with serialiVersionUID = 1L and the other
+with serialVersionUID = 2L) that gets included its ejb deployment and on local classpath (for the client).
+
+To properly test, have to run both ScopedUnitTestCase and then ScopedBUnitTestCase (or vise versa) against
+same running instance of JBoss server (i.e. running one, then re-booting JBossAS and running the other does
+not test for this bug fix).
\ No newline at end of file
Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/test/ScopedBUnitTestCase.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/test/ScopedBUnitTestCase.java (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/test/ScopedBUnitTestCase.java 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,177 @@
+package org.jboss.test.scoped.test;
+
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtField;
+import javassist.CtMethod;
+import javassist.CtNewMethod;
+import javassist.Modifier;
+import org.jboss.deployment.EARDeployerMBean;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.scoped.interfaces.b.SessionB;
+import org.jboss.test.scoped.interfaces.b.SessionBHome;
+import org.jboss.test.scoped.interfaces.dto.SimpleRequestDTO;
+
+import javax.management.Attribute;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:tom at jboss.org">Tom Elrod</a>
+ */
+public class ScopedBUnitTestCase extends JBossTestCase
+{
+ public ScopedBUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testScoped() throws Exception
+ {
+// isolateDeployments(Boolean.TRUE);
+
+ // scoped deployment B
+
+ // have to create response classes with different serialVersionUID for each deployment
+ String jbosstestDeployDir = System.getProperty("jbosstest.deploy.dir");
+ System.out.println("jbosstestDeployDir = " + jbosstestDeployDir);
+ String deployBDir = "/scopedB.ear/scopedB.jar";
+ File libDir = new File(jbosstestDeployDir, deployBDir);
+ System.out.println("libDir = " + libDir.getAbsolutePath());
+ // Create a SimpleResponseDTO class with a static serialVersionUID of 1L
+ //ClassPool defaultPool = ClassPool.getDefault();
+ ClassPool classes1Pool = ClassPool.getDefault();
+ //ClassPool classes1Pool = new ClassPool(defaultPool);
+ CtClass info = classes1Pool.makeClass("org.jboss.test.scoped.interfaces.dto.SimpleResponseDTO");
+ info.addInterface(classes1Pool.get("java.io.Serializable"));
+ CtClass s = classes1Pool.get("java.lang.String");
+ CtField firstName = new CtField(s, "firstName", info);
+ firstName.setModifiers(Modifier.PRIVATE);
+ info.addField(firstName);
+ CtMethod getFirstName = CtNewMethod.getter("getFirstName", firstName);
+ getFirstName.setModifiers(Modifier.PUBLIC);
+ info.addMethod(getFirstName);
+ CtMethod setFirstName = CtNewMethod.setter("setFirstName", firstName);
+ setFirstName.setModifiers(Modifier.PUBLIC);
+ info.addMethod(setFirstName);
+ CtClass s2 = classes1Pool.get("java.lang.String");
+ CtField lastName = new CtField(s2, "lastName", info);
+ lastName.setModifiers(Modifier.PRIVATE);
+ info.addField(lastName);
+ CtMethod getLastName = CtNewMethod.getter("getLastName", lastName);
+ getLastName.setModifiers(Modifier.PUBLIC);
+ info.addMethod(getLastName);
+ CtMethod setLastName = CtNewMethod.setter("setLastName", lastName);
+ setLastName.setModifiers(Modifier.PUBLIC);
+ info.addMethod(setLastName);
+ //CtClass s3 = classes1Pool.get("java.lang.Long");
+ //CtField serialVersion = new CtField(s3, "serialVersionUID", info);
+ CtField serialVersion = new CtField(CtClass.longType, "serialVersionUID", info);
+ serialVersion.setModifiers(Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL);
+ long serialVerionUID = 2L;
+ info.addField(serialVersion, CtField.Initializer.constant(serialVerionUID));
+
+ info.writeFile(libDir.getAbsolutePath());
+
+
+ String classesBDir = "/classes";
+ File rootDeployDir = new File(jbosstestDeployDir);
+ String rootDeployDirPath = rootDeployDir.getParent();
+ File classesDir = new File(rootDeployDirPath, classesBDir);
+ System.out.println("classesDir = " + classesDir.getAbsolutePath());
+
+// info.writeFile(classesDir.getAbsolutePath());
+
+ // copy the generated file in deploy to the classes directory
+ SimpleRequestDTO tmpFile = new SimpleRequestDTO();
+ String classPath = tmpFile.getClass().getResource("SimpleResponseDTO.class").getPath();
+ File fileSrc = new File(libDir.getAbsolutePath() + "/org/jboss/test/scoped/interfaces/dto/SimpleResponseDTO.class");
+ File fileDest = new File(classPath);
+ copyFiles(fileSrc, fileDest);
+
+
+ try
+ {
+// deploy("scopedA.ear");
+ try
+ {
+ // Run the test
+ deploy("scopedB.ear");
+ try
+ {
+ doTest();
+ }
+ finally
+ {
+ undeploy("scopedB.ear");
+ }
+
+ // Run the test after a redeployment
+// deploy("scopedB.ear");
+// try x
+// {
+// doTest();
+// }
+// finally
+// {
+// undeploy("scopedB.ear");
+// }
+ }
+ finally
+ {
+ //undeploy("scopedA.ear");
+ }
+ }
+ finally
+ {
+ isolateDeployments(Boolean.FALSE);
+ }
+ }
+
+ private void copyFiles(File fileSrc, File fileDest) throws IOException
+ {
+ FileInputStream fis = new FileInputStream(fileSrc);
+ FileOutputStream fos = new FileOutputStream(fileDest);
+ byte[] buf = new byte[1024];
+ int i = 0;
+ while ((i = fis.read(buf)) != -1)
+ {
+ fos.write(buf, 0, i);
+ }
+ fis.close();
+ fos.close();
+ }
+
+ private void doTest() throws Exception
+ {
+// Properties env = new Properties();
+// env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+// //env.put("java.naming.provider.url", "localhost:1099");
+// env.put("java.naming.provider.url", "localhost:1100");
+// env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+//
+// Context ic = new InitialContext(env);
+
+ SessionBHome home = (SessionBHome) getInitialContext().lookup("SessionB");
+ SessionB session = home.create();
+
+
+ SimpleRequestDTO requestDTO = new SimpleRequestDTO();
+ requestDTO.setFirstName("Daffy");
+ requestDTO.setLastName("Duck");
+ //SimpleResponseDTO result = session.runSimpleTest(requestDTO);
+ Object result = session.runSimpleTest(requestDTO);
+
+ System.out.println("result was " + result);
+ //System.out.println(result.getFirstName() + " " + result.getLastName());
+
+ }
+
+ private void isolateDeployments(Boolean value) throws Exception
+ {
+ //getServer().setAttribute(EARDeployerMBean.OBJECT_NAME, new Attribute("Isolated", value));
+ getServer().setAttribute(EARDeployerMBean.OBJECT_NAME, new Attribute("CallByValue", value));
+ }
+}
Added: branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/test/ScopedUnitTestCase.java
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/test/ScopedUnitTestCase.java (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/main/org/jboss/test/scoped/test/ScopedUnitTestCase.java 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,212 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, 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.test.scoped.test;
+
+import org.jboss.deployment.EARDeployerMBean;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.scoped.interfaces.a.SessionA;
+import org.jboss.test.scoped.interfaces.a.SessionAHome;
+import org.jboss.test.scoped.interfaces.dto.SimpleRequestDTO;
+import org.jboss.test.scoped.interfaces.dto.SimpleResponseDTO;
+import org.jboss.test.scoped.interfaces.b.SessionBHome;
+import org.jboss.test.scoped.interfaces.b.SessionB;
+
+import javax.management.Attribute;
+import java.io.File;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+import java.net.URL;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+
+import org.jboss.mx.loading.UnifiedLoaderRepository3;
+import org.jboss.mx.loading.RepositoryClassLoader;
+import org.jboss.test.util.ClassMover;
+import org.apache.log4j.Logger;
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtField;
+import javassist.Modifier;
+import javassist.CtMethod;
+import javassist.CtNewMethod;
+
+
+/**
+ * @author <a href="mailto:tom at jboss.org">Tom Elrod</a>
+ */
+public class ScopedUnitTestCase extends JBossTestCase
+{
+ public ScopedUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testScoped() throws Exception
+ {
+// isolateDeployments(Boolean.TRUE);
+
+ // scoped deployment A
+
+ // have to create response classes with different serialVersionUID for each deployment
+ String jbosstestDeployDir = System.getProperty("jbosstest.deploy.dir");
+ System.out.println("jbosstestDeployDir = " + jbosstestDeployDir);
+ String deployADir = "/scopedA.ear/scopedA.jar";
+ File libDir = new File(jbosstestDeployDir, deployADir);
+ System.out.println("libDir = " + libDir.getAbsolutePath());
+ // Create a SimpleResponseDTO class with a static serialVersionUID of 1L
+ //ClassPool defaultPool = ClassPool.getDefault();
+ ClassPool classes1Pool = ClassPool.getDefault();
+ //ClassPool classes1Pool = new ClassPool(defaultPool);
+ CtClass info = classes1Pool.makeClass("org.jboss.test.scoped.interfaces.dto.SimpleResponseDTO");
+ info.addInterface(classes1Pool.get("java.io.Serializable"));
+ CtClass s = classes1Pool.get("java.lang.String");
+ CtField firstName = new CtField(s, "firstName", info);
+ firstName.setModifiers(Modifier.PRIVATE);
+ info.addField(firstName);
+ CtMethod getFirstName = CtNewMethod.getter("getFirstName", firstName);
+ getFirstName.setModifiers(Modifier.PUBLIC);
+ info.addMethod(getFirstName);
+ CtMethod setFirstName = CtNewMethod.setter("setFirstName", firstName);
+ setFirstName.setModifiers(Modifier.PUBLIC);
+ info.addMethod(setFirstName);
+ CtClass s2 = classes1Pool.get("java.lang.String");
+ CtField lastName = new CtField(s2, "lastName", info);
+ lastName.setModifiers(Modifier.PRIVATE);
+ info.addField(lastName);
+ CtMethod getLastName = CtNewMethod.getter("getLastName", lastName);
+ getLastName.setModifiers(Modifier.PUBLIC);
+ info.addMethod(getLastName);
+ CtMethod setLastName = CtNewMethod.setter("setLastName", lastName);
+ setLastName.setModifiers(Modifier.PUBLIC);
+ info.addMethod(setLastName);
+ //CtClass s3 = classes1Pool.get("java.lang.Long");
+ CtField serialVersion = new CtField(CtClass.longType, "serialVersionUID", info);
+ serialVersion.setModifiers(Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL);
+ long serialVerionUID = 1L;
+ info.addField(serialVersion, CtField.Initializer.constant(serialVerionUID));
+
+ info.writeFile(libDir.getAbsolutePath());
+
+ String classesBDir = "/classes";
+ File rootDeployDir = new File(jbosstestDeployDir);
+ String rootDeployDirPath = rootDeployDir.getParent();
+ File classesDir = new File(rootDeployDirPath, classesBDir);
+ System.out.println("classesDir = " + classesDir.getAbsolutePath());
+
+// info.writeFile(classesDir.getAbsolutePath());
+
+ // copy the generated file in deploy to the classes directory
+ SimpleRequestDTO tmpFile = new SimpleRequestDTO();
+ String classPath = tmpFile.getClass().getResource("SimpleResponseDTO.class").getPath();
+ File fileSrc = new File(libDir.getAbsolutePath() + "/org/jboss/test/scoped/interfaces/dto/SimpleResponseDTO.class");
+ File fileDest = new File(classPath);
+ copyFiles(fileSrc, fileDest);
+
+
+ try
+ {
+ deploy("scopedA.ear");
+ try
+ {
+ // Run the test
+// deploy("scopedB.ear");
+ try
+ {
+ doTest();
+ }
+ finally
+ {
+ //undeploy("scopedB.ear");
+ }
+
+ // Run the test after a redeployment
+// deploy("scopedB.ear");
+// try x
+// {
+// doTest();
+// }
+// finally
+// {
+// undeploy("scopedB.ear");
+// }
+ }
+ finally
+ {
+ undeploy("scopedA.ear");
+ }
+ }
+ finally
+ {
+// isolateDeployments(Boolean.FALSE);
+ }
+ }
+
+ private void copyFiles(File fileSrc, File fileDest) throws IOException
+ {
+ FileInputStream fis = new FileInputStream(fileSrc);
+ FileOutputStream fos = new FileOutputStream(fileDest);
+ byte[] buf = new byte[1024];
+ int i = 0;
+ while ((i = fis.read(buf)) != -1)
+ {
+ fos.write(buf, 0, i);
+ }
+ fis.close();
+ fos.close();
+ }
+
+
+ private void doTest() throws Exception
+ {
+// Properties env = new Properties();
+// env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+// //env.put("java.naming.provider.url", "localhost:1099");
+// env.put("java.naming.provider.url", "localhost:1100");
+// env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+//
+// Context ic = new InitialContext(env);
+
+ SessionAHome home = (SessionAHome) getInitialContext().lookup("SessionA");
+ SessionA session = home.create();
+
+
+ SimpleRequestDTO requestDTO = new SimpleRequestDTO();
+ requestDTO.setFirstName("Daffy");
+ requestDTO.setLastName("Duck");
+ SimpleResponseDTO result = session.runSimpleTest(requestDTO);
+
+ System.out.println(result.getFirstName() + " " + result.getLastName());
+
+ }
+
+ private void isolateDeployments(Boolean value) throws Exception
+ {
+ //getServer().setAttribute(EARDeployerMBean.OBJECT_NAME, new Attribute("Isolated", value));
+ getServer().setAttribute(EARDeployerMBean.OBJECT_NAME, new Attribute("CallByValue", value));
+ }
+}
Added: branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ear/META-INF/application.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ear/META-INF/application.xml (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ear/META-INF/application.xml 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<application>
+ <display-name>scopedA</display-name>
+ <module>
+ <ejb>scopedA.jar</ejb>
+ </module>
+</application>
+
Added: branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ear/META-INF/jboss-app.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ear/META-INF/jboss-app.xml (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ear/META-INF/jboss-app.xml 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,5 @@
+<jboss-app>
+ <loader-repository>jboss.test:loader=sessionA.ear
+ <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
+ </loader-repository>
+</jboss-app>
\ No newline at end of file
Added: branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ejb/META-INF/ejb-jar.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ejb/META-INF/ejb-jar.xml (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ejb/META-INF/ejb-jar.xml 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,17 @@
+<?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>
+ <session>
+ <ejb-name>SessionA</ejb-name>
+ <home>org.jboss.test.scoped.interfaces.a.SessionAHome</home>
+ <remote>org.jboss.test.scoped.interfaces.a.SessionA</remote>
+ <ejb-class>org.jboss.test.scoped.ejb.a.SessionAEJB</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
Added: branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ejb/META-INF/jboss.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ejb/META-INF/jboss.xml (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/a/ejb/META-INF/jboss.xml 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jboss>
+ <enterprise-beans>
+ <session>
+ <ejb-name>SessionA</ejb-name>
+ <configuration-name>Pooled Stateless SessionBean</configuration-name>
+ <invoker-bindings>
+ <invoker>
+ <invoker-proxy-binding-name>stateless-pooled-invoker</invoker-proxy-binding-name>
+ <jndi-name>SessionA</jndi-name>
+ </invoker>
+ </invoker-bindings>
+ </session>
+ </enterprise-beans>
+
+ <invoker-proxy-bindings>
+ <!--<invoker-proxy-binding>-->
+ <!--<name>stateless-pooled-invoker</name>-->
+ <!--<invoker-mbean>jboss:service=invoker,type=pooled</invoker-mbean>-->
+ <!--<proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>-->
+ <!--<proxy-factory-config>-->
+ <!--<client-interceptors>-->
+ <!--<home>-->
+ <!--<interceptor>org.jboss.proxy.ejb.HomeInterceptor</interceptor>-->
+ <!--<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>-->
+ <!--<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>-->
+ <!--<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>-->
+ <!--</home>-->
+ <!--<bean>-->
+ <!--<interceptor>org.jboss.proxy.ejb.StatelessSessionInterceptor</interceptor>-->
+ <!--<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>-->
+ <!--<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>-->
+ <!--<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>-->
+ <!--</bean>-->
+ <!--</client-interceptors>-->
+ <!--</proxy-factory-config>-->
+ <!--</invoker-proxy-binding>-->
+
+ <invoker-proxy-binding>
+ <name>stateless-pooled-invoker</name>
+ <invoker-mbean>jboss:service=invoker,type=pooled</invoker-mbean>
+ <proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
+ <proxy-factory-config>
+ <client-interceptors>
+ <home>
+ <interceptor>org.jboss.proxy.ejb.HomeInterceptor</interceptor>
+ <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
+ <interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
+ <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+ <!--<interceptor call-by-value="false">org.jboss.invocation.InvokerInterceptor</interceptor>-->
+ <!--<interceptor call-by-value="true">org.jboss.invocation.MarshallingInvokerInterceptor</interceptor>-->
+ </home>
+ <bean>
+ <interceptor>org.jboss.proxy.ejb.StatelessSessionInterceptor</interceptor>
+ <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
+ <interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
+ <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+ <!--<interceptor call-by-value="false">org.jboss.invocation.InvokerInterceptor</interceptor>-->
+ <!--<interceptor call-by-value="true">org.jboss.invocation.MarshallingInvokerInterceptor</interceptor>-->
+ </bean>
+ </client-interceptors>
+ </proxy-factory-config>
+ </invoker-proxy-binding>
+
+ </invoker-proxy-bindings>
+
+ <container-configurations>
+ <container-configuration extends="Standard Stateless SessionBean">
+ <container-name>Pooled Stateless SessionBean</container-name>
+ <invoker-proxy-binding-name>stateless-pooled-invoker</invoker-proxy-binding-name>
+ </container-configuration>
+ </container-configurations>
+
+
+</jboss>
Added: branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ear/META-INF/application.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ear/META-INF/application.xml (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ear/META-INF/application.xml 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<application>
+ <display-name>scopedB</display-name>
+ <module>
+ <ejb>scopedB.jar</ejb>
+ </module>
+</application>
+
Added: branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ear/META-INF/jboss-app.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ear/META-INF/jboss-app.xml (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ear/META-INF/jboss-app.xml 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,5 @@
+<jboss-app>
+ <loader-repository>jboss.test:loader=sessionB.ear
+ <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
+ </loader-repository>
+</jboss-app>
\ No newline at end of file
Added: branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ejb/META-INF/ejb-jar.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ejb/META-INF/ejb-jar.xml (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ejb/META-INF/ejb-jar.xml 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,17 @@
+<?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>
+ <session>
+ <ejb-name>SessionB</ejb-name>
+ <home>org.jboss.test.scoped.interfaces.b.SessionBHome</home>
+ <remote>org.jboss.test.scoped.interfaces.b.SessionB</remote>
+ <ejb-class>org.jboss.test.scoped.ejb.b.SessionBEJB</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
Added: branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ejb/META-INF/jboss.xml
===================================================================
--- branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ejb/META-INF/jboss.xml (rev 0)
+++ branches/JBoss_4_0_2_CP/testsuite/src/resources/scoped/b/ejb/META-INF/jboss.xml 2007-01-17 15:39:20 UTC (rev 59688)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jboss>
+ <enterprise-beans>
+ <session>
+ <ejb-name>SessionB</ejb-name>
+ <configuration-name>Pooled Stateless SessionBean</configuration-name>
+ <invoker-bindings>
+ <invoker>
+ <invoker-proxy-binding-name>stateless-pooled-invoker</invoker-proxy-binding-name>
+ <jndi-name>SessionB</jndi-name>
+ </invoker>
+ </invoker-bindings>
+ </session>
+ </enterprise-beans>
+
+ <invoker-proxy-bindings>
+ <!--<invoker-proxy-binding>-->
+ <!--<name>stateless-pooled-invoker</name>-->
+ <!--<invoker-mbean>jboss:service=invoker,type=pooled</invoker-mbean>-->
+ <!--<proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>-->
+ <!--<proxy-factory-config>-->
+ <!--<client-interceptors>-->
+ <!--<home>-->
+ <!--<interceptor>org.jboss.proxy.ejb.HomeInterceptor</interceptor>-->
+ <!--<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>-->
+ <!--<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>-->
+ <!--<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>-->
+ <!--</home>-->
+ <!--<bean>-->
+ <!--<interceptor>org.jboss.proxy.ejb.StatelessSessionInterceptor</interceptor>-->
+ <!--<interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>-->
+ <!--<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>-->
+ <!--<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>-->
+ <!--</bean>-->
+ <!--</client-interceptors>-->
+ <!--</proxy-factory-config>-->
+ <!--</invoker-proxy-binding>-->
+
+ <invoker-proxy-binding>
+ <name>stateless-pooled-invoker</name>
+ <invoker-mbean>jboss:service=invoker,type=pooled</invoker-mbean>
+ <proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
+ <proxy-factory-config>
+ <client-interceptors>
+ <home>
+ <interceptor>org.jboss.proxy.ejb.HomeInterceptor</interceptor>
+ <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
+ <interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
+ <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+ <!--<interceptor call-by-value="false">org.jboss.invocation.InvokerInterceptor</interceptor>-->
+ <!--<interceptor call-by-value="true">org.jboss.invocation.MarshallingInvokerInterceptor</interceptor>-->
+ </home>
+ <bean>
+ <interceptor>org.jboss.proxy.ejb.StatelessSessionInterceptor</interceptor>
+ <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
+ <interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
+ <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
+ <!--<interceptor call-by-value="false">org.jboss.invocation.InvokerInterceptor</interceptor>-->
+ <!--<interceptor call-by-value="true">org.jboss.invocation.MarshallingInvokerInterceptor</interceptor>-->
+ </bean>
+ </client-interceptors>
+ </proxy-factory-config>
+ </invoker-proxy-binding>
+
+ </invoker-proxy-bindings>
+
+ <container-configurations>
+ <container-configuration extends="Standard Stateless SessionBean">
+ <container-name>Pooled Stateless SessionBean</container-name>
+ <invoker-proxy-binding-name>stateless-pooled-invoker</invoker-proxy-binding-name>
+ </container-configuration>
+ </container-configurations>
+
+
+</jboss>
More information about the jboss-cvs-commits
mailing list