[jboss-cvs] JBossAS SVN: r104870 - in branches/JBPAPP_5_1/testsuite: imports/config and 12 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon May 17 07:38:52 EDT 2010
Author: istudens at redhat.com
Date: 2010-05-17 07:38:51 -0400 (Mon, 17 May 2010)
New Revision: 104870
Added:
branches/JBPAPP_5_1/testsuite/imports/sections/jbossts.xml
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/
branches/JBPAPP_5_1/testsuite/src/resources/jbossts/
branches/JBPAPP_5_1/testsuite/src/resources/jbossts/crashrecovery/
branches/JBPAPP_5_1/testsuite/src/resources/jbossts/crashrecovery/META-INF/
Removed:
branches/JBPAPP_5_1/testsuite/imports/sections/crashrecovery.xml
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/
branches/JBPAPP_5_1/testsuite/src/resources/crashrecovery/
branches/JBPAPP_5_1/testsuite/src/resources/jbossts/META-INF/
branches/JBPAPP_5_1/testsuite/src/resources/jbossts/scripts/README.txt
Modified:
branches/JBPAPP_5_1/testsuite/imports/config/tests-crash-recovery.xml
branches/JBPAPP_5_1/testsuite/imports/test-jars.xml
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/ASCrashRecovery01/TestWithJPA.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/ASCrashRecovery01/WipeOutTxsInDoubt.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashBMTBean.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashCMTBean.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashHelper.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashHelperRem.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashLocal.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashLocalHome.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashRem.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashRemHome.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/RecoveredXid.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntity.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelper.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelperLocal.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelperRem.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureMode.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureSpec.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureType.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/ASTestResource.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecovery.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecoveryWithJPA.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ASClientTask.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ASTestConfig.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ClientAction.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ClientTask.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/JUnitClientAction.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/JUnitClientTest.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerBindingConfig.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerTask.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerTaskException.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TaskProperty.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TaskValue.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TransactionLog.java
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/Utils.java
branches/JBPAPP_5_1/testsuite/src/resources/jbossts/resources/sybase15-xa-ds.xml
branches/JBPAPP_5_1/testsuite/src/resources/jbossts/scripts/as-tests.xml
branches/JBPAPP_5_1/testsuite/src/resources/jbossts/scripts/imports/test-config.xml
Log:
crash recovery tests moved under 'jbossts' package, other TS tests will be added in near future, JBQA-2176
Modified: branches/JBPAPP_5_1/testsuite/imports/config/tests-crash-recovery.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/imports/config/tests-crash-recovery.xml 2010-05-17 10:19:13 UTC (rev 104869)
+++ branches/JBPAPP_5_1/testsuite/imports/config/tests-crash-recovery.xml 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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" />
@@ -22,11 +22,11 @@
| Usage for all tests:
| ./build.sh tests-ts-crash-recovery
|
- | or for selected database:
- | ./build.sh tests-ts-crash-recovery -Dcrash.db=psql_8.3 -Dcrash.target=crash-tests-single-db
+ | or for particular database:
+ | ./build.sh tests-ts-crash-recovery -Djbossts.db=psql_8.3 -Djbossts.target=crash-tests-single-db
|
- | or for selected 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
+ | or for particular test scenario:
+ | ./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
|
| Usage for cluster tests:
| ./build.sh tests-ts-crash-recovery -Dcrash.db=oracle_rac -Dcrash.tstype=jts -Dcrash.target=crash-tests-single-db-tstype
@@ -36,13 +36,21 @@
<target name="tests-ts-crash-recovery"
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="420000" />
- <run-as-test target="${crash.target}" />
+ <run-as-test target="${jbossts.target}" />
</target>
@@ -57,35 +65,34 @@
<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="${ant.library.dir}/ant-launcher.jar"/>
<path refid="org.apache.ant.classpath"/>
<path refid="junit.junit.classpath"/>
+ <path refid="jboss.server.manager.classpath"/>
+ <path refid="jboss.jbossts.classpath"/>
+ <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="jbossts.common.jar.dir" value="${jbosstest.dist}/common/lib" />
+ <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.dir" value="${jboss.server.manager.lib}" />
- <sysproperty key="jboss.server.manager.jar.name" value="jboss-server-manager.jar" />
- <sysproperty key="junit.junit.lib" value="${junit.junit.lib}" />
- <sysproperty key="org.apache.ant.lib" value="${org.apache.ant.lib}" />
<sysproperty key="build.reports" value="${build.reports}" />
<sysproperty key="sm.legacy.shutdown" value="true" />
<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="-verbose"/-->
<arg value="-f"/>
<arg value="${build.resources}/${jbossts.crash.recovery.test.script.dir}/as-tests.xml"/>
<arg value="@{target}"/>
@@ -96,7 +103,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="default" newconf="crashrecovery-jta">
<patternset>
Deleted: branches/JBPAPP_5_1/testsuite/imports/sections/crashrecovery.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/imports/sections/crashrecovery.xml 2010-05-17 10:19:13 UTC (rev 104869)
+++ branches/JBPAPP_5_1/testsuite/imports/sections/crashrecovery.xml 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/imports/sections/jbossts.xml (from rev 104860, branches/JBPAPP_5_1/testsuite/imports/sections/crashrecovery.xml)
===================================================================
--- branches/JBPAPP_5_1/testsuite/imports/sections/jbossts.xml (rev 0)
+++ branches/JBPAPP_5_1/testsuite/imports/sections/jbossts.xml 2010-05-17 11:38:51 UTC (rev 104870)
@@ -0,0 +1,22 @@
+<project name="tests-jbossts-jars">
+ <!-- JBossTS tests -->
+ <target name="_jars-jbossts" depends="jbqa2176"/>
+
+ <!-- JBossTS crash recovery tests -->
+ <target name="jbqa2176" depends="compile">
+ <jar destfile="${build.lib}/crashrecovery-astest.jar">
+ <fileset dir="${build.resources}/jbossts/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/jbossts/ASCrashRecovery01/*.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"/>
+ </fileset>
+ </jar>
+ </target>
+</project>
Modified: branches/JBPAPP_5_1/testsuite/imports/test-jars.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/imports/test-jars.xml 2010-05-17 10:19:13 UTC (rev 104869)
+++ branches/JBPAPP_5_1/testsuite/imports/test-jars.xml 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts (from rev 104860, branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery)
Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/ASCrashRecovery01/TestWithJPA.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/ASCrashRecovery01/TestWithJPA.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/ASCrashRecovery01/TestWithJPA.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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.");
@@ -109,7 +109,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 +132,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 +155,9 @@
{
}
- existingUids = getPendingUids();
}
+
+ existingUids = getPendingUids();
if (wipeOutTxsInDoubtBeforeTest)
wipeOutTxsInDoubt();
@@ -214,11 +217,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 +301,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()
{
@@ -428,13 +421,10 @@
int pendingUids;
int pendingXidsInDoubt;
int totalExistingXidsInDoubt = existingXidsInDoubt.size();
-
- if (expectFailure)
- {
- // wait for the server to start up the first time through, we will need it for later database checking
- suspendFor(2000); // short waiting is needed sometimes in order to be able to start server again, 2 secs
- config.startServer(serverName);
- }
+
+ // wait for the server to start up the first time through, we will need it for later database checking
+ suspendFor(2000); // a little waiting is needed sometimes in order to be able to start server again, 2 secs
+ config.startServer(serverName);
do
{
@@ -474,15 +464,19 @@
print("recoverUids failed, took too long to recover");
// 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");
@@ -494,16 +488,4 @@
return false;
}
- private void suspendFor(int millis)
- {
- try
- {
- Thread.sleep(millis);
- }
- catch (InterruptedException e)
- {
- System.out.println("Test " + getName() + " interupted");
- }
- }
-
}
Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/ASCrashRecovery01/WipeOutTxsInDoubt.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/ASCrashRecovery01/WipeOutTxsInDoubt.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/ASCrashRecovery01/WipeOutTxsInDoubt.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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())
{
Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashBMTBean.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashBMTBean.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashBMTBean.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashCMTBean.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashCMTBean.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashCMTBean.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashHelper.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashHelper.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashHelper.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashHelperRem.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashHelperRem.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashHelperRem.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashLocal.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashLocal.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashLocal.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashLocalHome.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashLocalHome.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashLocalHome.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashRem.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashRem.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashRem.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashRemHome.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/CrashRemHome.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/CrashRemHome.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/RecoveredXid.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/RecoveredXid.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/RecoveredXid.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntity.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/TestEntity.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntity.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelper.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/TestEntityHelper.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelper.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelperLocal.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/TestEntityHelperLocal.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelperLocal.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelperRem.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/crash/TestEntityHelperRem.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/crash/TestEntityHelperRem.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureMode.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/recovery/ASFailureMode.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureMode.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -18,37 +18,177 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.recovery;
+package org.jboss.test.jbossts.recovery;
import java.io.Serializable;
/**
- * Specification of what to do when a failure is injected
+ * Specification of what to do when a failure is injected.
*/
-public enum ASFailureMode implements Serializable
+public class ASFailureMode implements Serializable
{
- NONE(false)
+ private static final int _NONE = 0;
+ private static final int _HALT = 1;
+ private static final int _EXIT = 2;
+ private static final int _SUSPEND = 3;
+ private static final int _XAEXCEPTION = 4;
+ private static final int _EJBEXCEPTION = 5;
+ private static final int _ROLLBACK_ONLY = 6;
+
+ private static final String _NONE_NAME = "NONE";
+ private static final String _HALT_NAME = "HALT";
+ private static final String _EXIT_NAME = "EXIT";
+ private static final String _SUSPEND_NAME = "SUSPEND";
+ private static final String _XAEXCEPTION_NAME = "XAEXCEPTION";
+ private static final String _EJBEXCEPTION_NAME = "EJBEXCEPTION";
+ private static final String _ROLLBACK_ONLY_NAME = "ROLLBACK_ONLY";
+
+ /* just for simpler transition from the enum type */
+ public static final ASFailureMode NONE = new ASFailureMode(_NONE);
+ public static final ASFailureMode HALT = new ASFailureMode(_HALT);
+ public static final ASFailureMode EXIT = new ASFailureMode(_EXIT);
+ public static final ASFailureMode SUSPEND = new ASFailureMode(_SUSPEND);
+ public static final ASFailureMode XAEXCEPTION = new ASFailureMode(_XAEXCEPTION);
+ public static final ASFailureMode EJBEXCEPTION = new ASFailureMode(_EJBEXCEPTION);
+ public static final ASFailureMode ROLLBACK_ONLY = new ASFailureMode(_ROLLBACK_ONLY);
+
+ private int mode;
+
+ public ASFailureMode(int mode)
+ {
+ this.mode = mode;
+ }
+
+ public boolean willTerminateVM()
+ {
+ switch (mode)
+ {
+ case _HALT:
+ case _EXIT:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public boolean isException()
+ {
+ switch (mode)
+ {
+ case _XAEXCEPTION:
+ case _EJBEXCEPTION:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /* enum like methods */
+ public String name()
+ {
+ switch (mode)
+ {
+ case _NONE:
+ return _NONE_NAME;
+ case _HALT:
+ return _HALT_NAME;
+ case _EXIT:
+ return _EXIT_NAME;
+ case _SUSPEND:
+ return _SUSPEND_NAME;
+ case _XAEXCEPTION:
+ return _XAEXCEPTION_NAME;
+ case _EJBEXCEPTION:
+ return _EJBEXCEPTION_NAME;
+ case _ROLLBACK_ONLY:
+ return _ROLLBACK_ONLY_NAME;
+ default:
+ return "uninstantiated";
+ }
+ }
+
+ public int ordinal()
+ {
+ return mode;
+ }
+
+ public static ASFailureMode valueOf(String mode)
+ {
+ if (_NONE_NAME.equalsIgnoreCase(mode))
+ return NONE;
+ else if (_HALT_NAME.equalsIgnoreCase(mode))
+ return HALT;
+ else if (_EXIT_NAME.equalsIgnoreCase(mode))
+ return EXIT;
+ else if (_SUSPEND_NAME.equalsIgnoreCase(mode))
+ return SUSPEND;
+ else if (_XAEXCEPTION_NAME.equalsIgnoreCase(mode))
+ return XAEXCEPTION;
+ else if (_EJBEXCEPTION_NAME.equalsIgnoreCase(mode))
+ return EJBEXCEPTION;
+ else if (_ROLLBACK_ONLY_NAME.equalsIgnoreCase(mode))
+ return ROLLBACK_ONLY;
+ else
+ throw new IllegalArgumentException("There is no such value of ASFailureMode like " + mode);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + mode;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ASFailureMode other = (ASFailureMode) obj;
+ if (mode != other.mode)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return name();
+ }
+
+
+/*
+ NONE
- ,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 // halt the JVM
+ ,EXIT // exit the JVM
+ ,SUSPEND // suspend the calling thread
+ ,XAEXCEPTION // fail via one of the xa exception codes
+ ,EJBEXCEPTION // fail via EJBException -- for using only with ASFailureType.PRE_PREPARE and SYNCH_BEFORE
+ ,ROLLBACK_ONLY // mark a transaction as rollback-only -- for using only with ASFailureType.PRE_PREPARE and SYNCH_BEFORE
;
- private boolean willTerminateVM;
-
- ASFailureMode(boolean willTerminateVM)
- {
- this.willTerminateVM = willTerminateVM;
- }
-
public boolean willTerminateVM()
{
- return willTerminateVM;
+ switch (this)
+ {
+ case HALT:
+ case EXIT:
+ return true;
+ default:
+ return false;
+ }
}
public static ASFailureMode toEnum(String mode)
{
return ASFailureMode.valueOf(mode.toUpperCase());
}
+ */
}
Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureSpec.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/recovery/ASFailureSpec.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureSpec.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureType.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/recovery/ASFailureType.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/ASFailureType.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -18,15 +18,170 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.recovery;
+package org.jboss.test.jbossts.recovery;
import java.io.Serializable;
/**
- * Specification of when to inject a failure
+ * Specification of when to inject a failure.
*/
-public enum ASFailureType implements Serializable
+public class ASFailureType implements Serializable
{
+ private static final int _NONE = 1;
+ private static final int _PRE_PREPARE = 2;
+ private static final int _XARES_START = 3;
+ private static final int _XARES_END = 4;
+ private static final int _XARES_PREPARE = 5;
+ private static final int _XARES_ROLLBACK = 6;
+ private static final int _XARES_COMMIT = 7;
+ private static final int _XARES_RECOVER = 8;
+ private static final int _XARES_FORGET = 9;
+ private static final int _SYNCH_BEFORE = 10;
+ private static final int _SYNCH_AFTER = 11;
+
+ private static final String _NONE_NAME = "NONE";
+ private static final String _PRE_PREPARE_NAME = "PRE_PREPARE";
+ private static final String _XARES_START_NAME = "XARES_START";
+ private static final String _XARES_END_NAME = "XARES_END";
+ private static final String _XARES_PREPARE_NAME = "XARES_PREPARE";
+ private static final String _XARES_ROLLBACK_NAME = "XARES_ROLLBACK";
+ private static final String _XARES_COMMIT_NAME = "XARES_COMMIT";
+ private static final String _XARES_RECOVER_NAME = "XARES_RECOVER";
+ private static final String _XARES_FORGET_NAME = "XARES_FORGET";
+ private static final String _SYNCH_BEFORE_NAME = "SYNCH_BEFORE";
+ private static final String _SYNCH_AFTER_NAME = "SYNCH_AFTER";
+
+ public static final ASFailureType NONE = new ASFailureType(_NONE);
+ public static final ASFailureType PRE_PREPARE = new ASFailureType(_PRE_PREPARE);
+ public static final ASFailureType XARES_START = new ASFailureType(_XARES_START);
+ public static final ASFailureType XARES_END = new ASFailureType(_XARES_END);
+ public static final ASFailureType XARES_PREPARE = new ASFailureType(_XARES_PREPARE);
+ public static final ASFailureType XARES_ROLLBACK = new ASFailureType(_XARES_ROLLBACK);
+ public static final ASFailureType XARES_COMMIT = new ASFailureType(_XARES_COMMIT);
+ public static final ASFailureType XARES_RECOVER = new ASFailureType(_XARES_RECOVER);
+ public static final ASFailureType XARES_FORGET = new ASFailureType(_XARES_FORGET);
+ public static final ASFailureType SYNCH_BEFORE = new ASFailureType(_SYNCH_BEFORE);
+ public static final ASFailureType SYNCH_AFTER = new ASFailureType(_SYNCH_AFTER);
+
+ private int type;
+
+ public ASFailureType(int type)
+ {
+ this.type = type;
+ }
+
+ public boolean isXA()
+ {
+ return name().startsWith("XARES");
+ }
+
+ public boolean isSynchronization()
+ {
+ return name().startsWith("SYNCH");
+ }
+
+ public boolean isPreCommit()
+ {
+ return equals(PRE_PREPARE);
+ }
+
+ /* enum like methods */
+ public String name()
+ {
+ switch (type)
+ {
+ case _NONE:
+ return _NONE_NAME;
+ case _PRE_PREPARE:
+ return _PRE_PREPARE_NAME;
+ case _XARES_START:
+ return _XARES_START_NAME;
+ case _XARES_END:
+ return _XARES_END_NAME;
+ case _XARES_PREPARE:
+ return _XARES_PREPARE_NAME;
+ case _XARES_ROLLBACK:
+ return _XARES_ROLLBACK_NAME;
+ case _XARES_COMMIT:
+ return _XARES_COMMIT_NAME;
+ case _XARES_RECOVER:
+ return _XARES_RECOVER_NAME;
+ case _XARES_FORGET:
+ return _XARES_FORGET_NAME;
+ case _SYNCH_BEFORE:
+ return _SYNCH_BEFORE_NAME;
+ case _SYNCH_AFTER:
+ return _SYNCH_AFTER_NAME;
+ default:
+ return "uninstantiated";
+ }
+ }
+
+ public int ordinal()
+ {
+ return type;
+ }
+
+ public static ASFailureType valueOf(String mode)
+ {
+ if (_NONE_NAME.equalsIgnoreCase(mode))
+ return NONE;
+ else if (_PRE_PREPARE_NAME.equalsIgnoreCase(mode))
+ return PRE_PREPARE;
+ else if (_XARES_START_NAME.equalsIgnoreCase(mode))
+ return XARES_START;
+ else if (_XARES_END_NAME.equalsIgnoreCase(mode))
+ return XARES_END;
+ else if (_XARES_PREPARE_NAME.equalsIgnoreCase(mode))
+ return XARES_PREPARE;
+ else if (_XARES_ROLLBACK_NAME.equalsIgnoreCase(mode))
+ return XARES_ROLLBACK;
+ else if (_XARES_COMMIT_NAME.equalsIgnoreCase(mode))
+ return XARES_COMMIT;
+ else if (_XARES_RECOVER_NAME.equalsIgnoreCase(mode))
+ return XARES_RECOVER;
+ else if (_XARES_FORGET_NAME.equalsIgnoreCase(mode))
+ return XARES_FORGET;
+ else if (_SYNCH_BEFORE_NAME.equalsIgnoreCase(mode))
+ return SYNCH_BEFORE;
+ else if (_SYNCH_AFTER_NAME.equalsIgnoreCase(mode))
+ return SYNCH_AFTER;
+ else
+ throw new IllegalArgumentException("There is no such value of ASFailureType like " + mode);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + type;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ASFailureType other = (ASFailureType) obj;
+ if (type != other.type)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return name();
+ }
+
+
+/*
NONE
,PRE_PREPARE // do something before prepare is called
@@ -62,4 +217,5 @@
{
return equals(PRE_PREPARE);
}
+*/
}
Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/ASTestResource.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/recovery/ASTestResource.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/ASTestResource.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -18,12 +18,17 @@
* (C) 2008,
* @author JBoss Inc.
*/
-package org.jboss.test.crashrecovery.recovery;
+package org.jboss.test.jbossts.recovery;
+import org.jboss.logging.Logger;
+
+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;
@@ -35,293 +40,328 @@
*/
public class ASTestResource implements Synchronization, XAResource, Serializable
{
- private static final Map<String, XAException> xaCodeMap = new HashMap<String, XAException>();
+ private static Logger log = Logger.getLogger(ASTestResource.class);
- private ASFailureType _xaFailureType = ASFailureType.NONE;
- private ASFailureMode _xaFailureMode = ASFailureMode.NONE;
- private String[] _args;
- private int _suspend;
- private int _recoveryAttempts = 1;
- private XAException _xaException;
- 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
+ private static final Map<String, XAException> xaCodeMap = new HashMap<String, XAException>();
- static
- {
- init();
- }
-
- public ASTestResource()
- {
- }
+ private ASFailureType _xaFailureType = ASFailureType.NONE;
+ private ASFailureMode _xaFailureMode = ASFailureMode.NONE;
+ private String[] _args;
+ 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
- public ASTestResource(ASFailureSpec spec)
- {
- this();
+ static
+ {
+ init();
+ }
- if (spec == null)
- throw new IllegalArgumentException("Invalid XA resource failure injection specification");
-
- setFailureMode(spec.getMode(), spec.getModeArg());
- setFailureType(spec.getType());
- setRecoveryAttempts(spec.getRecoveryArg());
- }
+ public ASTestResource()
+ {
+ }
- public void applySpec(String message) throws XAException
- {
- applySpec(message, _isPrepared);
- }
+ public ASTestResource(ASFailureSpec spec)
+ {
+ this();
- public void applySpec(String message, boolean prepared) throws XAException
- {
- if (_xaFailureType.equals(ASFailureType.NONE) || _xaFailureMode.equals(ASFailureMode.NONE) || !prepared)
- {
- System.out.println(message + (_isPrepared ? " ... " : " recovery"));
- return; // NB if !_isPrepared then we must have been called from the recovery subsystem
- }
+ if (spec == null)
+ throw new IllegalArgumentException("Invalid XA resource failure injection specification");
- System.out.println("Applying fault injection with " + _xids.size() + " active branches");
- if (_xaException != null)
- {
- System.out.println(message + " ... xa error: " + _xaException.getMessage());
- throw _xaException;
- }
- else if (_xaFailureMode.equals(ASFailureMode.HALT))
- {
- System.out.println(message + " ... halting");
- Runtime.getRuntime().halt(1);
- }
- else if (_xaFailureMode.equals(ASFailureMode.EXIT))
- {
- System.out.println(message + " ... exiting");
- System.exit(1);
- }
- else if (_xaFailureMode.equals(ASFailureMode.SUSPEND))
- {
- System.out.println(message + " ... suspending for " + _suspend);
- suspend(_suspend);
- System.out.println(message + " ... resuming");
- }
- }
+ setFailureMode(spec.getMode(), spec.getModeArg());
+ setFailureType(spec.getType());
+ setRecoveryAttempts(spec.getRecoveryArg());
+ }
- public String toString()
- {
- return _xaFailureType + ", " + _xaFailureMode + ", " + (_args != null && _args.length != 0 ? _args[0] : "");
- }
+ public void applySpec(String message) throws XAException
+ {
+ applySpec(message, _isPrepared);
+ }
- private void suspend(int msecs)
- {
- try
- {
- Thread.sleep(msecs);
- }
- catch (InterruptedException e)
- {
- e.printStackTrace();
- }
- }
+ public void applySpec(String message, boolean prepared) throws XAException
+ {
+ if (_xaFailureType.equals(ASFailureType.NONE) || _xaFailureMode.equals(ASFailureMode.NONE) || !prepared)
+ {
+ System.out.println(message + (_isPrepared ? " ... " : " recovery"));
+ return; // NB if !_isPrepared then we must have been called from the recovery subsystem
+ }
- public void setFailureMode(ASFailureMode mode, String ... args) throws IllegalArgumentException
- {
- _xaFailureMode = mode;
- _args = args;
+ System.out.println("Applying fault injection with " + _xids.size() + " active branches");
+ if (_xaException != null)
+ {
+ 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");
+ Runtime.getRuntime().halt(1);
+ }
+ else if (_xaFailureMode.equals(ASFailureMode.EXIT))
+ {
+ System.out.println(message + " ... exiting");
+ System.exit(1);
+ }
+ else if (_xaFailureMode.equals(ASFailureMode.SUSPEND))
+ {
+ System.out.println(message + " ... suspending for " + _suspend);
+ suspend(_suspend);
+ System.out.println(message + " ... resuming");
+ }
+ else if (_xaFailureMode.equals(ASFailureMode.ROLLBACK_ONLY))
+ {
+ System.out.println(message + " ... marking the current transaction as rollback-only");
+ setRollbackOnly();
+ }
+ }
- if (args != null && args.length != 0)
- {
- if (_xaFailureMode.equals(ASFailureMode.SUSPEND))
- {
- _suspend = Integer.parseInt(args[0]);
- }
- else if (_xaFailureMode.equals(ASFailureMode.XAEXCEPTION))
- {
- _xaException = xaCodeMap.get(args[0]);
+ public String toString()
+ {
+ return _xaFailureType + ", " + _xaFailureMode + ", " + (_args != null && _args.length != 0 ? _args[0] : "");
+ }
- if (_xaException == null)
- _xaException = new XAException(XAException.XAER_RMFAIL);
- }
- }
- }
+ private void suspend(int msecs)
+ {
+ try
+ {
+ Thread.sleep(msecs);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
- public void setFailureType(ASFailureType type)
- {
- _xaFailureType = type;
- }
+ private void setRollbackOnly()
+ {
+ try
+ {
+ Transaction tx = com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction();
+ tx.setRollbackOnly();
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ }
+ }
- public ASFailureType getFailureType()
- {
- return _xaFailureType;
- }
+ public void setFailureMode(ASFailureMode mode, String ... args) throws IllegalArgumentException
+ {
+ _xaFailureMode = mode;
+ _args = args;
- public void setRecoveryAttempts(int _recoveryAttempts)
- {
- this._recoveryAttempts = _recoveryAttempts;
- }
+ if (args != null && args.length != 0)
+ {
+ if (_xaFailureMode.equals(ASFailureMode.SUSPEND))
+ {
+ _suspend = Integer.parseInt(args[0]);
+ }
+ else if (_xaFailureMode.equals(ASFailureMode.XAEXCEPTION))
+ {
+ _xaException = xaCodeMap.get(args[0]);
- // Synchronizatons
+ if (_xaException == null)
+ _xaException = new XAException(XAException.XAER_RMFAIL);
+ }
+ else if (_xaFailureMode.equals(ASFailureMode.EJBEXCEPTION))
+ {
+ _ejbException = new EJBException(args[0]);
+ }
+ }
+ }
- public void beforeCompletion()
- {
- if (_xaFailureType.equals(ASFailureType.SYNCH_BEFORE))
- try
- {
- applySpec("Before completion");
- }
- catch (XAException e)
- {
- throw new RuntimeException(e);
- }
- }
+ public void setFailureType(ASFailureType type)
+ {
+ _xaFailureType = type;
+ }
- public void afterCompletion(int i)
- {
- if (_xaFailureType.equals(ASFailureType.SYNCH_AFTER))
- try
- {
- applySpec("After completion");
- }
- catch (XAException e)
- {
- throw new RuntimeException(e);
- }
- }
+ public ASFailureType getFailureType()
+ {
+ return _xaFailureType;
+ }
- // XA Interface implementation
+ public void setRecoveryAttempts(int _recoveryAttempts)
+ {
+ this._recoveryAttempts = _recoveryAttempts;
+ }
- public void commit(Xid xid, boolean b) throws XAException
- {
- if (_xaFailureType.equals(ASFailureType.XARES_COMMIT))
- applySpec("xa commit");
+ // Synchronizations
- _isPrepared = false;
- _xids.remove(xid);
- }
+ public void beforeCompletion()
+ {
+ if (_xaFailureType.equals(ASFailureType.SYNCH_BEFORE))
+ try
+ {
+ applySpec("Before completion", true);
+ }
+ catch (XAException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
- public void rollback(Xid xid) throws XAException
- {
- if (_xaFailureType.equals(ASFailureType.XARES_ROLLBACK))
- applySpec("xa rollback");
+ public void afterCompletion(int i)
+ {
+ if (_xaFailureType.equals(ASFailureType.SYNCH_AFTER))
+ try
+ {
+ applySpec("After completion");
+ }
+ catch (XAException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
- _isPrepared = false;
- _xids.remove(xid);
- }
-
- public void end(Xid xid, int i) throws XAException
- {
- if (_xaFailureType.equals(ASFailureType.XARES_END))
- applySpec("xa end");
- }
+ // XA Interface implementation
- public void forget(Xid xid) throws XAException
- {
- if (_xaFailureType.equals(ASFailureType.XARES_FORGET))
- applySpec("xa forget");
+ public void commit(Xid xid, boolean b) throws XAException
+ {
+ log.debug("commit(Xid=" + xid + ", b=" + b);
+ if (_xaFailureType.equals(ASFailureType.XARES_COMMIT))
+ applySpec("xa commit");
- _isPrepared = false;
- _xids.remove(xid);
- }
+ _isPrepared = false;
+ _xids.remove(xid);
+ }
- public int getTransactionTimeout() throws XAException
- {
- return txTimeout;
- }
+ public void rollback(Xid xid) throws XAException
+ {
+ log.debug("rollback(Xid=" + xid);
+ if (_xaFailureType.equals(ASFailureType.XARES_ROLLBACK))
+ applySpec("xa rollback");
- public boolean isSameRM(XAResource xaResource) throws XAException
- {
- return false;
- }
+ _isPrepared = false;
+ _xids.remove(xid);
+ }
- public int prepare(Xid xid) throws XAException
- {
- _isPrepared = true;
-
- if (_xaFailureType.equals(ASFailureType.XARES_PREPARE))
- applySpec("xa prepare");
+ public void end(Xid xid, int i) throws XAException
+ {
+ log.debug("end(Xid=" + xid + ", i=" + i);
+ if (_xaFailureType.equals(ASFailureType.XARES_END))
+ applySpec("xa end");
+ }
- _xids.add(xid);
+ public void forget(Xid xid) throws XAException
+ {
+ if (_xaFailureType.equals(ASFailureType.XARES_FORGET))
+ applySpec("xa forget");
- return XA_OK;
- }
+ _isPrepared = false;
+ _xids.remove(xid);
+ }
- public Xid[] recover(int i) throws XAException
- {
- if (_recoveryAttempts <= 0)
- return _xids.toArray(new Xid[_xids.size()]);
+ public int getTransactionTimeout() throws XAException
+ {
+ return txTimeout;
+ }
- _recoveryAttempts -= 1;
+ public boolean isSameRM(XAResource xaResource) throws XAException
+ {
+ return false;
+ }
- if (_xaFailureType.equals(ASFailureType.XARES_RECOVER))
- applySpec("xa recover");
+ public int prepare(Xid xid) throws XAException
+ {
+ log.debug("prepare(Xid=" + xid);
+ _isPrepared = true;
- return new Xid[0];
- }
+ if (_xaFailureType.equals(ASFailureType.XARES_PREPARE))
+ applySpec("xa prepare");
- public boolean setTransactionTimeout(int txTimeout) throws XAException
- {
- this.txTimeout = txTimeout;
-
- return true; // set was successfull
- }
+ _xids.add(xid);
- public void start(Xid xid, int i) throws XAException
- {
- _xids.add(xid);
+ return XA_OK;
+ }
- if (_xaFailureType.equals(ASFailureType.XARES_START))
- applySpec("xa start");
- }
+ public Xid[] recover(int i) throws XAException
+ {
+ if (_recoveryAttempts <= 0)
+ return _xids.toArray(new Xid[_xids.size()]);
- public String getEISProductName() { return "Test XAResouce";}
-
- public String getEISProductVersion() { return "v666.0";}
+ _recoveryAttempts -= 1;
- @SuppressWarnings({"ThrowableInstanceNeverThrown"})
- private static void init()
- {
- xaCodeMap.put("XA_HEURCOM", new XAException(XAException.XA_HEURCOM));
- xaCodeMap.put("XA_HEURHAZ", new XAException(XAException.XA_HEURHAZ));
- xaCodeMap.put("XA_HEURMIX", new XAException(XAException.XA_HEURMIX));
- xaCodeMap.put("XA_HEURRB", new XAException(XAException.XA_HEURRB));
- xaCodeMap.put("XA_NOMIGRATE", new XAException(XAException.XA_NOMIGRATE));
- xaCodeMap.put("XA_RBBASE", new XAException(XAException.XA_RBBASE));
- xaCodeMap.put("XA_RBCOMMFAIL", new XAException(XAException.XA_RBCOMMFAIL));
- xaCodeMap.put("XA_RBDEADLOCK", new XAException(XAException.XA_RBDEADLOCK));
- xaCodeMap.put("XA_RBEND", new XAException(XAException.XA_RBEND));
- xaCodeMap.put("XA_RBINTEGRITY", new XAException(XAException.XA_RBINTEGRITY));
- xaCodeMap.put("XA_RBOTHER", new XAException(XAException.XA_RBOTHER));
- xaCodeMap.put("XA_RBPROTO", new XAException(XAException.XA_RBPROTO));
- xaCodeMap.put("XA_RBROLLBACK", new XAException(XAException.XA_RBROLLBACK));
- xaCodeMap.put("XA_RBTIMEOUT", new XAException(XAException.XA_RBTIMEOUT));
- xaCodeMap.put("XA_RBTRANSIENT", new XAException(XAException.XA_RBTRANSIENT));
- xaCodeMap.put("XA_RDONLY", new XAException(XAException.XA_RDONLY));
- xaCodeMap.put("XA_RETRY", new XAException(XAException.XA_RETRY));
- xaCodeMap.put("XAER_ASYNC", new XAException(XAException.XAER_ASYNC));
- xaCodeMap.put("XAER_DUPID", new XAException(XAException.XAER_DUPID));
- xaCodeMap.put("XAER_INVAL", new XAException(XAException.XAER_INVAL));
- xaCodeMap.put("XAER_NOTA", new XAException(XAException.XAER_NOTA));
- xaCodeMap.put("XAER_OUTSIDE", new XAException(XAException.XAER_OUTSIDE));
- xaCodeMap.put("XAER_PROTO", new XAException(XAException.XAER_PROTO));
- xaCodeMap.put("XAER_RMERR", new XAException(XAException.XAER_RMERR));
- xaCodeMap.put("XAER_RMFAIL ", new XAException(XAException.XAER_RMFAIL));
- }
+ if (_xaFailureType.equals(ASFailureType.XARES_RECOVER))
+ applySpec("xa recover");
- public boolean isXAResource()
- {
- return _xaFailureType.isXA() || _xaFailureType.equals(ASFailureType.NONE);
- }
+ return new Xid[0];
+ }
- public boolean isSynchronization()
- {
- return _xaFailureType.isSynchronization();
- }
+ public boolean setTransactionTimeout(int txTimeout) throws XAException
+ {
+ this.txTimeout = txTimeout;
- public boolean isPreCommit()
- {
- return _xaFailureType.isPreCommit();
- }
+ return true; // set was successfull
+ }
- public boolean expectException()
- {
- return _xaFailureMode.equals(ASFailureMode.XAEXCEPTION);
- }
+ public void start(Xid xid, int i) throws XAException
+ {
+ log.debug("start(Xid=" + xid + ", i=" + i);
+ _xids.add(xid);
+
+ if (_xaFailureType.equals(ASFailureType.XARES_START))
+ applySpec("xa start");
+ }
+
+ public String getEISProductName() { return "Test XAResouce";}
+
+ public String getEISProductVersion() { return "v666.0";}
+
+ @SuppressWarnings({"ThrowableInstanceNeverThrown"})
+ private static void init()
+ {
+ xaCodeMap.put("XA_HEURCOM", new XAException(XAException.XA_HEURCOM));
+ xaCodeMap.put("XA_HEURHAZ", new XAException(XAException.XA_HEURHAZ));
+ xaCodeMap.put("XA_HEURMIX", new XAException(XAException.XA_HEURMIX));
+ xaCodeMap.put("XA_HEURRB", new XAException(XAException.XA_HEURRB));
+ xaCodeMap.put("XA_NOMIGRATE", new XAException(XAException.XA_NOMIGRATE));
+ xaCodeMap.put("XA_RBBASE", new XAException(XAException.XA_RBBASE));
+ xaCodeMap.put("XA_RBCOMMFAIL", new XAException(XAException.XA_RBCOMMFAIL));
+ xaCodeMap.put("XA_RBDEADLOCK", new XAException(XAException.XA_RBDEADLOCK));
+ xaCodeMap.put("XA_RBEND", new XAException(XAException.XA_RBEND));
+ xaCodeMap.put("XA_RBINTEGRITY", new XAException(XAException.XA_RBINTEGRITY));
+ xaCodeMap.put("XA_RBOTHER", new XAException(XAException.XA_RBOTHER));
+ xaCodeMap.put("XA_RBPROTO", new XAException(XAException.XA_RBPROTO));
+ xaCodeMap.put("XA_RBROLLBACK", new XAException(XAException.XA_RBROLLBACK));
+ xaCodeMap.put("XA_RBTIMEOUT", new XAException(XAException.XA_RBTIMEOUT));
+ xaCodeMap.put("XA_RBTRANSIENT", new XAException(XAException.XA_RBTRANSIENT));
+ xaCodeMap.put("XA_RDONLY", new XAException(XAException.XA_RDONLY));
+ xaCodeMap.put("XA_RETRY", new XAException(XAException.XA_RETRY));
+ xaCodeMap.put("XAER_ASYNC", new XAException(XAException.XAER_ASYNC));
+ xaCodeMap.put("XAER_DUPID", new XAException(XAException.XAER_DUPID));
+ xaCodeMap.put("XAER_INVAL", new XAException(XAException.XAER_INVAL));
+ xaCodeMap.put("XAER_NOTA", new XAException(XAException.XAER_NOTA));
+ xaCodeMap.put("XAER_OUTSIDE", new XAException(XAException.XAER_OUTSIDE));
+ xaCodeMap.put("XAER_PROTO", new XAException(XAException.XAER_PROTO));
+ xaCodeMap.put("XAER_RMERR", new XAException(XAException.XAER_RMERR));
+ xaCodeMap.put("XAER_RMFAIL ", new XAException(XAException.XAER_RMFAIL));
+ }
+
+ public boolean isXAResource()
+ {
+ return _xaFailureType.isXA() || _xaFailureType.equals(ASFailureType.NONE);
+ }
+
+ public boolean isSynchronization()
+ {
+ return _xaFailureType.isSynchronization();
+ }
+
+ public boolean isPreCommit()
+ {
+ return _xaFailureType.isPreCommit();
+ }
+
+ public boolean expectException()
+ {
+ return _xaFailureMode.isException();
+ }
}
Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecovery.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/recovery/TestASRecovery.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecovery.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecoveryWithJPA.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/recovery/TestASRecoveryWithJPA.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/recovery/TestASRecoveryWithJPA.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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,59 +47,27 @@
}
/**
- * 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;
}
-
+
}
Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ASClientTask.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ASClientTask.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ASClientTask.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ASTestConfig.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ASTestConfig.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ASTestConfig.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ClientAction.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ClientAction.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ClientAction.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ClientTask.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ClientTask.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ClientTask.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/JUnitClientAction.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/JUnitClientAction.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/JUnitClientAction.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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))
@@ -70,13 +67,8 @@
testClass = val;
}
- ClassLoader loader1 = Thread.currentThread().getContextClassLoader();
- ClassLoader loader2 = this.getClass().getClassLoader();
-
try
{
- String serverPath = config.getServerPath(serverName);
-
TestResult result = new TestResult();
XMLJUnitResultFormatter resultFormatter = new XMLJUnitResultFormatter();
@@ -91,10 +83,7 @@
TestSuite suite = new TestSuite();
- // switch class loaders since a custom ant task runs with a different loader from the loader
- // that loader that loaded the class
- Thread.currentThread().setContextClassLoader(loader2);
-
+
JUnitClientTest test = null;
try
{
@@ -117,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);
@@ -142,10 +131,6 @@
throw new BuildException(e);
}
- finally
- {
- Thread.currentThread().setContextClassLoader(loader1);
- }
}
public boolean cancel() throws UnsupportedOperationException
Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/JUnitClientTest.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/JUnitClientTest.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/JUnitClientTest.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerBindingConfig.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ServerBindingConfig.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerBindingConfig.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerTask.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ServerTask.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerTask.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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;
@@ -114,7 +114,7 @@
}
catch (IOException e)
{
- throw new ServerTaskException("Error stoping server " + name);
+ throw new ServerTaskException("Error stoping server " + name + ": " + e, e);
}
}
@@ -135,7 +135,7 @@
}
catch (IOException e)
{
- throw new ServerTaskException("Error starting server " + name);
+ throw new ServerTaskException("Error starting server " + name + ": " + e, e);
}
}
}
Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerTaskException.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/ServerTaskException.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/ServerTaskException.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TaskProperty.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/TaskProperty.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TaskProperty.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TaskValue.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/TaskValue.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TaskValue.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TransactionLog.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/TransactionLog.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/TransactionLog.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/Utils.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/crashrecovery/taskdefs/Utils.java 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/jbossts/taskdefs/Utils.java 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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);
+ }
+ }
+
}
Copied: branches/JBPAPP_5_1/testsuite/src/resources/jbossts (from rev 104860, branches/JBPAPP_5_1/testsuite/src/resources/crashrecovery)
Copied: branches/JBPAPP_5_1/testsuite/src/resources/jbossts/crashrecovery/META-INF (from rev 104860, branches/JBPAPP_5_1/testsuite/src/resources/crashrecovery/META-INF)
Modified: branches/JBPAPP_5_1/testsuite/src/resources/jbossts/resources/sybase15-xa-ds.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/resources/crashrecovery/resources/sybase15-xa-ds.xml 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/resources/jbossts/resources/sybase15-xa-ds.xml 2010-05-17 11:38:51 UTC (rev 104870)
@@ -15,8 +15,8 @@
<!-- uncomment to enable interleaving <interleaving/> -->
<xa-datasource-class>com.sybase.jdbc3.jdbc.SybXADataSource</xa-datasource-class>
<xa-datasource-property name="NetworkProtocol">Tds</xa-datasource-property>
- <xa-datasource-property name="ServerName">dev77.qa.atl2.redhat.com</xa-datasource-property>
- <xa-datasource-property name="PortNumber">4100</xa-datasource-property>
+ <xa-datasource-property name="ServerName">vmg07.mw.lab.eng.bos.redhat.com</xa-datasource-property>
+ <xa-datasource-property name="PortNumber">5000</xa-datasource-property>
<xa-datasource-property name="DatabaseName">crashrec</xa-datasource-property>
<xa-datasource-property name="User">crashrec</xa-datasource-property>
<xa-datasource-property name="Password">crashrec</xa-datasource-property>
@@ -26,7 +26,7 @@
<!--check-valid-connection-sql>select 1 from mytable</check-valid-connection-sql-->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.SybaseExceptionSorter</exception-sorter-class-name>
<type-mapping>Sybase</type-mapping>
-
+ <track-connection-by-tx/>
</xa-datasource>
</datasources>
Deleted: branches/JBPAPP_5_1/testsuite/src/resources/jbossts/scripts/README.txt
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/resources/crashrecovery/scripts/README.txt 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/resources/jbossts/scripts/README.txt 2010-05-17 11:38:51 UTC (rev 104870)
@@ -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: branches/JBPAPP_5_1/testsuite/src/resources/jbossts/scripts/as-tests.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/resources/crashrecovery/scripts/as-tests.xml 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/resources/jbossts/scripts/as-tests.xml 2010-05-17 11:38:51 UTC (rev 104870)
@@ -1,33 +1,16 @@
<?xml version="1.0"?>
-<project name="crashrecovery-tests" default="as-tests" basedir="."
+<project name="crashrecovery-tests" default="crash-tests" basedir="."
xmlns:astest="http://jboss.org/ns/test/ant/astest">
<property environment="env"/>
<property name="jboss.home" value="${env.JBOSS_HOME}"/>
<property name="product.dir" value="${env.DTF_HOME}/JBossTS-JTA-QA/"/>
- <property name="jbossts.common.jar.dir" value="${product.dir}/lib/ext"/>
<property name="astest.jar.dir" value="${product.dir}/qa/resources"/>
<property name="astest.jar.name" value="astest.jar"/>
<property name="astest.jar.deploy.dir" value="qa/lib"/>
- <property name="jboss.server.manager.jar.dir" value="${product.dir}/qa/lib"/>
- <property name="jboss.server.manager.jar.name" value="jboss-server-manager-0.1.1.GA.jar"/>
- <path id="astest.taskdef.classpath">
- <pathelement location="${jboss.home}/client/jbossall-client.jar"/>
- <pathelement location="${jboss.home}/client/log4j.jar" />
- <pathelement location="${jboss.home}/client/jboss-logging-spi.jar" />
- <pathelement location="${jboss.home}/lib/trove.jar"/>
-
- <pathelement location="${jbossts.common.jar.dir}/jbossts-common.jar"/>
- <pathelement location="${astest.jar.dir}/${astest.jar.name}"/>
- <pathelement location="${jboss.server.manager.jar.dir}/${jboss.server.manager.jar.name}"/>
-
- <pathelement location="${junit.junit.lib}/junit.jar" />
- <pathelement location="${org.apache.ant.lib}/ant-junit.jar"/>
- </path>
-
<property name="node0" value="localhost" />
<property name="node1" value="192.168.1.106" />
@@ -55,60 +38,61 @@
Other targets...
-->
<target name="init">
+ <echo message="jboss.home=${jboss.home}"/>
<property name="wipeOutTxsInDoubt" value="true" />
</target>
<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.psql_8.4">
- <equals arg1="${crash.db}" arg2="psql_8.4"/>
+ <equals arg1="${jbossts.db}" arg2="psql_8.4"/>
</condition>
<condition property="want.psql_9.0">
- <equals arg1="${crash.db}" arg2="psql_9.0"/>
+ <equals arg1="${jbossts.db}" arg2="psql_9.0"/>
</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.oracle_11_r2">
- <equals arg1="${crash.db}" arg2="oracle_11_r2"/>
+ <equals arg1="${jbossts.db}" arg2="oracle_11_r2"/>
</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>
<condition property="want.oracle_rac">
- <equals arg1="${crash.db}" arg2="oracle_rac"/>
+ <equals arg1="${jbossts.db}" arg2="oracle_rac"/>
</condition>
<condition property="want.oracle_rac_lb">
- <equals arg1="${crash.db}" arg2="oracle_rac_lb"/>
+ <equals arg1="${jbossts.db}" arg2="oracle_rac_lb"/>
</condition>
<condition property="want.oracle_rac_r2">
- <equals arg1="${crash.db}" arg2="oracle_rac_r2"/>
+ <equals arg1="${jbossts.db}" arg2="oracle_rac_r2"/>
</condition>
<condition property="want.oracle_rac_r2_lb">
- <equals arg1="${crash.db}" arg2="oracle_rac_r2_lb"/>
+ <equals arg1="${jbossts.db}" arg2="oracle_rac_r2_lb"/>
</condition>
</target>
@@ -134,10 +118,10 @@
<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>
@@ -148,10 +132,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>
@@ -162,28 +146,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>
@@ -226,7 +210,7 @@
<target name="call-tests-for-psql_8.2" if="want.psql_8.2">
<antcall target="${call.target}">
- <param name="dbdriver" value="postgresql-8.2.jar"/>
+ <param name="dbdriver" value="${driver.name.psql_8.2}"/>
<param name="datasource" value="postgres82-xa-ds.xml" />
<param name="dbname" value="psql82" />
</antcall>
@@ -234,7 +218,7 @@
<target name="call-tests-for-psql_8.3" if="want.psql_8.3">
<antcall target="${call.target}">
- <param name="dbdriver" value="postgresql-8.3.jar"/>
+ <param name="dbdriver" value="${driver.name.psql_8.3}"/>
<param name="datasource" value="postgres83-xa-ds.xml" />
<param name="dbname" value="psql83" />
</antcall>
@@ -242,23 +226,23 @@
<target name="call-tests-for-psql_8.4" if="want.psql_8.4">
<antcall target="${call.target}">
- <param name="dbdriver" value="postgresql-8.3.jar"/>
+ <param name="dbdriver" value="${driver.name.psql_8.4}"/>
<param name="datasource" value="postgres83-xa-ds.xml" />
- <param name="dbname" value="psql83" />
+ <param name="dbname" value="psql84" />
</antcall>
</target>
<target name="call-tests-for-psql_9.0" if="want.psql_9.0">
<antcall target="${call.target}">
- <param name="dbdriver" value="postgresql-9.0.jar"/>
+ <param name="dbdriver" value="${driver.name.psql_9.0}"/>
<param name="datasource" value="postgres83-xa-ds.xml" />
- <param name="dbname" value="psql83" />
+ <param name="dbname" value="psql90" />
</antcall>
</target>
<target name="call-tests-for-oracle_10" if="want.oracle_10">
- <antcall target="${call.target}">
- <param name="dbdriver" value="ojdbc14.jar"/>
+ <antcall target="${call.target}">
+ <param name="dbdriver" value="${driver.name.oracle_10}"/>
<param name="datasource" value="oracle10-xa-ds.xml" />
<param name="dbname" value="oracle10" />
</antcall>
@@ -266,55 +250,55 @@
<target name="call-tests-for-oracle_11" if="want.oracle_11">
<antcall target="${call.target}">
- <param name="dbdriver" value="ojdbc6.jar"/>
+ <param name="dbdriver" value="${driver.name.oracle_11}"/>
<param name="datasource" value="oracle11-xa-ds.xml" />
<param name="dbname" value="oracle11" />
</antcall>
</target>
<target name="call-tests-for-oracle_11_r2" if="want.oracle_11_r2">
- <antcall target="${call.target}">
- <param name="dbdriver" value="ojdbc6.jar"/>
- <param name="datasource" value="oracle11-r2-xa-ds.xml" />
- <param name="dbname" value="oracle11_r2" />
+ <antcall target="${call.target}">
+ <param name="dbdriver" value="${driver.name.oracle_11}"/>
+ <param name="datasource" value="oracle11-r2-xa-ds.xml" />
+ <param name="dbname" value="oracle11_r2" />
</antcall>
</target>
<target name="call-tests-for-oracle_rac" if="want.oracle_rac">
- <antcall target="${call.target}">
- <param name="dbdriver" value="ojdbc6.jar"/>
- <param name="datasource" value="oracle-rac1-xa-ds.xml" />
- <param name="dbname" value="oracle_rac" />
+ <antcall target="${call.target}">
+ <param name="dbdriver" value="${driver.name.oracle_11}"/>
+ <param name="datasource" value="oracle-rac1-xa-ds.xml" />
+ <param name="dbname" value="oracle_rac" />
</antcall>
</target>
<target name="call-tests-for-oracle_rac_lb" if="want.oracle_rac_lb">
- <antcall target="${call.target}">
- <param name="dbdriver" value="ojdbc6.jar"/>
- <param name="datasource" value="oracle-rac-lb-xa-ds.xml" />
- <param name="dbname" value="oracle_rac_lb" />
+ <antcall target="${call.target}">
+ <param name="dbdriver" value="${driver.name.oracle_11}"/>
+ <param name="datasource" value="oracle-rac-lb-xa-ds.xml" />
+ <param name="dbname" value="oracle_rac_lb" />
</antcall>
</target>
<target name="call-tests-for-oracle_rac_r2" if="want.oracle_rac_r2">
- <antcall target="${call.target}">
- <param name="dbdriver" value="ojdbc6.jar"/>
- <param name="datasource" value="oracle-rac-r2-1-xa-ds.xml" />
- <param name="dbname" value="oracle_rac_r2" />
+ <antcall target="${call.target}">
+ <param name="dbdriver" value="${driver.name.oracle_11}"/>
+ <param name="datasource" value="oracle-rac-r2-1-xa-ds.xml" />
+ <param name="dbname" value="oracle_rac_r2" />
</antcall>
</target>
<target name="call-tests-for-oracle_rac_r2_lb" if="want.oracle_rac_r2_lb">
- <antcall target="${call.target}">
- <param name="dbdriver" value="ojdbc6.jar"/>
- <param name="datasource" value="oracle-rac-r2-lb-xa-ds.xml" />
- <param name="dbname" value="oracle_rac_r2_lb" />
+ <antcall target="${call.target}">
+ <param name="dbdriver" value="${driver.name.oracle_11}"/>
+ <param name="datasource" value="oracle-rac-r2-lb-xa-ds.xml" />
+ <param name="dbname" value="oracle_rac_r2_lb" />
</antcall>
</target>
<target name="call-tests-for-mssql_2005" if="want.mssql_2005">
<antcall target="${call.target}">
- <param name="dbdriver" value="sqljdbc4.jar"/>
+ <param name="dbdriver" value="${driver.name.mssql_2005}"/>
<param name="datasource" value="mssql2005-xa-ds.xml" />
<param name="dbname" value="mssql2005" />
</antcall>
@@ -322,7 +306,7 @@
<target name="call-tests-for-mssql_2008" if="want.mssql_2008">
<antcall target="${call.target}">
- <param name="dbdriver" value="sqljdbc4.jar"/>
+ <param name="dbdriver" value="${driver.name.mssql_2008}"/>
<param name="datasource" value="mssql2008-xa-ds.xml" />
<param name="dbname" value="mssql2008" />
</antcall>
@@ -330,7 +314,7 @@
<target name="call-tests-for-mysql_5.0" if="want.mysql_5.0">
<antcall target="${call.target}">
- <param name="dbdriver" value="mysql-connector-java-5.0.jar"/>
+ <param name="dbdriver" value="${driver.name.mysql_5.0}"/>
<param name="datasource" value="mysql50-xa-ds.xml" />
<param name="dbname" value="mysql50" />
</antcall>
@@ -338,7 +322,7 @@
<target name="call-tests-for-mysql_5.1" if="want.mysql_5.1">
<antcall target="${call.target}">
- <param name="dbdriver" value="mysql-connector-java-5.1.jar"/>
+ <param name="dbdriver" value="${driver.name.mysql_5.1}"/>
<param name="datasource" value="mysql51-xa-ds.xml" />
<param name="dbname" value="mysql51" />
</antcall>
@@ -346,7 +330,7 @@
<target name="call-tests-for-db2_9.7" if="want.db2_9.7">
<antcall target="${call.target}">
- <param name="dbdriver" value="db2jcc.jar" />
+ <param name="dbdriver" value="${driver.name.db2_9.7}" />
<param name="datasource" value="db2_97-xa-ds.xml" />
<param name="dbname" value="db2_9" />
</antcall>
@@ -354,7 +338,7 @@
<target name="call-tests-for-sybase_15" if="want.sybase_15">
<antcall target="${call.target}">
- <param name="dbdriver" value="jconn3.jar"/>
+ <param name="dbdriver" value="${driver.name.sybase_15}"/>
<param name="datasource" value="sybase15-xa-ds.xml" />
<param name="dbname" value="sybase15" />
</antcall>
@@ -376,7 +360,7 @@
<target name="crash-tests-all-testcases"
depends="testcase-none,
testcase-none-rev,
- testcase-prepare_ex,
+ testcase-prepare_ex,
testcase-prepare_ex-rev,
testcase-prepare_halt,
testcase-prepare_halt-rev,
@@ -425,7 +409,7 @@
</target>
<target name="testcase-commit_halt" if="want.commit_halt">
- <!-- DISABLED test-case: the test is invalid for the current version of JBossTS -->
+ <!-- DISABLED test-case: this test scenario is invalid for the current version of JBossTS -->
<antcall target="execute-crash-recovery-test">
<param name="specs" value="commit_halt"/><param name="reverseOrder" value="false"/><param name="rollbackExpected" value="false"/>
</antcall>
@@ -470,8 +454,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}" />
@@ -482,7 +466,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}" >
@@ -494,7 +478,7 @@
<!-- archive the server log -->
<zip destfile="${jboss.home}/server/crashrecovery-${tstype}/log/server-${dbname}-${testname}.log.zip">
<fileset file="${jboss.home}/server/crashrecovery-${tstype}/log/server.log"/>
- </zip>
+ </zip>
<delete file="${jboss.home}/server/crashrecovery-${tstype}/log/server.log"/>
<copy todir="${jboss.home}/server/crashrecovery-${tstype}/data/tx-object-store-${dbname}-${testname}">
<fileset dir="${jboss.home}/server/crashrecovery-${tstype}/data/tx-object-store" />
@@ -512,8 +496,8 @@
<target name="hack-after-astest-run" depends="hack-after-astest-run-for-db2_9.7, hack-after-astest-run-for-oracle_rac, hack-after-astest-run-for-oracle_rac_r2" />
<target name="hack-before-astest-run-for-db2_9.7" if="want.db2_9.7">
- <!-- deploy license .jar file -->
- <copy file="${product.dir}/dbdrivers/db2jcc_license_cu.jar" todir="${jboss.home}/server/crashrecovery-${tstype}/lib" />
+ <!-- deploy license .jar file
+ <copy file="${product.dir}/dbdrivers/db2jcc_license_cu.jar" todir="${jboss.home}/server/crashrecovery-${tstype}/lib" /-->
<!-- prepare hacked astest jar -->
<property name="astest.alternative.jar.name" value="db2-${astest.jar.name}" />
@@ -542,8 +526,8 @@
</target>
<target name="hack-after-astest-run-for-db2_9.7" if="want.db2_9.7">
- <!-- undeploy license .jar file -->
- <delete file="${jboss.home}/server/crashrecovery-${tstype}/lib/db2jcc_license_cu.jar" />
+ <!-- undeploy license .jar file
+ <delete file="${jboss.home}/server/crashrecovery-${tstype}/lib/db2jcc_license_cu.jar" /-->
</target>
@@ -566,26 +550,11 @@
<target name="hack-before-astest-run-for-oracle_racs">
<!-- deploy the second DS configuration -->
<copy file="${product.dir}/resources/${oracle_rac_second_ds}" todir="${jboss.home}/server/crashrecovery-${tstype}/deploy" />
-
- <!-- hack the configuration of JBossTS in order to use the second datasource for crash recovery -->
- <replace file="${jboss.home}/server/crashrecovery-${tstype}/conf/jbossts-properties.xml">
- <replacetoken><![CDATA[com.arjuna.ats.internal.jbossatx.jta.AppServerJDBCXARecovery;jndiname=CrashRecoveryDS]]></replacetoken>
- <replacevalue><![CDATA[com.arjuna.ats.internal.jbossatx.jta.AppServerJDBCXARecovery;jndiname=RecoveryDS]]></replacevalue>
- </replace>
</target>
<target name="hack-after-astest-run-for-oracle_racs">
<!-- undeploy the second DS configuration -->
<delete file="${jboss.home}/server/crashrecovery-${tstype}/deploy/${oracle_rac_second_ds}" />
-
- <!-- archive cluster jbossts configuration -->
- <copy file="${jboss.home}/server/crashrecovery-${tstype}/conf/jbossts-properties.xml" tofile="${jboss.home}/server/crashrecovery-${tstype}/jbossts-properties-for-${oracle_rac_second_ds}.xml" />
-
- <!-- unhack the configuration of JBossTS -->
- <replace file="${jboss.home}/server/crashrecovery-${tstype}/conf/jbossts-properties.xml">
- <replacetoken><![CDATA[com.arjuna.ats.internal.jbossatx.jta.AppServerJDBCXARecovery;jndiname=RecoveryDS]]></replacetoken>
- <replacevalue><![CDATA[com.arjuna.ats.internal.jbossatx.jta.AppServerJDBCXARecovery;jndiname=CrashRecoveryDS]]></replacevalue>
- </replace>
</target>
@@ -596,7 +565,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" />
@@ -616,12 +585,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-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}" />
@@ -631,51 +600,114 @@
</target>
- <!-- ===== get db drivers - borrowed from https://svn.jboss.org/repos/labs/labs/jbosstm/trunk/qa/build.xml ==== -->
- <!-- set these to the location(s) of the database drivers -->
+ <!-- ===== get db drivers ==== -->
+ <!-- set these to the location(s) of the database drivers -->
- <property name="driver.url" value="http://reports.qa.atl.jboss.com/jdbc-drivers"/>
+ <property name="driver.url" value="http://reports.qa.atl.jboss.com/jdbc-drivers/"/>
+ <property name="driver.name.psql_8.2" value="postgresql-8.2.jar"/>
+ <property name="driver.name.psql_8.3" value="postgresql-8.3.jar"/>
+ <property name="driver.name.psql_8.4" value="postgresql-8.4.jar"/>
+ <property name="driver.name.psql_9.0" value="postgresql-9.0.jar"/>
+ <property name="driver.name.sybase_15" value="jconn3.jar"/>
+ <property name="driver.name.oracle_10" value="ojdbc14.jar"/>
+ <property name="driver.name.oracle_11" value="ojdbc6.jar"/>
+ <property name="driver.name.db2_9.7" value="db2jcc.jar"/>
+ <property name="driver.name.mysql_5.0" value="mysql-connector-java-5.0.jar"/>
+ <property name="driver.name.mysql_5.1" value="mysql-connector-java-5.1.jar"/>
+ <property name="driver.name.mssql_2005" value="sqljdbc4.jar"/>
+ <property name="driver.name.mssql_2008" value="sqljdbc4.jar"/>
<target name="prepare-drivers">
- <available file="${driver.home}" property="have.dbdrivers" value="true"/>
+ <available file="${driver.home}/${driver.name.psql_8.2}" property="have.dbdriver.psql_8.2" value="true"/>
+ <available file="${driver.home}/${driver.name.psql_8.3}" property="have.dbdriver.psql_8.3" value="true"/>
+ <available file="${driver.home}/${driver.name.psql_8.4}" property="have.dbdriver.psql_8.4" value="true"/>
+ <available file="${driver.home}/${driver.name.psql_9.0}" property="have.dbdriver.psql_9.0" value="true"/>
+ <available file="${driver.home}/${driver.name.sybase_15}" property="have.dbdriver.sybase_15" value="true"/>
+ <available file="${driver.home}/${driver.name.oracle_10}" property="have.dbdriver.oracle_10" value="true"/>
+ <available file="${driver.home}/${driver.name.oracle_11}" property="have.dbdriver.oracle_11" value="true"/>
+ <available file="${driver.home}/${driver.name.db2_9.7}" property="have.dbdriver.db2_9.7" value="true"/>
+ <available file="${driver.home}/${driver.name.mysql_5.0}" property="have.dbdriver.mysql_5.0" value="true"/>
+ <available file="${driver.home}/${driver.name.mysql_5.1}" property="have.dbdriver.mysql_5.1" value="true"/>
+ <available file="${driver.home}/${driver.name.mssql_2005}" property="have.dbdriver.mssql_2005" value="true"/>
+ <available file="${driver.home}/${driver.name.mssql_2008}" property="have.dbdriver.mssql_2008" value="true"/>
+ <condition property="want.dbdriver.oracle_11">
+ <or>
+ <istrue value="${want.oracle_11}"/>
+ <istrue value="${want.oracle_11_r2}"/>
+ <istrue value="${want.oracle_rac}"/>
+ <istrue value="${want.oracle_rac_lb}"/>
+ <istrue value="${want.oracle_rac_r2}"/>
+ <istrue value="${want.oracle_rac_r2_lb}"/>
+ </or>
+ </condition>
+
+ <mkdir dir="${driver.home}" />
<antcall target="get.drivers" />
</target>
- <target name="get.drivers" unless="have.dbdrivers">
-
- <mkdir dir="${driver.home}" />
+ <target name="get.drivers"
+ depends="get.driver.oracle_10,
+ get.driver.oracle_11,
+ get.driver.mssql_2005,
+ get.driver.mssql_2008,
+ get.driver.psql_9.0,
+ get.driver.psql_8.4,
+ get.driver.psql_8.3,
+ get.driver.psql_8.2,
+ get.driver.mysql_5.1,
+ get.driver.mysql_5.0,
+ get.driver.db2_9.7,
+ get.driver.sybase_15" />
+ <target name="get.driver.oracle_10" unless="have.dbdriver.oracle_10" if="want.oracle_10">
<get src="${driver.url}/maven2/com/oracle/ojdbc14/10.2.0.4/ojdbc14-10.2.0.4.jar"
- dest="${driver.home}/ojdbc14.jar"/>
+ dest="${driver.home}/${driver.name.oracle_10}"/>
+ </target>
+ <target name="get.driver.oracle_11" unless="have.dbdriver.oracle_11" if="want.dbdriver.oracle_11">
<get src="${driver.url}/maven2/com/oracle/ojdbc6/11.2.0.1.0/ojdbc6-11.2.0.1.0.jar"
- dest="${driver.home}/ojdbc6.jar"/>
-
+ dest="${driver.home}/${driver.name.oracle_11}"/>
+ </target>
+ <target name="get.driver.mssql_2005" unless="have.dbdriver.mssql_2005" if="want.mssql_2005">
<get src="${driver.url}/maven2/com/microsoft/sqlserver/msjdbc/2.0.1008.2/msjdbc-2.0.1008.2-4.jar"
- dest="${driver.home}/sqljdbc4.jar"/>
-
+ dest="${driver.home}/${driver.name.mssql_2005}"/>
+ </target>
+ <target name="get.driver.mssql_2008" unless="have.dbdriver.mssql_2008" if="want.mssql_2008">
+ <get src="${driver.url}/maven2/com/microsoft/sqlserver/msjdbc/2.0.1008.2/msjdbc-2.0.1008.2-4.jar"
+ dest="${driver.home}/${driver.name.mssql_2008}"/>
+ </target>
+ <target name="get.driver.psql_8.4" unless="have.dbdriver.psql_8.4" if="want.psql_8.4">
<get src="${driver.url}/postgresql-8.3-605.jdbc4.jar"
- dest="${driver.home}/postgresql-8.4.jar"/>
+ dest="${driver.home}/${driver.name.psql_8.4}"/>
+ </target>
+ <target name="get.driver.psql_9.0" unless="have.dbdriver.psql_9.0" if="want.psql_9.0">
<get src="${driver.url}/postgresql-8.3-605.jdbc4.jar"
- dest="${driver.home}/postgresql-9.0.jar"/>
-
+ dest="${driver.home}/${driver.name.psql_9.0}"/>
+ </target>
+ <target name="get.driver.psql_8.3" unless="have.dbdriver.psql_8.3" if="want.psql_8.3">
<get src="${driver.url}/postgresql-8.3-605.jdbc4.jar"
- dest="${driver.home}/postgresql-8.3.jar"/>
+ dest="${driver.home}/${driver.name.psql_8.3}"/>
+ </target>
+ <target name="get.driver.psql_8.2" unless="have.dbdriver.psql_8.2" if="want.psql_8.2">
<get src="${driver.url}/postgresql-8.2-510.jdbc4.jar"
- dest="${driver.home}/postgresql-8.2.jar"/>
-
+ dest="${driver.home}/${driver.name.psql_8.2}"/>
+ </target>
+ <target name="get.driver.mysql_5.1" unless="have.dbdriver.mysql_5.1" if="want.mysql_5.1">
<get src="${driver.url}/maven2/mysql/mysql-connector-java/5.1.12/mysql-connector-java-5.1.12.jar"
- dest="${driver.home}/mysql-connector-java-5.1.jar"/>
+ dest="${driver.home}/${driver.name.mysql_5.1}"/>
+ </target>
+ <target name="get.driver.mysql_5.0" unless="have.dbdriver.mysql_5.0" if="want.mysql_5.0">
<get src="${driver.url}/maven2/mysql/mysql-connector-java/5.0.8/mysql-connector-java-5.0.8.jar"
- dest="${driver.home}/mysql-connector-java-5.0.jar"/>
-
+ dest="${driver.home}/${driver.name.mysql_5.0}"/>
+ </target>
+ <target name="get.driver.db2_9.7" unless="have.dbdriver.db2_9.7" if="want.db2_9.7">
<get src="${driver.url}/maven2/com/ibm/db2jcc/3.57.86/db2jcc-3.57.86.jar"
- dest="${driver.home}/db2jcc.jar"/>
+ dest="${driver.home}/${driver.name.db2_9.7}"/>
<get src="${driver.url}/maven2/com/ibm/db2jcc_license_cu/3.57.86/db2jcc_license_cu-3.57.86.jar"
dest="${driver.home}/db2jcc_license_cu.jar"/>
-
+ </target>
+ <target name="get.driver.sybase_15" unless="have.dbdriver.sybase_15" if="want.sybase_15">
<get src="${driver.url}/maven2/com/sybase/jconnect/6.0.5_26564/jconnect-6.0.5_26564.jar"
- dest="${driver.home}/jconn3.jar"/>
-
+ dest="${driver.home}/${driver.name.sybase_15}"/>
</target>
</project>
Modified: branches/JBPAPP_5_1/testsuite/src/resources/jbossts/scripts/imports/test-config.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/resources/crashrecovery/scripts/imports/test-config.xml 2010-05-17 09:46:00 UTC (rev 104860)
+++ branches/JBPAPP_5_1/testsuite/src/resources/jbossts/scripts/imports/test-config.xml 2010-05-17 11:38:51 UTC (rev 104870)
@@ -1,15 +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">
- <classpath refid="astest.taskdef.classpath"/>
</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>
@@ -17,23 +16,17 @@
- 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>
- <!--
- - a server is specification of how configure a instance of an AS
- <typedef name="server" classname="org.jboss.jbossas.servermanager.Server"
- uri="http://jboss.org/ns/test/ant/astest" loaderref="astest.loader">
- </typedef>
- -->
<!--
- If the product directory where this test is running from contains an AS installation then use it,
@@ -49,10 +42,10 @@
- server can be changed via the server.binding.name and server.binding.location properties.
-->
<astest:config javaHome="${env.JAVA_HOME}" debug="false">
+ <spec name= "none" mode="NONE" type="NONE" />
<spec name= "prepare_ex" mode="XAEXCEPTION" 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" />
<!--
Profiles for JBossAS Testsuite integration
More information about the jboss-cvs-commits
mailing list