[jboss-cvs] JBossAS SVN: r57959 - in branches/JBoss_3_2_7_CP/testsuite: . imports src/main/org/jboss src/main/org/jboss/ant src/main/org/jboss/ant/taskdefs src/main/org/jboss/test src/main/org/jboss/test/compatibility src/main/org/jboss/test/compatibility/test src/main/org/jboss/test/compatibility/test/matrix src/main/org/jboss/test/testbyvalue src/main/org/jboss/test/testbyvalue/META-INF src/resources src/resources/testbyvalue src/resources/testbyvalue/bean src/resources/testbyvalue/interfaces src/resources/testbyvalue/test
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 31 19:48:36 EST 2006
Author: jaroslaw.kijanowski
Date: 2006-10-31 19:48:35 -0500 (Tue, 31 Oct 2006)
New Revision: 57959
Added:
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/ant/
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/ant/taskdefs/
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/ant/taskdefs/AntCallOnDirectoryList.java
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/ant/taskdefs/XMLJUnitMultipleResultFormatter.java
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/compatibility/
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/compatibility/test/
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/compatibility/test/matrix/
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/compatibility/test/matrix/MatrixTestContainer.java
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/ejb-jar.xml
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/jboss.xml
branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/jbosscmp-jdbc.xml
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByReferenceStatelessSessionBean.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByValueEntityBean.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByValueStatelessSessionBean.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByValueStefulSessionBean.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ClassWithProperty.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/RootStatelessSessionBean.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByReferenceStatelessSession.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByReferenceStatelessSessionHome.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueEntity.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueEntityHome.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatefulSession.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatefulSessionHome.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatelessSession.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatelessSessionHome.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/RootStatelessSession.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/RootStatelessSessionHome.java
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/test/
branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/test/ByValueUnitTestCase.java
Modified:
branches/JBoss_3_2_7_CP/testsuite/build.xml
branches/JBoss_3_2_7_CP/testsuite/imports/test-jars.xml
Log:
backporting compatibility matrix tests - JBQA-535
Modified: branches/JBoss_3_2_7_CP/testsuite/build.xml
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/build.xml 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/build.xml 2006-11-01 00:48:35 UTC (rev 57959)
@@ -1825,4 +1825,115 @@
</style>
</target>
+ <!-- Matrix Test Suite -->
+
+ <!-- It requires -Dmatrix-versions=defined if you want to execute this task.
+ More information at http://wiki.jboss.org/wiki/Wiki.jsp?page=HowToExecuteMatrixTests
+ -->
+
+ <target name="tests-matrix"
+ description="Executes only the version check compatibility suite. Use -Dmatrix-versions=[version container] for this task" depends="maybejars" if="matrix-versions">
+ <test-compatibility client-version="3_2_7" serialization-flag=""/>
+ <test-compatibility client-version="3_2_8" serialization-flag=""/>
+ <test-compatibility client-version="3_2_8SP1" serialization-flag=""/>
+ </target>
+
+ <macrodef name="test-compatibility">
+ <attribute name="client-version"/>
+ <attribute name="serialization-flag"/>
+ <sequential>
+ <start-jboss conf="all" jvmargs="-Xmx128m @{serialization-flag}"/>
+ <wait-on-host/>
+ <antcall target="tests-standard-unit-matrix-version">
+ <param name="matrix-configuration" value="@{client-version}"/>
+ <param name="current-version-dir" value="${matrix-versions}/@{client-version}"/>
+ </antcall>
+ <!--stop-jboss jvmargs="@{serialization-flag}"/-->
+ <stop-jboss/>
+ <wait-on-shutdown conf="all"/>
+ </sequential>
+ </macrodef>
+
+ <target name="tests-standard-unit-matrix-version">
+ <execute-matrix-unit test-name="testbyvalue" parameter-filter="org/jboss/test/testbyvalue/test/**/*TestCase.class"/>
+ <execute-matrix-unit test-name="client" parameter-filter="org/jboss/test/client/**/*TestCase.class"/>
+ <execute-matrix-unit test-name="bmp" parameter-filter="org/jboss/test/bmp/**/*TestCase.class"/>
+ <execute-matrix-unit test-name="cmp2" parameter-filter="org/jboss/test/cmp2/**/*TestCase.class"/>
+ <execute-matrix-unit test-name="jms" parameter-filter="org/jboss/test/jbossmq/test/JBossMQUnitTest.class"/>
+ </target>
+
+ <macrodef name="execute-matrix-unit">
+ <attribute name="test-name"/>
+ <attribute name="parameter-filter"/>
+ <sequential>
+ <!-- this requires antcall as a property can't be redefined -->
+ <antcall target="execute-matrix-unit-target">
+ <param name="test-name" value="@{test-name}"/>
+ <param name="parameter-filter" value="@{parameter-filter}"/>
+ </antcall>
+ </sequential>
+ </macrodef>
+
+ <target name="execute-matrix-unit-target">
+ <echo message=">>>>>> Executing test=${test-name}"/>
+ <pathconvert pathSep="," dirSep="/" property="jbosstest.hometest">
+ <path location="${build.classes}"/>
+ </pathconvert>
+
+ <pathconvert pathSep="," dirSep="/" property="jbosstest.executionlist">
+ <path >
+ <fileset dir="${build.classes}">
+ <include name="${parameter-filter}"/>
+ </fileset>
+ </path>
+ </pathconvert>
+
+ <junit dir="${module.output}"
+ printsummary="${junit.printsummary}"
+ haltonerror="${junit.haltonerror}"
+ haltonfailure="${junit.haltonfailure}"
+ fork="true"
+ timeout="${junit.timeout}"
+ jvm="${junit.jvm}">
+
+ <jvmarg value="${junit.jvm.options}"/>
+ <!-- Used for JGroups -->
+ <jvmarg value="-Dbind.address=${node0}"/>
+ <sysproperty key="jbosstest.deploy.dir" file="${build.lib}"/>
+ <sysproperty key="build.testlog" value="${build.testlog}"/>
+ <sysproperty key="log4j.configuration" value="file:${build.resources}/log4j.xml"/>
+ <sysproperty key="jboss-junit-configuration" value="${test-name}_${matrix-configuration}"/>
+ <sysproperty key="java.naming.provider.url" value="${node0.jndi.url}"/>
+ <sysproperty key="jbosstest.server.host" value="${node0}"/>
+ <!-- Pass along any jbosstest.* system properties -->
+ <syspropertyset>
+ <propertyref prefix="jbosstest."/>
+ </syspropertyset>
+ <classpath>
+ <pathelement location="${build.classes}"/>
+ <pathelement location="${build.resources}"/>
+ <fileset dir="${current-version-dir}" includes="*.jar"/>
+ <path refid="thirdparty.classpath" />
+ </classpath>
+ <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
+ usefile="${junit.formatter.usefile}"
+ extension="-${test-name}_${matrix-configuration}.xml"/>
+
+ <batchtest todir="${build.reports}"
+ haltonerror="${junit.batchtest.haltonerror}"
+ haltonfailure="${junit.batchtest.haltonfailure}"
+ fork="${junit.batchtest.fork}">
+
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/compatibility/test/matrix/MatrixTestContainer.class"/>
+ </fileset>
+ </batchtest>
+ </junit>
+
+ </target>
+
+
+ <!-- End Matrix Test Suite -->
+
+
</project>
Modified: branches/JBoss_3_2_7_CP/testsuite/imports/test-jars.xml
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/imports/test-jars.xml 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/imports/test-jars.xml 2006-11-01 00:48:35 UTC (rev 57959)
@@ -59,7 +59,8 @@
_jars-tm,
_jars-util,
_jars-web,
- _jars-xa
+ _jars-xa,
+ _jars_byvalue
">
</target>
@@ -4128,4 +4129,18 @@
</jar>
</target>
+ <target name="_jars_byvalue">
+ <mkdir dir="${build.lib}"/>
+
+ <jar destfile="${build.lib}/jar-byvalue.jar">
+ <metainf dir="${build.resources}/testbyvalue/META-INF"/>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/testbyvalue/bean/**"/>
+ <include name="org/jboss/test/testbyvalue/interfaces/**"/>
+ </fileset>
+ </jar>
+
+ </target>
+
+
</project>
Added: branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/ant/taskdefs/AntCallOnDirectoryList.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/ant/taskdefs/AntCallOnDirectoryList.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/ant/taskdefs/AntCallOnDirectoryList.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ant.taskdefs;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.taskdefs.Ant;
+import org.apache.tools.ant.taskdefs.Property;
+import org.apache.tools.ant.util.SourceFileScanner;
+import org.apache.tools.ant.util.FlatFileNameMapper;
+import org.apache.tools.ant.types.DirSet;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.io.File;
+
+
+/**
+ * This class will call a specified ant class for each existent file into fileSet or dirSet
+ *
+ * @author Clebert.suconic at jboss.com
+ */
+public class AntCallOnDirectoryList extends Task
+{
+ ArrayList list = new ArrayList();
+
+ String targetToExecute;
+
+ String directoryProperty;
+ String versionNameProperty;
+
+ Ant ant = null;
+
+ public String getVersionNameProperty()
+ {
+ return versionNameProperty;
+ }
+
+ public void setVersionNameProperty(String versionNameProperty)
+ {
+ this.versionNameProperty = versionNameProperty;
+ }
+
+ public String getTargetToExecute()
+ {
+ return targetToExecute;
+ }
+
+ public void setTargetToExecute(String targetToExecute)
+ {
+ this.targetToExecute = targetToExecute;
+ }
+
+ public String getDirectoryProperty()
+ {
+ return directoryProperty;
+ }
+
+ public void setDirectoryProperty(String directoryProperty)
+ {
+ this.directoryProperty = directoryProperty;
+ }
+
+
+ public void init()
+ {
+ super.init();
+ ant = (Ant) this.getProject().createTask("ant");
+ ant.setAntfile(this.getProject().getProperty("ant.file"));
+ ant.setOwningTarget(getOwningTarget());
+ ant.setTaskName(getTaskName());
+ ant.setLocation(getLocation());
+ ant.init();
+ }
+
+
+ public void addDirSet(DirSet dirSet)
+ {
+ list.add(dirSet);
+ }
+
+ public void execute() throws BuildException
+ {
+ init();
+ ant.setTarget(getTargetToExecute());
+ Property parameterDirectory = ant.createProperty();
+ parameterDirectory.setName(this.getDirectoryProperty());
+
+ Property parameterName = ant.createProperty();
+ parameterName.setName(this.getVersionNameProperty());
+
+
+ Iterator iter = list.iterator();
+ while (iter.hasNext())
+ {
+ DirSet dirSet = (DirSet) iter.next();
+ File currentDir = dirSet.getDir(this.getProject());
+ DirectoryScanner scanner = dirSet.getDirectoryScanner(this.getProject());
+
+ SourceFileScanner sourceScanner = new SourceFileScanner(this);
+ String[] strfiles = scanner.getIncludedDirectories();
+ ArrayList files = new ArrayList();
+ for (int i = 0; i < strfiles.length; i++)
+ {
+ File currentFile = new File(currentDir, strfiles[i]);
+ if (currentFile.getParentFile().getAbsolutePath().equals(currentDir.getAbsolutePath()))
+ {
+ files.add(currentFile);
+ parameterDirectory.setValue(currentFile.getAbsolutePath());
+ parameterName.setValue(currentFile.getName());
+ ant.execute();
+ }
+ }
+
+ }
+ }
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/ant/taskdefs/XMLJUnitMultipleResultFormatter.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/ant/taskdefs/XMLJUnitMultipleResultFormatter.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/ant/taskdefs/XMLJUnitMultipleResultFormatter.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,49 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ant.taskdefs;
+
+
+import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
+import org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter;
+
+/**
+ * This class only serves the proposite of keep multiple JUnit runnings between different configurations.
+ * For example, if you run a testcase as cluster, and the same testcase as singlenode, we want to keep both results in the JUnitReport.
+ * This is a simple implementation that uses a variable defined jboss-configuration and put that as part of the name.
+ * @author Clebert Suconic
+ */
+public class XMLJUnitMultipleResultFormatter extends XMLJUnitResultFormatter
+{
+
+ public void startTestSuite(JUnitTest test)
+ {
+ String configuration = (String)System.getProperties().get("jboss-junit-configuration");
+
+ if (configuration!=null && !configuration.trim().equals(""))
+ {
+ test.setName(test.getName() + "(" + configuration + ")");
+ }
+
+ super.startTestSuite(test);
+ }
+
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/compatibility/test/matrix/MatrixTestContainer.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/compatibility/test/matrix/MatrixTestContainer.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/compatibility/test/matrix/MatrixTestContainer.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,294 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.compatibility.test.matrix;
+
+import org.apache.log4j.Logger;
+
+
+import junit.framework.AssertionFailedError;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestListener;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.io.CharArrayReader;
+import java.io.StreamTokenizer;
+
+/**
+ * This class is a container for other tests used for the MatrixTest.
+ * For each version used by the Matrix verification we are containing a bunch of other tests.
+ *
+ * This class uses list of variables defined by the testSuite and they have to be in the System.getProperties()
+ * jbosstest.hometest = Contains where we are loading the testcases
+ * jbosstest.executionlist = A comma based list of .class files. Each file has to begin with ${jbosstest.hometest}
+ * jbosstest.versionname = The name of the version being tested
+ *
+ * @author clebert.suconic at jboss.com
+ */
+public class MatrixTestContainer extends TestCase
+{
+ static Logger log = Logger.getLogger("MatrixTestContainer");
+
+ /** Used to similuate tests while renaming its names. */
+ private static class DummyTestCase extends TestCase
+ {
+ DummyTestCase(String name)
+ {
+ super (name);
+ }
+ }
+
+ /** We need this proxy just to inform failures*/
+ private static class TestSuiteProxy extends TestSuite
+ {
+ ArrayList loadFailures;
+ public TestSuiteProxy(ArrayList loadFailures)
+ {
+ this.loadFailures=loadFailures;
+ }
+
+ public void run(TestResult testResult)
+ {
+ Iterator iter = loadFailures.iterator();
+ while (iter.hasNext())
+ {
+ LoadFailure load = (LoadFailure)iter.next();
+ TestCase test = new DummyTestCase(load.className);
+ testResult.startTest(test);
+ testResult.addError(test,load.exception);
+ }
+
+ loadFailures.clear();
+
+ super.run(testResult);
+ }
+
+
+ }
+
+ private static class LoadFailure
+ {
+ String className;
+ Throwable exception;
+
+ public LoadFailure(String className, Throwable exception)
+ {
+ this.className=className;
+ this.exception=exception;
+ }
+ }
+
+ /**
+ * One of the goals of this class also is to keep original classNames into testNames. So, you will realize several proxies existent here to
+ * keep these class names while executing method names.
+ */
+ static class TestProxy extends TestCase
+ {
+ Hashtable hashTests = new Hashtable();
+
+
+
+ public TestProxy(Test testcase, String name)
+ {
+ super(name);
+ this.testcase = testcase;
+ }
+
+ public int countTestCases()
+ {
+ return testcase.countTestCases();
+ }
+
+ /**
+ * Create a dummy test renaming its content
+ * @param test
+ * @return
+ */
+ private Test createDummyTest(Test test)
+ {
+ Test dummyTest = (Test)hashTests.get(test);
+ if (dummyTest==null)
+ {
+ if (test instanceof TestCase)
+ {
+ dummyTest = new DummyTestCase(this.getName() + ":"+ ((TestCase)test).getName());
+ } else
+ if (test instanceof TestSuite)
+ {
+ dummyTest = new DummyTestCase(this.getName() + ":"+ ((TestCase)test).getName());
+ }
+ else
+ {
+ // if can't recover the name, don't create a proxy
+ log.warn("Couldn't find a name for " + test.toString() + ", class=" + test.getClass().getName());
+
+ dummyTest = new DummyTestCase(test.getClass().getName());
+ }
+
+ hashTests.put(test,dummyTest);
+ }
+
+ return dummyTest;
+ }
+
+ public void run(final TestResult result)
+ {
+ TestResult subResult = new TestResult();
+ subResult.addListener(new TestListener()
+ {
+ public void addError(Test subtest, Throwable throwable)
+ {
+ Test dummyTest = createDummyTest(subtest);
+ result.addError(dummyTest, throwable);
+ }
+
+ public void addFailure(Test subtest, AssertionFailedError assertionFailedError)
+ {
+ Test dummyTest = createDummyTest(subtest);
+ result.addFailure(dummyTest, assertionFailedError);
+ }
+
+ public void endTest(Test subtest)
+ {
+ Test dummyTest = createDummyTest(subtest);
+ result.endTest(dummyTest);
+ }
+
+ public void startTest(Test subtest)
+ {
+ Test dummyTest = createDummyTest(subtest);
+ result.startTest(dummyTest);
+ }
+ });
+ testcase.run(subResult);
+ }
+
+ Test testcase;
+ }
+
+ private static Test createSuite(Class clazz) throws Exception
+ {
+ Method method = null;
+ try
+ {
+ method = clazz.getMethod("suite", null);
+ }
+ catch (Exception e)
+ {
+ }
+
+ if (method != null)
+ {
+ return (Test) method.invoke(null, null);
+ } else
+ {
+ TestSuite suiteTmp = new TestSuite();
+ suiteTmp.addTestSuite(clazz);
+ return suiteTmp;
+ }
+ }
+
+ private static void copySuite(Test source, TestSuite destination, String baseName)
+ {
+ destination.addTest(new TestProxy(source,baseName));
+ }
+
+ /** As jdk1.3 doesn't have .slipt as a method on string, I've created this method */
+ public static String[] split(String arguments)
+ {
+
+ ArrayList list = new ArrayList();
+ while (arguments!=null && !arguments.equals(""))
+ {
+ int position = arguments.indexOf(',');
+
+ if (position>=0)
+ {
+ String currentString = arguments.substring(0,position);
+ list.add(currentString);
+ arguments = arguments.substring(position+1);
+ }
+ else
+ {
+ list.add(arguments);
+ arguments = null;
+ }
+ }
+ return (String[]) list.toArray(new String[list.size()]);
+ }
+
+
+ public static Test suite()
+ {
+ try
+ {
+ String homedir = (String) System.getProperties().get("jbosstest.hometest");
+
+ String executionList = (String) System.getProperties().get("jbosstest.executionlist");
+ System.out.println("ExecutionList = " + executionList);
+
+ String[] tests = split(executionList);
+
+ ArrayList loadFailures = new ArrayList();
+
+ TestSuite suite = new TestSuiteProxy(loadFailures);
+
+ for (int classesCount = 0; classesCount < tests.length; classesCount++)
+ {
+ String testName = null;
+ try
+ {
+ if (tests[classesCount].trim().equals("")) continue;
+ testName = tests[classesCount].substring(homedir.length() + 1);
+ testName = testName.replace('/', '.');
+ testName = testName.substring(0, testName.length() - 6); // - ".class".length()
+
+ Class clazz = Class.forName(testName);
+ Test suiteTmp = createSuite(clazz);
+ copySuite(suiteTmp, suite, testName + ":");
+ } catch (Throwable e)
+ {
+ loadFailures.add(new LoadFailure(testName,e));
+ log.info("Error Loading " + testName);
+ e.printStackTrace();
+ log.warn(e.getMessage());
+ }
+ }
+
+ log.info("All classes loaded, executing tests");
+
+ return suite;
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+
+
+ }
+
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/ejb-jar.xml
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/ejb-jar.xml 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/ejb-jar.xml 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,88 @@
+<?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>
+ <description>TestByValue root Bean</description>
+ <ejb-name>RootTestByValue</ejb-name>
+ <home>org.jboss.test.testbyvalue.interfaces.RootStatelessSessionHome</home>
+ <remote>org.jboss.test.testbyvalue.interfaces.RootStatelessSession</remote>
+ <ejb-class>org.jboss.test.testbyvalue.bean.RootStatelessSessionBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Bean</transaction-type>
+ <ejb-ref>
+ <ejb-ref-name>ejb/CalledByValue</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.jboss.test.testbyvalue.interfaces.ByValueStatelessSessionHome</home>
+ <remote>org.jboss.test.testbyvalue.interfaces.ByValueStatelessSession</remote>
+ <ejb-link>TestByValue</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/CalledByReference</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.jboss.test.testbyvalue.interfaces.ByReferenceStatelessSessionHome</home>
+ <remote>org.jboss.test.testbyvalue.interfaces.ByReferenceStatelessSession</remote>
+ <ejb-link>TestByReference</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/TestByValueEntity</ejb-ref-name>
+ <ejb-ref-type>Entity</ejb-ref-type>
+ <home>org.jboss.test.testbyvalue.interfaces.ByValueEntityHome</home>
+ <remote>org.jboss.test.testbyvalue.interfaces.ByValueEntity</remote>
+ <ejb-link>TestByValueEntity</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/TestByReferenceEntity</ejb-ref-name>
+ <ejb-ref-type>Entity</ejb-ref-type>
+ <home>org.jboss.test.testbyvalue.interfaces.ByValueEntityHome</home>
+ <remote>org.jboss.test.testbyvalue.interfaces.ByValueEntity</remote>
+ <ejb-link>TestByReferenceEntity</ejb-link>
+ </ejb-ref>
+ </session>
+ <session>
+ <description>TestByValue called Bean</description>
+ <ejb-name>TestByValue</ejb-name>
+ <home>org.jboss.test.testbyvalue.interfaces.ByValueStatelessSessionHome</home>
+ <remote>org.jboss.test.testbyvalue.interfaces.ByValueStatelessSession</remote>
+ <ejb-class>org.jboss.test.testbyvalue.bean.ByValueStatelessSessionBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Bean</transaction-type>
+ </session>
+ <session>
+ <description>TestByReferece called Bean</description>
+ <ejb-name>TestByReference</ejb-name>
+ <home>org.jboss.test.testbyvalue.interfaces.ByReferenceStatelessSessionHome</home>
+ <remote>org.jboss.test.testbyvalue.interfaces.ByReferenceStatelessSession</remote>
+ <ejb-class>org.jboss.test.testbyvalue.bean.ByReferenceStatelessSessionBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Bean</transaction-type>
+ </session>
+ <entity>
+ <description>TestByValue beans</description>
+ <ejb-name>TestByValueEntity</ejb-name>
+ <home>org.jboss.test.testbyvalue.interfaces.ByValueEntityHome</home>
+ <remote>org.jboss.test.testbyvalue.interfaces.ByValueEntity</remote>
+ <ejb-class>org.jboss.test.testbyvalue.bean.ByValueEntityBean</ejb-class>
+ <persistence-type>Bean</persistence-type>
+ <prim-key-class>java.lang.String</prim-key-class>
+ <reentrant>False</reentrant>
+ <primkey-field>name</primkey-field>
+ </entity>
+ <entity>
+ <description>TestByValue beans</description>
+ <ejb-name>TestByReferenceEntity</ejb-name>
+ <home>org.jboss.test.testbyvalue.interfaces.ByValueEntityHome</home>
+ <remote>org.jboss.test.testbyvalue.interfaces.ByValueEntity</remote>
+ <ejb-class>org.jboss.test.testbyvalue.bean.ByValueEntityBean</ejb-class>
+ <persistence-type>Bean</persistence-type>
+ <prim-key-class>java.lang.String</prim-key-class>
+ <reentrant>False</reentrant>
+ <primkey-field>name</primkey-field>
+ </entity>
+ </enterprise-beans>
+ <assembly-descriptor>
+ </assembly-descriptor>
+</ejb-jar>
+
Added: branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/jboss.xml
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/jboss.xml 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/jboss.xml 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<jboss>
+ <enterprise-beans>
+ <session>
+ <ejb-name>RootTestByValue</ejb-name>
+ <jndi-name>RootTestByValue</jndi-name>
+ </session>
+ <session>
+ <ejb-name>TestByValue</ejb-name>
+ <call-by-value>true</call-by-value>
+ </session>
+ <session>
+ <ejb-name>TestByReference</ejb-name>
+ <call-by-value>false</call-by-value>
+ </session>
+ <entity>
+ <ejb-name>TestByValueEntity</ejb-name>
+ <call-by-value>true</call-by-value>
+ </entity>
+ <entity>
+ <ejb-name>TestByReferenceEntity</ejb-name>
+ <call-by-value>false</call-by-value>
+ </entity>
+ </enterprise-beans>
+</jboss>
+
Added: branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/jbosscmp-jdbc.xml
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/jbosscmp-jdbc.xml 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/main/org/jboss/test/testbyvalue/META-INF/jbosscmp-jdbc.xml 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE jbosscmp-jdbc PUBLIC
+ "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
+
+<jbosscmp-jdbc>
+ <defaults>
+ <!--
+ <datasource>java:/PostgresDS</datasource>
+ <datasource-mapping>PostgreSQL 7.2</datasource-mapping>
+ -->
+ <create-table>true</create-table>
+ <remove-table>true</remove-table>
+ <pk-constraint>true</pk-constraint>
+ </defaults>
+</jbosscmp-jdbc>
+
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByReferenceStatelessSessionBean.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByReferenceStatelessSessionBean.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByReferenceStatelessSessionBean.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.bean;
+
+import java.rmi.*;
+import javax.ejb.*;
+import javax.naming.InitialContext;
+import javax.naming.Context;
+
+/**
+ * $Id: ByReferenceStatelessSessionBean.java 40542 2006-01-24 21:14:57Z csuconic $
+ * @author Clebert Suconic
+ */
+public class ByReferenceStatelessSessionBean implements SessionBean
+{
+ org.apache.log4j.Category log = org.apache.log4j.Category.getInstance(getClass());
+ private SessionContext sessionContext;
+
+ public void ejbCreate() throws RemoteException, CreateException
+ {
+ }
+
+ public void ejbActivate() throws RemoteException
+ {
+ }
+
+ public void ejbPassivate() throws RemoteException
+ {
+ }
+
+ public void ejbRemove() throws RemoteException
+ {
+ }
+
+ public void setSessionContext(SessionContext context) throws RemoteException
+ {
+ sessionContext = context;
+ //Exception e = new Exception("in set Session context");
+ //log.debug("failed", e);
+ }
+
+ public void doTestByReference(ClassWithProperty propertyClass) throws RemoteException
+ {
+ propertyClass.setX(propertyClass.getX() + 1000);
+ }
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByValueEntityBean.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByValueEntityBean.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByValueEntityBean.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,107 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.bean;
+
+
+import java.rmi.*;
+import javax.ejb.*;
+import javax.naming.Context;
+import javax.sql.DataSource;
+import javax.naming.InitialContext;
+import java.sql.Connection;
+import org.jboss.test.testbean.interfaces.StatelessSession;
+import org.jboss.test.testbean.interfaces.StatelessSessionHome;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Vector;
+import java.util.Enumeration;
+
+public class ByValueEntityBean implements EntityBean {
+ private EntityContext entityContext;
+ public String name;
+
+ public String ejbCreate() throws RemoteException, CreateException {
+
+ name="nothing";
+ return name;
+
+
+ }
+ public String ejbCreate(String name) throws RemoteException, CreateException {
+ this.name=name;
+ return name;
+ }
+
+
+ public String ejbFindByPrimaryKey(String name) throws RemoteException, FinderException {
+ return name;
+ }
+
+
+ public void ejbPostCreate() throws RemoteException, CreateException {
+ }
+
+ public void ejbPostCreate(String name) throws RemoteException, CreateException {
+ }
+
+
+ public void ejbActivate() throws RemoteException {
+ }
+
+ public void ejbLoad() throws RemoteException {
+ }
+
+ public void ejbPassivate() throws RemoteException {
+ }
+
+ public void ejbRemove() throws RemoteException, RemoveException {
+ }
+
+ public void ejbStore() throws RemoteException {
+ }
+
+
+ public void setEntityContext(EntityContext context) throws RemoteException {
+ entityContext = context;
+ }
+
+ public void unsetEntityContext() throws EJBException, RemoteException
+ {
+ this.entityContext=null;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name=name;
+ }
+
+ public void doByValueTest(ClassWithProperty property)
+ {
+ property.setX(property.getX()+1000);
+ }
+
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByValueStatelessSessionBean.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByValueStatelessSessionBean.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByValueStatelessSessionBean.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.bean;
+
+import java.rmi.*;
+import javax.ejb.*;
+import javax.naming.InitialContext;
+import javax.naming.Context;
+
+/**
+ * $Id: ByValueStatelessSessionBean.java 40542 2006-01-24 21:14:57Z csuconic $
+ * @author Clebert Suconic
+ */
+public class ByValueStatelessSessionBean implements SessionBean
+{
+ org.apache.log4j.Category log = org.apache.log4j.Category.getInstance(getClass());
+ private SessionContext sessionContext;
+
+ public void ejbCreate() throws RemoteException, CreateException
+ {
+ }
+
+ public void ejbActivate() throws RemoteException
+ {
+ }
+
+ public void ejbPassivate() throws RemoteException
+ {
+ }
+
+ public void ejbRemove() throws RemoteException
+ {
+ }
+
+ public void setSessionContext(SessionContext context) throws RemoteException
+ {
+ sessionContext = context;
+ //Exception e = new Exception("in set Session context");
+ //log.debug("failed", e);
+ }
+
+ public void doTestByValue(ClassWithProperty propertyClass) throws RemoteException
+ {
+ propertyClass.setX(propertyClass.getX() + 1000);
+ }
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByValueStefulSessionBean.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByValueStefulSessionBean.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ByValueStefulSessionBean.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,66 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.bean;
+
+import java.rmi.*;
+import javax.ejb.*;
+import javax.naming.InitialContext;
+import javax.naming.Context;
+
+/**
+ * $Id: ByValueStefulSessionBean.java 40542 2006-01-24 21:14:57Z csuconic $
+ * @author Clebert Suconic
+ */
+public class ByValueStefulSessionBean implements SessionBean
+{
+ static org.apache.log4j.Category log = org.apache.log4j.Category.getInstance(ByValueStefulSessionBean.class);
+ private SessionContext sessionContext;
+
+ public void ejbCreate() throws RemoteException, CreateException
+ {
+ }
+
+ public void ejbActivate() throws RemoteException
+ {
+ }
+
+ public void ejbPassivate() throws RemoteException
+ {
+ }
+
+ public void ejbRemove() throws RemoteException
+ {
+ }
+
+ public void setSessionContext(SessionContext context) throws RemoteException
+ {
+ sessionContext = context;
+ //Exception e = new Exception("in set Session context");
+ //log.debug("failed", e);
+ }
+
+ public void doTestByValue(ClassWithProperty propertyClass) throws RemoteException
+ {
+ System.out.println("stateful Session Bean Call");
+ propertyClass.setX(propertyClass.getX() + 1000);
+ }
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ClassWithProperty.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ClassWithProperty.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/ClassWithProperty.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,41 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.bean;
+
+/**
+ * We change a property in a passByValue operation and verify if the value was changed or not
+ * @author clebert.suconic at jboss.com
+ */
+public class ClassWithProperty implements java.io.Serializable
+{
+ int x;
+
+ public int getX()
+ {
+ return x;
+ }
+
+ public void setX(int x)
+ {
+ this.x = x;
+ }
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/RootStatelessSessionBean.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/RootStatelessSessionBean.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/bean/RootStatelessSessionBean.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,193 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.bean;
+
+import org.jboss.test.testbyvalue.interfaces.ByValueStatelessSessionHome;
+import org.jboss.test.testbyvalue.interfaces.ByValueStatelessSession;
+import org.jboss.test.testbyvalue.interfaces.ByReferenceStatelessSessionHome;
+import org.jboss.test.testbyvalue.interfaces.ByReferenceStatelessSession;
+import org.jboss.test.testbyvalue.interfaces.ByValueEntityHome;
+import org.jboss.test.testbyvalue.interfaces.ByValueEntity;
+
+import java.rmi.*;
+import javax.ejb.*;
+import javax.naming.InitialContext;
+import javax.naming.Context;
+import javax.rmi.PortableRemoteObject;
+
+/**
+ * $Id: RootStatelessSessionBean.java 40542 2006-01-24 21:14:57Z csuconic $
+ * @author Clebert Suconic
+ */
+public class RootStatelessSessionBean implements SessionBean
+{
+ org.apache.log4j.Category log = org.apache.log4j.Category.getInstance(getClass());
+ private SessionContext sessionContext;
+
+ public void ejbCreate() throws RemoteException, CreateException
+ {
+ }
+
+ public void ejbActivate() throws RemoteException
+ {
+ }
+
+ public void ejbPassivate() throws RemoteException
+ {
+ }
+
+ public void ejbRemove() throws RemoteException
+ {
+ }
+
+ public void setSessionContext(SessionContext context) throws RemoteException
+ {
+ sessionContext = context;
+
+ //Exception e = new Exception("in set Session context");
+ //log.debug("failed", e);
+ }
+
+ public long doTestByValue(int iterations) throws Exception
+ {
+
+ Context ctx = new InitialContext();
+ Object objhome =
+ ctx.lookup("java:comp/env/ejb/CalledByValue");
+
+ ByValueStatelessSessionHome home = (ByValueStatelessSessionHome) PortableRemoteObject.narrow(objhome, ByValueStatelessSessionHome.class);
+ ByValueStatelessSession session = home.create();
+
+ ClassWithProperty property = new ClassWithProperty();
+
+ property.setX(1000);
+
+ long initTime = System.currentTimeMillis();
+
+
+ for (int i=0;i<iterations;i++)
+ {
+ session.doTestByValue(property);
+
+ if (property.getX()!=1000)
+ {
+ throw new RuntimeException("Property was changed in a call-by-value operation");
+ }
+ }
+
+ return System.currentTimeMillis() - initTime;
+ }
+
+ public long doTestByReference(int iterations) throws Exception
+ {
+ Context ctx = new InitialContext();
+ Object objhome =
+ ctx.lookup("java:comp/env/ejb/CalledByReference");
+
+ ByReferenceStatelessSessionHome home = (ByReferenceStatelessSessionHome) PortableRemoteObject.narrow(objhome, ByReferenceStatelessSessionHome.class);
+ ByReferenceStatelessSession session = home.create();
+
+ ClassWithProperty property = new ClassWithProperty();
+
+ property.setX(1000);
+
+ long initTime = System.currentTimeMillis();
+
+
+ for (int i=0;i<iterations;i++)
+ {
+ session.doTestByReference(property);
+
+ if (property.getX()==1000)
+ {
+ throw new RuntimeException("Property was not changed in a call-by-reference operation");
+ }
+
+ property.setX(1000);
+ }
+
+ return System.currentTimeMillis() - initTime;
+ }
+
+ public long doTestEntity(int iterations) throws Exception
+ {
+ Context ctx = new InitialContext();
+ Object objhome =
+ ctx.lookup("java:comp/env/ejb/TestByValueEntity");
+
+ ByValueEntityHome home = (ByValueEntityHome) PortableRemoteObject.narrow(objhome, ByValueEntityHome.class);
+ ByValueEntity entity = home.create();
+
+ ClassWithProperty property = new ClassWithProperty();
+
+ property.setX(1000);
+
+ long initTime = System.currentTimeMillis();
+
+
+ for (int i=0;i<iterations;i++)
+ {
+ entity.doByValueTest(property);
+
+ if (property.getX()!=1000)
+ {
+ throw new RuntimeException("Property was changed in a call-by-value operation");
+ }
+
+ property.setX(1000);
+ }
+
+ return System.currentTimeMillis() - initTime;
+ }
+
+ public long doTestEntityByReference(int iterations) throws Exception
+ {
+ Context ctx = new InitialContext();
+ Object objhome =
+ ctx.lookup("java:comp/env/ejb/TestByReferenceEntity");
+
+ ByValueEntityHome home = (ByValueEntityHome) PortableRemoteObject.narrow(objhome, ByValueEntityHome.class);
+ ByValueEntity entity = home.create();
+
+ ClassWithProperty property = new ClassWithProperty();
+
+ property.setX(1000);
+
+ long initTime = System.currentTimeMillis();
+
+
+ for (int i=0;i<iterations;i++)
+ {
+ entity.doByValueTest(property);
+
+ if (property.getX()==1000)
+ {
+ throw new RuntimeException("Property was not changed in a call-by-reference operation");
+ }
+
+ property.setX(1000);
+ }
+
+ return System.currentTimeMillis() - initTime;
+ }
+
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByReferenceStatelessSession.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByReferenceStatelessSession.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByReferenceStatelessSession.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.interfaces;
+
+import org.jboss.test.testbyvalue.bean.ClassWithProperty;
+
+import javax.ejb.*;
+import java.rmi.*;
+
+/**
+ * @author Clebert Suconic
+ */
+public interface ByReferenceStatelessSession extends EJBObject {
+ public void doTestByReference(ClassWithProperty propertyClass) throws RemoteException;
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByReferenceStatelessSessionHome.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByReferenceStatelessSessionHome.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByReferenceStatelessSessionHome.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.interfaces;
+
+import javax.ejb.*;
+import java.rmi.*;
+
+/**
+ * @author Clebert Suconic
+ */
+public interface ByReferenceStatelessSessionHome extends EJBHome {
+
+ public ByReferenceStatelessSession create() throws RemoteException, javax.ejb.CreateException;
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueEntity.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueEntity.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueEntity.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.interfaces;
+
+import org.jboss.test.testbyvalue.bean.ClassWithProperty;
+
+import javax.ejb.EJBObject;
+import java.rmi.RemoteException;
+
+/** @author Clebert Suconic*/
+public interface ByValueEntity extends EJBObject {
+
+ public String getName() throws RemoteException;
+ public void setName(String value) throws RemoteException;
+
+
+ public void doByValueTest(ClassWithProperty property) throws RemoteException;
+
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueEntityHome.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueEntityHome.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueEntityHome.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.interfaces;
+
+import org.jboss.test.testbean.interfaces.*;
+import org.jboss.test.testbean.interfaces.EntityBMP;
+
+import javax.ejb.EJBHome;
+import java.rmi.RemoteException;
+import javax.ejb.CreateException;
+import javax.ejb.FinderException;
+import java.util.Collection;
+import java.util.Enumeration;
+
+public interface ByValueEntityHome extends EJBHome {
+
+ public ByValueEntity create()
+ throws RemoteException, CreateException;
+
+ public ByValueEntity create(String name)
+ throws RemoteException, CreateException;
+
+ public ByValueEntity findByPrimaryKey(String name)
+ throws RemoteException, FinderException;
+
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatefulSession.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatefulSession.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatefulSession.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.interfaces;
+
+import org.jboss.test.testbyvalue.bean.ClassWithProperty;
+
+import javax.ejb.*;
+import java.rmi.*;
+
+/**
+ * @author Clebert Suconic
+ */
+public interface ByValueStatefulSession extends EJBObject {
+ public void doTestByValue(ClassWithProperty propertyClass) throws RemoteException;
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatefulSessionHome.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatefulSessionHome.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatefulSessionHome.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,32 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.interfaces;
+
+import javax.ejb.*;
+import java.rmi.*;
+
+/**
+ * @author Clebert Suconic
+ */
+public interface ByValueStatefulSessionHome extends EJBHome {
+ public ByValueStatefulSession create() throws RemoteException, CreateException;
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatelessSession.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatelessSession.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatelessSession.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.interfaces;
+
+import org.jboss.test.testbyvalue.bean.ClassWithProperty;
+
+import javax.ejb.*;
+import java.rmi.*;
+
+/**
+ * @author Clebert Suconic
+ */
+public interface ByValueStatelessSession extends EJBObject {
+ public void doTestByValue(ClassWithProperty propertyClass) throws RemoteException;
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatelessSessionHome.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatelessSessionHome.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/ByValueStatelessSessionHome.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.interfaces;
+
+import javax.ejb.*;
+import java.rmi.*;
+
+/**
+ * @author Clebert Suconic
+ */
+public interface ByValueStatelessSessionHome extends EJBHome {
+
+ public ByValueStatelessSession create() throws RemoteException, javax.ejb.CreateException;
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/RootStatelessSession.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/RootStatelessSession.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/RootStatelessSession.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.interfaces;
+
+import javax.ejb.*;
+import java.rmi.*;
+
+/**
+ * @author Clebert Suconic
+ */
+public interface RootStatelessSession extends EJBObject {
+ public long doTestByValue(int iterations) throws RemoteException, Exception;
+ public long doTestByReference(int iterations) throws RemoteException, Exception;
+ public long doTestEntity(int iterations) throws RemoteException, Exception;
+ public long doTestEntityByReference(int iterations) throws RemoteException, Exception;
+
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/RootStatelessSessionHome.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/RootStatelessSessionHome.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/interfaces/RootStatelessSessionHome.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.interfaces;
+
+import javax.ejb.*;
+import java.rmi.*;
+
+/**
+ * @author Clebert Suconic
+ */
+public interface RootStatelessSessionHome extends EJBHome {
+
+ public RootStatelessSession create() throws java.rmi.RemoteException, javax.ejb.CreateException;
+}
Added: branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/test/ByValueUnitTestCase.java
===================================================================
--- branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/test/ByValueUnitTestCase.java 2006-10-31 23:49:52 UTC (rev 57958)
+++ branches/JBoss_3_2_7_CP/testsuite/src/resources/testbyvalue/test/ByValueUnitTestCase.java 2006-11-01 00:48:35 UTC (rev 57959)
@@ -0,0 +1,107 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.testbyvalue.test;
+
+import java.util.Date;
+import java.math.BigDecimal;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.testbyvalue.interfaces.RootStatelessSessionHome;
+
+/**
+* @author Clebert Suconic
+*/
+public class ByValueUnitTestCase
+extends JBossTestCase
+{
+ static boolean deployed = false;
+ static int test = 0;
+ static Date startDate = new Date();
+
+ protected final String namingFactory =
+ System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
+
+ protected final String providerURL =
+ System.getProperty(Context.PROVIDER_URL);
+ private static final int ITERATIONS = 1000;
+
+ public ByValueUnitTestCase(String name) {
+ super(name);
+ }
+
+ public void testByValue() throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+ Object obj = ctx.lookup("RootTestByValue");
+
+ RootStatelessSessionHome home = (RootStatelessSessionHome) PortableRemoteObject.narrow(obj, RootStatelessSessionHome.class);
+ long time = home.create().doTestByValue(ITERATIONS);
+ // I really wanted System.out as I wanted this to be sent to the XML output for ant junit tests
+ System.out.println("Time spent into CallByValues over "+ITERATIONS+" iterations=" + time);
+ }
+
+ public void testByValueOnEntity() throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+ Object obj = ctx.lookup("RootTestByValue");
+
+ RootStatelessSessionHome home = (RootStatelessSessionHome) PortableRemoteObject.narrow(obj, RootStatelessSessionHome.class);
+ long time = home.create().doTestEntity(ITERATIONS);
+ // I really wanted System.out as I wanted this to be sent to the XML output for ant junit tests
+ System.out.println("Time spent into CallByValues over "+ITERATIONS+" iterations=" + time);
+ }
+
+ public void testByReferenceOnEntity() throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+ Object obj = ctx.lookup("RootTestByValue");
+
+ RootStatelessSessionHome home = (RootStatelessSessionHome) PortableRemoteObject.narrow(obj, RootStatelessSessionHome.class);
+ long time = home.create().doTestEntityByReference(ITERATIONS);
+ // I really wanted System.out as I wanted this to be sent to the XML output for ant junit tests
+ System.out.println("Time spent into CallByValues over "+ITERATIONS+" iterations=" + time);
+ }
+
+ public void testByReference() throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+ Object obj = ctx.lookup("RootTestByValue");
+
+ RootStatelessSessionHome home = (RootStatelessSessionHome) PortableRemoteObject.narrow(obj, RootStatelessSessionHome.class);
+ long time = home.create().doTestByReference(ITERATIONS);
+ // I really wanted System.out as I wanted this to be sent to the XML output for ant junit tests
+ System.out.println("Time spent into CallByReferences over "+ITERATIONS+" iterations=" + time);
+ }
+
+ public static Test suite() throws Exception
+ {
+ Test t1 = getDeploySetup(ByValueUnitTestCase.class, "jar-byvalue.jar");
+ return t1;
+ }
+
+}
More information about the jboss-cvs-commits
mailing list