[jboss-cvs] JBossAS SVN: r99251 - in trunk/testsuite: imports/config and 21 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jan 11 17:10:07 EST 2010
Author: istudens at redhat.com
Date: 2010-01-11 17:10:03 -0500 (Mon, 11 Jan 2010)
New Revision: 99251
Added:
trunk/testsuite/imports/config/tests-jts-propagation.xml
trunk/testsuite/imports/sections/jbossts.xml
trunk/testsuite/src/main/org/jboss/test/jbossts/
trunk/testsuite/src/main/org/jboss/test/jbossts/JTSContextPropagation01/
trunk/testsuite/src/main/org/jboss/test/jbossts/JTSContextPropagation01/TestContextPropagation.java
trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecoveryWithJTSPropagation.java
trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/
trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/EJBUtils.java
trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ORBWrapper.java
trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/
trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/TxPropagationEJB2Bean.java
trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/TxPropagationEJB2Home.java
trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/TxPropagationEJB2Rem.java
trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb3/
trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb3/TxPropagationBean.java
trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb3/TxPropagationRem.java
trunk/testsuite/src/resources/jbossts/
trunk/testsuite/src/resources/jbossts/crashrecovery/
trunk/testsuite/src/resources/jbossts/crashrecovery/META-INF/
trunk/testsuite/src/resources/jbossts/jts-propagation/
trunk/testsuite/src/resources/jbossts/jts-propagation/ejb2/
trunk/testsuite/src/resources/jbossts/jts-propagation/ejb2/META-INF/
trunk/testsuite/src/resources/jbossts/jts-propagation/ejb2/META-INF/ejb-jar.xml
trunk/testsuite/src/resources/jbossts/jts-propagation/ejb2/META-INF/jboss.xml
trunk/testsuite/src/resources/jbossts/jts-propagation/ejb3/
trunk/testsuite/src/resources/jbossts/jts-propagation/ejb3/META-INF/
trunk/testsuite/src/resources/jbossts/jts-propagation/ejb3/META-INF/persistence.xml
Removed:
trunk/testsuite/imports/sections/crashrecovery.xml
trunk/testsuite/src/main/org/jboss/test/crashrecovery/
trunk/testsuite/src/resources/crashrecovery/
trunk/testsuite/src/resources/jbossts/META-INF/
trunk/testsuite/src/resources/jbossts/scripts/README.txt
Modified:
trunk/testsuite/imports/config/configs.xml
trunk/testsuite/imports/config/tests-crash-recovery.xml
trunk/testsuite/imports/test-jars.xml
trunk/testsuite/src/main/org/jboss/test/jbossts/ASCrashRecovery01/TestWithJPA.java
trunk/testsuite/src/main/org/jboss/test/jbossts/ASCrashRecovery01/WipeOutTxsInDoubt.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashBMTBean.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashCMTBean.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashHelper.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashHelperRem.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashLocal.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashLocalHome.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashRem.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashRemHome.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/RecoveredXid.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntity.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelper.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelperLocal.java
trunk/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelperRem.java
trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureMode.java
trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureSpec.java
trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureType.java
trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/ASTestResource.java
trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecovery.java
trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecoveryWithJPA.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ASClientTask.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ASTestConfig.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ClientAction.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ClientTask.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/JUnitClientAction.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/JUnitClientTest.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerBindingConfig.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerTask.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerTaskException.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TaskProperty.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TaskValue.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TransactionLog.java
trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/Utils.java
trunk/testsuite/src/resources/jbossts/scripts/as-tests.xml
trunk/testsuite/src/resources/jbossts/scripts/imports/test-config.xml
Log:
added JTS propagation tests, modified crash recovery tests for new version of JBossTS, JBQA-2604
Modified: trunk/testsuite/imports/config/configs.xml
===================================================================
--- trunk/testsuite/imports/config/configs.xml 2010-01-11 21:49:15 UTC (rev 99250)
+++ trunk/testsuite/imports/config/configs.xml 2010-01-11 22:10:03 UTC (rev 99251)
@@ -11,6 +11,7 @@
JBoss Server Configuration -->
<import file="tests-clustering.xml"/>
<import file="tests-crash-recovery.xml"/>
+<import file="tests-jts-propagation.xml"/>
<import file="tests-bootstrap-dependencies.xml"/>
<import file="tests-password-mask.xml"/>
<import file="tests-jts.xml"/>
Modified: trunk/testsuite/imports/config/tests-crash-recovery.xml
===================================================================
--- trunk/testsuite/imports/config/tests-crash-recovery.xml 2010-01-11 21:49:15 UTC (rev 99250)
+++ trunk/testsuite/imports/config/tests-crash-recovery.xml 2010-01-11 22:10:03 UTC (rev 99251)
@@ -5,10 +5,10 @@
-->
<!-- $Id$ -->
-<project name="main.server.config.crashrecovery" xmlns:server="http://jboss.org/ns/test/ant/server">
+<project name="main.server.config.jbossts.crashrecovery" xmlns:server="http://jboss.org/ns/test/ant/server">
- <property name="jbossts.crash.recovery.test.dir" value="crashrecovery" />
+ <property name="jbossts.crash.recovery.test.dir" value="jbossts" />
<property name="jbossts.crash.recovery.test.script.dir" value="${jbossts.crash.recovery.test.dir}/scripts" />
<property name="jbossts.crash.recovery.test.resource.dir" value="${jbossts.crash.recovery.test.dir}/resources" />
@@ -23,23 +23,31 @@
| ./build.sh tests-ts-crash-recovery
|
| or for particular database:
- | ./build.sh tests-ts-crash-recovery -Dcrash.db=psql_8.3 -Dcrash.target=crash-tests-single-db
+ | ./build.sh tests-ts-crash-recovery -Djbossts.db=psql_8.3 -Djbossts.target=crash-tests-single-db
|
| or for particular test scenario:
- | ./build.sh tests-ts-crash-recovery -Dcrash.db=psql_8.3 -Dcrash.tstype=jts -Dcrash.tsdemarc=bmt -Dcrash.testcase=none.rev -Dcrash.target=crash-tests-single
+ | ./build.sh tests-ts-crash-recovery -Djbossts.db=psql_8.3 -Djbossts.tstype=jts -Djbossts.tsdemarc=bmt -Djbossts.testcase=none.rev -Djbossts.target=crash-tests-single
|
| Note: If you want to force the wiping out any txs in doubt from DB before the test you can use the property -DwipeOutTxsInDoubtBeforeTest=true.
-->
<target name="tests-ts-crash-recovery" depends="init-dependencies"
description="Runs JBossTS crash recovery tests">
- <available file="${jboss.dist}/server/crashrecovery-jta" property="have.profiles" value="true"/>
+ <!--available file="${jboss.dist}/server/crashrecovery-jta" property="have.crashrecovery.jta.profile" value="true"/>
+ <available file="${jboss.dist}/server/crashrecovery-jts" property="have.crashrecovery.jts.profile" value="true"/>
+ <condition property="have.crash.recovery.profiles">
+ <and>
+ <istrue value="${have.crashrecovery.jta.profile}"/>
+ <istrue value="${have.crashrecovery.jts.profile}"/>
+ </and>
+ </condition-->
+
<antcall target="prepare-crashrec-profiles" />
- <property name="crash.target" value="crash-tests" />
- <property name="crash.max.time" value="300000" />
+ <property name="jbossts.target" value="crash-tests" />
+ <property name="jbossts.max.time" value="300000" />
- <run-as-test target="${crash.target}" />
+ <run-as-test target="${jbossts.target}" />
</target>
@@ -53,34 +61,35 @@
<sequential>
<echo message="starting of ${build.resources}/${jbossts.crash.recovery.test.script.dir}/as-tests.xml"/>
<java classname="org.apache.tools.ant.launch.Launcher" fork="true" failonerror="true">
- <classpath>
- <pathelement location="${build.lib}/crashrecovery-astest.jar"/>
- <pathelement location="${jbosstest.dist}/common/lib/jbossts-common.jar"/>
- <pathelement location="${ant.library.dir}/ant-launcher.jar"/>
- <fileset refid="org.apache.ant:ant:jar"/>
- <fileset refid="org.apache.ant:ant-junit:jar"/>
- <fileset refid="junit:junit:jar"/>
- <fileset refid="org.jboss.jbossas:jboss-server-manager:jar"/>
- <fileset dir="${jbosstest.dist}/client"/>
- </classpath>
+ <classpath>
+ <pathelement location="${build.lib}/crashrecovery-astest.jar"/>
+ <pathelement location="${ant.library.dir}/ant-launcher.jar"/>
+ <fileset refid="org.apache.ant:ant:jar"/>
+ <fileset refid="org.apache.ant:ant-junit:jar"/>
+ <fileset refid="junit:junit:jar"/>
+ <fileset refid="org.jboss.jbossas:jboss-server-manager:jar"/>
+ <fileset refid="jboss.jbossts:jbossjts:jar"/>
+ <fileset refid="jboss.jbossts:jbossjts-integration:jar"/>
+ <fileset dir="${jbosstest.dist}/client"/>
+ </classpath>
<sysproperty key="ant.home" value="${ant.home}"/>
<sysproperty key="ant.library.dir" value="${ant.library.dir}"/>
<sysproperty key="java.security.policy" value="${build.resources}/${jbossts.crash.recovery.test.resource.dir}/java.policy"/>
<sysproperty key="product.dir" value="${build.resources}/${jbossts.crash.recovery.test.dir}" />
<sysproperty key="jboss.home" value="${jbosstest.dist}" />
+ <sysproperty key="jboss.dist" value="${jboss.dist}" />
<sysproperty key="astest.jar.dir" value="${build.lib}" />
<sysproperty key="astest.jar.name" value="crashrecovery-astest.jar" />
<sysproperty key="astest.jar.deploy.dir" value="../../lib" />
- <sysproperty key="jboss.server.manager.jar" value="${org.jboss.jbossas:jboss-server-manager:jar}" />
<sysproperty key="build.reports" value="${build.reports}" />
<sysproperty key="jbossas.startup.timeout" value="480" />
<sysproperty key="jbossas.shutdown.timeout" value="240" />
<sysproperty key="wipeOutTxsInDoubtBeforeTest" value="${wipeOutTxsInDoubtBeforeTest}" />
- <sysproperty key="crash.db" value="${crash.db}" />
- <sysproperty key="crash.tstype" value="${crash.tstype}" />
- <sysproperty key="crash.tsdemarc" value="${crash.tsdemarc}" />
- <sysproperty key="crash.testcase" value="${crash.testcase}" />
- <sysproperty key="testTime" value="${crash.max.time}" />
+ <sysproperty key="jbossts.db" value="${jbossts.db}" />
+ <sysproperty key="jbossts.tstype" value="${jbossts.tstype}" />
+ <sysproperty key="jbossts.tsdemarc" value="${jbossts.tsdemarc}" />
+ <sysproperty key="jbossts.testcase" value="${jbossts.testcase}" />
+ <sysproperty key="testTime" value="${jbossts.max.time}" />
<env key="JBOSS_HOME" value="${jbosstest.dist}" />
<arg value="-f"/>
<arg value="${build.resources}/${jbossts.crash.recovery.test.script.dir}/as-tests.xml"/>
@@ -92,7 +101,7 @@
</macrodef>
- <target name="prepare-crashrec-profiles" unless="have.profiles">
+ <target name="prepare-crashrec-profiles" unless="have.crash.recovery.profiles">
<delete dir="${jboss.dist}/server/crashrecovery-jta" />
<create-config baseconf="standard" newconf="crashrecovery-jta">
<patternset>
@@ -126,22 +135,29 @@
<macrodef name="setup-crash-recovery">
<attribute name="conf"/>
<sequential>
+
<!-- enable crash recovery and point it to our datasource -->
+ <replaceregexp file="${jboss.dist}/server/@{conf}/deploy/transaction-jboss-beans.xml" flags="s"
+ match="(<bean name="JTAEnvironmentBean")(.*?)(</bean>)"
+ replace="\1\2@@@PUT_RECOVERY_PROPERTY_HERE@@@\3" />
+ <replace file="${jboss.dist}/server/@{conf}/deploy/transaction-jboss-beans.xml">
+ <replacetoken><![CDATA[@@@PUT_RECOVERY_PROPERTY_HERE@@@]]></replacetoken>
+ <replacevalue><![CDATA[
+ <property name="xaResourceRecoveryInstances">
+ <list elementClass="java.lang.String">
+ <value>com.arjuna.ats.internal.jbossatx.jta.AppServerJDBCXARecovery;jndiname=CrashRecoveryDS</value>
+ </list>
+ </property>
+]]></replacevalue>
+ </replace>
+
+ <!-- more verbose logging
+ FIXME modify it for new transactions, i.e. for deploy/transaction-jboss-beans.xml file
<replace file="${jboss.dist}/server/@{conf}/conf/jbossts-properties.xml">
- <replacetoken><![CDATA[</transaction-service>]]></replacetoken>
- <replacevalue><![CDATA[
- <properties depends="arjuna" name="jta">
- <property name="com.arjuna.ats.jta.recovery.XAResourceRecovery1" value= "com.arjuna.ats.internal.jbossatx.jta.AppServerJDBCXARecovery;jndiname=CrashRecoveryDS"/>
- <!-- xaRecoveryNode should match value in nodeIdentifier or be * -->
- <property name="com.arjuna.ats.jta.xaRecoveryNode" value="1"/>
- </properties>
-</transaction-service>]]></replacevalue>
- </replace>
- <!-- more verbose logging -->
- <replace file="${jboss.dist}/server/@{conf}/conf/jbossts-properties.xml">
<replacetoken><![CDATA[type="System" value="0x00000000"]]></replacetoken>
<replacevalue><![CDATA[type="System" value="0xffffffff"]]></replacevalue>
- </replace>
+ </replace-->
+
</sequential>
</macrodef>
Added: trunk/testsuite/imports/config/tests-jts-propagation.xml
===================================================================
--- trunk/testsuite/imports/config/tests-jts-propagation.xml (rev 0)
+++ trunk/testsuite/imports/config/tests-jts-propagation.xml 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,164 @@
+<?xml version="1.0"?>
+
+<!--
+ | Targets that run JBossTS JTS propagation tests
+-->
+
+<!-- $Id$ -->
+<project name="main.server.config.jbossts.jtspropagation" xmlns:server="http://jboss.org/ns/test/ant/server">
+
+
+ <property name="jbossts.jts.propagation.test.dir" value="jbossts" />
+ <property name="jbossts.jts.propagation.test.script.dir" value="${jbossts.jts.propagation.test.dir}/scripts" />
+ <property name="jbossts.jts.propagation.test.resource.dir" value="${jbossts.jts.propagation.test.dir}/resources" />
+
+ <!--
+ | Targets
+ -->
+
+ <!--
+ | JBQA-2604 - JBossTS JTS propagation tests.
+ |
+ | Usage for all tests:
+ | ./build.sh tests-jts-propagation
+ |
+ | or for particular test scenario:
+ | ./build.sh -Djbossts.ejbX={ejb2|ejb3} -Djbossts.transport={jrmp|iiop} -Djbossts.target=jts-propagation-tests-single tests-jts-propagation
+ |
+ | Note: If you want to force the wiping out any txs in doubt from DB before the test you can use the property -DwipeOutTxsInDoubtBeforeTest=true.
+ -->
+ <target name="tests-jts-propagation" depends="init-dependencies"
+ description="Runs JBossTS JTS propagation tests">
+
+ <!--FIXME odkomentovat available file="${jboss.dist}/server/jts-propagation-node0" property="have.jts.propag.node0.profile" value="true"/>
+ <available file="${jboss.dist}/server/jts-propagation-node1" property="have.jts.propag.node1.profile" value="true"/>
+ <condition property="have.jts.propag.profiles">
+ <and>
+ <istrue value="${have.jts.propag.node0.profile}"/>
+ <istrue value="${have.jts.propag.node1.profile}"/>
+ </and>
+ </condition-->
+
+ <antcall target="prepare-jts-propogation-profiles" />
+
+ <property name="jbossts.target" value="jts-propagation-tests" />
+ <property name="jbossts.max.time" value="300000" />
+ <property name="jbossts.clientTx" value="false" />
+
+ <run-jts-propag-test target="${jbossts.target}" />
+
+ </target>
+
+
+ <!--
+ | Macros and others
+ -->
+
+ <macrodef name="run-jts-propag-test">
+ <attribute name="target"/>
+ <sequential>
+ <echo message="starting of ${build.resources}/${jbossts.jts.propagation.test.script.dir}/as-tests.xml"/>
+ <java classname="org.apache.tools.ant.launch.Launcher" fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="${build.lib}/jts-propagation-client.jar"/>
+ <pathelement location="${ant.library.dir}/ant-launcher.jar"/>
+ <fileset refid="org.apache.ant:ant:jar"/>
+ <fileset refid="org.apache.ant:ant-junit:jar"/>
+ <fileset refid="junit:junit:jar"/>
+ <fileset refid="org.jboss.jbossas:jboss-server-manager:jar"/>
+ <fileset refid="jboss.jbossts:jbossjts:jar"/>
+ <fileset refid="jboss.jbossts:jbossjts-integration:jar"/>
+ <fileset dir="${jbosstest.dist}/client"/>
+ </classpath>
+ <sysproperty key="ant.home" value="${ant.home}"/>
+ <sysproperty key="ant.library.dir" value="${ant.library.dir}"/>
+ <sysproperty key="java.security.policy" value="${build.resources}/${jbossts.jts.propagation.test.resource.dir}/java.policy"/>
+ <sysproperty key="product.dir" value="${build.resources}/${jbossts.jts.propagation.test.dir}" />
+ <sysproperty key="jboss.home" value="${jbosstest.dist}" />
+ <sysproperty key="jboss.dist" value="${jboss.dist}" />
+ <sysproperty key="astest.jar.dir" value="${build.lib}" />
+ <sysproperty key="astest.jar.deploy.dir" value="../../lib" />
+ <sysproperty key="build.reports" value="${build.reports}" />
+ <sysproperty key="jbossas.startup.timeout" value="480" />
+ <sysproperty key="jbossas.shutdown.timeout" value="240" />
+ <sysproperty key="wipeOutTxsInDoubtBeforeTest" value="${wipeOutTxsInDoubtBeforeTest}" />
+ <sysproperty key="jbossts.ejbX" value="${jbossts.ejbX}" />
+ <sysproperty key="jbossts.transport" value="${jbossts.transport}" />
+ <sysproperty key="jbossts.clientTx" value="${jbossts.clientTx}" />
+ <sysproperty key="node0" value="${node0}" />
+ <sysproperty key="node1" value="${node0}" /> <!-- uses the Service Binding Manager -->
+ <sysproperty key="testTime" value="${jbossts.max.time}" />
+ <sysproperty key="jbosstest.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+ <env key="JBOSS_HOME" value="${jbosstest.dist}" />
+ <arg value="-f"/>
+ <arg value="${build.resources}/${jbossts.jts.propagation.test.script.dir}/as-tests.xml"/>
+ <arg value="@{target}"/>
+ <!--jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/-->
+ </java>
+ </sequential>
+ </macrodef>
+
+
+ <target name="prepare-jts-propogation-profiles" unless="have.jts.propag.profiles">
+ <delete dir="${jboss.dist}/server/jts-propagation-node0" />
+ <create-config baseconf="all" newconf="jts-propagation-node0">
+ <patternset>
+ <include name="conf/**"/>
+ <include name="deploy/**"/>
+ <include name="deployers/**"/>
+ <include name="lib/**"/>
+ </patternset>
+ </create-config>
+
+ <delete dir="${jboss.dist}/server/jts-propagation-node1" />
+ <create-config baseconf="all" newconf="jts-propagation-node1">
+ <patternset>
+ <include name="conf/**"/>
+ <include name="deploy/**"/>
+ <include name="deployers/**"/>
+ <include name="lib/**"/>
+ </patternset>
+ </create-config>
+
+ <!-- install JTS transactions into these profiles -->
+ <ant dir="${jboss.dist}/docs/examples/transactions" target="jts">
+ <property name="target.server.dir" location="${jboss.dist}/server/jts-propagation-node0"/>
+ </ant>
+ <ant dir="${jboss.dist}/docs/examples/transactions" target="jts">
+ <property name="target.server.dir" location="${jboss.dist}/server/jts-propagation-node1"/>
+ </ant>
+
+ <setup-jts-propogation-crash-recovery conf="jts-propagation-node0"/>
+ <setup-jts-propogation-crash-recovery conf="jts-propagation-node1"/>
+ </target>
+
+
+ <macrodef name="setup-jts-propogation-crash-recovery">
+ <attribute name="conf"/>
+ <sequential>
+ <!-- enable crash recovery and point it to our datasource -->
+ <replaceregexp file="${jboss.dist}/server/@{conf}/deploy/transaction-jboss-beans.xml" flags="s"
+ match="(<bean name="JTAEnvironmentBean")(.*?)(</bean>)"
+ replace="\1\2@@@PUT_RECOVERY_PROPERTY_HERE@@@\3" />
+ <replace file="${jboss.dist}/server/@{conf}/deploy/transaction-jboss-beans.xml">
+ <replacetoken><![CDATA[@@@PUT_RECOVERY_PROPERTY_HERE@@@]]></replacetoken>
+ <replacevalue><![CDATA[
+ <property name="xaResourceRecoveryInstances">
+ <list elementClass="java.lang.String">
+ <value>com.arjuna.ats.internal.jbossatx.jta.AppServerJDBCXARecovery;jndiname=CrashRecoveryDS</value>
+ </list>
+ </property>
+]]></replacevalue>
+ </replace>
+
+ <!-- more verbose logging
+ FIXME modify it for new transactions, i.e. for deploy/transaction-jboss-beans.xml file
+ <replace file="${jboss.dist}/server/@{conf}/conf/jbossts-properties.xml">
+ <replacetoken><![CDATA[type="System" value="0x00000000"]]></replacetoken>
+ <replacevalue><![CDATA[type="System" value="0xffffffff"]]></replacevalue>
+ </replace-->
+ </sequential>
+ </macrodef>
+
+</project>
Deleted: trunk/testsuite/imports/sections/crashrecovery.xml
===================================================================
--- trunk/testsuite/imports/sections/crashrecovery.xml 2010-01-11 21:49:15 UTC (rev 99250)
+++ trunk/testsuite/imports/sections/crashrecovery.xml 2010-01-11 22:10:03 UTC (rev 99251)
@@ -1,18 +0,0 @@
-<project name="tests-crashrecovery-jars">
- <!-- JBossTS crash recovery tests -->
- <target name="_jars-crashrecovery" depends="jbqa2176"/>
-
- <target name="jbqa2176" depends="compile">
- <jar destfile="${build.lib}/crashrecovery-astest.jar">
- <fileset dir="${build.resources}/crashrecovery">
- <include name="META-INF/*.xml"/>
- </fileset>
- <fileset dir="${build.resources}/crashrecovery/resources">
- <include name="java.policy"/>
- </fileset>
- <fileset dir="${build.classes}">
- <include name="org/jboss/test/crashrecovery/**/*.class"/>
- </fileset>
- </jar>
- </target>
-</project>
Copied: trunk/testsuite/imports/sections/jbossts.xml (from rev 96161, trunk/testsuite/imports/sections/crashrecovery.xml)
===================================================================
--- trunk/testsuite/imports/sections/jbossts.xml (rev 0)
+++ trunk/testsuite/imports/sections/jbossts.xml 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,62 @@
+<project name="tests-jbossts-jars">
+ <target name="_jars-jbossts" depends="jbqa2176, jbqa2604"/>
+
+ <!-- JBossTS crash recovery tests -->
+ <target name="jbqa2176">
+ <jar destfile="${build.lib}/crashrecovery-astest.jar">
+ <fileset dir="${build.resources}/jbossts/crashrecovery">
+ <include name="META-INF/*.xml"/>
+ </fileset>
+ <fileset dir="${build.resources}/jbossts/resources">
+ <include name="java.policy"/>
+ </fileset>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/jbossts/**/*.class"/> <!-- FIXME include only classes needed for crash recovery tests -->
+ </fileset>
+ </jar>
+ </target>
+
+ <!-- JBossTS JTS propagation tests -->
+ <target name="jbqa2604">
+ <jar destfile="${build.lib}/jts-propagation-client.jar">
+ <fileset dir="${build.resources}/jbossts/resources">
+ <include name="java.policy"/>
+ </fileset>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/jbossts/JTSContextPropagation01/*.class"/>
+ <include name="org/jboss/test/jbossts/crash/*.class"/>
+ <include name="org/jboss/test/jbossts/recovery/*.class"/>
+ <include name="org/jboss/test/jbossts/taskdefs/*.class"/>
+ <include name="org/jboss/test/jbossts/txpropagation/**/*.class"/>
+ </fileset>
+ </jar>
+
+ <jar destfile="${build.lib}/jts-propagation-ejb3.jar">
+ <fileset dir="${build.resources}/jbossts/jts-propagation/ejb3">
+ <include name="META-INF/*.xml"/>
+ </fileset>
+ <fileset dir="${build.resources}/jbossts/resources">
+ <include name="java.policy"/>
+ </fileset>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/jbossts/txpropagation/*.class"/>
+ <include name="org/jboss/test/jbossts/txpropagation/ejb3/*.class"/>
+ <include name="org/jboss/test/jbossts/crash/*.class"/>
+ <include name="org/jboss/test/jbossts/recovery/*.class"/>
+ </fileset>
+ </jar>
+
+ <jar destfile="${build.lib}/jts-propagation-ejb2.jar">
+ <fileset dir="${build.resources}/jbossts/jts-propagation/ejb2">
+ <include name="META-INF/*.xml"/>
+ </fileset>
+ <fileset dir="${build.resources}/jbossts/resources">
+ <include name="java.policy"/>
+ </fileset>
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/jbossts/txpropagation/ejb2/*.class"/>
+ </fileset>
+ </jar>
+ </target>
+
+</project>
Modified: trunk/testsuite/imports/test-jars.xml
===================================================================
--- trunk/testsuite/imports/test-jars.xml 2010-01-11 21:49:15 UTC (rev 99250)
+++ trunk/testsuite/imports/test-jars.xml 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,6 @@
<import file="sections/cluster.xml"/>
<import file="sections/cmp.xml"/>
<import file="sections/cookie.xml"/>
- <import file="sections/crashrecovery.xml"/>
<import file="sections/cts.xml"/>
<import file="sections/dbtest.xml"/>
<import file="sections/deadlock.xml"/>
@@ -39,6 +38,7 @@
<import file="sections/jbossmessaging-cluster.xml"/>
<import file="sections/jbossmessaging.xml"/>
<import file="sections/jbossmx.xml"/>
+ <import file="sections/jbossts.xml"/>
<import file="sections/jbpm.xml"/>
<import file="sections/jca.xml"/>
<import file="sections/jms.xml"/>
@@ -104,7 +104,6 @@
_jars-cluster,
_jars-cmp2,
_jars-cookie,
- _jars-crashrecovery,
_jars-cts,
_jars-dbtest,
_jars-deadlock,
@@ -132,6 +131,7 @@
_jars-jbossmessaging,
_jars-jbossmessaging-cluster,
_jars-jbossmx,
+ _jars-jbossts,
_jars-jbpm,
_jars-jca,
_jars-jcaprops,
Copied: trunk/testsuite/src/main/org/jboss/test/jbossts (from rev 97836, trunk/testsuite/src/main/org/jboss/test/crashrecovery)
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/ASCrashRecovery01/TestWithJPA.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/ASCrashRecovery01/TestWithJPA.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/ASCrashRecovery01/TestWithJPA.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,18 +18,19 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.ASCrashRecovery01;
+package org.jboss.test.jbossts.ASCrashRecovery01;
-import org.jboss.test.crashrecovery.recovery.ASFailureSpec;
-import org.jboss.test.crashrecovery.taskdefs.JUnitClientTest;
-import org.jboss.test.crashrecovery.taskdefs.TransactionLog;
-import org.jboss.test.crashrecovery.crash.CrashHelper;
-import org.jboss.test.crashrecovery.crash.CrashHelperRem;
-import org.jboss.test.crashrecovery.crash.CrashRem;
-import org.jboss.test.crashrecovery.crash.RecoveredXid;
-import org.jboss.test.crashrecovery.crash.TestEntity;
-import org.jboss.test.crashrecovery.crash.TestEntityHelper;
-import org.jboss.test.crashrecovery.crash.TestEntityHelperRem;
+import org.jboss.test.jbossts.recovery.ASFailureSpec;
+import org.jboss.test.jbossts.taskdefs.JUnitClientTest;
+import org.jboss.test.jbossts.taskdefs.TransactionLog;
+import org.jboss.test.jbossts.taskdefs.Utils;
+import org.jboss.test.jbossts.crash.CrashHelper;
+import org.jboss.test.jbossts.crash.CrashHelperRem;
+import org.jboss.test.jbossts.crash.CrashRem;
+import org.jboss.test.jbossts.crash.RecoveredXid;
+import org.jboss.test.jbossts.crash.TestEntity;
+import org.jboss.test.jbossts.crash.TestEntityHelper;
+import org.jboss.test.jbossts.crash.TestEntityHelperRem;
import org.jboss.remoting.CannotConnectException;
import org.apache.tools.ant.BuildException;
@@ -58,7 +59,6 @@
private boolean isCMT = false;
private boolean clientTx = false;
- private boolean isDebug = false;
private boolean expectFailure = false;
private boolean reverseOrder = false;
private boolean rollbackExpected = false;
@@ -68,7 +68,7 @@
private int maxTestTime = MAX_TEST_TIME;
private String storeDir = null;
- private String storeImple = "HashedActionStore";
+ private String storeImple = "com.arjuna.ats.internal.arjuna.objectstore.HashedActionStore";
private String storeType = "StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction";
private TransactionLog store;
private int existingUids;
@@ -79,7 +79,7 @@
private TestEntity initEntity;
- public void testCrashRecovery()
+ public void testAction()
{
if (config == null || params == null)
throw new UnsupportedOperationException("The test has not been initiated yet. Call the init() method first.");
@@ -96,8 +96,6 @@
setName(val);
else if ("cmt".equals(key))
isCMT = val.equalsIgnoreCase("true");
- else if ("debug".equals(key))
- isDebug = val.equalsIgnoreCase("true");
else if ("serverName".equals(key))
serverName = val;
else if ("storeType".equals(key))
@@ -109,7 +107,7 @@
else if ("storeImple".equals(key))
storeImple = val;
else if ("testTime".equals(key))
- maxTestTime = parseInt(val, "parameter testTime should represent a number of miliseconds: ");
+ maxTestTime = Utils.parseInt(val, "parameter testTime should represent a number of miliseconds: ");
else if ("specs".equals(key))
fspecs = parseSpecs(val, sb);
else if ("wait".equals(key))
@@ -132,6 +130,8 @@
try
{
+ String serverPath = config.getServerPath(serverName);
+
// get a handle to the transaction logs
if (storeDir == null)
storeDir = serverPath + "data/tx-object-store";
@@ -153,8 +153,9 @@
{
}
- existingUids = getPendingUids();
}
+
+ existingUids = getPendingUids();
if (wipeOutTxsInDoubtBeforeTest)
wipeOutTxsInDoubt();
@@ -214,11 +215,15 @@
TestEntityHelperRem hlp = (TestEntityHelperRem) config.getNamingContext(serverName).lookup(TestEntityHelper.REMOTE_JNDI_NAME);
TestEntity recoveredEntity = hlp.getTestEntity(entityPK);
- print("TestWithJPA#checkDatabase(): initEntity = " + initEntity);
- print("TestWithJPA#checkDatabase(): recoveredEntity = " + recoveredEntity);
+ if (recoveredEntity != null)
+ {
+ print("TestWithJPA#checkDatabase(): initEntity = " + initEntity);
+ print("TestWithJPA#checkDatabase(): recoveredEntity = " + recoveredEntity);
- return (rollbackExpected) ? recoveredEntity.getA() == initEntity.getA()
- : recoveredEntity.getA() != initEntity.getA();
+ return (rollbackExpected) ? recoveredEntity.getA() == initEntity.getA()
+ : recoveredEntity.getA() != initEntity.getA();
+
+ }
}
catch (Exception e)
{
@@ -294,20 +299,6 @@
return fspecs;
}
- private int parseInt(String intValue, String errorMessage) throws IllegalArgumentException
- {
- try
- {
- return Integer.parseInt(intValue);
- }
- catch (NumberFormatException e)
- {
- System.out.println(errorMessage + e.getMessage());
-
- throw new IllegalArgumentException(e);
- }
- }
-
// count how many pending transaction branches there are in the transaction log
private int getPendingUids()
{
@@ -381,7 +372,7 @@
}
catch (RuntimeException re)
{
- if (re.getCause() instanceof HeuristicMixedException)
+ if (re.getCause() instanceof HeuristicMixedException) //FIXME unreachable condition?
{
// try to recover, this failure was expected maybe?!
print("Failure was expected (maybe): " + re.getMessage());
@@ -464,15 +455,19 @@
} while (maxWait > 0);
// the test failed to recover some uids - clear them out ready for the next test
- try
+ if (pendingUids > 0)
{
- store.clearXids(storeType);
+ try
+ {
+ store.clearXids(storeType);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
- catch (Exception e)
- {
- e.printStackTrace();
- }
+ // the test failed to recover some xids in the database - clear them out ready for the next test
if (pendingXidsInDoubt > 0)
{
print(pendingXidsInDoubt + " new txs in doubt in database after the test");
@@ -484,16 +479,4 @@
return false;
}
- private void suspendFor(int millis)
- {
- try
- {
- Thread.sleep(millis);
- }
- catch (InterruptedException e)
- {
- System.out.println("Test " + getName() + " interupted");
- }
- }
-
}
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/ASCrashRecovery01/WipeOutTxsInDoubt.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/ASCrashRecovery01/WipeOutTxsInDoubt.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/ASCrashRecovery01/WipeOutTxsInDoubt.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,11 +18,11 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.ASCrashRecovery01;
+package org.jboss.test.jbossts.ASCrashRecovery01;
-import org.jboss.test.crashrecovery.taskdefs.JUnitClientTest;
-import org.jboss.test.crashrecovery.crash.CrashHelper;
-import org.jboss.test.crashrecovery.crash.CrashHelperRem;
+import org.jboss.test.jbossts.taskdefs.JUnitClientTest;
+import org.jboss.test.jbossts.crash.CrashHelper;
+import org.jboss.test.jbossts.crash.CrashHelperRem;
import org.apache.tools.ant.BuildException;
import java.util.Map;
@@ -40,7 +40,7 @@
private String serverName = "default";
- public void testCrashRecovery()
+ public void testAction()
{
for (Map.Entry<String, String> me : params.entrySet())
{
Added: trunk/testsuite/src/main/org/jboss/test/jbossts/JTSContextPropagation01/TestContextPropagation.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossts/JTSContextPropagation01/TestContextPropagation.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/JTSContextPropagation01/TestContextPropagation.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,643 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.test.jbossts.JTSContextPropagation01;
+
+import org.jboss.test.jbossts.recovery.ASFailureSpec;
+import org.jboss.test.jbossts.taskdefs.JUnitClientTest;
+import org.jboss.test.jbossts.taskdefs.TransactionLog;
+import org.jboss.test.jbossts.taskdefs.Utils;
+import org.jboss.test.jbossts.txpropagation.EJBUtils;
+import org.jboss.test.jbossts.txpropagation.ORBWrapper;
+import org.jboss.test.jbossts.txpropagation.ejb2.TxPropagationEJB2Rem;
+import org.jboss.test.jbossts.txpropagation.ejb3.TxPropagationRem;
+import org.jboss.test.jbossts.crash.CrashHelper;
+import org.jboss.test.jbossts.crash.CrashHelperRem;
+import org.jboss.test.jbossts.crash.RecoveredXid;
+import org.jboss.test.jbossts.crash.TestEntity;
+import org.jboss.test.jbossts.crash.TestEntityHelper;
+import org.jboss.test.jbossts.crash.TestEntityHelperRem;
+import org.jboss.remoting.CannotConnectException;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CosTransactions.SubtransactionsUnavailable;
+import org.apache.tools.ant.BuildException;
+
+import com.arjuna.ats.jts.OTSManager;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.ejb.EJBTransactionRolledbackException;
+import javax.naming.NamingException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+
+/**
+ * JTS context propagation tests.
+ *
+ * @author <a href="istudens at redhat.com">Ivo Studensky</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestContextPropagation extends JUnitClientTest
+{
+ // the longest time to wait in millis before declaring a test a failed (overridable)
+ private static final int MAX_TEST_TIME = 300000; // 5 minutes - allows two intervals of recovery which is 2 minutes by default
+
+ private boolean useOTS = false;
+ private boolean useEJB3 = false;
+ private boolean clientTx = false;
+ private boolean rollbackExpected = false;
+ private boolean wipeOutTxsInDoubt = false;
+ private boolean wipeOutTxsInDoubtBeforeTest = false;
+ private boolean wipeOutTxsInDoubtAfterTest = false;
+ private int maxTestTime = MAX_TEST_TIME;
+
+ private String storeDirServer0 = null;
+ private String storeDirServer1 = null;
+ private String storeImple = "com.arjuna.ats.internal.arjuna.objectstore.HashedActionStore";
+ private String storeType = "StateManager/BasicAction/TwoPhaseCoordinator/ArjunaTransactionImple";
+ private TransactionLog storeServer0;
+ private TransactionLog storeServer1;
+ private int existingUidsServer0;
+ private int existingUidsServer1;
+ private Set<RecoveredXid> existingXidsInDoubtServer0;
+ private Set<RecoveredXid> existingXidsInDoubtServer1;
+ private boolean expectFailureNode0 = false;
+ private boolean expectFailureNode1 = false;
+
+ private String serverName0 = "default";
+ private String serverName1 = "default";
+ private String host0 = "127.0.0.1";
+ private String host1 = "127.0.0.1";
+ private int jndiPort0 = 1099;
+ private int jndiPort1 = 1199;
+ private int corbaPort0 = 3528;
+ private int corbaPort1 = 3628;
+
+ private UserTransaction tx = null;
+ private static ORBWrapper orb = null;
+
+
+ public void testAction()
+ {
+ if (config == null || params == null)
+ throw new UnsupportedOperationException("The test has not been initiated yet. Call the init() method first.");
+
+ StringBuilder sb = new StringBuilder();
+ ASFailureSpec[] fSpecsNode0 = null;
+ ASFailureSpec[] fSpecsNode1 = null;
+
+ for (Map.Entry<String, String> me : params.entrySet())
+ {
+ String key = me.getKey().trim();
+ String val = me.getValue().trim();
+
+ if ("name".equals(key))
+ setName(val);
+ else if ("ots".equals(key))
+ useOTS = val.equalsIgnoreCase("true");
+ else if ("ejb3".equals(key))
+ useEJB3 = val.equalsIgnoreCase("true");
+ else if ("serverName0".equals(key))
+ serverName0 = val;
+ else if ("serverName1".equals(key))
+ serverName1 = val;
+ else if ("host0".equals(key))
+ host0 = val;
+ else if ("host1".equals(key))
+ host1 = val;
+ else if ("jndiPort0".equals(key))
+ jndiPort0 = Integer.parseInt(val);
+ else if ("jndiPort1".equals(key))
+ jndiPort1 = Integer.parseInt(val);
+ else if ("corbaPort0".equals(key))
+ corbaPort0 = Integer.parseInt(val);
+ else if ("corbaPort1".equals(key))
+ corbaPort1 = Integer.parseInt(val);
+ else if ("storeType".equals(key))
+ storeType = val;
+ else if ("storeDirServer0".equals(key))
+ storeDirServer0 = val;
+ else if ("storeDirServer1".equals(key))
+ storeDirServer1 = val;
+ else if ("clientTx".equals(key))
+ clientTx = val.equalsIgnoreCase("true");
+ else if ("storeImple".equals(key))
+ storeImple = val;
+ else if ("testTime".equals(key))
+ maxTestTime = Utils.parseInt(val, "parameter testTime should represent a number of miliseconds: ");
+ else if ("specs0".equals(key))
+ fSpecsNode0 = parseSpecs(val, sb, key);
+ else if ("specs1".equals(key))
+ fSpecsNode1 = parseSpecs(val, sb, key);
+ else if ("wait".equals(key))
+ suspendFor(Integer.parseInt(val));
+ else if ("rollbackExpected".equals(key))
+ rollbackExpected = val.equalsIgnoreCase("true");
+ else if ("wipeOutTxsInDoubt".equals(key))
+ wipeOutTxsInDoubt = val.equalsIgnoreCase("true");
+ else if ("wipeOutTxsInDoubtBeforeTest".equals(key))
+ wipeOutTxsInDoubtBeforeTest = val.equalsIgnoreCase("true");
+ else if ("wipeOutTxsInDoubtAfterTest".equals(key))
+ wipeOutTxsInDoubtAfterTest = val.equalsIgnoreCase("true");
+ }
+
+ sb.insert(0, ":\n").insert(0, getName()).insert(0, "Executing test ");
+
+ System.out.println(sb);
+
+ try
+ {
+ // get a handle to the transaction logs
+ storeServer0 = initStore(serverName0, storeDirServer0);
+ storeServer1 = initStore(serverName1, storeDirServer1);
+
+ // this test may halt the VM so make sure the transaction log is empty
+ // before starting the test - then the pass/fail check is simply to
+ // test whether or not the log is empty (see recoverUids() below).
+ if (expectFailureNode0)
+ {
+ clearXidsOnServer0();
+ }
+ if (expectFailureNode1)
+ {
+ clearXidsOnServer1();
+ }
+
+ existingUidsServer0 = getPendingUids(storeServer0);
+ existingUidsServer1 = getPendingUids(storeServer1);
+
+ if (wipeOutTxsInDoubtBeforeTest)
+ {
+ wipeOutTxsInDoubt(serverName0);
+ wipeOutTxsInDoubt(serverName1);
+ }
+
+ existingXidsInDoubtServer0 = lookupCrashHelper(serverName0).checkXidsInDoubt();
+ existingXidsInDoubtServer1 = lookupCrashHelper(serverName1).checkXidsInDoubt();
+ if (isDebug)
+ {
+ print(existingXidsInDoubtServer0.size() + " txs in doubt in database on server0 before test run");
+ print(existingXidsInDoubtServer1.size() + " txs in doubt in database on server1 before test run");
+ }
+
+ // name of this test will be the primary key for test record in DB
+ String testEntityPKServer0 = getName() + "_" + serverName0;
+ String testEntityPKServer1 = getName() + "_" + serverName1;
+
+ // initialize databases
+ TestEntity initEntityServer0 = initDatabase(serverName0, testEntityPKServer0);
+ TestEntity initEntityServer1 = initDatabase(serverName1, testEntityPKServer1);
+
+ // run the crash test
+ boolean result = propagationTest(fSpecsNode0, fSpecsNode1, testEntityPKServer0, testEntityPKServer1);
+ print("test result: " + result);
+
+ // checking the state of DB after recovering
+ boolean dbChangedServer0 = true;
+ boolean dbChangedServer1 = true;
+ if (result)
+ {
+ dbChangedServer0 = checkDatabase(serverName0, testEntityPKServer0, initEntityServer0);
+ dbChangedServer1 = checkDatabase(serverName1, testEntityPKServer1, initEntityServer1);
+ print("checkDatabase result for server0: " + dbChangedServer0);
+ print("checkDatabase result for server1: " + dbChangedServer1);
+ }
+
+ Set<RecoveredXid> xidsInDoubtAfterTestServer0 = lookupCrashHelper(serverName0).checkXidsInDoubt();
+ Set<RecoveredXid> xidsInDoubtAfterTestServer1 = lookupCrashHelper(serverName1).checkXidsInDoubt();
+ if (wipeOutTxsInDoubt || wipeOutTxsInDoubtAfterTest)
+ {
+ wipeOutTxsInDoubt(serverName0, existingXidsInDoubtServer0, xidsInDoubtAfterTestServer0);
+ wipeOutTxsInDoubt(serverName1, existingXidsInDoubtServer1, xidsInDoubtAfterTestServer1);
+ }
+
+ assertTrue("Propagation test failed.", result);
+ assertTrue("Incorrect data in database on server0.", dbChangedServer0);
+ assertTrue("Incorrect data in database on server1.", dbChangedServer1);
+ assertEquals("There are still unrecovered txs in database on server0 after the test.", existingXidsInDoubtServer0.size(), xidsInDoubtAfterTestServer0.size());
+ assertEquals("There are still unrecovered txs in database on server0 after the test.", existingXidsInDoubtServer1.size(), xidsInDoubtAfterTestServer1.size());
+ }
+ catch (Exception e)
+ {
+ if (isDebug)
+ e.printStackTrace();
+
+ throw new BuildException(e);
+ }
+ }
+
+ private TransactionLog initStore(String serverName, String storeDir)
+ {
+ String serverPath = config.getServerPath(serverName);
+
+ if (storeDir == null)
+ storeDir = serverPath + "data/tx-object-store";
+ else
+ storeDir = serverPath + storeDir;
+
+ TransactionLog store = new TransactionLog(storeDir, storeImple);
+
+ return store;
+ }
+
+ private boolean propagationTest(ASFailureSpec[] fSpecsNode0, ASFailureSpec[] fSpecsNode1, String testEntityPK0, String testEntityPK1) throws Exception
+ {
+ try
+ {
+ String res = null;
+
+ if (clientTx)
+ startTx(serverName0);
+
+ if (useEJB3)
+ {
+ TxPropagationRem cr = EJBUtils.lookupTxPropagationBeanEJB3(host0, jndiPort0, corbaPort0, useOTS);
+ res = cr.testXA(fSpecsNode0, fSpecsNode1, testEntityPK0, testEntityPK1, host1, expectFailureNode1, useOTS, jndiPort1, corbaPort1);
+ }
+ else
+ {
+ TxPropagationEJB2Rem cr = EJBUtils.lookupTxPropagationBeanEJB2(host0, jndiPort0, corbaPort0, useOTS);
+ res = cr.testXA(fSpecsNode0, fSpecsNode1, testEntityPK0, testEntityPK1, host1, expectFailureNode1, useOTS, jndiPort1, corbaPort1);
+ }
+
+ return "Passed".equalsIgnoreCase(res);
+ }
+ catch (CannotConnectException e)
+ {
+ if (expectFailureNode0 || expectFailureNode1)
+ {
+ print("Failure was expected: " + e.getMessage());
+
+ return recoverUids();
+ }
+ else
+ {
+ print("propagationTest: Caught[1] " + e);
+
+ e.printStackTrace();
+ }
+ }
+ catch (Throwable t)
+ {
+ if (t instanceof EJBTransactionRolledbackException
+ || t instanceof java.rmi.ServerException
+ || t instanceof javax.ejb.EJBException
+ || t instanceof org.jboss.tm.JBossTransactionRolledbackException
+ || t instanceof javax.transaction.TransactionRolledbackException)
+ {
+ // try to recover, this failure was expected (maybe?!)
+ print("Failure was expected (maybe?): " + t.getMessage());
+
+ return recoverUids();
+ }
+ else
+ {
+ print("propagationTest: Caught[2] " + t);
+
+ t.printStackTrace();
+ }
+ }
+ finally
+ {
+ if (clientTx)
+ endTx();
+ }
+
+ return false;
+ }
+
+ /**
+ * Wait for any pending transactions to recover by restarting both of the AS.
+ * @return true if all pending branches have been recovered
+ * @throws IOException if the server cannot be started
+ */
+ private boolean recoverUids() throws IOException
+ {
+ int retryPeriod = 60000; // 1 minute
+ int maxWait = maxTestTime;
+
+ // wait for the server to start up the first time through, we will need it for later database checking
+
+ Set<RecoveredXid> xidsInDoubtAfterTest0;
+ Set<RecoveredXid> xidsInDoubtAfterTest1;
+ int pendingUids0;
+ int pendingUids1;
+ int pendingXidsInDoubt0;
+ int pendingXidsInDoubt1;
+ int existingXidsInDoubt0Cnt = existingXidsInDoubtServer0.size();
+ int existingXidsInDoubt1Cnt = existingXidsInDoubtServer1.size();
+
+
+ if (expectFailureNode0 || expectFailureNode1)
+ {
+ suspendFor(2000); // a little waiting is needed sometimes in order to be able to start server again, 2 secs
+
+ if (expectFailureNode0)
+ config.startServer(serverName0);
+ if (expectFailureNode1)
+ config.startServer(serverName1);
+ }
+
+ do
+ {
+ pendingUids0 = getPendingUids(storeServer0);
+ pendingUids1 = getPendingUids(storeServer1);
+ try
+ {
+ xidsInDoubtAfterTest0 = lookupCrashHelper(serverName0).checkXidsInDoubt();
+ xidsInDoubtAfterTest1 = lookupCrashHelper(serverName1).checkXidsInDoubt();
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+ pendingXidsInDoubt0 = xidsInDoubtAfterTest0.size();
+ pendingXidsInDoubt1 = xidsInDoubtAfterTest1.size();
+
+ if (pendingUids0 == -1 || pendingUids1 == -1)
+ return false; // object store error
+
+ if (pendingUids0 <= existingUidsServer0 && pendingXidsInDoubt0 <= existingXidsInDoubt0Cnt
+ && pendingUids1 <= existingUidsServer1 && pendingXidsInDoubt1 <= existingXidsInDoubt1Cnt)
+ return true; // all uids in AS and txs in doubt in DB have been recovered
+
+ pendingUids0 -= existingUidsServer0;
+ pendingUids1 -= existingUidsServer1;
+ pendingXidsInDoubt0 -= existingXidsInDoubt0Cnt;
+ pendingXidsInDoubt1 -= existingXidsInDoubt1Cnt;
+
+ print("waiting for " + pendingUids0 + " branches on server0");
+ print("waiting for " + pendingXidsInDoubt0 + " txs in doubt on server0");
+ print("waiting for " + pendingUids1 + " branches on server1");
+ print("waiting for " + pendingXidsInDoubt1 + " txs in doubt on server1");
+
+ suspendFor(retryPeriod);
+ maxWait -= retryPeriod;
+
+ } while (maxWait > 0);
+
+ // the test failed to recover some uids - clear them out ready for the next test
+ if (pendingUids0 > 0)
+ {
+ clearXidsOnServer0();
+ }
+ if (pendingUids1 > 0)
+ {
+ clearXidsOnServer1();
+ }
+
+ if (pendingXidsInDoubt0 > 0)
+ {
+ print(pendingXidsInDoubt0 + " new txs in doubt in database on server0 after the test");
+
+ if (wipeOutTxsInDoubt || wipeOutTxsInDoubtAfterTest)
+ {
+ wipeOutTxsInDoubt(serverName0, existingXidsInDoubtServer0, xidsInDoubtAfterTest0);
+ }
+ }
+ if (pendingXidsInDoubt1 > 0)
+ {
+ print(pendingXidsInDoubt1 + " new txs in doubt in database on server1 after the test");
+
+ if (wipeOutTxsInDoubt || wipeOutTxsInDoubtAfterTest)
+ {
+ wipeOutTxsInDoubt(serverName1, existingXidsInDoubtServer1, xidsInDoubtAfterTest1);
+ }
+ }
+
+ return false;
+ }
+
+ private TestEntity initDatabase(String serverName, String entityPK) throws Exception
+ {
+ TestEntityHelperRem hlp = (TestEntityHelperRem) config.getNamingContext(serverName).lookup(TestEntityHelper.REMOTE_JNDI_NAME);
+
+ TestEntity initEntity = hlp.initTestEntity(entityPK);
+ if (isDebug)
+ print("TestContextPropagation#initDatabase(serverName=" + serverName + "): initEntity = " + initEntity);
+
+ return initEntity;
+ }
+
+ private boolean checkDatabase(String serverName, String entityPK, TestEntity initEntity)
+ {
+ try
+ {
+ TestEntityHelperRem hlp = (TestEntityHelperRem) config.getNamingContext(serverName).lookup(TestEntityHelper.REMOTE_JNDI_NAME);
+ TestEntity checkedEntity = hlp.getTestEntity(entityPK);
+
+ if (checkedEntity != null)
+ {
+ if (isDebug)
+ {
+ print("TestContextPropagation#checkDatabase(serverName=" + serverName + "): initEntity = " + initEntity);
+ print("TestContextPropagation#checkDatabase(serverName=" + serverName + "): checkedEntity = " + checkedEntity);
+ }
+
+ return (rollbackExpected) ? checkedEntity.getA() == initEntity.getA()
+ : checkedEntity.getA() != initEntity.getA();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ protected CrashHelperRem lookupCrashHelper(String serverName) throws Exception
+ {
+ return (CrashHelperRem) config.getNamingContext(serverName).lookup(CrashHelper.REMOTE_JNDI_NAME);
+ }
+
+ protected TestEntityHelperRem lookupTestEntityHelper(String serverName) throws Exception
+ {
+ return (TestEntityHelperRem) config.getNamingContext(serverName).lookup(TestEntityHelper.REMOTE_JNDI_NAME);
+ }
+
+ protected void startTx(String serverName) throws NamingException, SystemException, NotSupportedException, SubtransactionsUnavailable, org.omg.CORBA.SystemException, InvalidName
+ {
+ if (isDebug)
+ print("startTx at serverName=" + serverName + ", useOTS = " + useOTS);
+
+ if (useOTS)
+ {
+ initORB();
+ OTSManager.get_current().begin();
+ }
+ else
+ {
+ tx = (UserTransaction) config.getNamingContext(serverName).lookup("UserTransaction");
+ tx.begin();
+ }
+ }
+
+ protected void endTx()
+ {
+ if (isDebug)
+ print("endTx useOTS = " + useOTS);
+
+ try
+ {
+ if (useOTS)
+ if (rollbackExpected)
+ OTSManager.get_current().rollback();
+ else
+ OTSManager.get_current().commit(true);
+ else
+ if (rollbackExpected)
+ tx.rollback();
+ else
+ tx.commit();
+ }
+ catch (Throwable e)
+ {
+ print("User tx " + (rollbackExpected ? "rollback" : "commit") + " failure: " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Wipes out all the txs in doubt from the database on a given server.
+ *
+ * @return true in success, fail otherwise
+ */
+ private boolean wipeOutTxsInDoubt(String serverName)
+ {
+ // wipes out all txs in doubt from DB
+ return wipeOutTxsInDoubt(serverName, null);
+ }
+
+ /**
+ * Wipes out only new txs in doubt from the database on a given server after test run.
+ *
+ * @param xidsInDoubtBeforeTest txs in doubt in database before test run
+ * @param xidsInDoubtBeforeTest txs in doubt in database after test run
+ * @return true in success, fail otherwise
+ */
+ private boolean wipeOutTxsInDoubt(String serverName, Set<RecoveredXid> xidsInDoubtBeforeTest, Set<RecoveredXid> xidsInDoubtAfterTest)
+ {
+ Set<RecoveredXid> xidsToRecover = new HashSet<RecoveredXid>(xidsInDoubtAfterTest);
+ xidsToRecover.removeAll(xidsInDoubtBeforeTest);
+
+ if (xidsToRecover.isEmpty())
+ return true;
+
+ return wipeOutTxsInDoubt(serverName, xidsToRecover);
+ }
+
+ /**
+ * Wipes out txs in doubt from the database on a given server according to a xidsToRecover list.
+ *
+ * @param xidsToRecover list of xids to recover
+ * @return true in success, fail otherwise
+ */
+ private boolean wipeOutTxsInDoubt(String serverName, Set<RecoveredXid> xidsToRecover)
+ {
+ print("wiping out txs in doubt");
+ try
+ {
+ lookupCrashHelper(serverName).wipeOutTxsInDoubt(xidsToRecover);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+
+ /**
+ * Count how many pending transaction branches there are in the transaction log.
+ *
+ * @return number of pending transaction branches
+ */
+ private int getPendingUids(TransactionLog store)
+ {
+ try
+ {
+ return store.getIds(storeType).size();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+
+ return -1;
+ }
+ }
+
+ private void clearXidsOnServer0()
+ {
+ clearXidsOnServerX(storeServer0);
+ }
+
+ private void clearXidsOnServer1()
+ {
+ clearXidsOnServerX(storeServer1);
+ }
+
+ private void clearXidsOnServerX(TransactionLog store)
+ {
+ try
+ {
+ store.clearXids(storeType);
+ }
+ catch (Exception ignore)
+ {
+ ignore.printStackTrace();
+ }
+ }
+
+ private ASFailureSpec[] parseSpecs(String specArg, StringBuilder sb, String specKey)
+ {
+ ASFailureSpec[] fspecs = config.parseSpecs(specArg);
+
+ for (ASFailureSpec spec: fspecs)
+ {
+ String name = (spec == null ? "INVALID" : spec.getName());
+
+ if (spec != null && spec.willTerminateVM())
+ {
+ if ("specsNode0".equals(specKey))
+ expectFailureNode0 = true;
+ else if ("specsNode1".equals(specKey))
+ expectFailureNode1 = true;
+ }
+
+ sb.append("\t").append(name).append('\n');
+ }
+
+ return fspecs;
+ }
+
+ public static synchronized void initORB() throws InvalidName
+ {
+ if (orb == null)
+ {
+ orb = new ORBWrapper();
+ orb.start();
+ }
+ }
+
+}
\ No newline at end of file
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashBMTBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashBMTBean.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashBMTBean.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,12 +18,12 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
import org.jboss.logging.Logger;
-import org.jboss.test.crashrecovery.recovery.ASFailureSpec;
-import org.jboss.test.crashrecovery.recovery.TestASRecovery;
-import org.jboss.test.crashrecovery.recovery.TestASRecoveryWithJPA;
+import org.jboss.test.jbossts.recovery.ASFailureSpec;
+import org.jboss.test.jbossts.recovery.TestASRecovery;
+import org.jboss.test.jbossts.recovery.TestASRecoveryWithJPA;
import javax.annotation.Resource;
import javax.ejb.EJBContext;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashCMTBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashCMTBean.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashCMTBean.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,12 +18,12 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
import org.jboss.logging.Logger;
-import org.jboss.test.crashrecovery.recovery.ASFailureSpec;
-import org.jboss.test.crashrecovery.recovery.TestASRecovery;
-import org.jboss.test.crashrecovery.recovery.TestASRecoveryWithJPA;
+import org.jboss.test.jbossts.recovery.ASFailureSpec;
+import org.jboss.test.jbossts.recovery.TestASRecovery;
+import org.jboss.test.jbossts.recovery.TestASRecoveryWithJPA;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashHelper.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashHelper.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashHelper.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -19,7 +19,7 @@
* 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.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
import java.sql.SQLException;
import java.util.HashSet;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashHelperRem.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashHelperRem.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashHelperRem.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -19,7 +19,7 @@
* 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.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
import java.util.Set;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashLocal.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashLocal.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashLocal.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,11 +18,11 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
import javax.ejb.Local;
-import org.jboss.test.crashrecovery.recovery.ASFailureSpec;
+import org.jboss.test.jbossts.recovery.ASFailureSpec;
@Local
public interface CrashLocal {
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashLocalHome.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashLocalHome.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashLocalHome.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
import javax.ejb.EJBLocalHome;
import javax.ejb.CreateException;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashRem.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashRem.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashRem.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,9 +18,9 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
-import org.jboss.test.crashrecovery.recovery.ASFailureSpec;
+import org.jboss.test.jbossts.recovery.ASFailureSpec;
import javax.ejb.Remote;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashRemHome.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashRemHome.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/CrashRemHome.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
import javax.ejb.EJBHome;
import javax.ejb.CreateException;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/RecoveredXid.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/RecoveredXid.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/RecoveredXid.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -19,7 +19,7 @@
* 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.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
import java.io.Serializable;
import java.util.Arrays;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntity.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/TestEntity.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntity.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -19,7 +19,7 @@
* 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.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
import java.io.Serializable;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelper.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/TestEntityHelper.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelper.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -19,7 +19,7 @@
* 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.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelperLocal.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/TestEntityHelperLocal.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelperLocal.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -19,7 +19,7 @@
* 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.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
import javax.ejb.Local;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelperRem.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/crash/TestEntityHelperRem.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelperRem.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -19,7 +19,7 @@
* 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.crashrecovery.crash;
+package org.jboss.test.jbossts.crash;
import javax.ejb.Remote;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureMode.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/recovery/ASFailureMode.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureMode.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.recovery;
+package org.jboss.test.jbossts.recovery;
import java.io.Serializable;
@@ -29,10 +29,12 @@
{
NONE(false)
- ,HALT(true) // halt the JVM
- ,EXIT(true) // exit the JVM
- ,SUSPEND(false) // suspend the calling thread
- ,XAEXCEPTION(false) // fail via one of the xa exception codes
+ ,HALT(true) // halt the JVM
+ ,EXIT(true) // exit the JVM
+ ,SUSP(false) // suspend the calling thread
+ ,XAEX(false) // fail via one of the xa exception codes
+ ,EJEX(false) // fail via EJBException -- for using only with ASFailureType.PRE_PREPARE and SYNCH_BEFORE
+ ,RBLY(false) // mark a transaction as rollback-only -- for using only with ASFailureType.PRE_PREPARE and SYNCH_BEFORE
;
private boolean willTerminateVM;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureSpec.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/recovery/ASFailureSpec.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureSpec.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.recovery;
+package org.jboss.test.jbossts.recovery;
import java.io.Serializable;
@@ -31,12 +31,12 @@
* test will be given a reference to these specifications and is
* responsible for interpreting their meaning.
*
- * @see org.jboss.test.crashrecovery.ASCrashRecovery01.Test03 for an example
- * @see org.jboss.test.crashrecovery.recovery.ASFailureMode
- * @see org.jboss.test.crashrecovery.recovery.ASFailureType
+ * @see org.jboss.test.jbossts.ASCrashRecovery01.Test03 for an example
+ * @see org.jboss.test.jbossts.recovery.ASFailureMode
+ * @see org.jboss.test.jbossts.recovery.ASFailureType
*
* A failure specification is defined in ASTestConfig
- * @see org.jboss.test.crashrecovery.taskdefs.ASTestConfig
+ * @see org.jboss.test.jbossts.taskdefs.ASTestConfig
*/
public class ASFailureSpec implements Serializable
{
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureType.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/recovery/ASFailureType.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureType.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.recovery;
+package org.jboss.test.jbossts.recovery;
import java.io.Serializable;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/ASTestResource.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/recovery/ASTestResource.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/ASTestResource.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,12 +18,15 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.recovery;
+package org.jboss.test.jbossts.recovery;
+import javax.ejb.EJBException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import javax.transaction.xa.XAException;
import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+
import java.io.Serializable;
import java.util.Set;
import java.util.HashSet;
@@ -43,6 +46,7 @@
private int _suspend;
private int _recoveryAttempts = 1;
private XAException _xaException;
+ private EJBException _ejbException;
private int txTimeout = 10;
private Set<Xid> _xids = new HashSet<Xid>();
private transient boolean _isPrepared = false; // transient so it doesn't get persisted in the tx store
@@ -87,6 +91,11 @@
System.out.println(message + " ... xa error: " + _xaException.getMessage());
throw _xaException;
}
+ else if (_ejbException != null)
+ {
+ System.out.println(message + " ... ejb error: " + _ejbException.getMessage());
+ throw _ejbException;
+ }
else if (_xaFailureMode.equals(ASFailureMode.HALT))
{
System.out.println(message + " ... halting");
@@ -97,14 +106,19 @@
System.out.println(message + " ... exiting");
System.exit(1);
}
- else if (_xaFailureMode.equals(ASFailureMode.SUSPEND))
+ else if (_xaFailureMode.equals(ASFailureMode.SUSP))
{
System.out.println(message + " ... suspending for " + _suspend);
suspend(_suspend);
System.out.println(message + " ... resuming");
}
+ else if (_xaFailureMode.equals(ASFailureMode.RBLY))
+ {
+ System.out.println(message + " ... marking the current transaction as rollback-only");
+ setRollbackOnly();
+ }
}
-
+
public String toString()
{
return _xaFailureType + ", " + _xaFailureMode + ", " + (_args != null && _args.length != 0 ? _args[0] : "");
@@ -122,6 +136,19 @@
}
}
+ private void setRollbackOnly()
+ {
+ try
+ {
+ Transaction tx = com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction();
+ tx.setRollbackOnly();
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ }
+ }
+
public void setFailureMode(ASFailureMode mode, String ... args) throws IllegalArgumentException
{
_xaFailureMode = mode;
@@ -129,17 +156,21 @@
if (args != null && args.length != 0)
{
- if (_xaFailureMode.equals(ASFailureMode.SUSPEND))
+ if (_xaFailureMode.equals(ASFailureMode.SUSP))
{
_suspend = Integer.parseInt(args[0]);
}
- else if (_xaFailureMode.equals(ASFailureMode.XAEXCEPTION))
+ else if (_xaFailureMode.equals(ASFailureMode.XAEX))
{
_xaException = xaCodeMap.get(args[0]);
if (_xaException == null)
_xaException = new XAException(XAException.XAER_RMFAIL);
}
+ else if (_xaFailureMode.equals(ASFailureMode.EJEX))
+ {
+ _ejbException = new EJBException(args[0]);
+ }
}
}
@@ -158,14 +189,14 @@
this._recoveryAttempts = _recoveryAttempts;
}
- // Synchronizatons
+ // Synchronizations
public void beforeCompletion()
{
if (_xaFailureType.equals(ASFailureType.SYNCH_BEFORE))
try
{
- applySpec("Before completion");
+ applySpec("Before completion", true);
}
catch (XAException e)
{
@@ -322,6 +353,6 @@
public boolean expectException()
{
- return _xaFailureMode.equals(ASFailureMode.XAEXCEPTION);
+ return _xaFailureMode.equals(ASFailureMode.XAEX);
}
}
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecovery.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/recovery/TestASRecovery.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecovery.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.recovery;
+package org.jboss.test.jbossts.recovery;
import javax.transaction.xa.XAException;
import javax.transaction.*;
@@ -31,91 +31,127 @@
*/
public class TestASRecovery
{
- List<ASTestResource> resources = new ArrayList<ASTestResource> ();
- private boolean expectException;
+ List<ASTestResource> resources = new ArrayList<ASTestResource> ();
+ private boolean expectException;
- public void addResource(ASFailureSpec spec)
- {
- resources.add(new ASTestResource(spec));
- }
+ /**
+ * Order of enlisting of additional XA resources. The default value is false.
+ * <ul>
+ * <li>rev (true):
+ * enlist <tt>spec</tt> resources at first, i.e. enlists ASTestResources from <tt>spec</tt> and then calls the addTxResources method
+ * <li>non-rev (false):
+ * enlist additional XA resources at first, i.e. calls the addTxResources method and then enlists ASTestResources from <tt>spec</tt>,
+ * </ul>
+ */
+ private boolean reverseOrder = false;
- /**
- * See if there are any faults that should be injected before starting the
- * commit protocol
- */
- private void preCommit()
- {
- for (ASTestResource spec : resources)
- {
- if (spec.isPreCommit())
- try
- {
- spec.applySpec("Pre commit", true);
- }
- catch (XAException ignore)
- {
- }
- }
- }
- public boolean startTest(Transaction tx)
- {
- try
- {
- for (ASTestResource res : resources)
- {
- System.out.println("Enlisting " + res);
+ public void addResource(ASFailureSpec spec)
+ {
+ resources.add(new ASTestResource(spec));
+ }
- if (res.isXAResource())
- tx.enlistResource(res);
- else if (res.isSynchronization())
- tx.registerSynchronization(res);
+ /**
+ * See if there are any faults that should be injected before starting the
+ * commit protocol
+ */
+ private void preCommit()
+ {
+ for (ASTestResource spec : resources)
+ {
+ if (spec.isPreCommit())
+ try
+ {
+ spec.applySpec("Pre commit", true);
+ }
+ catch (XAException ignore)
+ {
+ }
+ }
+ }
- if (res.expectException())
- expectException = true;
- }
+ public boolean startTest(Transaction tx)
+ {
+ try
+ {
+ boolean result = true;
- preCommit();
+ if (!reverseOrder)
+ result = addTxResources(tx);
- return true;
- }
- catch (RollbackException e)
- {
- e.printStackTrace();
- }
- catch (SystemException e)
- {
- e.printStackTrace();
- }
+ for (ASTestResource res : resources)
+ {
+ System.out.println("Enlisting " + res);
- return false;
- }
+ if (res.isXAResource())
+ tx.enlistResource(res);
+ else if (res.isSynchronization())
+ tx.registerSynchronization(res);
- public boolean startTest()
- {
- UserTransaction ut = com.arjuna.ats.jta.UserTransaction.userTransaction();
+ if (res.expectException())
+ expectException = true;
+ }
- try
- {
- ut.begin();
+ if (reverseOrder)
+ result = result && addTxResources(tx);
- if (!startTest(com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction()))
- ut.rollback();
- else
- {
- ut.commit();
-
- return !expectException;
- }
- }
- catch (Exception e)
- {
- if (expectException)
- return true; // TODO should check each specific exception type
-
- e.printStackTrace();
- }
+ preCommit();
- return false;
- }
+ return result;
+ }
+ catch (RollbackException e)
+ {
+ e.printStackTrace();
+ }
+ catch (SystemException e)
+ {
+ e.printStackTrace();
+ }
+
+ return false;
+ }
+
+ public boolean startTest()
+ {
+ UserTransaction ut = com.arjuna.ats.jta.UserTransaction.userTransaction();
+
+ try
+ {
+ ut.begin();
+
+ if (!startTest(com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction()))
+ ut.rollback();
+ else
+ {
+ ut.commit();
+
+ return !expectException;
+ }
+ }
+ catch (Exception e)
+ {
+ if (expectException)
+ return true; // TODO should check each specific exception type
+
+ e.printStackTrace();
+ }
+
+ return false;
+ }
+
+ /**
+ * To be optionally redefined by adding your own resources/actions to the tested transaction.
+ *
+ * @return
+ */
+ protected boolean addTxResources(Transaction tx)
+ {
+ return true;
+ }
+
+ public void setReverseOrder(boolean b)
+ {
+ this.reverseOrder = b;
+ }
+
}
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecoveryWithJPA.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/recovery/TestASRecoveryWithJPA.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecoveryWithJPA.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -19,14 +19,14 @@
* 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.crashrecovery.recovery;
+package org.jboss.test.jbossts.recovery;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.transaction.Transaction;
-import org.jboss.test.crashrecovery.crash.TestEntityHelper;
-import org.jboss.test.crashrecovery.crash.TestEntityHelperLocal;
+import org.jboss.test.jbossts.crash.TestEntityHelper;
+import org.jboss.test.jbossts.crash.TestEntityHelperLocal;
/**
* Extends TestASRecovery class by adding JPA entity update.
@@ -34,7 +34,6 @@
public class TestASRecoveryWithJPA extends TestASRecovery
{
private String testEntityPK = null;
- private boolean reverseOrder = false;
/**
* Primary key of test entity.
@@ -48,58 +47,26 @@
}
/**
- * Sets order of enlisting of XA resources.
- * <ul><li>non-rev (b=false): 1. JPA XA resource, 2. crash XA resource
- * <li>rev (b=true): 1. crash XA resource, 2. JPA XA resource</ul>
- *
- * @param b
- */
- public void setReverseOrder(boolean b)
- {
- this.reverseOrder = b;
- }
-
- public boolean startTest(Transaction tx)
- {
- boolean result = true;
-
- if (reverseOrder)
- {
- result = result && super.startTest(tx); // this sequence denies usage of PRECOMMIT, but we don't need it for crash recovery tests
- result = result && doJPAEntityUpdate();
- }
- else
- {
- result = result && doJPAEntityUpdate();
- result = result && super.startTest(tx);
- }
-
-
- return result;
- }
-
- public boolean startTest()
- {
- return super.startTest();
- }
-
-
- /**
* Calls update of a test entity.
*/
- protected boolean doJPAEntityUpdate()
+ @Override
+ protected boolean addTxResources(Transaction tx)
{
- TestEntityHelperLocal testEntityHelper;
- try
+ if (super.addTxResources(tx))
{
- testEntityHelper = (TestEntityHelperLocal) new InitialContext().lookup(TestEntityHelper.LOCAL_JNDI_NAME);
-
- return testEntityHelper.updateTestEntity(testEntityPK);
+ TestEntityHelperLocal testEntityHelper;
+ try
+ {
+ testEntityHelper = (TestEntityHelperLocal) new InitialContext().lookup(TestEntityHelper.LOCAL_JNDI_NAME);
+
+ return testEntityHelper.updateTestEntity(testEntityPK);
+ }
+ catch (NamingException e)
+ {
+ e.printStackTrace();
+ }
}
- catch (NamingException e)
- {
- e.printStackTrace();
- }
+
return false;
}
Added: trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecoveryWithJTSPropagation.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecoveryWithJTSPropagation.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecoveryWithJTSPropagation.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.jbossts.recovery;
+
+import javax.ejb.EJBTransactionRolledbackException;
+import javax.transaction.Transaction;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.CannotConnectException;
+import org.jboss.test.jbossts.txpropagation.EJBUtils;
+import org.jboss.test.jbossts.txpropagation.ejb2.TxPropagationEJB2Rem;
+import org.jboss.test.jbossts.txpropagation.ejb3.TxPropagationRem;
+
+/**
+ * Extends TestASRecovery class by calling an ejb bean on a remote host.
+ */
+public class TestASRecoveryWithJTSPropagation extends TestASRecoveryWithJPA
+{
+ private static Logger log = Logger.getLogger(TestASRecoveryWithJTSPropagation.class);
+
+ private String remoteHost = null;
+ private int remoteJndiPort = 1099;
+ private int remoteCorbaPort = 3528;
+ private ASFailureSpec[] fSpecsRemoteNode = null;
+ private String testEntityPKRemoteNode = null;
+ private boolean expectFailureOnRemoteNode = false;
+
+ private boolean useOTS = false;
+ private boolean useEJB3 = false;
+
+
+ /**
+ * Calls update of a test entity.
+ */
+ @Override
+ protected boolean addTxResources(Transaction tx)
+ {
+ boolean result = super.addTxResources(tx);
+ result = result && callRemoteBean();
+
+ return result;
+ }
+
+ private boolean callRemoteBean()
+ {
+ if (remoteHost == null)
+ return true;
+
+
+ log.info("calling remote bean with params; remote host " + remoteHost + ", useEJB3 " + useEJB3 + ", useOTS " + useOTS);
+
+ try
+ {
+ String result = null;
+
+ if (useEJB3)
+ {
+ TxPropagationRem cr = EJBUtils.lookupTxPropagationBeanEJB3(remoteHost, remoteJndiPort, remoteCorbaPort, useOTS);
+ result = cr.testXA(fSpecsRemoteNode, testEntityPKRemoteNode);
+ }
+ else
+ {
+ TxPropagationEJB2Rem cr = EJBUtils.lookupTxPropagationBeanEJB2(remoteHost, remoteJndiPort, remoteCorbaPort, useOTS);
+ result = cr.testXA(fSpecsRemoteNode, testEntityPKRemoteNode);
+ }
+
+ log.info("result = " + result);
+ return "Passed".equalsIgnoreCase(result);
+ }
+ catch (CannotConnectException e)
+ {
+ if (expectFailureOnRemoteNode)
+ {
+ // try to recover, this failure was expected
+ log.info("Failure was expected: " + e.getMessage(), e);
+ throw e;
+ }
+ else
+ {
+ log.error(e);
+ e.printStackTrace();
+ }
+ }
+ catch (EJBTransactionRolledbackException re)
+ {
+ // try to recover, this failure was expected maybe?!
+ log.info("Failure was expected (maybe): " + re.getMessage(), re);
+ throw re;
+ }
+ catch (Throwable t)
+ {
+ log.error(t);
+ t.printStackTrace();
+ }
+
+ return false;
+ }
+
+
+ public void setRemoteHost(String remoteHost)
+ {
+ this.remoteHost = remoteHost;
+ }
+
+ public void setfSpecsRemoteNode(ASFailureSpec[] fSpecsRemoteNode)
+ {
+ this.fSpecsRemoteNode = fSpecsRemoteNode;
+ }
+
+ public void setTestEntityPKRemoteNode(String testEntityPKRemoteNode)
+ {
+ this.testEntityPKRemoteNode = testEntityPKRemoteNode;
+ }
+
+ public void setExpectFailureOnRemoteNode(boolean expectFailureOnRemoteNode)
+ {
+ this.expectFailureOnRemoteNode = expectFailureOnRemoteNode;
+ }
+
+ public void setUseOTS(boolean useOTS)
+ {
+ this.useOTS = useOTS;
+ }
+
+ public void setUseEJB3(boolean useEJB3)
+ {
+ this.useEJB3 = useEJB3;
+ }
+
+ public void setRemoteJndiPort(int remoteJndiPort)
+ {
+ this.remoteJndiPort = remoteJndiPort;
+ }
+
+ public void setRemoteCorbaPort(int remoteCorbaPort)
+ {
+ this.remoteCorbaPort = remoteCorbaPort;
+ }
+
+}
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ASClientTask.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ASClientTask.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ASClientTask.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,11 +18,11 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
-import org.jboss.test.crashrecovery.taskdefs.ClientAction;
+import org.jboss.test.jbossts.taskdefs.ClientAction;
import java.util.List;
import java.util.ArrayList;
@@ -147,7 +147,7 @@
/**
* Task property to set the test name. This name will be printed when the test completes
* followed by a string to indicate pass or failure.
- * see org.jboss.test.crashrecovery.taskdefs.ASClientTask.PASS
+ * see org.jboss.test.jbossts.taskdefs.ASClientTask.PASS
* @param name the name of the test.
*/
public void setName(String name)
@@ -194,7 +194,7 @@
/**
* Task property defaults to
- * see org.jboss.test.crashrecovery.taskdefs.ASTestConfig.PASS
+ * see org.jboss.test.jbossts.taskdefs.ASTestConfig.PASS
*
* @param passText the text to print if the test succeeds
*/
@@ -205,7 +205,7 @@
/**
* Task property to
- * see org.jboss.test.crashrecovery.taskdefs.ASTestConfig.FAIL
+ * see org.jboss.test.jbossts.taskdefs.ASTestConfig.FAIL
*
* @param failText the text to print if the test succeeds
*/
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ASTestConfig.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ASTestConfig.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ASTestConfig.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,11 +18,11 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
-import org.jboss.test.crashrecovery.recovery.ASFailureSpec;
+import org.jboss.test.jbossts.recovery.ASFailureSpec;
import org.jboss.jbossas.servermanager.Server;
import org.jboss.jbossas.servermanager.ServerManager;
import org.xml.sax.SAXException;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ClientAction.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ClientAction.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ClientAction.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
import java.util.Map;
@@ -35,7 +35,7 @@
* @param params Arbitary collection of name/value pairs passed in from the ant script
* that triggered this action
* @return true to indicate that the action completed successfully
- * @see org.jboss.test.crashrecovery.taskdefs.ASClientTask
+ * @see org.jboss.test.jbossts.taskdefs.ASClientTask
*/
boolean execute(ASTestConfig config, Map<String, String> params);
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ClientTask.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ClientTask.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ClientTask.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,11 +18,11 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
-import org.jboss.test.crashrecovery.taskdefs.ClientAction;
+import org.jboss.test.jbossts.taskdefs.ClientAction;
import java.util.List;
import java.util.ArrayList;
@@ -147,7 +147,7 @@
/**
* Task property to set the test name. This name will be printed when the test completes
* followed by a string to indicate pass or failure.
- * see org.jboss.test.crashrecovery.taskdefs.ASClientTask.PASS
+ * see org.jboss.test.jbossts.taskdefs.ASClientTask.PASS
* @param name the name of the test.
*/
public void setName(String name)
@@ -194,7 +194,7 @@
/**
* Task property defaults to
- * see org.jboss.test.crashrecovery.taskdefs.ASTestConfig.PASS
+ * see org.jboss.test.jbossts.taskdefs.ASTestConfig.PASS
*
* @param passText the text to print if the test succeeds
*/
@@ -205,7 +205,7 @@
/**
* Task property to
- * see org.jboss.test.crashrecovery.taskdefs.ASTestConfig.FAIL
+ * see org.jboss.test.jbossts.taskdefs.ASTestConfig.FAIL
*
* @param failText the text to print if the test succeeds
*/
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/JUnitClientAction.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/JUnitClientAction.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/JUnitClientAction.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
@@ -50,7 +50,6 @@
{
String testClass = null;
String name = "Test";
- String serverName = "default";
String reportFile = null;
for (Map.Entry<String, String> me : params.entrySet())
@@ -60,8 +59,6 @@
if ("name".equals(key))
name = val;
- else if ("serverName".equals(key))
- serverName = val;
else if ("debug".equals(key))
isDebug = val.equalsIgnoreCase("true");
else if ("reportFile".equals(key))
@@ -72,8 +69,6 @@
try
{
- String serverPath = config.getServerPath(serverName);
-
TestResult result = new TestResult();
XMLJUnitResultFormatter resultFormatter = new XMLJUnitResultFormatter();
@@ -111,8 +106,8 @@
System.err.println("Class " + testClass + " cannot be instantiated: " + e.getMessage());
}
- test.setName("testCrashRecovery");
- test.init(config, params, serverPath);
+ test.setName("testAction");
+ test.init(config, params, isDebug);
suite.addTest(test);
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/JUnitClientTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/JUnitClientTest.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/JUnitClientTest.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -19,14 +19,14 @@
* 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.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
import java.util.Map;
import junit.framework.TestCase;
/**
- * Abstract junit-based client test.
+ * Abstract JUnit-based client test.
*
* @author <a href="istudens at redhat.com">Ivo Studensky</a>
* @version $Revision: 1.1 $
@@ -35,7 +35,7 @@
{
protected ASTestConfig config = null;
protected Map<String, String> params = null;
- protected String serverPath = null;
+ protected boolean isDebug = false;
public JUnitClientTest()
{
@@ -47,23 +47,35 @@
super(name);
}
- public void init(ASTestConfig config, Map<String, String> params, String serverPath)
+ public void init(ASTestConfig config, Map<String, String> params, boolean debug)
{
this.config = config;
this.params = params;
- this.serverPath = serverPath;
+ this.isDebug = debug;
}
/**
* The test method.
* Should be overridden.
*/
- public abstract void testCrashRecovery();
+ public abstract void testAction();
protected void print(String msg)
{
System.out.println(msg);
}
+
+ public void suspendFor(int millis)
+ {
+ try
+ {
+ Thread.sleep(millis);
+ }
+ catch (InterruptedException e)
+ {
+ System.out.println("Test " + getName() + " interupted");
+ }
+ }
}
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerBindingConfig.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ServerBindingConfig.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerBindingConfig.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
import java.io.File;
import java.io.IOException;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerTask.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ServerTask.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerTask.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerTaskException.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ServerTaskException.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerTaskException.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
import java.util.Collection;
import java.util.ArrayList;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TaskProperty.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/TaskProperty.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TaskProperty.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
/**
* Key/value holder for passing in parameters to custom ant tasks
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TaskValue.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/TaskValue.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TaskValue.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
/**
* Value holder for passing in parameters to custom ant tasks
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TransactionLog.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/TransactionLog.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TransactionLog.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,7 +18,7 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
import com.arjuna.ats.arjuna.objectstore.ObjectStore;
import com.arjuna.ats.arjuna.common.Uid;
Modified: trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/Utils.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/Utils.java 2009-12-15 07:42:53 UTC (rev 97836)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/taskdefs/Utils.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -18,23 +18,39 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.taskdefs;
+package org.jboss.test.jbossts.taskdefs;
import java.io.File;
import java.io.IOException;
+
public class Utils
{
- public static File toFile(String fileName)
- {
- try
- {
- return new File(fileName).getCanonicalFile();
- }
- catch (IOException e)
- {
- return new File(fileName).getAbsoluteFile();
- }
- }
+ public static File toFile(String fileName)
+ {
+ try
+ {
+ return new File(fileName).getCanonicalFile();
+ }
+ catch (IOException e)
+ {
+ return new File(fileName).getAbsoluteFile();
+ }
+ }
+
+ public static int parseInt(String intValue, String errorMessage) throws IllegalArgumentException
+ {
+ try
+ {
+ return Integer.parseInt(intValue);
+ }
+ catch (NumberFormatException e)
+ {
+ System.out.println(errorMessage + e.getMessage());
+
+ throw new IllegalArgumentException(e);
+ }
+ }
+
}
Added: trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/EJBUtils.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/EJBUtils.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/EJBUtils.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.test.jbossts.txpropagation;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.rmi.PortableRemoteObject;
+
+import org.jboss.test.jbossts.txpropagation.ejb2.TxPropagationEJB2Home;
+import org.jboss.test.jbossts.txpropagation.ejb2.TxPropagationEJB2Rem;
+import org.jboss.test.jbossts.txpropagation.ejb3.TxPropagationRem;
+
+public class EJBUtils
+{
+ private static String EJB2_JNDI_CORBA_FAC = "com.sun.jndi.cosnaming.CNCtxFactory";
+ // use the CORBA name service to do JNDI lookups
+ // HOST is the host where the EJB has been registered
+ // ORB is the implementation name of the ORB (default name is JBoss
+ // - see conf/jacorb.properties property jacorb.implname)
+ // the port 3528 is the IIOP port officially assigned to JBoss by IANA
+ private static String EJB2_JNDI_CORBA_URL = "corbaloc::HOST:PORT/ORB/Naming/root";
+ private static String JBOSS_ORB = "JBoss";
+
+ private static String JNDI_FAC = "org.jboss.naming.NamingContextFactory"; //"org.jnp.interfaces.NamingContextFactory"
+ private static String JNDI_URL = "jnp://HOST:PORT";
+ private static String JNDI_PKGS = "org.jboss.naming.client:org.jnp.interfaces";
+
+
+
+ public static Object lookupEjb(String host, int jndiPort, int corbaPort, String name, @SuppressWarnings("unchecked") Class clazz, boolean useOTS) throws Exception
+ {
+ System.out.println("looking up " + name + " on host " + host);
+
+ Context ctx = getNamingContext(host, jndiPort, corbaPort, useOTS);
+
+ try
+ {
+ Object o = ctx.lookup(name);
+
+ return PortableRemoteObject.narrow(o, clazz);
+ }
+ finally
+ {
+ ctx.close();
+ }
+ }
+
+ public static Object lookupObject(String host, int jndiPort, int corbaPort, String name, boolean useOTS) throws Exception
+ {
+ System.out.println("looking up " + name + " on host " + host);
+
+ Context ctx = getNamingContext(host, jndiPort, corbaPort, useOTS);
+ return ctx.lookup(name);
+ }
+
+ public static Context getNamingContext(String host, int jndiPort, int corbaPort, boolean useOTS) throws NamingException, IOException
+ {
+ Properties properties = new Properties();
+ String url = useOTS ? EJB2_JNDI_CORBA_URL : JNDI_URL;
+ String fac = useOTS ? EJB2_JNDI_CORBA_FAC : JNDI_FAC;
+
+ url = url.replace("HOST", host).replace("ORB", JBOSS_ORB);
+ url = url.replace("PORT", Integer.toString(useOTS ? corbaPort : jndiPort));
+
+ System.out.println("jndi url: " + url);
+ properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, fac);
+ properties.setProperty(Context.URL_PKG_PREFIXES, JNDI_PKGS);
+ properties.setProperty(Context.PROVIDER_URL, url);
+
+ return new InitialContext(properties);
+ }
+
+ public static TxPropagationEJB2Rem lookupTxPropagationBeanEJB2(String host, int jndiPort, int corbaPort, boolean useOTS) throws Exception
+ {
+ String jndiName = useOTS ? TxPropagationEJB2Rem.JNDI_NAME_IIOP : TxPropagationEJB2Rem.JNDI_NAME_JRMP;
+ TxPropagationEJB2Home home = (TxPropagationEJB2Home) lookupEjb(host, jndiPort, corbaPort, jndiName, TxPropagationEJB2Home.class, useOTS);
+ return home.create();
+ }
+
+ public static TxPropagationRem lookupTxPropagationBeanEJB3(String host, int jndiPort, int corbaPort, boolean useOTS) throws Exception
+ {
+ if (useOTS)
+ throw new UnsupportedOperationException("ejb3 does not support IIOP protocol yet");
+
+ return (TxPropagationRem) lookupEjb(host, jndiPort, corbaPort, TxPropagationRem.JNDI_NAME, TxPropagationRem.class, false);
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ORBWrapper.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ORBWrapper.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ORBWrapper.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+package org.jboss.test.jbossts.txpropagation;
+
+import org.omg.CORBA.ORBPackage.InvalidName;
+
+import com.arjuna.orbportability.ORB;
+import com.arjuna.orbportability.RootOA;
+
+/**
+ * Simple class to start and stop an ORB for use with OTS based transactions
+ */
+public class ORBWrapper
+{
+ ORB orb;
+ RootOA oa;
+
+ public void start() throws InvalidName
+ {
+ orb = com.arjuna.orbportability.ORB.getInstance("ClientSide");
+ System.err.println("orb="+orb);
+ oa = com.arjuna.orbportability.OA.getRootOA(orb);
+ System.err.println("oa="+oa);
+ orb.initORB(new String[] {}, null);
+ oa.initOA();
+ }
+
+ public void stop()
+ {
+ oa.destroy();
+ orb.shutdown();
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/TxPropagationEJB2Bean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/TxPropagationEJB2Bean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/TxPropagationEJB2Bean.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009
+ * @author JBoss Inc.
+ */
+package org.jboss.test.jbossts.txpropagation.ejb2;
+
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.transaction.Transaction;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.jbossts.recovery.ASFailureSpec;
+import org.jboss.test.jbossts.recovery.TestASRecoveryWithJTSPropagation;
+
+ at SuppressWarnings("serial")
+public class TxPropagationEJB2Bean implements SessionBean
+{
+ private static Logger log = Logger.getLogger(TxPropagationEJB2Bean.class);
+
+
+ // Dedicated for the first call of the propagation tests.
+ public String testXA(ASFailureSpec[] fSpecsNode, ASFailureSpec[] fSpecsRemoteNode, String testEntityPK, String testEntityPKRemoteNode, String remoteHost, boolean expectFailureOnRemoteNode, boolean useOTS, int remoteJndiPort, int remoteCorbaPort)
+ {
+ log.info("CMT testXA called with " + fSpecsNode.length + "(this node) and " + fSpecsRemoteNode.length + "(remote node) specs and testEntityPK=" + testEntityPK + ", testEntityPKRemoteNode=" + testEntityPKRemoteNode + ", remoteHost=" + remoteHost + ", expectFailureOnRemoteNode=" + expectFailureOnRemoteNode + ", useOTS=" + useOTS);
+
+ TestASRecoveryWithJTSPropagation xatest = new TestASRecoveryWithJTSPropagation();
+ Transaction tx;
+
+ try
+ {
+ tx = com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction();
+ }
+ catch (javax.transaction.SystemException e)
+ {
+ tx = null;
+ }
+
+ if (tx == null)
+ {
+ log.error("CMT method called without a transaction");
+
+ return "Failed";
+ }
+ else
+ {
+ xatest.setTestEntityPK(testEntityPK);
+ xatest.setRemoteHost(remoteHost);
+ xatest.setfSpecsRemoteNode(fSpecsRemoteNode);
+ xatest.setTestEntityPKRemoteNode(testEntityPKRemoteNode);
+ xatest.setExpectFailureOnRemoteNode(expectFailureOnRemoteNode);
+ xatest.setRemoteJndiPort(remoteJndiPort);
+ xatest.setRemoteCorbaPort(remoteCorbaPort);
+ xatest.setUseEJB3(false);
+ xatest.setUseOTS(useOTS);
+
+ for (ASFailureSpec spec : fSpecsNode)
+ xatest.addResource(spec);
+
+ return xatest.startTest(tx) ? "Passed" : "Failed";
+ }
+ }
+
+ // Dedicated for the second call (remote side) of the propagation tests, i.e. it expects to be run within an existing transaction.
+ public String testXA(ASFailureSpec[] fSpecsNode, String testEntityPK)
+ {
+ log.info("CMT testXA called with " + fSpecsNode.length + " specs and testEntityPK=" + testEntityPK);
+
+ TestASRecoveryWithJTSPropagation xatest = new TestASRecoveryWithJTSPropagation();
+ Transaction tx;
+
+ try
+ {
+ tx = com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction();
+ }
+ catch (javax.transaction.SystemException e)
+ {
+ tx = null;
+ }
+
+ if (tx == null)
+ {
+ log.error("CMT method called without a transaction");
+
+ return "Failed";
+ }
+ else
+ {
+ xatest.setTestEntityPK(testEntityPK);
+
+ for (ASFailureSpec spec : fSpecsNode)
+ xatest.addResource(spec);
+
+ return xatest.startTest(tx) ? "Passed" : "Failed";
+ }
+ }
+
+ public void setSessionContext(SessionContext context) { }
+ public void ejbCreate() { }
+ public void ejbActivate() { }
+ public void ejbPassivate() { }
+ public void ejbRemove() { }
+}
Added: trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/TxPropagationEJB2Home.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/TxPropagationEJB2Home.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/TxPropagationEJB2Home.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009
+ * @author JBoss Inc.
+ */
+
+package org.jboss.test.jbossts.txpropagation.ejb2;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+import java.rmi.RemoteException;
+
+public interface TxPropagationEJB2Home extends EJBHome
+{
+ TxPropagationEJB2Rem create() throws CreateException, RemoteException;
+}
Added: trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/TxPropagationEJB2Rem.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/TxPropagationEJB2Rem.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb2/TxPropagationEJB2Rem.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009
+ * @author JBoss Inc.
+ */
+package org.jboss.test.jbossts.txpropagation.ejb2;
+
+import java.rmi.RemoteException;
+
+import org.jboss.test.jbossts.recovery.ASFailureSpec;
+
+public interface TxPropagationEJB2Rem extends javax.ejb.EJBObject
+{
+ String JNDI_NAME_JRMP = "TxPropagationEJB2Bean";
+ String JNDI_NAME_IIOP = "TxPropagationEJB2BeanIIOP";
+
+ /**
+ * Dedicated for the first node of the propagation tests.
+ *
+ * @param fSpecsNode0
+ * @param fSpecsNode1
+ * @param testEntityPK0
+ * @param testEntityPK1
+ * @param host1
+ * @param useOTS
+ * @return
+ */
+ public String testXA(ASFailureSpec[] fSpecsNode, ASFailureSpec[] fSpecsRemoteNode, String testEntityPK, String testEntityPKRemoteNode, String remoteHost, boolean expectFailureOnRemoteNode, boolean useOTS, int remoteJndiPort, int remoteCorbaPort) throws RemoteException;
+
+ /**
+ * Dedicated for the second node of the propagation tests.
+ *
+ * @param fSpecsNode
+ * @param testEntityPK
+ * @return
+ */
+ public String testXA(ASFailureSpec[] fSpecsNode, String testEntityPK) throws RemoteException;
+}
Added: trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb3/TxPropagationBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb3/TxPropagationBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb3/TxPropagationBean.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.test.jbossts.txpropagation.ejb3;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.jbossts.recovery.ASFailureSpec;
+import org.jboss.test.jbossts.recovery.TestASRecoveryWithJTSPropagation;
+
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.transaction.Transaction;
+
+ at Stateless
+public class TxPropagationBean implements TxPropagationRem
+{
+ private static Logger log = Logger.getLogger(TxPropagationBean.class);
+
+
+ // Dedicated for the first call of the propagation tests.
+ @TransactionAttribute(TransactionAttributeType.REQUIRED)
+ public String testXA(ASFailureSpec[] fSpecsNode, ASFailureSpec[] fSpecsRemoteNode, String testEntityPK, String testEntityPKRemoteNode, String remoteHost, boolean expectFailureOnRemoteNode, boolean useOTS, int remoteJndiPort, int remoteCorbaPort)
+ {
+ log.info("CMT testXA called with " + fSpecsNode.length + "(this node) and " + fSpecsRemoteNode.length + "(remote node) specs and testEntityPK=" + testEntityPK + ", testEntityPKRemoteNode=" + testEntityPKRemoteNode + ", remoteHost=" + remoteHost + ", expectFailureOnRemoteNode=" + expectFailureOnRemoteNode + ", useOTS=" + useOTS);
+
+ TestASRecoveryWithJTSPropagation xatest = new TestASRecoveryWithJTSPropagation();
+ Transaction tx;
+
+ try
+ {
+ tx = com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction();
+ }
+ catch (javax.transaction.SystemException e)
+ {
+ tx = null;
+ }
+
+ if (tx == null)
+ {
+ log.error("CMT method called without a transaction");
+
+ return "Failed";
+ }
+ else
+ {
+ xatest.setTestEntityPK(testEntityPK);
+ xatest.setRemoteHost(remoteHost);
+ xatest.setfSpecsRemoteNode(fSpecsRemoteNode);
+ xatest.setTestEntityPKRemoteNode(testEntityPKRemoteNode);
+ xatest.setExpectFailureOnRemoteNode(expectFailureOnRemoteNode);
+ xatest.setRemoteJndiPort(remoteJndiPort);
+ xatest.setRemoteCorbaPort(remoteCorbaPort);
+ xatest.setUseEJB3(true);
+ xatest.setUseOTS(useOTS);
+
+ for (ASFailureSpec spec : fSpecsNode)
+ xatest.addResource(spec);
+
+ return xatest.startTest(tx) ? "Passed" : "Failed";
+ }
+ }
+
+ // Dedicated for the second call (remote side) of the propagation tests, i.e. it expects to be run within an existing transaction.
+ @TransactionAttribute(TransactionAttributeType.MANDATORY)
+ public String testXA(ASFailureSpec[] fSpecsNode, String testEntityPK)
+ {
+ log.info("CMT testXA called with " + fSpecsNode.length + " specs and testEntityPK=" + testEntityPK);
+
+ TestASRecoveryWithJTSPropagation xatest = new TestASRecoveryWithJTSPropagation();
+ Transaction tx;
+
+ try
+ {
+ tx = com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction();
+ }
+ catch (javax.transaction.SystemException e)
+ {
+ tx = null;
+ }
+
+ if (tx == null)
+ {
+ log.error("CMT testXA called without a transaction");
+
+ return "Failed";
+ }
+ else
+ {
+ xatest.setTestEntityPK(testEntityPK);
+
+ for (ASFailureSpec spec : fSpecsNode)
+ xatest.addResource(spec);
+
+ return xatest.startTest(tx) ? "Passed" : "Failed";
+ }
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb3/TxPropagationRem.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb3/TxPropagationRem.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jbossts/txpropagation/ejb3/TxPropagationRem.java 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ * @author JBoss Inc.
+ */
+package org.jboss.test.jbossts.txpropagation.ejb3;
+
+import org.jboss.test.jbossts.recovery.ASFailureSpec;
+
+import javax.ejb.Remote;
+
+ at Remote
+public interface TxPropagationRem
+{
+ String JNDI_NAME = "TxPropagationBean/remote";
+
+ /**
+ * Dedicated for the first node of the propagation tests.
+ *
+ * @param fSpecsNode0
+ * @param fSpecsNode1
+ * @param testEntityPK0
+ * @param testEntityPK1
+ * @param host1
+ * @param useOTS
+ * @return
+ */
+ public String testXA(ASFailureSpec[] fSpecsNode, ASFailureSpec[] fSpecsRemoteNode, String testEntityPK, String testEntityPKRemoteNode, String remoteHost, boolean expectFailureOnRemoteNode, boolean useOTS, int remoteJndiPort, int remoteCorbaPort);
+
+ /**
+ * Dedicated for the second node of the propagation tests.
+ *
+ * @param fSpecsNode
+ * @param testEntityPK
+ * @return
+ */
+ String testXA(ASFailureSpec[] fSpecsNode, String testEntityPK);
+}
Copied: trunk/testsuite/src/resources/jbossts (from rev 96161, trunk/testsuite/src/resources/crashrecovery)
Copied: trunk/testsuite/src/resources/jbossts/crashrecovery/META-INF (from rev 96161, trunk/testsuite/src/resources/crashrecovery/META-INF)
Added: trunk/testsuite/src/resources/jbossts/jts-propagation/ejb2/META-INF/ejb-jar.xml
===================================================================
--- trunk/testsuite/src/resources/jbossts/jts-propagation/ejb2/META-INF/ejb-jar.xml (rev 0)
+++ trunk/testsuite/src/resources/jbossts/jts-propagation/ejb2/META-INF/ejb-jar.xml 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,86 @@
+<?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>Test transaction propagation using EJB2</description>
+ <ejb-name>TxPropagationEJB2BeanIIOP</ejb-name>
+ <home>org.jboss.test.jbossts.txpropagation.ejb2.TxPropagationEJB2Home</home>
+ <remote>org.jboss.test.jbossts.txpropagation.ejb2.TxPropagationEJB2Rem</remote>
+ <ejb-class>org.jboss.test.jbossts.txpropagation.ejb2.TxPropagationEJB2Bean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+
+ <session>
+ <description>Test transaction propagation using EJB2</description>
+ <ejb-name>TxPropagationEJB2Bean</ejb-name>
+ <home>org.jboss.test.jbossts.txpropagation.ejb2.TxPropagationEJB2Home</home>
+ <remote>org.jboss.test.jbossts.txpropagation.ejb2.TxPropagationEJB2Rem</remote>
+ <ejb-class>org.jboss.test.jbossts.txpropagation.ejb2.TxPropagationEJB2Bean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+
+ <assembly-descriptor>
+ <container-transaction>
+ <method>
+ <ejb-name>TxPropagationEJB2BeanIIOP</ejb-name>
+ <method-intf>Remote</method-intf>
+ <method-name>testXA</method-name>
+ <method-params>
+ <method-param>org.jboss.test.jbossts.recovery.ASFailureSpec[]</method-param>
+ <method-param>org.jboss.test.jbossts.recovery.ASFailureSpec[]</method-param>
+ <method-param>java.lang.String</method-param>
+ <method-param>java.lang.String</method-param>
+ <method-param>java.lang.String</method-param>
+ <method-param>java.lang.boolean</method-param>
+ <method-param>java.lang.boolean</method-param>
+ </method-params>
+ </method>
+ <trans-attribute>Required</trans-attribute>
+ </container-transaction>
+ <container-transaction>
+ <method>
+ <ejb-name>TxPropagationEJB2BeanIIOP</ejb-name>
+ <method-intf>Remote</method-intf>
+ <method-name>testXA</method-name>
+ <method-params>
+ <method-param>org.jboss.test.jbossts.recovery.ASFailureSpec[]</method-param>
+ <method-param>java.lang.String</method-param>
+ </method-params>
+ </method>
+ <trans-attribute>Mandatory</trans-attribute>
+ </container-transaction>
+ <container-transaction>
+ <method>
+ <ejb-name>TxPropagationEJB2Bean</ejb-name>
+ <method-intf>Remote</method-intf>
+ <method-name>testXA</method-name>
+ <method-params>
+ <method-param>org.jboss.test.jbossts.recovery.ASFailureSpec[]</method-param>
+ <method-param>org.jboss.test.jbossts.recovery.ASFailureSpec[]</method-param>
+ <method-param>java.lang.String</method-param>
+ <method-param>java.lang.String</method-param>
+ <method-param>java.lang.String</method-param>
+ <method-param>java.lang.boolean</method-param>
+ <method-param>java.lang.boolean</method-param>
+ </method-params>
+ </method>
+ <trans-attribute>Required</trans-attribute>
+ </container-transaction>
+ <container-transaction>
+ <method>
+ <ejb-name>TxPropagationEJB2Bean</ejb-name>
+ <method-intf>Remote</method-intf>
+ <method-name>testXA</method-name>
+ <method-params>
+ <method-param>org.jboss.test.jbossts.recovery.ASFailureSpec[]</method-param>
+ <method-param>java.lang.String</method-param>
+ </method-params>
+ </method>
+ <trans-attribute>Mandatory</trans-attribute>
+ </container-transaction>
+ </assembly-descriptor>
+</ejb-jar>
Added: trunk/testsuite/src/resources/jbossts/jts-propagation/ejb2/META-INF/jboss.xml
===================================================================
--- trunk/testsuite/src/resources/jbossts/jts-propagation/ejb2/META-INF/jboss.xml (rev 0)
+++ trunk/testsuite/src/resources/jbossts/jts-propagation/ejb2/META-INF/jboss.xml 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<jboss>
+ <enterprise-beans>
+ <session>
+ <ejb-name>TxPropagationEJB2BeanIIOP</ejb-name>
+ <jndi-name>TxPropagationEJB2BeanIIOP</jndi-name>
+ <invoker-bindings>
+ <invoker>
+ <invoker-proxy-binding-name>iiop</invoker-proxy-binding-name>
+ </invoker>
+ </invoker-bindings>
+ </session>
+
+ <session>
+ <ejb-name>TxPropagationEJB2Bean</ejb-name>
+ <jndi-name>TxPropagationEJB2Bean</jndi-name>
+ </session>
+ </enterprise-beans>
+</jboss>
Added: trunk/testsuite/src/resources/jbossts/jts-propagation/ejb3/META-INF/persistence.xml
===================================================================
--- trunk/testsuite/src/resources/jbossts/jts-propagation/ejb3/META-INF/persistence.xml (rev 0)
+++ trunk/testsuite/src/resources/jbossts/jts-propagation/ejb3/META-INF/persistence.xml 2010-01-11 22:10:03 UTC (rev 99251)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence">
+ <persistence-unit name="jts-propagation-tests-ejb3">
+ <jta-data-source>java:/CrashRecoveryDS</jta-data-source>
+ <properties>
+ <property name="jboss.entity.manager.jndi.name" value="java:/JTSPropagationManager" />
+ <property name="jboss.entity.manager.factory.jndi.name"
+ value="java:/JTSPropagationManagerFactory" />
+ <property name="hibernate.hbm2ddl.auto" value="update"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Deleted: trunk/testsuite/src/resources/jbossts/scripts/README.txt
===================================================================
--- trunk/testsuite/src/resources/crashrecovery/scripts/README.txt 2009-11-09 09:33:39 UTC (rev 96161)
+++ trunk/testsuite/src/resources/jbossts/scripts/README.txt 2010-01-11 22:10:03 UTC (rev 99251)
@@ -1,18 +0,0 @@
-This directory contains ant build scripts for running TS tests with an AS under
-the DTF framework.
-
-To add new tests you may either add new targets to an existing script or write
-a new script. For an example of how to run a target under DTF please refer to
-the test selection jbossts-qa-as-crashrecovery01-testdefs.xml located in
-the testdefs directory.
-
-These tests normally run as part of the DTF test suite. To run them in
-standalone mode you will need define a security policy and override the ant
-property product.dir (which controls where the tests will search for product
-resources) as follows:
- export ANT_OPTS="-Djava.security.policy=../src/org/jboss/jbossts/qa/astests/resources/java.policy
--Dproduct.dir=../../build/"
-
-If the target product directory does not contain a directory called 'as'
-containing a JBOSS installation then the environment variable JBOSS_HOME will
-be used.
Modified: trunk/testsuite/src/resources/jbossts/scripts/as-tests.xml
===================================================================
--- trunk/testsuite/src/resources/crashrecovery/scripts/as-tests.xml 2009-11-09 09:33:39 UTC (rev 96161)
+++ trunk/testsuite/src/resources/jbossts/scripts/as-tests.xml 2010-01-11 22:10:03 UTC (rev 99251)
@@ -34,6 +34,11 @@
<target name="crash-tests-single" depends="init, prepare-drivers, set-db, set-tstype, set-tsdemarc, set-testcase, crash-tests-tstype-jta, crash-tests-tstype-jts" />
+ <target name="jts-propagation-tests" depends="want-all-ejbX, want-all-transports, jts-propagation-tests-single" />
+
+ <target name="jts-propagation-tests-single" depends="init-propagation-tests, prepare-drivers, set-ejbX, set-transport, propag-tests-main" />
+
+
<!--
Other targets...
-->
@@ -44,34 +49,34 @@
<target name="set-db">
<condition property="want.psql_8.2">
- <equals arg1="${crash.db}" arg2="psql_8.2"/>
+ <equals arg1="${jbossts.db}" arg2="psql_8.2"/>
</condition>
<condition property="want.psql_8.3">
- <equals arg1="${crash.db}" arg2="psql_8.3"/>
+ <equals arg1="${jbossts.db}" arg2="psql_8.3"/>
</condition>
<condition property="want.sybase_15">
- <equals arg1="${crash.db}" arg2="sybase_15"/>
+ <equals arg1="${jbossts.db}" arg2="sybase_15"/>
</condition>
<condition property="want.oracle_10">
- <equals arg1="${crash.db}" arg2="oracle_10"/>
+ <equals arg1="${jbossts.db}" arg2="oracle_10"/>
</condition>
<condition property="want.oracle_11">
- <equals arg1="${crash.db}" arg2="oracle_11"/>
+ <equals arg1="${jbossts.db}" arg2="oracle_11"/>
</condition>
<condition property="want.db2_9.7">
- <equals arg1="${crash.db}" arg2="db2_9.7"/>
+ <equals arg1="${jbossts.db}" arg2="db2_9.7"/>
</condition>
<condition property="want.mysql_5.0">
- <equals arg1="${crash.db}" arg2="mysql_5.0"/>
+ <equals arg1="${jbossts.db}" arg2="mysql_5.0"/>
</condition>
<condition property="want.mysql_5.1">
- <equals arg1="${crash.db}" arg2="mysql_5.1"/>
+ <equals arg1="${jbossts.db}" arg2="mysql_5.1"/>
</condition>
<condition property="want.mssql_2005">
- <equals arg1="${crash.db}" arg2="mssql_2005"/>
+ <equals arg1="${jbossts.db}" arg2="mssql_2005"/>
</condition>
<condition property="want.mssql_2008">
- <equals arg1="${crash.db}" arg2="mssql_2008"/>
+ <equals arg1="${jbossts.db}" arg2="mssql_2008"/>
</condition>
</target>
@@ -86,16 +91,14 @@
<property name="want.mysql_5.1" value="true" />
<property name="want.mssql_2005" value="true" />
<property name="want.mssql_2008" value="true" />
- <!-- DEPRECATED property name="want.sybase_12" value="true" /-->
- <!-- DEPRECATED property name="want.db2_8.2" value="true" /-->
</target>
<target name="set-tstype">
<condition property="want.tstype.jta">
- <equals arg1="${crash.tstype}" arg2="jta"/>
+ <equals arg1="${jbossts.tstype}" arg2="jta"/>
</condition>
<condition property="want.tstype.jts">
- <equals arg1="${crash.tstype}" arg2="jts"/>
+ <equals arg1="${jbossts.tstype}" arg2="jts"/>
</condition>
</target>
@@ -106,10 +109,10 @@
<target name="set-tsdemarc">
<condition property="want.cmt">
- <equals arg1="${crash.tsdemarc}" arg2="cmt"/>
+ <equals arg1="${jbossts.tsdemarc}" arg2="cmt"/>
</condition>
<condition property="want.bmt">
- <equals arg1="${crash.tsdemarc}" arg2="bmt"/>
+ <equals arg1="${jbossts.tsdemarc}" arg2="bmt"/>
</condition>
</target>
@@ -120,28 +123,28 @@
<target name="set-testcase">
<condition property="want.none">
- <equals arg1="${crash.testcase}" arg2="none"/>
+ <equals arg1="${jbossts.testcase}" arg2="none"/>
</condition>
<condition property="want.none.rev">
- <equals arg1="${crash.testcase}" arg2="none.rev"/>
+ <equals arg1="${jbossts.testcase}" arg2="none.rev"/>
</condition>
<condition property="want.prepare_ex">
- <equals arg1="${crash.testcase}" arg2="prepare_ex"/>
+ <equals arg1="${jbossts.testcase}" arg2="prepare_ex"/>
</condition>
<condition property="want.prepare_ex.rev">
- <equals arg1="${crash.testcase}" arg2="prepare_ex.rev"/>
+ <equals arg1="${jbossts.testcase}" arg2="prepare_ex.rev"/>
</condition>
<condition property="want.prepare_halt">
- <equals arg1="${crash.testcase}" arg2="prepare_halt"/>
+ <equals arg1="${jbossts.testcase}" arg2="prepare_halt"/>
</condition>
<condition property="want.prepare_halt.rev">
- <equals arg1="${crash.testcase}" arg2="prepare_halt.rev"/>
+ <equals arg1="${jbossts.testcase}" arg2="prepare_halt.rev"/>
</condition>
<condition property="want.commit_halt">
- <equals arg1="${crash.testcase}" arg2="commit_halt"/>
+ <equals arg1="${jbossts.testcase}" arg2="commit_halt"/>
</condition>
<condition property="want.commit_halt.rev">
- <equals arg1="${crash.testcase}" arg2="commit_halt.rev"/>
+ <equals arg1="${jbossts.testcase}" arg2="commit_halt.rev"/>
</condition>
</target>
@@ -394,8 +397,8 @@
<deploy from="resources/${datasource}" to="deploy/${datasource}" />
<deploy from="${astest.jar.deploy.dir}/${astest.app.jar.name}" to="deploy/${astest.app.jar.name}" />
</astest:server>
- <astest:action abortOnFail="false" waitFor="10000" impl="org.jboss.test.crashrecovery.taskdefs.JUnitClientAction">
- <param key="testClass" value="org.jboss.test.crashrecovery.ASCrashRecovery01.TestWithJPA" />
+ <astest:action abortOnFail="false" waitFor="10000" impl="org.jboss.test.jbossts.taskdefs.JUnitClientAction">
+ <param key="testClass" value="org.jboss.test.jbossts.ASCrashRecovery01.TestWithJPA" />
<param key="name" value="${dbname}-${testname}" />
<param key="serverName" value="crashrecovery-${tstype}" />
<param key="specs" value="${specs}" />
@@ -406,7 +409,7 @@
<param key="wipeOutTxsInDoubtBeforeTest" value="${wipeOutTxsInDoubtBeforeTest}" />
<param key="wipeOutTxsInDoubt" value="${wipeOutTxsInDoubt}" />
<param key="debug" value="true" />
- <param key="reportFile" value="${build.reports}/TEST-org.jboss.test.crashrecovery.ASCrashRecovery01.TestWithJPA-${dbname}-${testname}.xml" />
+ <param key="reportFile" value="${build.reports}/TEST-org.jboss.test.jbossts.ASCrashRecovery01.TestWithJPA-${dbname}-${testname}.xml" />
<param key="testTime" value="${testTime}" />
</astest:action>
<astest:server method="stop" serverName="crashrecovery-${tstype}" >
@@ -481,7 +484,7 @@
<!--
Do use this target if you want to wipe out txs in doubt.
- You can select the databases by setting crash.db property, see target set-db.
+ You can select the databases by setting jbossts.db property, see the 'set-db' target.
-->
<target name="wipeout-txs-indoubt-single-db" depends="set-db, prepare-drivers">
<property name="tstype" value="jta" />
@@ -501,12 +504,12 @@
<deploy from="resources/${datasource}" to="deploy/${datasource}" />
<deploy from="${astest.jar.deploy.dir}/${astest.app.jar.name}" to="deploy/${astest.app.jar.name}" />
</astest:server>
- <astest:action abortOnFail="false" waitFor="10000" impl="org.jboss.test.crashrecovery.taskdefs.JUnitClientAction">
- <param key="testClass" value="org.jboss.test.crashrecovery.ASCrashRecovery01.WipeOutTxsInDoubt" />
+ <astest:action abortOnFail="false" waitFor="10000" impl="org.jboss.test.jbossts.taskdefs.JUnitClientAction">
+ <param key="testClass" value="org.jboss.test.jbossts.ASCrashRecovery01.WipeOutTxsInDoubt" />
<param key="name" value="test-wipeout-txs-indoubt-${dbname}" />
- <param key="serverName" value="crashrecovery-${tstype}" />
+ <param key="serverName" value="crashrecovery-jta" />
<param key="debug" value="true" />
- <param key="reportFile" value="${build.reports}/TEST-org.jboss.test.crashrecovery.ASCrashRecovery01.WipeOutTxsInDoubt-${dbname}.xml" />
+ <param key="reportFile" value="${build.reports}/TEST-org.jboss.test.jbossts.ASCrashRecovery01.WipeOutTxsInDoubt-${dbname}.xml" />
</astest:action>
<astest:server method="stop" serverName="crashrecovery-jta" >
<undeploy from="deploy/${datasource}" />
@@ -562,4 +565,150 @@
</target>
+ <!-- =========== JTS Propagation Test ========== -->
+
+ <target name="init-propagation-tests">
+ <property name="wipeOutTxsInDoubt" value="true" />
+ <property name="dbdriver" value="postgresql-8.3.jar"/>
+ <property name="datasource" value="postgres83-xa-ds.xml"/>
+
+ <echo message="jboss.home=${jboss.home}"/>
+ <echo message="node0=${node0}"/>
+ <echo message="node1=${node1}"/>
+ <echo message="dbdriver=${dbdriver}"/>
+ <echo message="datasource=${datasource}"/>
+ </target>
+
+ <target name="want-all-ejbX">
+ <property name="want.ejb2" value="true" />
+ <property name="want.ejb3" value="true" />
+ </target>
+
+ <target name="set-ejbX">
+ <condition property="want.ejb2">
+ <equals arg1="${jbossts.ejbX}" arg2="ejb2"/>
+ </condition>
+ <condition property="want.ejb3">
+ <equals arg1="${jbossts.ejbX}" arg2="ejb3"/>
+ </condition>
+ </target>
+
+ <target name="want-all-transports">
+ <property name="want.jrmp" value="true" />
+ <property name="want.iiop" value="true" />
+ </target>
+
+ <target name="set-transport">
+ <condition property="want.jrmp">
+ <equals arg1="${jbossts.transport}" arg2="jrmp"/>
+ </condition>
+ <condition property="want.iiop">
+ <equals arg1="${jbossts.transport}" arg2="iiop"/>
+ </condition>
+ </target>
+
+ <target name="propag-tests-main"
+ depends="start-servers-for-jts-propagation-tests,
+ propag-tests-ejb3,
+ propag-tests-ejb2,
+ stop-servers-for-jts-propagation-tests" />
+
+ <target name="propag-tests-ejb2" if="want.ejb2">
+ <antcall target="propag-tests-transport"><param name="ejb3" value="false" /></antcall>
+ </target>
+
+ <target name="propag-tests-ejb3" if="want.ejb3">
+ <antcall target="propag-tests-transport"><param name="ejb3" value="true" /><param name="ejb3.run" value="true" /></antcall>
+ </target>
+
+ <target name="propag-tests-transport" depends="propag-tests-jrmp, propag-tests-iiop" />
+
+ <target name="propag-tests-jrmp" if="want.jrmp">
+ <antcall target="jts-propagation-tests-batch"><param name="ots" value="false" /></antcall>
+ </target>
+
+ <target name="propag-tests-iiop" if="want.iiop" unless="ejb3.run">
+ <antcall target="jts-propagation-tests-batch"><param name="ots" value="true" /></antcall>
+ </target>
+
+ <target name="jts-propagation-tests-batch">
+ <condition property="test.name.ejbX" value="ejb3" else="ejb2">
+ <istrue value="${ejb3}"/>
+ </condition>
+ <condition property="test.name.transport" value="iiop" else="jrmp">
+ <istrue value="${ots}"/>
+ </condition>
+ <property name="testname.prefix" value="${test.name.ejbX}-${test.name.transport}"/>
+
+ <!-- batch of jts propagation test scenarios -->
+ <run-jts-propagation-test specs0="none" specs1="none" rollbackExpected="false" />
+ <run-jts-propagation-test specs0="none" specs1="pre_prepare_rollbackonly" rollbackExpected="true" />
+ <run-jts-propagation-test specs0="pre_prepare_rollbackonly" specs1="none" rollbackExpected="true" />
+ <run-jts-propagation-test specs0="none" specs1="pre_prepare_ejbexception" rollbackExpected="true" />
+ <run-jts-propagation-test specs0="pre_prepare_ejbexception" specs1="none" rollbackExpected="true" />
+ <run-jts-propagation-test specs0="none" specs1="synch_before_rollbackonly" rollbackExpected="true" />
+ <run-jts-propagation-test specs0="synch_before_rollbackonly" specs1="none" rollbackExpected="true" />
+ <run-jts-propagation-test specs0="none" specs1="prepare_ex_rollback" rollbackExpected="true" />
+ <run-jts-propagation-test specs0="prepare_ex_rollback" specs1="none" rollbackExpected="true" />
+ <run-jts-propagation-test specs0="pre_prepare_suspend_long" specs1="none" rollbackExpected="true" />
+ <run-jts-propagation-test specs0="none" specs1="pre_prepare_suspend_long" rollbackExpected="true" />
+ </target>
+
+ <target name="start-servers-for-jts-propagation-tests" unless="dont.start.server.for.astests">
+ <astest:server method="start" serverName="jts-propagation-node0" >
+ <deploy from="dbdrivers/${dbdriver}" to="lib/${dbdriver}" />
+ <deploy from="resources/${datasource}" to="deploy/${datasource}" />
+ <deploy from="${astest.jar.deploy.dir}/jts-propagation-ejb3.jar" to="deploy/jts-propagation-ejb3.jar" />
+ <deploy from="${astest.jar.deploy.dir}/jts-propagation-ejb2.jar" to="deploy/jts-propagation-ejb2.jar" />
+ </astest:server>
+ <astest:server method="start" serverName="jts-propagation-node1" >
+ <deploy from="dbdrivers/${dbdriver}" to="lib/${dbdriver}" />
+ <deploy from="resources/${datasource}" to="deploy/${datasource}" />
+ <deploy from="${astest.jar.deploy.dir}/jts-propagation-ejb3.jar" to="deploy/jts-propagation-ejb3.jar" />
+ <deploy from="${astest.jar.deploy.dir}/jts-propagation-ejb2.jar" to="deploy/jts-propagation-ejb2.jar" />
+ </astest:server>
+ </target>
+
+ <target name="stop-servers-for-jts-propagation-tests" unless="dont.start.server.for.astests">
+ <astest:server method="stop" serverName="jts-propagation-node1">
+ <undeploy from="deploy/jts-propagation-ejb2.jar" />
+ <undeploy from="deploy/jts-propagation-ejb3.jar" />
+ <undeploy from="deploy/${datasource}" />
+ <undeploy from="lib/${dbdriver}" />
+ </astest:server>
+ <astest:server method="stop" serverName="jts-propagation-node0">
+ <undeploy from="deploy/jts-propagation-ejb2.jar" />
+ <undeploy from="deploy/jts-propagation-ejb3.jar" />
+ <undeploy from="deploy/${datasource}" />
+ <undeploy from="lib/${dbdriver}" />
+ </astest:server>
+ </target>
+
+ <macrodef name="run-jts-propagation-test">
+ <attribute name="specs0"/>
+ <attribute name="specs1"/>
+ <attribute name="rollbackExpected"/>
+ <sequential>
+ <astest:action abortOnFail="false" waitFor="10000" impl="org.jboss.test.jbossts.taskdefs.JUnitClientAction">
+ <param key="testClass" value="org.jboss.test.jbossts.JTSContextPropagation01.TestContextPropagation" />
+ <param key="name" value="${testname.prefix}-@{specs0}-@{specs1}" />
+ <param key="specs0" value="@{specs0}" />
+ <param key="specs1" value="@{specs1}" />
+ <param key="ots" value="${ots}" />
+ <param key="ejb3" value="${ejb3}" />
+ <param key="serverName0" value="jts-propagation-node0" />
+ <param key="serverName1" value="jts-propagation-node1" />
+ <param key="host0" value="${node0}" />
+ <param key="host1" value="${node1}" />
+ <param key="clientTx" value="${jbossts.clientTx}" />
+ <param key="rollbackExpected" value="@{rollbackExpected}" />
+ <param key="wipeOutTxsInDoubtBeforeTest" value="${wipeOutTxsInDoubtBeforeTest}" />
+ <param key="wipeOutTxsInDoubt" value="${wipeOutTxsInDoubt}" />
+ <param key="debug" value="true" />
+ <param key="reportFile" value="${build.reports}/TEST-org.jboss.test.jbossts.JTSContextPropagation01.TestContextPropagation-${testname.prefix}-@{specs0}-@{specs1}.xml" />
+ <param key="testTime" value="${testTime}" />
+ </astest:action>
+ </sequential>
+ </macrodef>
+
</project>
Modified: trunk/testsuite/src/resources/jbossts/scripts/imports/test-config.xml
===================================================================
--- trunk/testsuite/src/resources/crashrecovery/scripts/imports/test-config.xml 2009-11-09 09:33:39 UTC (rev 96161)
+++ trunk/testsuite/src/resources/jbossts/scripts/imports/test-config.xml 2010-01-11 22:10:03 UTC (rev 99251)
@@ -1,14 +1,14 @@
<project name="crashrecovery-tests-server-config"
xmlns:astest="http://jboss.org/ns/test/ant/astest">
- <taskdef name="config" classname="org.jboss.test.crashrecovery.taskdefs.ASTestConfig"
+ <taskdef name="config" classname="org.jboss.test.jbossts.taskdefs.ASTestConfig"
uri="http://jboss.org/ns/test/ant/astest" loaderref="astest.loader">
</taskdef>
<!--
- Task to start/stop servers with attribute for deploying and undeploying artifacts
-->
- <taskdef name="server" classname="org.jboss.test.crashrecovery.taskdefs.ServerTask"
+ <taskdef name="server" classname="org.jboss.test.jbossts.taskdefs.ServerTask"
uri="http://jboss.org/ns/test/ant/astest" loaderref="astest.loader">
</taskdef>
@@ -16,14 +16,14 @@
- Task to perform an arbitary action. The action will have access to the test configuration
- specified in the configuration.
-->
- <taskdef name="action" classname="org.jboss.test.crashrecovery.taskdefs.ASClientTask"
+ <taskdef name="action" classname="org.jboss.test.jbossts.taskdefs.ASClientTask"
uri="http://jboss.org/ns/test/ant/astest" loaderref="astest.loader">
</taskdef>
<!--
- a spec is specification of how to inject faults into the XA protocol operations
-->
- <typedef name="spec" classname="org.jboss.test.crashrecovery.recovery.ASFailureSpec"
+ <typedef name="spec" classname="org.jboss.test.jbossts.recovery.ASFailureSpec"
uri="http://jboss.org/ns/test/ant/astest" loaderref="astest.loader">
</typedef>
@@ -42,10 +42,18 @@
- server can be changed via the server.binding.name and server.binding.location properties.
-->
<astest:config javaHome="${env.JAVA_HOME}" debug="false">
- <spec name= "prepare_ex" mode="XAEXCEPTION" type="XARES_PREPARE" modeArg="XAER_RMFAIL" />
+ <spec name= "prepare_ex" mode="XAEX" type="XARES_PREPARE" modeArg="XAER_RMFAIL" />
<spec name= "prepare_halt" mode="HALT" type="XARES_PREPARE" />
<spec name= "commit_halt" mode="HALT" type="XARES_COMMIT" />
<spec name= "none" mode="NONE" type="NONE" />
+ <spec name= "prepare_ex_rollback" mode="XAEX" type="XARES_PREPARE" modeArg="XA_RBROLLBACK" />
+ <spec name= "pre_prepare_rollbackonly" mode="RBLY" type="PRE_PREPARE" />
+ <spec name= "pre_prepare_ejbexception" mode="EJEX" type="PRE_PREPARE" modeArg="ejb exception before commit" />
+ <spec name= "synch_before_rollbackonly" mode="RBLY" type="SYNCH_BEFORE" />
+ <spec name= "pre_prepare_suspend_short" mode="SUSP" type="PRE_PREPARE" modeArg="100000" />
+ <spec name= "pre_prepare_suspend_long" mode="SUSP" type="PRE_PREPARE" modeArg="200000" />
+ <spec name= "synch_before_suspend_short" mode="SUSP" type="SYNCH_BEFORE" modeArg="100000" />
+ <spec name= "synch_before_suspend_long" mode="SUSP" type="SYNCH_BEFORE" modeArg="200000" />
<!--
Profiles for JBossAS Testsuite integration
@@ -54,27 +62,52 @@
<jvmarg value="-Xms128m" />
<jvmarg value="-Xmx512m" />
<jvmarg value="-XX:MaxPermSize=512m" />
- <jvmarg value="-server" />
<sysproperty key="java.net.preferIPv4Stack" value="true" />
- <sysproperty key="org.jboss.resolver.warning" value="true" />
- <sysproperty key="sun.rmi.dgc.client.gcInterval" value="3600000" />
- <sysproperty key="sun.rmi.dgc.server.gcInterval" value="3600000" />
- <sysproperty key="xb.builder.useUnorderedSequence" value="true" />
+ <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+ <sysproperty key="resolve.dns" value="false" />
<!--jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/-->
</server>
- <server name="crashrecovery-jts" host="${node0}">
- <jvmarg value="-Xms128m" />
- <jvmarg value="-Xmx512m" />
- <jvmarg value="-XX:MaxPermSize=512m" />
- <jvmarg value="-server" />
- <sysproperty key="java.net.preferIPv4Stack" value="true" />
- <sysproperty key="org.jboss.resolver.warning" value="true" />
- <sysproperty key="sun.rmi.dgc.client.gcInterval" value="3600000" />
- <sysproperty key="sun.rmi.dgc.server.gcInterval" value="3600000" />
- <sysproperty key="xb.builder.useUnorderedSequence" value="true" />
- </server>
+ <server name="crashrecovery-jts" host="${node0}">
+ <jvmarg value="-Xms128m" />
+ <jvmarg value="-Xmx512m" />
+ <jvmarg value="-XX:MaxPermSize=512m" />
+ <sysproperty key="java.net.preferIPv4Stack" value="true" />
+ <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+ <sysproperty key="resolve.dns" value="false" />
+ </server>
+ <!--
+ Profiles for JTS Propagation Tests
+ -->
+ <server name="jts-propagation-node0" host="${node0}">
+ <jvmarg value="-Xms128m" />
+ <jvmarg value="-Xmx512m" />
+ <jvmarg value="-XX:MaxPermSize=512m" />
+ <sysproperty key="java.net.preferIPv4Stack" value="true" />
+ <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+ <sysproperty key="resolve.dns" value="false" />
+ <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+ <sysproperty key="jboss.messaging.ServerPeerID" value="0" />
+ <sysproperty key="jgroups.bind_addr" value="${node0}" />
+ <!--jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/-->
+ </server>
+
+ <server name="jts-propagation-node1" host="${node1}" httpPort="8180" rmiPort="1199">
+ <jvmarg value="-Xms128m" />
+ <jvmarg value="-Xmx512m" />
+ <jvmarg value="-XX:MaxPermSize=512m" />
+ <jvmarg value="-XX:-UseGCOverheadLimit" />
+ <sysproperty key="java.net.preferIPv4Stack" value="true" />
+ <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" />
+ <sysproperty key="resolve.dns" value="false" />
+ <sysproperty key="jgroups.udp.ip_ttl" value="${jbosstest.udp.ip_ttl}" />
+ <sysproperty key="jboss.messaging.ServerPeerID" value="1" />
+ <sysproperty key="jgroups.bind_addr" value="${node1}" />
+ <sysproperty key="jboss.service.binding.set" value="ports-01" />
+ </server>
+
</astest:config>
</project>
More information about the jboss-cvs-commits
mailing list