[jboss-svn-commits] JBL Code SVN: r21336 - in labs/jbosstm/trunk: qa and 15 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Aug 4 06:31:06 EDT 2008


Author: mmusgrov
Date: 2008-08-04 06:31:05 -0400 (Mon, 04 Aug 2008)
New Revision: 21336

Added:
   labs/jbosstm/trunk/qa/ext/
   labs/jbosstm/trunk/qa/ext/jboss-server-manager-0.1.0.GA.jar
   labs/jbosstm/trunk/qa/testdefs/jbossts-qa-as-crashrecovery01-testdefs.xml
   labs/jbosstm/trunk/qa/tests/scripts/
   labs/jbosstm/trunk/qa/tests/scripts/README.txt
   labs/jbosstm/trunk/qa/tests/scripts/as-tests.xml
   labs/jbosstm/trunk/qa/tests/scripts/imports/
   labs/jbosstm/trunk/qa/tests/scripts/imports/test-config.xml
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/Test01.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/Test02.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/Test03.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/ejb-jar.xml
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/jboss-beans.xml
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/jboss.xml
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashBMTBean.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashCMTBean.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashLocal.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashLocalHome.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashRem.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashRemHome.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASFailureMode.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASFailureSpec.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASFailureType.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASTestResource.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/TestASRecovery.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/java.policy
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/oracle-xa-ds.xml
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/sample-bindings.xml
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/xa-mq-destinations-service.xml
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ASClientTask.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ASTestConfig.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ClientAction.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerBindingConfig.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerTask.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerTaskException.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerWrapper.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/TaskProperty.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/TaskValue.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/TransactionLog.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/Utils.java
   labs/jbosstm/trunk/qa/testselections/300_AJQ_Linux.xml
   labs/jbosstm/trunk/qa/testselections/301_JTAQ_Linux.xml
Modified:
   labs/jbosstm/trunk/ext/TestingFramework.jar
   labs/jbosstm/trunk/qa/README.txt
   labs/jbosstm/trunk/qa/build.xml
   labs/jbosstm/trunk/qa/config/JBossTS_JTA_QA.xml
   labs/jbosstm/trunk/qa/config/JBossTS_JTS_JacORB_QA.xml
   labs/jbosstm/trunk/qa/config/jbossts.jsp
   labs/jbosstm/trunk/qa/tests/build-core.xml
   labs/jbosstm/trunk/qa/tests/build-jta.xml
   labs/jbosstm/trunk/qa/tests/build-jts.xml
Log:
These changes integrate the AS server manager project with the qa build and implement a set of ant tasks for scripting AS crash recovery. An example test is included which will run standalone (via ant) or under the control of the DTF.

Resolves JBTM-360


Modified: labs/jbosstm/trunk/ext/TestingFramework.jar
===================================================================
(Binary files differ)

Modified: labs/jbosstm/trunk/qa/README.txt
===================================================================
--- labs/jbosstm/trunk/qa/README.txt	2008-08-04 09:28:49 UTC (rev 21335)
+++ labs/jbosstm/trunk/qa/README.txt	2008-08-04 10:31:05 UTC (rev 21336)
@@ -75,7 +75,10 @@
 should be possible for the open source dbs at least, plus maybe others
 
 Now edit the build.xml file in this directory, setting the properties near the top to the locations of
-the various pre-requisites mentioned above.
+the various pre-requisites mentioned above. If you want to package an AS as part of the test suite
+then make sure that the JBOSS_HOME environment variable points to a valid JBoss distribution and
+set the ant property 'as' to true. When runing the tests ensure that the version of TestingFramework.jar used
+running the DTF is the same one that is checked into JBossTS.
 
 Create the directory config/jdbc_profiles/<name_of_testnode_host>/ by copying the existing
 config/jdbc_profiles/_template/ directory, one for each host on which a test node will run.
@@ -87,9 +90,10 @@
 
 Set the JAVA_HOME to the older version of Java you may want to run tests on..
 
-Run 'ant'. This builds the JTS version of the product test classes by calling tests/build-jts.xml,
-then builds a .zip file with the QA distribution, which contains the tests plus the product itself
-copied in from your installation above, plus the database drivers, plus some config files.
+Run 'ant'. This target will build JTA/JTS version of the product if the JBossTS build was JTA/JTS.
+The builds generates a .zip file with the QA distribution, which contains the tests plus the product itself
+copied in from your installation above, plus the database drivers, plus some config files and a copy of
+the JBoss AS if built with 'ant -Das=true'.
 
 To deploy the built product QA distribution to the DTF:
 

Modified: labs/jbosstm/trunk/qa/build.xml
===================================================================
--- labs/jbosstm/trunk/qa/build.xml	2008-08-04 09:28:49 UTC (rev 21335)
+++ labs/jbosstm/trunk/qa/build.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -20,15 +20,15 @@
 -->
 <project name="JBossTS QA Suite Distribution" default="dist">
 
-	<!-- jta or jts. TODO: Should really be determied automatically by looking at content of ts.home -->
-	<property name="buildtype" value="jts"/>
+	<property environment="env"/>
+	<property name="driver.home" value="/home/mmusgrov/drivers"/>
 
 	<!-- set this property to the location of a JBossTS JTA/JTS build or installation -->
 	<property name="org.jboss.jbossts.qa.ts.home" location="../install"/>
+	<property name="jbossts.install.lib" location="${org.jboss.jbossts.qa.ts.home}/lib"/>
 
 	<!-- set this property to the location of a DTF TestingFramework.jar build -->
-    <!-- TODO should ref the version checked into JBossTS? -->
-    <property name="org.jboss.jbossts.qa.testingframework_location" location="/home/jhalli/IdeaProjects/jboss/dtf/installation/lib/TestingFramework.jar"/>
+	<property name="org.jboss.jbossts.qa.testingframework_location" location="../ext/TestingFramework.jar"/>
 
 	<!-- TODO cd ArjunaJTS/orbportability; ant -f build-anttasks.xml -->
 	<property name="org.jboss.jbossts.qa.idlcompiler.lib"
@@ -36,34 +36,30 @@
 
 	<!-- set these to the location(s) of the database drivers -->
 
-	<fileset id="oracle.drivers" dir="/home/jhalli/javastuff/dbdrivers/oracle_10_2_0_4/">
+	<fileset id="oracle.drivers" dir="${driver.home}/oracle_10_2_0_4/">
 		<include name="ojdbc14.jar"/>
 	</fileset>
 
-	<fileset id="mssql.drivers.old" dir="/home/jhalli/javastuff/mssql2000jdbc/lib">
-		<include name="ms*.jar"/>
-	</fileset>
-
-	<fileset id="mssql.drivers" dir="/home/jhalli/javastuff/dbdrivers/mssql2005_sqljdbc_1.2/enu/">
+	<fileset id="mssql.drivers" dir="${driver.home}/mssql2005_sqljdbc_1.2/enu/">
 		<include name="sqljdbc.jar"/>
 	</fileset>
 
 	<!-- 8.1.408 is broken, use something more recent. -->
-	<fileset id="pgsql.drivers" dir="/home/jhalli/javastuff/dbdrivers/">
+	<fileset id="pgsql.drivers" dir="${driver.home}/">
 		<include name="postgresql-8.3-603.jdbc3.jar"/>
 	</fileset>
 
 	<!-- server version 5 is the first with XA support, do use anything less.
 	 		driver versions before 5.0.5 are broken, don't use them either. -->
-	<fileset id="mysql.drivers" dir="/home/jhalli/javastuff/dbdrivers//">
+	<fileset id="mysql.drivers" dir="${driver.home}/">
 		<include name="mysql-connector-java-5.1.6-bin.jar"/>
 	</fileset>
 
-	<fileset id="ibmdb2.drivers" dir="/home/jhalli/javastuff/dbdrivers/DB2_v9/">
+	<fileset id="ibmdb2.drivers" dir="${driver.home}/DB2_v9/">
 		<include name="db2jcc*.jar"/>
 	</fileset>
 
-	<fileset id="sybase.drivers" dir="/home/jhalli/javastuff/dbdrivers/jConnect-5_5/classes/">
+	<fileset id="sybase.drivers" dir="${driver.home}/jConnect-5_5/classes/">
 		<include name="jconn2.jar"/>
 	</fileset>
 
@@ -78,15 +74,44 @@
 		<fileset refid="sybase.drivers"/>
 	</path>
 
+	<property name="org.jboss.jbossts.qa.server_manager_location" location="ext/jboss-server-manager-0.1.0.GA.jar"/>
 	<property name="org.jboss.jbossts.qa.dist.buildroot" location="build"/>
 
-	<target name="clean">
+	<target name="buildtype">
+		<available file="${jbossts.install.lib}/jbossjts.jar" property="buildtype" value="jts"/>
+		<available file="${jbossts.install.lib}/jts.jar" property="buildtype" value="jts"/>
+
+		<available file="${jbossts.install.lib}/jbossjta.jar" property="buildtype" value="jta"/>                        
+		<available file="${jbossts.install.lib}/jta.jar" property="buildtype" value="jta"/>
+
+		<available file="${jbossts.install.lib}/jbossjta-integration.jar" property="integration.build"/>
+		<available file="${jbossts.install.lib}/jbossjts-integration.jar" property="integration.build"/>
+
+		<condition property="dist.as">
+			<and>
+				<isset property="integration.build"/>
+				<isset property="as"/>
+			</and>
+		</condition>
+	</target>
+
+	<target name="dist.as" depends="buildtype" if="dist.as">
+		<fail unless="env.JBOSS_HOME" message="Please set the JBOSS_HOME environment variable" />
+		<echo message="copying ${env.JBOSS_HOME} - this may take a while ..."/>
+		<mkdir dir="${org.jboss.jbossts.qa.dist.buildroot}/as"/>
+		<copy todir="${org.jboss.jbossts.qa.dist.buildroot}/as">
+			<fileset dir="${env.JBOSS_HOME}"/>
+		</copy>
+	</target>
+
+	<target name="clean" depends="buildtype">
 		<delete dir="${org.jboss.jbossts.qa.dist.buildroot}"/>
 		<ant dir="tests" antfile="build-${buildtype}.xml" target="clean"/>
 	</target>
 
-	<target name="init">
+	<target name="init" depends="buildtype">
 		<mkdir dir="${org.jboss.jbossts.qa.dist.buildroot}"/>
+		<antcall target="dist.as"/>
 	</target>
 
 	<target name="dist" depends="clean, init">
@@ -94,6 +119,8 @@
 		<!-- build the test suite -->
 		<ant dir="tests" antfile="build-${buildtype}.xml">
 			<reference refid="database.drivers.path"/>
+			<property name="org.jboss.jbossts.qa.server_manager_location"
+			          value="${org.jboss.jbossts.qa.server_manager_location}"/>
 		</ant>
 
 		<!-- prepare the content of the qa distribution, which is the product build
@@ -110,6 +137,9 @@
 		<copy todir="${org.jboss.jbossts.qa.dist.buildroot}/qa/lib">
 			<fileset file="${org.jboss.jbossts.qa.testingframework_location}"/>
 			<fileset file="tests/build/jbossts-${buildtype}-qa.jar"/>
+			<fileset file="tests/build/astest.jar"/>
+			<fileset file="tests/build/java.policy"/>
+			<fileset file="${org.jboss.jbossts.qa.server_manager_location}"/>
 			<fileset refid="oracle.drivers"/>
 			<fileset refid="mssql.drivers"/>
 			<fileset refid="pgsql.drivers"/>
@@ -117,6 +147,14 @@
 			<fileset refid="ibmdb2.drivers"/>
 			<fileset refid="sybase.drivers"/>
 		</copy>
+		<copy todir="${org.jboss.jbossts.qa.dist.buildroot}/qa">
+			<fileset dir="tests/build/qa">
+				<include name="resources/**/*"/>
+			</fileset>
+			<fileset dir="tests">
+				<include name="scripts/**/*"/>
+			</fileset>
+		</copy>
 		<!-- testing is done with some non-default properties: -->
 		<copy todir="${org.jboss.jbossts.qa.dist.buildroot}/etc" overwrite="true">
 			<fileset file="config/jboss${buildtype}-properties.xml"/>
@@ -128,4 +166,16 @@
 
 	</target>
 
+	<target name="help">
+<echo>Supported targets:
+  jta - build tests for the standalone jta transaction engine
+  jts - build tests for the standalone jts transaction engine
+  jbossjta - build tests for the integrated jta transaction engine
+  jbossjts - build tests for the integrated jts transaction engine
+  dist - build tests for the last build of the transaction engine
+
+  To include a copy of the AS (pointed to by the JBOSS_HOME
+  environment variable) in the distribution please set the ant
+  property 'as' to true.</echo>
+	</target>
 </project>

Modified: labs/jbosstm/trunk/qa/config/JBossTS_JTA_QA.xml
===================================================================
--- labs/jbosstm/trunk/qa/config/JBossTS_JTA_QA.xml	2008-08-04 09:28:49 UTC (rev 21335)
+++ labs/jbosstm/trunk/qa/config/JBossTS_JTA_QA.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -63,14 +63,14 @@
 				<property name="org.jboss.jbossts.qa.Utils.nameserviceuri" value="//localhost:1099/NameService"/>
 			</properties>
 			<sets>
-				<set name="DTF_HOME" value="/home/jhalli/IdeaProjects/jboss/dtf/installation"/>
+				<set name="DTF_HOME" value="/home/mmusgrov/misc/DTF"/>
 				<set name="LOCAL_PARAMETER" value="-local"/>
-				<set name="PRODUCTS_HOME" value="/home/jhalli/IdeaProjects/jboss/dtf/installation/products"/>
-				<set name="INSTALL.DIR" value="/home/jhalli/IdeaProjects/jboss/dtf/installation/JBossTS-JTA-QA/"/>
+				<set name="PRODUCTS_HOME" value="/services/DTF/products"/>
+				<set name="INSTALL.DIR" value="/home/mmusgrov/misc/DTF/JBossTS-JTA-QA/"/>
 				<set name="CALLS" value="100"/>
-				<set name="PRODUCT.DIR" value="/home/jhalli/IdeaProjects/jboss/dtf/installation/JBossTS-JTA-QA/"/>
+				<set name="PRODUCT.DIR" value="/home/mmusgrov/misc/DTF/JBossTS-JTA-QA/"/>
 				<!-- TODO: should this really be ARJUNAJTS home even thoug it's JTA? -->
-				<set name="ARJUNAJTS_HOME" value="/home/jhalli/IdeaProjects/jboss/dtf/installation/JBossTS-JTA-QA/"/>
+				<set name="ARJUNAJTS_HOME" value="/home/mmusgrov/misc/DTF/JBossTS-JTA-QA/"/>
 			</sets>
 			<jvm id="1.5.0"/>
 			<default-classpath name="main"/>
@@ -178,5 +178,13 @@
 			<param name="wait_for_text" value="Ready"/>
 			<param name="pass_indicator" value="Passed"/>
 		</task-runner>
+		<task-runner name="AntTaskRunner" class="com.arjuna.mwlabs.testframework.testnode.AntTaskRunner"
+					 log-to="http://localhost:8080/dtf/">
+			<param name="pass_on_wait_for" value="true"/>
+			<param name="fail_indicator" value="Failed"/>
+			<param name="wait_for_text" value="Ready"/>
+			<param name="pass_indicator" value="Passed"/>
+			<param name="product_dir" value="$(PRODUCT.DIR)"/>
+		</task-runner>
 	</task-runner-definitions>
 </product-configuration>

Modified: labs/jbosstm/trunk/qa/config/JBossTS_JTS_JacORB_QA.xml
===================================================================
--- labs/jbosstm/trunk/qa/config/JBossTS_JTS_JacORB_QA.xml	2008-08-04 09:28:49 UTC (rev 21335)
+++ labs/jbosstm/trunk/qa/config/JBossTS_JTS_JacORB_QA.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -29,6 +29,7 @@
 			<jar name="$(PRODUCT.DIR)/lib/ext/*.jar"/>
 			<jar name="$(PRODUCT.DIR)/lib/ext/*.zip"/>
 
+            <jar name="$(PRODUCT.DIR)/jacorb/etc/"/>
 			<jar name="$(PRODUCT.DIR)/qa/lib/*.jar"/>
 
 			<jar name="$(ORB_HOME)/lib/*.jar"/>
@@ -67,13 +68,13 @@
 				<property name="org.jboss.jbossts.qa.Utils.nameserviceuri" value="//localhost:1099/NameService"/>
 			</properties>
 			<sets>
-				<set name="DTF_HOME" value="/home/jhalli/IdeaProjects/jboss/dtf/installation"/>
-				<set name="PRODUCTS_HOME" value="/services/DTF/products"/>
-				<set name="INSTALL.DIR" value="/home/jhalli/IdeaProjects/jboss/dtf/installation/JBossTS-JTS-JacORB-QA/"/>
-				<set name="ORB_HOME" value="/home/jhalli/IdeaProjects/jboss/dtf/installation/JBossTS-JTS-JacORB-QA/jacorb/"/>
-				<set name="CALLS" value="1000"/>
-				<set name="PRODUCT.DIR" value="/home/jhalli/IdeaProjects/jboss/dtf/installation/JBossTS-JTS-JacORB-QA/"/>
-				<set name="ARJUNAJTS_HOME" value="/home/jhalli/IdeaProjects/jboss/dtf/installation/JBossTS-JTS-JacORB-QA/"/>
+				<set name="DTF_HOME"       value="/home/mmusgrov/misc/DTF"/>
+				<set name="PRODUCTS_HOME"  value="/services/DTF/products"/>
+				<set name="INSTALL.DIR"    value="/home/mmusgrov/misc/DTF/JBossTS-JTS-JacORB-QA/"/>
+				<set name="ORB_HOME"       value="/home/mmusgrov/misc/DTF/JBossTS-JTS-JacORB-QA/jacorb/"/>
+				<set name="CALLS"          value="1000"/>
+				<set name="PRODUCT.DIR"    value="/home/mmusgrov/misc/DTF/JBossTS-JTS-JacORB-QA/"/>
+				<set name="ARJUNAJTS_HOME" value="/home/mmusgrov/misc/DTF/JBossTS-JTS-JacORB-QA/"/>
 			</sets>
 			<jvm id="1.5.0"/>
 			<default-classpath name="main"/>
@@ -187,6 +188,14 @@
 			<param name="wait_for_text" value="Ready"/>
 			<param name="pass_indicator" value="Passed"/>
 		</task-runner>
+                <task-runner name="AntTaskRunner" class="com.arjuna.mwlabs.testframework.testnode.AntTaskRunner"
+                                         log-to="http://localhost:8080/dtf/">
+                        <param name="pass_on_wait_for" value="true"/>
+                        <param name="fail_indicator" value="Failed"/>
+                        <param name="wait_for_text" value="Ready"/>
+                        <param name="pass_indicator" value="Passed"/>
+                        <param name="product_dir" value="$(PRODUCT.DIR)"/>
+                </task-runner>
 	</task-runner-definitions>
 
 </product-configuration>

Modified: labs/jbosstm/trunk/qa/config/jbossts.jsp
===================================================================
--- labs/jbosstm/trunk/qa/config/jbossts.jsp	2008-08-04 09:28:49 UTC (rev 21335)
+++ labs/jbosstm/trunk/qa/config/jbossts.jsp	2008-08-04 10:31:05 UTC (rev 21336)
@@ -24,8 +24,8 @@
                                         "Raw Subtransaction Aware Resources Tests 01-3", "Raw Subtransaction Aware Resources Tests 02-1",
                                         "Raw Subtransaction Aware Resources Tests 02-2", "Raw Subtransaction Aware Resources Tests 02-3" };
 
-    String[] jts_crTestIds = new String[] { "72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "146" };
-    String[] jts_crTestNames = new String[] { "Crash Recovery Tests 01", "Crash Recovery Tests 02-1", "Crash Recovery Tests 02-2",
+    String[] jts_crTestIds = new String[] { "300", "72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "146" };
+    String[] jts_crTestNames = new String[] { "AS Crash Recovery Tests 01", "Crash Recovery Tests 01", "Crash Recovery Tests 02-1", "Crash Recovery Tests 02-2",
                                         "Crash Recovery Tests 03", "Crash Recovery Tests 04", "Crash Recovery Tests 05-1",
                                         "Crash Recovery Tests 05-2", "Crash Recovery Tests 06", "Crash Recovery Tests 07",
                                         "Crash Recovery Tests 08", "Crash Recovery Tests 12" };
@@ -49,8 +49,11 @@
                                         "JDBC Local Tests 01 - IBM DB2 JNDI", "JDBC Local Tests 01 - PostgreSQL JNDI",
                                         "JDBC Local Tests 01 - MySQL JNDI", "JDBC Local Tests 01 - Sybase JNDI" };
 
+    String[] jta_crashTestIds = new String[] { "300" };
+    String[] jta_crashTestNames = new String[] { "JTA Crash Tests" };
+
     // for single host setups you may want to add "Linux" to this list 
-    String[] OS = new String[] { "RHEL4-32", "RHEL4-64", "RHEL5-32", "RHEL5-64", "WIN2003-64", "SOL10-SPARC", "HPUX11-IA64", };
+    String[] OS = new String[] { "RHEL4-32", "RHEL4-64", "RHEL5-32", "RHEL5-64", "WIN2003-64", "SOL10-SPARC", "HPUX11-IA64", "Linux"};
 
     ArrayList allJTSTestIdsInRunOrder = new ArrayList();
     allJTSTestIdsInRunOrder.addAll(Arrays.asList(jts_basicTestIds));
@@ -62,9 +65,10 @@
     ArrayList allJTATestIdsInRunOrder = new ArrayList();
     allJTATestIdsInRunOrder.addAll(Arrays.asList(jta_basicTestIds));
     allJTATestIdsInRunOrder.addAll(Arrays.asList(jta_jdbcTestIds));
+    allJTATestIdsInRunOrder.addAll(Arrays.asList(jta_crashTestIds));
 
 
-    String distributionList = "jonathan.halliday at redhat.com";
+    String distributionList = "mmusgrov at redhat.com";
 
     int count = 0;
     for(int i = 0; i < allJTSTestIdsInRunOrder.size(); i++) {
@@ -177,6 +181,7 @@
 
     <tr>
         <td><b>DTF Tests for JBossTS JTS (JBossTS_JTS_JacORB_QA)</b></td>
+        <td><input type="submit" value="schedule selected tests"/></td>
     </tr>
 
     <tr>
@@ -278,6 +283,19 @@
 
     <tr><td></td></tr>
     <tr>
+        <td>Crash Tests</td>
+    </tr>
+    <% for(int i = 0; i < jta_crashTestIds.length; i++) { %>
+        <tr>
+            <td><%= jta_crashTestNames[i] %></td>
+            <% for(int j = 0; j < OS.length; j++) { %>
+            <td><input type="checkbox" name="runJTATest#<%= jta_crashTestIds[i] %>@<%= OS[j] %>"/></td>
+            <% } %>
+        </tr>
+    <% } %>
+
+    <tr><td></td></tr>
+    <tr>
         <td>JDBC Tests</td>
     </tr>
     <% for(int i = 0; i < jta_jdbcTestIds.length; i++) { %>
@@ -299,4 +317,4 @@
 </table>
 
 </body>
-</html>
\ No newline at end of file
+</html>

Added: labs/jbosstm/trunk/qa/ext/jboss-server-manager-0.1.0.GA.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbosstm/trunk/qa/ext/jboss-server-manager-0.1.0.GA.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbosstm/trunk/qa/testdefs/jbossts-qa-as-crashrecovery01-testdefs.xml
===================================================================
--- labs/jbosstm/trunk/qa/testdefs/jbossts-qa-as-crashrecovery01-testdefs.xml	                        (rev 0)
+++ labs/jbosstm/trunk/qa/testdefs/jbossts-qa-as-crashrecovery01-testdefs.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,63 @@
+<!--
+  JBoss, Home of Professional Open Source
+  Copyright 2007, Red Hat Middleware LLC, and individual contributors
+  as indicated by the @author tags.
+  See the copyright.txt in the distribution for a
+  full listing of individual contributors.
+  This copyrighted material is made available to anyone wishing to use,
+  modify, copy, or redistribute it subject to the terms and conditions
+  of the GNU Lesser General Public License, v. 2.1.
+  This program is distributed in the hope that it will be useful, but WITHOUT A
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+  PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+  You should have received a copy of the GNU Lesser General Public License,
+  v.2.1 along with this distribution; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+  MA  02110-1301, USA.
+
+  (C) 2008,
+  @author JBoss Inc.
+-->
+
+<test_set>
+    <default_timeout value="480"/>
+    <description>AS Crash Recovery Tests 01</description>
+
+    <test_group name="ASCrashRecovery01">
+
+        <task_declaration>
+            <task id="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test01" classname="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test01" runner="JavaTaskRunner"
+                  type="expect_pass_fail"/>
+            <task id="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test02" runner="AntTaskRunner" type="expect_pass_fail"/>
+            <task id="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03" runner="AntTaskRunner" type="expect_pass_fail"/>
+        </task_declaration>
+
+        <test_declaration id="ASCrashRecovery01_Test01" descriptive_name="Sanity Test" author="JBoss" >
+            <action_list>
+                <start_task id="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test01" runtime_id="outcome1"/>
+            </action_list>
+        </test_declaration>
+
+        <test_declaration id="ASCrashRecovery01_Test02" descriptive_name="Null Ant Test" author="JBoss" >
+            <action_list>
+                <start_task id="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test02" runtime_id="outcome2">
+                    <param>buildfile=qa/scripts/as-tests.xml</param>
+                    <param>targets=nulltest</param>
+                    <jvm_param>-Djava.security.policy=qa/resources/java.policy</jvm_param>
+                </start_task>
+            </action_list>
+        </test_declaration>
+
+        <test_declaration id="ASCrashRecovery01_Test03" descriptive_name="Test AS recovery" author="JBoss" >
+            <action_list>
+                <start_task id="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03" runtime_id="outcome3">
+                    <param>buildfile=qa/scripts/as-tests.xml</param>
+                    <param>targets=test4</param>
+                    <jvm_param>-Djava.security.policy=qa/resources/java.policy</jvm_param>
+                </start_task>
+            </action_list>
+        </test_declaration>
+    </test_group>
+
+</test_set>
+

Modified: labs/jbosstm/trunk/qa/tests/build-core.xml
===================================================================
--- labs/jbosstm/trunk/qa/tests/build-core.xml	2008-08-04 09:28:49 UTC (rev 21335)
+++ labs/jbosstm/trunk/qa/tests/build-core.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -24,9 +24,8 @@
 	<property name="org.jboss.jbossts.qa.ts.home" location="../../install/"/>
 
 	<!-- set this property to the location of a DTF TestingFramework build -->
-	<property name="org.jboss.jbossts.qa.testingframework_location" location="/home/jhalli/IdeaProjects/jboss/dtf/installation/lib/TestingFramework.jar"/>
+	<property name="org.jboss.jbossts.qa.testingframework_location" location="../../ext/TestingFramework.jar"/>
 
-
 	<property name="org.jboss.jbossts.qa.buildroot" location="build"/>
 	<property name="org.jboss.jbossts.qa.build.classes" value="${org.jboss.jbossts.qa.buildroot}/classes/"/>
 	<property name="org.jboss.jbossts.qa.core.src" location="src"/>

Modified: labs/jbosstm/trunk/qa/tests/build-jta.xml
===================================================================
--- labs/jbosstm/trunk/qa/tests/build-jta.xml	2008-08-04 09:28:49 UTC (rev 21335)
+++ labs/jbosstm/trunk/qa/tests/build-jta.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -23,8 +23,12 @@
 	<!-- set this property to the location of a JBossTS JTA build -->
 	<property name="org.jboss.jbossts.qa.ts.home" location="../../install/"/>
 
+	<!-- set properties for AS testing -->
+	<property environment="env"/>
+	<property name="jbossall-client.location" location="${env.JBOSS_HOME}/client/jbossall-client.jar"/>
+    
 	<!-- set this property to the location of a DTF TestingFramework build -->
-	<property name="org.jboss.jbossts.qa.testingframework_location" location="/home/jhalli/IdeaProjects/jboss/dtf/installation/lib/TestingFramework.jar"/>
+	<property name="org.jboss.jbossts.qa.testingframework_location" location="../../ext/TestingFramework.jar"/>
 
 	<!-- set this to the location(s) of the database drivers -->
 	<path id="database.drivers.path">
@@ -56,6 +60,8 @@
 			<include name="jbossts-common.jar"/>
 			<include name="jta-1_1-classes.zip"/>
 		</fileset>
+		<fileset file="${org.jboss.jbossts.qa.server_manager_location}" />
+		<fileset file="${jbossall-client.location}" />
 	</path>
 
 	<target name="org.jboss.jbossts.qa.init">
@@ -68,7 +74,6 @@
 	</target>
 
 	<target name="org.jboss.jbossts.qa.compile" depends="org.jboss.jbossts.qa.clean, org.jboss.jbossts.qa.init">
-
 		<javac srcdir="${org.jboss.jbossts.qa.src}"
 			   destdir="${org.jboss.jbossts.qa.build.classes}"
 			   debug="on"
@@ -81,6 +86,7 @@
 			<include name="**/ArjunaCore/**/*.java"/>
 			<include name="**/org/jboss/jbossts/qa/JDBCLocals*/*.java"/>
 			<include name="**/org/jboss/jbossts/qa/JTA01Tests/*.java"/>
+			<include name="**/org/jboss/jbossts/qa/astests/**/*.java"/>
 
 			<classpath>
 				<path refid="jta.classpath"/>
@@ -93,7 +99,26 @@
 
 	</target>
 
-	<target name="org.jboss.jbossts.qa.jar" depends="org.jboss.jbossts.qa.compile">
+   <property name="astest.dir" value="org/jboss/jbossts/qa/astests"/>
+
+   <target name="as-ejbjar">
+      <jar jarfile="${org.jboss.jbossts.qa.buildroot}/astest.jar">
+         <fileset dir="${org.jboss.jbossts.qa.build.classes}">
+            <include name="${astest.dir}/**/*.class"/>
+         </fileset>
+         <fileset dir="${org.jboss.jbossts.qa.src}/${astest.dir}">
+            <include name="META-INF/*.xml"/>
+         </fileset>
+         <fileset dir="${org.jboss.jbossts.qa.src}/${astest.dir}/resources">
+            <include name="java.policy"/>
+         </fileset>
+      </jar>
+      <copy todir="${org.jboss.jbossts.qa.buildroot}/qa/resources">
+        <fileset dir="${org.jboss.jbossts.qa.src}/${astest.dir}/resources"/>
+      </copy>
+   </target>
+
+	<target name="org.jboss.jbossts.qa.jar" depends="org.jboss.jbossts.qa.compile, as-ejbjar">
 		<jar jarfile="${org.jboss.jbossts.qa.buildroot}/jbossts-jta-qa.jar"
 			 basedir="${org.jboss.jbossts.qa.build.classes}"/>
 	</target>

Modified: labs/jbosstm/trunk/qa/tests/build-jts.xml
===================================================================
--- labs/jbosstm/trunk/qa/tests/build-jts.xml	2008-08-04 09:28:49 UTC (rev 21335)
+++ labs/jbosstm/trunk/qa/tests/build-jts.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -23,10 +23,16 @@
 	<!-- set this property to the location of a JBossTS JTS build -->
 	<property name="org.jboss.jbossts.qa.ts.home" location="../../install"/>
 
-	<!-- set this property to the location of a DTF TestingFramework build -->
-	<property name="org.jboss.jbossts.qa.testingframework_location" location="/home/jhalli/IdeaProjects/jboss/dtf/installation/lib/TestingFramework.jar"/>
+	<!-- set properties for AS testing -->
+	<property environment="env"/>
+	<property name="jboss.home" value="${env.JBOSS_HOME}"/>
+	<property name="jbossall-client.location" location="${jboss.home}/client/jbossall-client.jar"/>
+	<property name="astest.dir" value="org/jboss/jbossts/qa/astests"/>
+    
+    <!-- set this property to the location of a DTF TestingFramework build -->
+	<property name="org.jboss.jbossts.qa.testingframework_location" location="../../ext/TestingFramework.jar"/>
 
-	<!-- TODO cd ArjunaJTS/orbportability; ant -f build-anttasks.xml -->
+    <!-- TODO cd ArjunaJTS/orbportability; ant -f build-anttasks.xml -->
 	<property name="org.jboss.jbossts.qa.idlcompiler.lib"
 			  location="../../ArjunaJTS/orbportability/lib/ext"/>
 
@@ -70,7 +76,9 @@
 		<fileset dir="${org.jboss.jbossts.qa.idlcompiler.lib}">
 			<include name="orbportability-ant.jar"/>
 		</fileset>
-		<pathelement path="${org.jboss.jbossts.qa.orb.classpath}"/>
+		<fileset file="${org.jboss.jbossts.qa.server_manager_location}" />
+		<fileset file="${jbossall-client.location}" /> 
+        <pathelement path="${org.jboss.jbossts.qa.orb.classpath}"/>
 	</path>
 
 	<target name="org.jboss.jbossts.qa.init">
@@ -233,12 +241,13 @@
 	</target>
 
 	<target name="org.jboss.jbossts.qa.compile" depends="org.jboss.jbossts.qa.idl.compile">
-
 		<javac srcdir="${org.jboss.jbossts.qa.src}"
 			   destdir="${org.jboss.jbossts.qa.build.classes}"
-			   debug="on" deprecation="on"
-			   excludes="org/jboss/jbossts/qa/ArjunaCore/Common/ClassPathParserTest.java">
+			   debug="on" deprecation="on">
 
+			<exclude name="org/jboss/jbossts/qa/ArjunaCore/Common/ClassPathParserTest.java" />
+			<exclude name="**/${astest.dir}/**/*.java" />
+
 			<classpath>
 				<path refid="jts.classpath"/>
 				<path refid="database.drivers.path"/>
@@ -250,7 +259,51 @@
 
 	</target>
 
-	<target name="org.jboss.jbossts.qa.jar" depends="org.jboss.jbossts.qa.compile">
+	<path id="as.classpath">
+                <fileset dir="${org.jboss.jbossts.qa.ts.home}/lib/">
+                        <include name="jbossjts.jar"/>
+                </fileset>
+                <fileset dir="${org.jboss.jbossts.qa.ts.home}/lib/ext">
+                        <include name="jbossts-common.jar"/>
+                        <include name="jta-1_1-classes.zip"/>
+                </fileset>
+                <!-- include classes for AS tests -->
+                <fileset file="${org.jboss.jbossts.qa.server_manager_location}" />
+                <fileset dir="${jboss.home}/client">
+                        <include name="jbossall-client.jar"/>
+                        <include name="jboss-javaee.jar"/>
+                </fileset>
+	</path>
+
+    <target name="as-ejbjar.compile" >
+        <javac srcdir="${org.jboss.jbossts.qa.src}"
+               destdir="${org.jboss.jbossts.qa.build.classes}"
+               debug="on" deprecation="on">
+            <include name="**/${astest.dir}/**/*.java" />
+            <classpath>
+                <path refid="as.classpath"/>
+            </classpath>
+        </javac>
+    </target>
+
+   <target name="as-ejbjar" depends="as-ejbjar.compile" >
+      <jar jarfile="${org.jboss.jbossts.qa.buildroot}/astest.jar">
+         <fileset dir="${org.jboss.jbossts.qa.build.classes}">
+            <include name="${astest.dir}/**/*.class"/>
+         </fileset>
+         <fileset dir="${org.jboss.jbossts.qa.src}/${astest.dir}">
+            <include name="META-INF/*.xml"/>
+         </fileset>
+         <fileset dir="${org.jboss.jbossts.qa.src}/${astest.dir}/resources">
+            <include name="java.policy"/>
+         </fileset>
+      </jar>
+      <copy todir="${org.jboss.jbossts.qa.buildroot}/qa/resources">
+        <fileset dir="${org.jboss.jbossts.qa.src}/${astest.dir}/resources"/>
+      </copy>
+   </target>
+
+	<target name="org.jboss.jbossts.qa.jar" depends="org.jboss.jbossts.qa.compile, as-ejbjar">
 		<jar jarfile="${org.jboss.jbossts.qa.buildroot}/jbossts-jts-qa.jar"
 			 basedir="${org.jboss.jbossts.qa.build.classes}"/>
 	</target>

Added: labs/jbosstm/trunk/qa/tests/scripts/README.txt
===================================================================
--- labs/jbosstm/trunk/qa/tests/scripts/README.txt	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/scripts/README.txt	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,18 @@
+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.

Added: labs/jbosstm/trunk/qa/tests/scripts/as-tests.xml
===================================================================
--- labs/jbosstm/trunk/qa/tests/scripts/as-tests.xml	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/scripts/as-tests.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,165 @@
+<?xml version="1.0"?>
+
+<project name="JBoss" default="help" basedir="."
+         xmlns:astest="http://jboss.org/ns/test/ant/astest">
+
+  <property environment="env"/>
+  <property name="jboss.home" value="${env.JBOSS_HOME}"/>
+  <property name="jboss.server.config" value="default"/>
+  <property name="product.dir" value="${env.DTF_HOME}/JBossTS-JTA-QA/"/>
+
+  <path id="astest.taskdef.classpath">
+    <pathelement location="${jboss.home}/client/jbossall-client.jar"/>
+    <pathelement location="${jboss.home}/client/log4j.jar" />
+    <pathelement location="${jboss.home}/lib/jboss-aop-jdk50.jar"/>
+    <pathelement location="${jboss.home}/lib/trove.jar"/>
+
+    <fileset dir="${product.dir}">
+       <include name="lib/*.jar"/>
+       <include name="lib/ext/*.jar"/>
+       <include name="qa/lib/*.jar"/>
+    </fileset>
+  </path>
+
+  <property name="node0" value="localhost" />
+  <property name="node1" value="192.168.1.106" />
+
+  <target name="help">
+    <echo message="
+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:${line.separator}
+   export ANT_OPTS=&quot;-Djava.security.policy=../src/org/jboss/jbossts/qa/astests/resources/java.policy -Dproduct.dir=../../build/&quot;
+${line.separator}
+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.
+"/>
+    <echo message="test4 - 2 xa resources, throw exceptions in commit"/>
+    <echo message="test5 - 2 xa resources, suspend one in prepare"/>
+    <echo message="test6 - 2 xa resources, halt the VM on commit"/>
+    <echo message="testjta - run lots of tests in parallel against a running server (using jta) "/>
+    <echo message="testjts - run lots of tests in parallel against a running server (using jts) "/>
+  </target>
+
+  <!--
+      import configuration settings for the tests
+    -->
+  <import file="imports/test-config.xml"/>
+
+  <target name="test4">
+    <!--
+        start a server identified by the name default (specified in the imported config file)
+        and deploy one artifact
+      -->
+    <astest:server method="start" serverName="default" >
+      <deploy from="qa/lib/astest.jar" to="deploy/astest.jar" />
+    </astest:server>
+    <!--
+        wait 10000 ms and then execute an action (TODO implement a method of detecting when the
+        desired artifacts have deployed)
+      -->
+    <astest:action waitFor="10000" impl="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03">
+      <param key="name" value="test04" />
+      <param key="specs" value="commit_ex,commit_ex" />
+      <param key="serverName" value="default" />
+    </astest:action>
+    <!--
+        stop a server and undeploy an artifact
+      -->
+    <astest:server method="stop" serverName="default" >
+      <undeploy from="deploy/astest.jar" />
+    </astest:server>
+  </target>
+
+  <target name="test5">
+    <astest:server method="start" serverName="default" >
+      <deploy from="qa/lib/astest.jar" to="deploy/astest.jar" />
+    </astest:server>
+    <astest:action waitFor="10000" impl="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03">
+      <param key="name" value="test05" />
+      <param key="specs" value="prepare_suspend,none" />
+      <param key="cmt" value="false" />
+      <param key="debug" value="false" />
+      <param key="serverName" value="default" />
+    </astest:action>
+    <astest:server method="stop" serverName="default" >
+      <undeploy from="deploy/astest.jar" />
+    </astest:server>
+  </target>
+
+  <target name="test6">
+    <astest:server method="start" serverName="default" >
+      <deploy from="qa/lib/astest.jar" to="deploy/astest.jar" />
+    </astest:server>
+    <astest:action waitFor="10000" impl="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03">
+      <param key="name" value="test06" />
+      <param key="specs" value="none,commit_halt" />
+      <param key="cmt" value="true" />
+      <param key="debug" value="false" />
+      <param key="serverName" value="default" />
+      <param key="storeType" value="StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction" />
+    </astest:action>
+    <astest:server method="stop" serverName="default" >
+      <undeploy from="deploy/astest.jar" />
+    </astest:server>
+  </target>
+
+  <target name="nulltest">
+    <astest:action impl="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test01" />
+  </target>
+
+  <!--
+      A test that does not start a server - ie the server must already be running.
+      A waitFor property is used on the deploy action to give enough time
+      for the server to deploy the artifacts.
+    -->
+  <target name="testjta">
+    <astest:server method="deploy" serverName="jta" waitFor="10000">
+      <deploy from="qa/lib/astest.jar" to="deploy/astest.jar" />
+    </astest:server>
+    <parallel>
+      <astest:action abortOnFail="false" impl="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03">
+        <param key="specs" value="sync_before,sync_after,none,pre_prepare_suspend" />
+      </astest:action>
+      <astest:action abortOnFail="false" impl="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03">
+        <param key="name" value="testjta" />
+        <param key="specs" value="none,none,none,commit_ex,commit_ex" />
+        <param key="serverName" value="jta" />
+      </astest:action>
+      <astest:action abortOnFail="false" impl="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03">
+        <param key="specs" value="sync_before,sync_after,none,pre_prepare_suspend" />
+      </astest:action>
+    </parallel>
+    <astest:server method="undeploy" serverName="jta" >
+      <undeploy from="deploy/astest.jar" />
+    </astest:server>
+  </target>
+
+  <target name="testjts">
+    <astest:server method="deploy" serverName="jts" waitFor="10000">
+      <deploy from="qa/lib/astest.jar" to="deploy/astest.jar" />
+    </astest:server>
+    <parallel>
+      <astest:action abortOnFail="false" impl="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03">
+        <param key="name" value="testjts" />
+        <param key="specs" value="none,none,none,commit_ex,commit_ex" />
+        <param key="serverName" value="jts" />
+      </astest:action>
+      <astest:action abortOnFail="false" impl="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03">
+        <param key="specs" value="sync_before,sync_after,none,pre_prepare_suspend" />
+        <param key="serverName" value="jts" />
+      </astest:action>
+      <astest:action abortOnFail="false" impl="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03">
+        <param key="specs" value="sync_before,sync_after,none,pre_prepare_suspend" />
+      </astest:action>
+      <astest:action abortOnFail="false" impl="org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03">
+        <param key="specs" value="sync_before,sync_after,none,pre_prepare_suspend" />
+      </astest:action>
+    </parallel>
+    <astest:server method="undeploy" serverName="jts" >
+      <undeploy from="deploy/astest.jar" />
+    </astest:server>
+  </target>
+
+</project>

Added: labs/jbosstm/trunk/qa/tests/scripts/imports/test-config.xml
===================================================================
--- labs/jbosstm/trunk/qa/tests/scripts/imports/test-config.xml	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/scripts/imports/test-config.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,88 @@
+<project name="server-config" default="help"
+         xmlns:astest="http://jboss.org/ns/test/ant/astest">
+
+  <taskdef name="config" classname="org.jboss.jbossts.qa.astests.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.jbossts.qa.astests.taskdefs.ServerTask"
+           uri="http://jboss.org/ns/test/ant/astest" loaderref="astest.loader">
+  </taskdef>
+
+  <!--
+    - 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.jbossts.qa.astests.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.jbossts.qa.astests.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,
+    - otherwise use the value of the JBOSS_HOME environment variable
+    -->
+  <!--
+    - The framework detects whether a server is running via the httpPort if the server has a web server,
+    - otherwise it uses the servers rmi port.
+    - To specify the http port use the httpPort attribute in the server definition.
+    - To specify the rmi port in the server definition use the rmiPort attribute together with hasWebServer="false"
+    - 
+    - The port numbers must match the ports used by the actual server. Note that the default port bindings for a
+    - server can be changed via the server.binding.name and server.binding.location properties.
+    -->
+  <astest:config javaHome="${env.JAVA_HOME}" debug="false">
+     <spec name= "commit_ex" mode="XAEXCEPTION" type="XARES_COMMIT" modeArg="XA_RDONLY" />
+     <spec name= "prepare_suspend" mode="SUSPEND" type="XARES_PREPARE" modeArg="40000" />
+     <spec name= "pre_prepare_suspend" mode="SUSPEND" type="PRE_PREPARE" modeArg="40000" />
+     <spec name= "sync_before" mode="NONE" type="SYNCH_BEFORE" modeArg="0" />
+     <spec name= "sync_after" mode="NONE" type="SYNCH_AFTER" modeArg="0" />
+     <spec name= "prepare_ex" mode="XAEXCEPTION" type="XARES_PREPARE" modeArg="XA_RDONLY" />
+     <spec name= "prepare_halt" mode="HALT" type="XARES_PREPARE" />
+     <spec name= "commit_suspend" mode="SUSPEND" type="XARES_COMMIT" modeArg="40000" />
+     <spec name= "commit_halt" mode="HALT" type="XARES_COMMIT" />
+     <spec name= "none" mode="NONE" type="NONE" />
+
+     <server name="jta" host="${node0}" >
+       <jvmarg value="-Xmx512M" />
+       <jvmarg value="-Xdebug" />
+       <jvmarg value="-Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006"/>
+     </server>
+
+     <server name="jts" host="${node0}" />
+
+     <server name="default" host="${node0}">
+       <jvmarg value="-Xms128m" />
+       <jvmarg value="-Xmx512m" />
+       <jvmarg value="-XX:MaxPermSize=512m" />
+       <jvmarg value="-server" />
+<!--
+       <jvmarg value="-Xdebug" />
+       <jvmarg value="-Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006"/>
+-->
+       <sysproperty key="java.net.preferIPv4Stack" value="true" />
+       <sysproperty key="org.jboss.resolver.warning" value="true" />
+       <sysproperty key="sun.rmi.dgc.client.gcInterval" value="3600000" />
+       <sysproperty key="sun.rmi.dgc.server.gcInterval" value="3600000" />
+       <sysproperty key="server.binding.name" value="ports-02" />
+       <sysproperty key="server.binding.location" value="qa/resources/sample-bindings.xml" />
+     </server>
+  </astest:config>
+</project>

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/Test01.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/Test01.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/Test01.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,25 @@
+package org.jboss.jbossts.qa.astests.ASCrashRecovery01;
+
+import org.jboss.jbossts.qa.astests.taskdefs.ClientAction;
+import org.jboss.jbossts.qa.astests.taskdefs.ASTestConfig;
+
+import java.util.Map;
+
+public class Test01 implements ClientAction
+{
+    public static void main(String args[])
+	{
+        System.out.println("Passed");
+    }
+
+    public boolean execute(ASTestConfig config, Map<String, String> params)
+    {
+        return true;
+    }
+
+    public boolean cancel() throws UnsupportedOperationException
+    {
+        throw new UnsupportedOperationException("TODO");
+    }
+}
+

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/Test02.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/Test02.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/Test02.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,21 @@
+package org.jboss.jbossts.qa.astests.ASCrashRecovery01;
+
+import org.jboss.jbossts.qa.astests.taskdefs.ClientAction;
+import org.jboss.jbossts.qa.astests.taskdefs.ASTestConfig;
+
+
+import java.util.Map;
+
+public class Test02 implements ClientAction
+{
+
+    public boolean execute(ASTestConfig config, Map<String, String> params)
+    {
+        return true;
+    }
+
+    public boolean cancel() throws UnsupportedOperationException
+    {
+        return true;
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/Test03.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/Test03.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/ASCrashRecovery01/Test03.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,311 @@
+package org.jboss.jbossts.qa.astests.ASCrashRecovery01;
+
+import org.jboss.jbossts.qa.astests.taskdefs.ClientAction;
+import org.jboss.jbossts.qa.astests.recovery.ASFailureSpec;
+import org.jboss.jbossts.qa.astests.taskdefs.ASTestConfig;
+import org.jboss.jbossts.qa.astests.taskdefs.TransactionLog;
+import org.jboss.jbossts.qa.astests.crash.CrashRem;
+import org.jboss.jbossts.qa.astests.crash.CrashRemHome;
+import org.jboss.remoting.CannotConnectException;
+import org.apache.tools.ant.BuildException;
+
+import java.util.Map;
+import java.io.*;
+
+import javax.rmi.PortableRemoteObject;
+import javax.transaction.*;
+import javax.naming.NamingException;
+
+public class Test03 implements ClientAction
+{
+    // the longest time to wait in millis before declaring a test a failed (overridable)
+    private static final int MAX_TEST_TIME = 180000;
+
+    private ASTestConfig config;
+    private boolean isCMT = false;
+    private boolean clientTx = false;
+    private boolean isDebug = false;
+    private boolean expectFailure = false;
+    private int maxTestTime = MAX_TEST_TIME;
+
+    private String storeDir = null;
+    private String storeImple = "HashedActionStore";
+    private String storeType = null; //"StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction";
+    private TransactionLog store;
+    private int existingUids;
+
+    private String name = "Test";
+    private String serverName = "default";
+
+    public boolean execute(ASTestConfig config, Map<String, String> params)
+    {
+        StringBuilder sb = new StringBuilder();
+        ASFailureSpec[] fspecs = null;
+
+        this.config = config;
+
+        for (Map.Entry<String, String> me : params.entrySet())
+        {
+            String key = me.getKey().trim();
+            String val = me.getValue().trim();
+
+            if ("name".equals(key))
+                name = val;
+            else if ("cmt".equals(key))
+                isCMT = val.equalsIgnoreCase("true");
+            else if ("debug".equals(key))
+                isDebug = val.equalsIgnoreCase("true");
+            else if ("serverName".equals(key))
+                serverName = val;
+            else if ("storeType".equals(key))
+                storeType = val;
+            else if ("storeDir".equals(key))
+                storeDir = val;
+            else if ("clientTx".equals(key))
+                clientTx = val.equalsIgnoreCase("true");
+            else if ("storeImple".equals(key))
+                storeImple = val;
+            else if ("testTime".equals(key))
+                maxTestTime = parseInt(val, "parameter testTime should represent a number of seconds: ");
+            else if ("specs".equals(key))
+                fspecs = parseSpecs(val, sb);
+            else if ("wait".equals(key))
+                suspendFor(Integer.parseInt(val));
+        }
+
+        sb.insert(0, ":\n").insert(0, name).insert(0, "Executing test ");
+
+        System.out.println(sb);
+
+        ClassLoader loader1 = Thread.currentThread().getContextClassLoader();
+        ClassLoader loader2 = this.getClass().getClassLoader();
+
+        try
+        {
+            String serverPath = config.getServerPath(serverName);
+
+            // 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);
+
+            // get a handle to the transaction logs
+            if (storeDir == null)
+                storeDir = serverPath + "data/tx-object-store";
+            else
+                storeDir = serverPath + storeDir;
+
+            store = new TransactionLog(storeDir, storeImple);
+
+            if (expectFailure)
+            {
+                // this test may halt the VM so make sure the transaction log is empty
+                // before starting the test - then the pass/fail check is simply to
+                // test whether or not the log is empty (see recoverUids() below).
+                try
+                {
+                    store.clearXids(storeType);
+                }
+                catch (Exception ignore)
+                {
+                }
+
+                existingUids = getPendingUids();
+            }
+
+            // run the crash test
+            return crashTest(fspecs);
+        }
+        catch (Exception e)
+        {
+            if (isDebug)
+                e.printStackTrace();
+
+            throw new BuildException(e);
+        }
+        finally
+        {
+            Thread.currentThread().setContextClassLoader(loader1);
+        }
+    }
+
+    public boolean cancel() throws UnsupportedOperationException
+    {
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    private ASFailureSpec[] parseSpecs(String specArg, StringBuilder sb)
+    {
+        ASFailureSpec[] fspecs = config.parseSpecs(specArg);
+
+        for (ASFailureSpec spec : fspecs)
+        {
+            String name = (spec == null ? "INVALID" : spec.getName());
+
+            if (spec != null && spec.willTerminateVM())
+                expectFailure = true;
+
+            sb.append("\t").append(name).append('\n');
+        }
+
+        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()
+    {
+        try
+        {
+            return store.getIds(storeType).size();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+
+            return -1;
+        }
+    }
+
+    private CrashRem lookup(String name) throws Exception
+    {
+        Object o = config.getNamingContext(serverName).lookup(name);
+        CrashRemHome home = (CrashRemHome) PortableRemoteObject.narrow(o, CrashRemHome.class);
+
+        return home.create();
+    }
+
+    private UserTransaction startTx() throws NamingException, SystemException, NotSupportedException
+    {
+        UserTransaction tx = (UserTransaction) config.getNamingContext(serverName).lookup("UserTransaction");
+
+        tx.begin();
+
+        return tx;
+    }
+
+    private boolean crashTest(ASFailureSpec[] sa) throws Exception
+    {
+        UserTransaction tx = null;
+
+        try
+        {
+            CrashRem cr = lookup(isCMT ? CrashRem.CMT_JNDI_NAME : CrashRem.BMT_JNDI_NAME);
+
+            if (clientTx)
+                tx = startTx();
+
+            String res = cr.testXA(sa);
+
+            return "Passed".equalsIgnoreCase(res);
+        }
+        catch (CannotConnectException e)
+        {
+            if (expectFailure)
+            {
+                print("Failure was expected: " + e.getMessage());
+
+                return recoverUids();
+            }
+            else
+            {
+                System.err.println("XACrashTest:crashTest: Caught " + e);
+
+                e.printStackTrace();
+            }
+        }
+        catch (Throwable t)
+        {
+            t.printStackTrace();
+            System.err.println("XACrashTest:crashTest: Caught " + t);
+        }
+        finally {
+            if (clientTx)
+                try
+                {
+                    tx.commit();
+                }
+                catch (Throwable e)
+                {
+                    System.out.println("User tx commit failure: " + e.getMessage());
+                }
+        }
+
+        return false;
+    }
+
+    /**
+     * Wait for any pending transactions to recover by restaring the AS.
+     * @return true if all pending branches have been recovered
+     * @throws IOException if the server cannot be started
+     */
+    private boolean recoverUids() throws IOException
+    {
+        int retryPeriod = 30000;
+        int maxWait = maxTestTime;
+        int pendingUids;
+
+        do
+        {
+            pendingUids = getPendingUids();
+
+            if (pendingUids == -1)
+                return false;   // object store error
+
+            if (pendingUids <= existingUids)
+                return true;    // all uids recovered
+
+            pendingUids -= existingUids;
+
+            print("waiting for " + pendingUids + " branches");
+
+            // wait for the server to start up the first time through
+            if (maxWait == maxTestTime)
+                config.startServer(serverName);
+
+            suspendFor(retryPeriod);
+            maxWait -= retryPeriod;
+        } while (maxWait > 0);
+
+        // the test failed to recover some uids - clear them out ready for the next test
+        try
+        {
+            store.clearXids(storeType);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+
+        return false;
+    }
+
+    private void suspendFor(int millis)
+    {
+        try
+        {
+            Thread.sleep(millis);
+        }
+        catch (InterruptedException e)
+        {
+            System.out.println("Test " + name + " interupted");
+        }
+    }
+
+    static void print(String msg)
+    {
+        System.out.println(msg);
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/ejb-jar.xml
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/ejb-jar.xml	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/ejb-jar.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
+<ejb-jar>
+  <enterprise-beans>
+      <session>
+          <description>Crash Testing BMT (Remote)</description>
+          <ejb-name>CrashBMTRemEJB</ejb-name>
+          <home>org.jboss.jbossts.qa.astests.crash.CrashRemHome</home>
+          <remote>org.jboss.jbossts.qa.astests.crash.CrashRem</remote>
+          <local-home>org.jboss.jbossts.qa.astests.crash.CrashLocalHome</local-home>
+          <local>org.jboss.jbossts.qa.astests.crash.CrashLocal</local>
+          <ejb-class>org.jboss.jbossts.qa.astests.crash.CrashBMTBean</ejb-class>
+          <session-type>Stateless</session-type>
+          <transaction-type>Bean</transaction-type>
+      </session>
+      
+      <session>
+          <description>Crash Testing CMT (Remote)</description>
+          <ejb-name>CrashCMTRemEJB</ejb-name>
+          <home>org.jboss.jbossts.qa.astests.crash.CrashRemHome</home>
+          <remote>org.jboss.jbossts.qa.astests.crash.CrashRem</remote>
+          <local-home>org.jboss.jbossts.qa.astests.crash.CrashLocalHome</local-home>
+          <local>org.jboss.jbossts.qa.astests.crash.CrashLocal</local>
+          <ejb-class>org.jboss.jbossts.qa.astests.crash.CrashCMTBean</ejb-class>
+          <session-type>Stateless</session-type>
+          <transaction-type>Container</transaction-type>
+      </session>
+<!--
+      <message-driven>
+          <ejb-name>TextMdb</ejb-name>
+          <ejb-class>org.jboss.jbossts.qa.astests.crash.TextMdb</ejb-class>
+          <transaction-type>Bean</transaction-type>
+          <message-driven-destination>
+              <destination-type>javax.jms.Queue</destination-type>
+          </message-driven-destination>
+
+        <security-identity>
+            <run-as>
+                <role-name>guest</role-name>
+            </run-as>
+        </security-identity>
+      </message-driven>
+-->
+  </enterprise-beans>
+
+  <assembly-descriptor>
+      <container-transaction>
+          <method>
+              <ejb-name>CrashCMTRemEJB</ejb-name>
+              <method-name>testXA</method-name>
+          </method>
+          <trans-attribute>RequiresNew</trans-attribute>
+      </container-transaction>
+    </assembly-descriptor>
+</ejb-jar>

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/jboss-beans.xml
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/jboss-beans.xml	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/jboss-beans.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+<!--
+  <bean name="ASTestEJB" class="org.jboss.jbossts.qa.astests.crash.CrashBMTBean" >
+    <depends>jboss.mq:service=DestinationManager</depends>
+    <depends>jboss.mq:service=SecurityManager</depends>
+  </bean>
+-->
+
+</deployment>

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/jboss.xml
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/jboss.xml	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/META-INF/jboss.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<jboss>
+   <enterprise-beans>
+      <session>
+         <ejb-name>CrashBMTRemEJB</ejb-name>
+         <jndi-name>org.jboss.jbossts.qa.astests.crash.CrashBMTRem</jndi-name>
+      </session>
+       
+      <session>
+         <ejb-name>CrashCMTRemEJB</ejb-name>
+         <jndi-name>org.jboss.jbossts.qa.astests.crash.CrashCMTRem</jndi-name>
+      </session>
+
+<!--
+      <message-driven>
+         <ejb-name>TextMdb</ejb-name>
+         <destination-jndi-name>queue/sndQ</destination-jndi-name>
+      </message-driven>
+-->
+
+   </enterprise-beans>
+</jboss>

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashBMTBean.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashBMTBean.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashBMTBean.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,86 @@
+package org.jboss.jbossts.qa.astests.crash;
+
+import org.jboss.jbossts.qa.astests.recovery.ASFailureSpec;
+import org.jboss.jbossts.qa.astests.recovery.TestASRecovery;
+
+import javax.ejb.SessionContext;
+import javax.ejb.SessionBean;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+
+public class CrashBMTBean implements SessionBean {
+    private SessionContext context;
+
+    public void setSessionContext(SessionContext context) { this.context = context; }
+    public void ejbCreate() { }
+    public void ejbActivate() { }
+    public void ejbPassivate() { }
+    public void ejbRemove() { }
+
+    public CrashBMTBean()
+    {
+    }
+
+    public String testXA(String ... args)
+    {
+         return "Passed";
+    }
+
+    public String testXA(ASFailureSpec... specs)
+    {
+        TestASRecovery xatest = new TestASRecovery();
+        String txStatus = getStatus(context.getUserTransaction());
+
+        if (txStatus != null)
+            System.out.println("BMT method called with tx status: " + txStatus);
+        
+        System.out.println("BMT testXA called with " + specs.length + " specs");
+
+        for (ASFailureSpec spec : specs)
+            xatest.addResource(spec);
+
+        return xatest.startTest() ? "Passed" : "Failed";
+    }
+
+    public String getStatus(UserTransaction tx)
+    {
+        if (tx == null)
+            return null;
+
+        try
+        {
+            return org.jboss.tm.TxUtils.getStatusAsString(tx.getStatus());
+/*
+            switch (tx.getStatus())
+            {
+                case Status.STATUS_ACTIVE:
+                    return "A transaction is associated with the target object and it is in the active state.";
+                case Status.STATUS_COMMITTED:
+                    return "A transaction is associated with the target object and it has been committed.";
+                case Status.STATUS_COMMITTING:
+                    return "A transaction is associated with the target object and it is in the process of committing.";
+                case Status.STATUS_MARKED_ROLLBACK:
+                    return "A transaction is associated with the target object and it has been marked for rollback, perhaps as a result of a setRollbackOnly operation.";
+                case Status.STATUS_NO_TRANSACTION:
+                    return "No transaction is currently associated with the target object.";
+                case Status.STATUS_PREPARED:
+                    return "A transaction is associated with the target object and it has been prepared.";
+                case Status.STATUS_PREPARING:
+                    return "A transaction is associated with the target object and it is in the process of preparing.";
+                case Status.STATUS_ROLLEDBACK:
+                    return "A transaction is associated with the target object and the outcome has been determined to be rollback.";
+                case Status.STATUS_ROLLING_BACK:
+                    return "A transaction is associated with the target object and it is in the process of rolling back.";
+                case Status.STATUS_UNKNOWN:
+                    return "A transaction is associated with the target object but its current status cannot be determined.";
+                default:
+                    return "Unknown tx status code: " + tx.getStatus();
+            }
+*/
+        }
+        catch (SystemException e)
+        {
+            return "tx status error: " + e.getMessage();
+        }
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashCMTBean.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashCMTBean.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashCMTBean.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,56 @@
+package org.jboss.jbossts.qa.astests.crash;
+
+import org.jboss.jbossts.qa.astests.recovery.ASFailureSpec;
+import org.jboss.jbossts.qa.astests.recovery.TestASRecovery;
+
+import javax.ejb.SessionContext;
+import javax.ejb.SessionBean;
+import javax.transaction.Transaction;
+
+public class CrashCMTBean implements SessionBean {
+    private SessionContext context;
+
+    public void setSessionContext(SessionContext context) { this.context = context; }
+    public void ejbCreate() { }
+    public void ejbActivate() { }
+    public void ejbPassivate() { }
+    public void ejbRemove() { }
+
+    public String testXA(String ... args)
+    {
+        return "Passed";
+    }
+
+    public String testXA(ASFailureSpec... specs)
+    {
+        System.out.println("CMT testXA called with " + specs.length + " specs");
+
+        TestASRecovery xatest = new TestASRecovery();
+        Transaction tx;
+
+        try
+        {
+            tx = com.arjuna.ats.jta.TransactionManager.transactionManager().getTransaction();
+        }
+        catch (javax.transaction.SystemException e)
+        {
+            tx = null;
+        }
+
+        if (tx == null)
+        {
+            System.out.println("CMT testXA called without a transaction");
+
+            return "Failed";
+        }
+        else
+        {
+            for (ASFailureSpec spec : specs)
+                xatest.addResource(spec);
+
+            xatest.startTest(tx);
+
+            return "Passed";
+        }
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashLocal.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashLocal.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashLocal.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,8 @@
+package org.jboss.jbossts.qa.astests.crash;
+
+import org.jboss.jbossts.qa.astests.recovery.ASFailureSpec;
+
+public interface CrashLocal extends javax.ejb.EJBLocalObject {
+    String testXA(String ... args);
+    String testXA(ASFailureSpec... specs);
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashLocalHome.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashLocalHome.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashLocalHome.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,8 @@
+package org.jboss.jbossts.qa.astests.crash;
+
+import javax.ejb.EJBLocalHome;
+import javax.ejb.CreateException;
+
+public interface CrashLocalHome extends EJBLocalHome {
+    CrashLocal create() throws CreateException;
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashRem.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashRem.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashRem.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,15 @@
+package org.jboss.jbossts.qa.astests.crash;
+
+import org.jboss.jbossts.qa.astests.recovery.ASFailureSpec;
+
+import javax.ejb.EJBObject;
+import java.rmi.RemoteException;
+
+public interface CrashRem extends EJBObject {
+    // JNDI names of the fault injection beans
+    String BMT_JNDI_NAME = "org.jboss.jbossts.qa.astests.crash.CrashBMTRem";
+    String CMT_JNDI_NAME = "org.jboss.jbossts.qa.astests.crash.CrashCMTRem";
+
+    String testXA(String ... args) throws RemoteException;
+    String testXA(ASFailureSpec... specs) throws RemoteException;
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashRemHome.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashRemHome.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/crash/CrashRemHome.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,9 @@
+package org.jboss.jbossts.qa.astests.crash;
+
+import javax.ejb.EJBHome;
+import javax.ejb.CreateException;
+import java.rmi.RemoteException;
+
+public interface CrashRemHome extends EJBHome {
+    CrashRem create() throws CreateException, RemoteException;
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASFailureMode.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASFailureMode.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASFailureMode.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,34 @@
+package org.jboss.jbossts.qa.astests.recovery;
+
+import java.io.Serializable;
+
+/**
+ * Specification of what to do when a failure is injected
+ */
+public enum ASFailureMode implements Serializable
+{
+    NONE(false)
+    
+    ,HALT(true)    // halt the JVM
+    ,EXIT(true)   // exit the JVM
+    ,SUSPEND(false)  // suspend the calling thread
+    ,XAEXCEPTION(false)    // fail via one of the xa exception codes
+    ;
+
+    private boolean willTerminateVM;
+
+    ASFailureMode(boolean willTerminateVM)
+    {
+        this.willTerminateVM = willTerminateVM;
+    }
+
+    public boolean willTerminateVM()
+    {
+        return willTerminateVM;
+    }
+
+    public static ASFailureMode toEnum(String mode)
+    {
+        return ASFailureMode.valueOf(mode.toUpperCase());
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASFailureSpec.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASFailureSpec.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASFailureSpec.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,120 @@
+package org.jboss.jbossts.qa.astests.recovery;
+
+import java.io.Serializable;
+
+/**
+ * An ASFailureSpec is for defining different ways of generating
+ * failures and essentially consists of a mode and type.
+ *
+ * If you need to generate new kinds of failure you should
+ * modify the ASFailureMode and ASFailureType classes. Your
+ * test will be given a reference to these specifications and is
+ * responsible for interpreting their meaning.
+ *
+ * @see org.jboss.jbossts.qa.astests.ASCrashRecovery01.Test03 for an example
+ * @see org.jboss.jbossts.qa.astests.recovery.ASFailureMode
+ * @see org.jboss.jbossts.qa.astests.recovery.ASFailureType
+ *
+ * A failure specification is defined in ASTestConfig
+ * @see org.jboss.jbossts.qa.astests.taskdefs.ASTestConfig
+ */
+public class ASFailureSpec implements Serializable
+{
+    String name;
+    ASFailureMode mode;
+    ASFailureType type;
+    String modeArg;
+    int recoveryArg;
+
+    public ASFailureSpec()
+    {
+        mode = ASFailureMode.NONE;
+        type = ASFailureType.NONE;
+    }
+
+    public ASFailureSpec(String name, ASFailureMode mode, ASFailureType type, String modeArg, int recoveryArg)
+    {
+        this.name = name;
+        this.mode = mode;
+        this.type = type;
+        this.modeArg = modeArg;
+        this.recoveryArg = recoveryArg;
+    }
+
+    public boolean willTerminateVM()
+    {
+        return mode.willTerminateVM();
+    }
+
+    public ASFailureMode getMode()
+    {
+        return mode;
+    }
+
+    public ASFailureType getType()
+    {
+        return type;
+    }
+
+    public String getModeArg()
+    {
+        return modeArg;
+    }
+
+    public int getRecoveryArg()
+    {
+        return recoveryArg;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    public void setMode(String mode)
+    {
+        this.mode = ASFailureMode.valueOf(mode);
+    }
+
+    public void setType(String type)
+    {
+        this.type = ASFailureType.valueOf(type);
+    }
+
+    public void setModeArg(String modeArg)
+    {
+        this.modeArg = modeArg;
+    }
+
+    public void setRecoveryArg(int recoveryArg)
+    {
+        this.recoveryArg = recoveryArg;
+    }
+
+    public String toString()
+    {
+        return new StringBuilder().append(mode).append(',').append(type).append(',').append(modeArg).toString();
+    }
+
+    public boolean equals(Object o)
+    {
+        if (this == o) return true;
+        if (!(o instanceof ASFailureSpec)) return false;
+
+        ASFailureSpec that = (ASFailureSpec) o;
+
+        if (name != null ? !name.equals(that.name) : that.name != null) return false;
+
+        return true;
+    }
+
+    public int hashCode()
+    {
+        return (name != null ? name.hashCode() : 0);
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASFailureType.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASFailureType.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASFailureType.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,45 @@
+package org.jboss.jbossts.qa.astests.recovery;
+
+import java.io.Serializable;
+
+/**
+ * Specification of when to inject a failure
+ */
+public enum ASFailureType implements Serializable
+{
+    NONE
+
+    ,PRE_PREPARE // do something before prepare is called
+
+    ,XARES_START    // failures specific to the XA protocol
+    ,XARES_END
+    ,XARES_PREPARE
+    ,XARES_ROLLBACK
+    ,XARES_COMMIT
+    ,XARES_RECOVER
+    ,XARES_FORGET
+
+    ,SYNCH_BEFORE   // do something before completion
+    ,SYNCH_AFTER
+    ;
+    
+    public static ASFailureType toEnum(String type)
+    {
+        return ASFailureType.valueOf(type.toUpperCase());
+    }
+
+    public boolean isXA()
+    {
+        return name().startsWith("XARES");
+    }
+
+    public boolean isSynchronization()
+    {
+        return name().startsWith("SYNCH");
+    }
+
+    public boolean isPreCommit()
+    {
+        return equals(PRE_PREPARE);
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASTestResource.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASTestResource.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/ASTestResource.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,307 @@
+package org.jboss.jbossts.qa.astests.recovery;
+
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+import javax.transaction.xa.XAException;
+import javax.transaction.Synchronization;
+import java.io.Serializable;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Simulate a variety of faults during the various phases of the XA protocol
+ */
+public class ASTestResource implements Synchronization, XAResource, Serializable
+{
+    private static final Map<String, XAException> xaCodeMap = new HashMap<String, XAException>();
+
+    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
+
+    static
+    {
+        init();
+    }
+    
+    public ASTestResource()
+    {
+    }
+
+    public ASTestResource(ASFailureSpec spec)
+    {
+        this();
+
+        if (spec == null)
+            throw new IllegalArgumentException("Invalid XA resource failure injection specification");
+        
+        setFailureMode(spec.getMode(), spec.getModeArg());
+        setFailureType(spec.getType());
+        setRecoveryAttempts(spec.getRecoveryArg());
+    }
+
+    public void applySpec(String message) throws XAException
+    {
+        applySpec(message, _isPrepared);
+    }
+
+    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
+        }
+
+        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");
+        }
+    }
+
+    public String toString()
+    {
+        return _xaFailureType + ", " + _xaFailureMode + ", " + (_args != null && _args.length != 0 ? _args[0] : "");
+    }
+
+    private void suspend(int msecs)
+    {
+        try
+        {
+            Thread.sleep(msecs);
+        }
+        catch (InterruptedException e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    public void setFailureMode(ASFailureMode mode, String ... args) throws IllegalArgumentException
+    {
+        _xaFailureMode = mode;
+        _args = args;
+
+        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]);
+
+                if (_xaException == null)
+                    _xaException = new XAException(XAException.XAER_RMFAIL);
+            }
+        }
+    }
+
+    public void setFailureType(ASFailureType type)
+    {
+        _xaFailureType = type;
+    }
+
+    public ASFailureType getFailureType()
+    {
+        return _xaFailureType;
+    }
+
+    public void setRecoveryAttempts(int _recoveryAttempts)
+    {
+        this._recoveryAttempts = _recoveryAttempts;
+    }
+
+    // Synchronizatons
+
+    public void beforeCompletion()
+    {
+        if (_xaFailureType.equals(ASFailureType.SYNCH_BEFORE))
+            try
+            {
+                applySpec("Before completion");
+            }
+            catch (XAException e)
+            {
+                throw new RuntimeException(e);
+            }
+    }
+
+    public void afterCompletion(int i)
+    {
+        if (_xaFailureType.equals(ASFailureType.SYNCH_AFTER))
+            try
+            {
+                applySpec("After completion");
+            }
+            catch (XAException e)
+            {
+                throw new RuntimeException(e);
+            }
+    }
+
+    // XA Interface implementation
+
+    public void commit(Xid xid, boolean b) throws XAException
+    {
+        if (_xaFailureType.equals(ASFailureType.XARES_COMMIT))
+            applySpec("xa commit");
+
+        _isPrepared = false;
+        _xids.remove(xid);
+    }
+
+    public void rollback(Xid xid) throws XAException
+    {
+       if (_xaFailureType.equals(ASFailureType.XARES_ROLLBACK))
+            applySpec("xa rollback");
+
+        _isPrepared = false;
+        _xids.remove(xid);
+    }
+    
+    public void end(Xid xid, int i) throws XAException
+    {
+        if (_xaFailureType.equals(ASFailureType.XARES_END))
+            applySpec("xa end");
+    }
+
+    public void forget(Xid xid) throws XAException
+    {
+        if (_xaFailureType.equals(ASFailureType.XARES_FORGET))
+            applySpec("xa forget");
+
+        _isPrepared = false;
+        _xids.remove(xid);
+    }
+
+    public int getTransactionTimeout() throws XAException
+    {
+        return txTimeout;
+    }
+
+    public boolean isSameRM(XAResource xaResource) throws XAException
+    {
+        return false;
+    }
+
+    public int prepare(Xid xid) throws XAException
+    {
+        _isPrepared = true;
+        
+        if (_xaFailureType.equals(ASFailureType.XARES_PREPARE))
+            applySpec("xa prepare");
+
+        _xids.add(xid);
+
+        return XA_OK;
+    }
+
+    public Xid[] recover(int i) throws XAException
+    {
+        if (_recoveryAttempts <= 0)
+            return _xids.toArray(new Xid[_xids.size()]);
+
+        _recoveryAttempts -= 1;
+
+        if (_xaFailureType.equals(ASFailureType.XARES_RECOVER))
+            applySpec("xa recover");
+
+        return new Xid[0];
+    }
+
+    public boolean setTransactionTimeout(int txTimeout) throws XAException
+    {
+        this.txTimeout = txTimeout;
+        
+        return true;    // set was successfull
+    }
+
+    public void start(Xid xid, int i) throws XAException
+    {
+        _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.equals(ASFailureMode.XAEXCEPTION);
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/TestASRecovery.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/TestASRecovery.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/recovery/TestASRecovery.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,101 @@
+package org.jboss.jbossts.qa.astests.recovery;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Helper class for manually starting a transaction and enlisting various resources
+ * and synchronizations.
+ */
+public class TestASRecovery
+{
+    List<ASTestResource> resources = new ArrayList<ASTestResource> ();
+    private boolean expectException;
+
+    public void addResource(ASFailureSpec spec)
+    {
+        resources.add(new ASTestResource(spec));
+    }
+
+    /**
+     * 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);
+
+                if (res.isXAResource())
+                    tx.enlistResource(res);
+                else if (res.isSynchronization())
+                    tx.registerSynchronization(res);
+
+                if (res.expectException())
+                    expectException = true;
+            }
+
+            preCommit();
+
+            return true;
+        }
+        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;
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/java.policy
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/java.policy	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/java.policy	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,3 @@
+grant {
+    permission java.security.AllPermission;
+};

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/oracle-xa-ds.xml
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/oracle-xa-ds.xml	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/oracle-xa-ds.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  JBoss Server Configuration                                           -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: oracle-xa-ds.xml 71535 2008-04-01 07:05:03Z adrian at jboss.org $ -->
+
+<!-- ===================================================================== -->
+<!-- ATTENTION:  DO NOT FORGET TO SET Pad=true IN transaction-service.xml  -->
+<!-- ===================================================================== -->
+
+<datasources>
+  <xa-datasource>
+    <jndi-name>XAOracleDS</jndi-name>
+    <track-connection-by-tx>true</track-connection-by-tx> 
+    <isSameRM-override-value>false</isSameRM-override-value>
+    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
+    <xa-datasource-property name="URL">jdbc:oracle:oci8:@dtfdb5:1521:TSH1</xa-datasource-property>
+    <xa-datasource-property name="User">system</xa-datasource-property>
+    <xa-datasource-property name="Password">jboss83</xa-datasource-property>
+    <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
+    <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
+    <!-- Checks the Oracle error codes and messages for fatal errors -->
+    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
+    <!-- Oracles XA datasource cannot reuse a connection outside a transaction once enlisted in a global transaction and vice-versa -->
+    <no-tx-separate-pools/>
+
+      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
+      <metadata>
+         <type-mapping>Oracle9i</type-mapping>
+      </metadata>
+  </xa-datasource>
+
+  <xa-datasource>
+    <jndi-name>XAOracleDS2</jndi-name>
+    <track-connection-by-tx>true</track-connection-by-tx> 
+    <isSameRM-override-value>false</isSameRM-override-value>
+    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
+    <xa-datasource-property name="URL">jdbc:oracle:oci8:@dtfdb7:1521:TSH1</xa-datasource-property>
+    <xa-datasource-property name="User">system</xa-datasource-property>
+    <xa-datasource-property name="Password">jboss83</xa-datasource-property>
+    <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
+    <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
+    <!-- Checks the Oracle error codes and messages for fatal errors -->
+    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
+    <!-- Oracles XA datasource cannot reuse a connection outside a transaction once enlisted in a global transaction and vice-versa -->
+    <no-tx-separate-pools/>
+
+      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
+      <metadata>
+         <type-mapping>Oracle9i</type-mapping>
+      </metadata>
+  </xa-datasource>
+  <mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter" 
+         name="jboss.jca:service=OracleXAExceptionFormatter">
+    <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
+  </mbean>
+
+</datasources>

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/sample-bindings.xml
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/sample-bindings.xml	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/sample-bindings.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,1370 @@
+<!--
+   $Id: sample-bindings.xml 71362 2008-03-27 22:38:50Z clebert.suconic at jboss.com $
+		
+   A sample configuration for the binding service which defines different
+   port configurations (ports-default, ports-01, ports-02) for running multiple
+   JBoss instances in parallel on the same machine.
+
+   The actual port configuration can be selected within the jboss-service.xml
+   file via ServiceBindingManager attribute ServerName.
+
+   The following sample e.g. selects the jboss-default port configuration
+
+   <mbean code="org.jboss.services.binding.ServiceBindingManager"
+          name="jboss.system:service=ServiceBindingManager">
+      <attribute name="ServerName">ports-default</attribute>
+      <attribute name="StoreURL">file:../server/port-bindings.xml</attribute>
+      <attribute name="StoreFactoryClassName">
+         org.jboss.services.binding.XMLServicesStoreFactory
+      </attribute>
+   </mbean>
+
+   For running a second server instance you have to change the port
+   bindings of that instance by specifing an alternative port binding
+   configuration in the jboss-service.xml of the second server, e.g.
+
+   <attribute name="ServerName">ports-01</attribute>
+
+   Additional documentation for running multiple JBoss instances on the
+   same machine can be found at http://www.jboss.com/products/jbossas/docs
+   in the offical JBoss Application Server Guide in chapter
+   "MBean Service Miscellany - Services Binding Management"
+-->
+<service-bindings>
+
+   <!-- ********************************************************** -->
+   <!-- *                        ports-default                   * -->
+   <!-- ********************************************************** -->
+   <server name="ports-default">
+
+      <!-- ********************* jboss-service.xml ****************** -->
+
+      <service-config name="jboss:service=Naming"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port" hostName="BindAddress">
+            <attribute name="RmiPort">1098</attribute>
+         </delegate-config>
+         <binding port="1099" host="${jboss.bind.address}"/>
+      </service-config>
+
+
+      <service-config name="jboss:service=WebService"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port"/>
+         <binding port="8083"/>
+      </service-config>
+
+
+      <service-config name="jboss:service=invoker,type=jrmp"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="RMIObjectPort"/>
+         <binding port="4444"/>
+      </service-config>
+
+      <service-config name="jboss:service=invoker,type=pooled"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="ServerBindPort"/>
+         <!-- don't care for now -->
+         <binding port="0"/>
+      </service-config>
+
+
+      <!-- ********************* cluster-service.xml **************** -->
+
+      <service-config name="jboss:service=HAJNDI"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+         <delegate-config portName="Port">
+            <attribute name="RmiPort">1101</attribute>
+         </delegate-config>
+         <binding port="1100"/>
+      </service-config>
+
+      <service-config name="jboss:service=invoker,type=jrmpha"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+         <delegate-config portName="RMIObjectPort"/>
+         <binding port="4445"/>
+      </service-config>
+
+      <service-config name="jboss:service=invoker,type=pooledha"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+         <delegate-config portName="ServerBindPort"/>
+         <binding port="4448"/>
+      </service-config>   
+      
+      <!-- ********************* iiop-service.xml ****************** -->
+
+      <service-config name="jboss:service=CorbaORB"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port"/>
+         <binding port="3528"/>
+      </service-config>
+
+
+      <!-- ********************* jmx-rmi-adaptor.sar **************** -->
+
+      <service-config name="jboss.jmx:type=Connector,name=RMI"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="RMIObjectPort"/>
+         <binding port="19001"/>
+      </service-config>
+
+
+      <!-- ********************* snmp-adaptor.sar ****************** -->
+
+      <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port"/>
+         <binding port="1162"/>
+      </service-config>
+      
+      <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port"/>
+         <binding port="1161"/>
+      </service-config>
+
+      <!-- ********************* jbossmq-service.xml **************** -->
+
+      <!-- JMS related services -->
+      <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="ServerBindPort"/>
+         <binding port="8093"/>
+      </service-config>
+
+      <service-config name="jboss.mq:service=InvocationLayer,type=OIL"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="ServerBindPort"/>
+         <binding port="8090"/>
+      </service-config>
+
+
+      <!-- ********************* jbossmq-httpil.sar **************** -->
+      <service-config name="jboss.mq:service=InvocationLayer,type=HTTP"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="URLPort"/>
+         <binding port="8080"/>
+      </service-config>
+
+      <!-- **************** http-invoker.sar & httpha-invoker.sar*************** -->
+      <!-- EJBInvoker -->
+      <service-config name="jboss:service=invoker,type=http"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerServlet</attribute>
+        </delegate-config>
+         <!-- 
+            MUST BE THE SAME AS
+            TOMCAT HTTP CONNECTOR BELOW !!!
+             -->
+         <binding port="8080"/>
+      </service-config>
+
+        <!-- JMXInvoker -->
+      <service-config name="jboss:service=invoker,type=http,target=Naming"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerServlet</attribute>
+        </delegate-config>
+         <!-- 
+            MUST BE THE SAME AS
+            TOMCAT HTTP CONNECTOR BELOW !!!
+             -->
+         <binding port="8080"/>
+      </service-config>
+
+        <!-- readonly JMXInvoker -->
+      <service-config name="jboss:service=invoker,type=http,target=Naming,readonly=true"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/readonly/JMXInvokerServlet</attribute>
+        </delegate-config>
+         <!-- 
+            MUST BE THE SAME AS
+            TOMCAT HTTP CONNECTOR BELOW !!!
+             -->
+         <binding port="8080"/>
+      </service-config>
+
+    <!-- **************** httpha-invoker.sar*************** -->
+      <!-- EJBInvokerHA -->
+      <service-config name="jboss:service=invoker,type=httpHA"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerHAServlet</attribute>
+        </delegate-config>
+         <binding port="8080"/>
+      </service-config>
+
+      <!-- JMXInvokerHA -->
+      <service-config name="jboss:service=invoker,type=http,target=HAJNDI"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerHAServlet</attribute>
+        </delegate-config>
+         <binding port="8080"/>
+      </service-config>
+
+
+      <!-- ********************* jbossws.sar **************** -->
+
+      <!-- Web Service related services -->
+      <service-config name="jboss.ws:service=ServiceEndpointManager"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+        <delegate-config portName="WebServicePort" hostName="WebServiceHost">
+            <attribute name="WebServiceSecurePort">8443</attribute>
+        </delegate-config>
+        <binding port="8080" host="${jboss.bind.address}"/>
+      </service-config>
+	   
+      <!-- ********************* remoting **************** -->
+
+      <service-config name="jboss.remoting:service=JMXConnectorServer,protocol=rmi"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+        <delegate-config portName="RegistryPort" hostName="BindAddress"/>
+        <binding port="1090" host="${jboss.bind.address}"/>
+      </service-config>
+      
+      <service-config name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+        <delegate-config>
+           <attribute name="InvokerLocator">socket://0.0.0.0:3873</attribute>
+        </delegate-config>
+      </service-config>
+
+       <!-- *** remoting connector *** -->
+       <service-config name="jboss.remoting:service=Connector,transport=socket"
+          delegateClass="org.jboss.services.binding.XSLTConfigDelegate">
+          <delegate-config>
+             <xslt-config configName="Configuration"><![CDATA[
+               <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+                  <xsl:output method="xml" />
+                  <xsl:param name="port"/>
+
+                  <xsl:template match="/">
+                     <xsl:apply-templates/>
+                  </xsl:template>
+
+                  <xsl:template match="attribute[@name='serverBindPort']">
+                     <attribute type="java.lang.String" name="serverBindPort"><xsl:value-of select='$port'/></attribute>
+                  </xsl:template>
+
+                  <xsl:template match="*|@*">
+                     <xsl:copy>
+                        <xsl:apply-templates select="@*|node()"/>
+                     </xsl:copy>
+                  </xsl:template>
+               </xsl:stylesheet>
+          ]]>
+          </xslt-config>
+          </delegate-config>
+          <binding port="4446" />
+       </service-config>
+
+	   
+      <!-- ********************* hsqldb-ds.xml ********************** -->
+
+      <!-- Hypersonic related services when using the tcp/ip access
+      <service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS"
+         delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
+      >
+         <delegate-config>
+         <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[
+<xsl:stylesheet
+      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+  <xsl:output method="xml" />
+  <xsl:param name="host"/>
+  <xsl:param name="port"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="config-property[@name='ConnectionURL']">
+    <config-property type="java.lang.String" name="ConnectionURL">jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/></config-property>
+  </xsl:template>
+
+  <xsl:template match="*|@*">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>
+]]>
+         </xslt-config>
+         </delegate-config>
+         <binding host="localhost" port="1701" />
+      </service-config>
+
+      <service-config name="jboss:service=Hypersonic"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+      >
+         <delegate-config portName="Port" />
+         <binding port="1701" />
+      </service-config>
+      -->
+
+      <!-- jbossweb-tomcat50.sar -->
+      <service-config name="jboss.web:service=WebServer"
+         delegateClass="org.jboss.services.binding.XSLTFileDelegate"
+         >
+         <delegate-config>
+            <xslt-config configName="ConfigFile"><![CDATA[
+   <xsl:stylesheet
+         xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+     <xsl:output method="xml" />
+     <xsl:param name="port"/>
+
+     <xsl:variable name="portAJP" select="$port - 71"/>
+     <xsl:variable name="portHttps" select="$port + 363"/>
+
+     <xsl:template match="/">
+       <xsl:apply-templates/>
+     </xsl:template>
+
+      <xsl:template match = "Connector">
+         <Connector>
+            <xsl:for-each select="@*">
+            <xsl:choose>
+               <xsl:when test="(name() = 'port' and . = '8080')">
+                  <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8009')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'redirectPort')">
+                  <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8443')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
+               </xsl:otherwise>
+            </xsl:choose>
+            </xsl:for-each>
+            <xsl:apply-templates/>
+         </Connector>
+      </xsl:template>
+
+     <xsl:template match="*|@*">
+       <xsl:copy>
+         <xsl:apply-templates select="@*|node()"/>
+       </xsl:copy>
+     </xsl:template>
+   </xsl:stylesheet>
+   ]]>
+            </xslt-config>
+         </delegate-config>
+         <binding port="8080"/>
+      </service-config>
+
+      <!-- ********************* jbossweb-tomcat.sar *****************
+      <service-config name="jboss.web:service=WebServer"
+         delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
+         >
+         <delegate-config>
+            <xslt-config configName="Config"><![CDATA[
+   <xsl:stylesheet
+         xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+     <xsl:output method="xml" />
+     <xsl:param name="port"/>
+
+     <xsl:variable name="portAJP" select="$port - 71"/>
+     <xsl:variable name="portHttps" select="$port + 363"/>
+
+     <xsl:template match="/">
+       <xsl:apply-templates/>
+     </xsl:template>
+
+      <xsl:template match = "Connector">
+         <Connector>
+            <xsl:for-each select="@*">
+            <xsl:choose>
+               <xsl:when test="(name() = 'port' and . = '8080')">
+                  <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8009')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'redirectPort')">
+                  <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8443')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
+               </xsl:otherwise>
+            </xsl:choose>
+            </xsl:for-each>
+            <xsl:apply-templates/>
+         </Connector>
+      </xsl:template>
+
+     <xsl:template match="*|@*">
+       <xsl:copy>
+         <xsl:apply-templates select="@*|node()"/>
+       </xsl:copy>
+     </xsl:template>
+   </xsl:stylesheet>
+   ]]>
+            </xslt-config>
+         </delegate-config>
+         <binding port="8080"/>
+      </service-config>
+-->
+
+      <!-- ********************* jboss messaging ********************** -->
+      
+      <service-config name="jboss.messaging:service=Connector,transport=bisocket"
+                      delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+         <delegate-config>
+            <attribute name="Configuration"><![CDATA[
+         <config>
+            <invoker transport="bisocket">
+               <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="dataType" isParam="true">jms</attribute>
+               <attribute name="socket.check_connection" isParam="true">false</attribute>
+               <attribute name="timeout" isParam="true">0</attribute>
+               <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
+               <attribute name="serverBindPort">4457</attribute>
+               <attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
+               <attribute name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
+               <attribute name="numberOfCallRetries" isParam="true">1</attribute>
+               <attribute name="pingFrequency" isParam="true">214748364</attribute>
+               <attribute name="pingWindowFactor" isParam="true">10</attribute>
+               <attribute name="onewayThreadPool">org.jboss.jms.server.remoting.DirectThreadPool</attribute>               
+               <attribute name="stopLeaseOnFailure" isParam="true">true</attribute>
+               <attribute name="clientLeasePeriod" isParam="true">10000</attribute>
+               <attribute name="numberOfRetries" isParam="true">10</attribute>
+               <attribute name="JBM_clientMaxPoolSize" isParam="true">200</attribute>
+               <attribute name="callbackTimeout">10000</attribute> 
+            </invoker>
+            <handlers>
+               <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
+            </handlers>
+         </config>
+         ]]></attribute>
+         </delegate-config>
+         <binding port="4457"/>
+      </service-config>
+      
+   </server>
+
+
+   <!-- ********************************************************** -->
+   <!-- *                          ports-01                      * -->
+   <!-- ********************************************************** -->
+   <server name="ports-01">
+
+      <!-- ********************* jboss-service.xml ****************** -->
+
+      <service-config name="jboss:service=Naming"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port" hostName="BindAddress">
+            <attribute name="RmiPort">1198</attribute>
+         </delegate-config>
+         <binding port="1199" host="${jboss.bind.address}"/>
+      </service-config>
+
+
+      <service-config name="jboss:service=WebService"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port"/>
+         <binding port="8183"/>
+      </service-config>
+
+
+      <service-config name="jboss:service=invoker,type=jrmp"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="RMIObjectPort"/>
+         <binding port="4544"/>
+      </service-config>
+
+
+      <service-config name="jboss:service=invoker,type=pooled"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="ServerBindPort"/>
+         <!-- don't care for now -->
+         <binding port="0"/>
+      </service-config>
+
+      <!-- ********************* cluster-service.xml **************** -->
+
+      <service-config name="jboss:service=HAJNDI"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+         <delegate-config portName="Port">
+            <attribute name="RmiPort">1201</attribute>
+         </delegate-config>
+         <binding port="1200"/>
+      </service-config>
+
+      <service-config name="jboss:service=invoker,type=jrmpha"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+         <delegate-config portName="RMIObjectPort"/>
+         <binding port="4545"/>
+      </service-config>
+
+      <service-config name="jboss:service=invoker,type=pooledha"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+         <delegate-config portName="ServerBindPort"/>
+         <binding port="4548"/>
+      </service-config>
+      
+      <!-- ********************* iiop-service.xml ****************** -->
+
+      <service-config name="jboss:service=CorbaORB"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port"/>
+         <binding port="3628"/>
+      </service-config>
+
+
+      <!-- ********************* jmx-rmi-adaptor.sar **************** -->
+
+      <service-config name="jboss.jmx:type=Connector,name=RMI"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="RMIObjectPort"/>
+         <binding port="19101"/>
+      </service-config>
+
+
+      <!-- ********************* snmp-adaptor.sar ****************** -->
+
+      <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port"/>
+         <binding port="1262"/>
+      </service-config>
+
+      <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port"/>
+         <binding port="1261"/>
+      </service-config>
+      
+      <!-- ********************* jbossmq-service.xml **************** -->
+
+      <!-- JMS related services -->
+      <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="ServerBindPort"/>
+         <binding port="8193"/>
+      </service-config>
+
+      <service-config name="jboss.mq:service=InvocationLayer,type=OIL"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="ServerBindPort"/>
+         <binding port="8190"/>
+      </service-config>
+
+
+      <!-- ********************* jbossmq-httpil.sar **************** -->
+      <service-config name="jboss.mq:service=InvocationLayer,type=HTTP"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="URLPort"/>
+         <binding port="8180"/>
+      </service-config>
+
+      <!-- **************** http-invoker.sar & httpha-invoker.sar*************** -->
+      <!-- EJBInvoker -->
+      <service-config name="jboss:service=invoker,type=http"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerServlet</attribute>
+        </delegate-config>
+         <!-- 
+            MUST BE THE SAME AS
+            TOMCAT HTTP CONNECTOR BELOW !!!
+             -->
+         <binding port="8180"/>
+      </service-config>
+
+        <!-- JMXInvoker -->
+      <service-config name="jboss:service=invoker,type=http,target=Naming"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerServlet</attribute>
+        </delegate-config>
+         <!-- 
+            MUST BE THE SAME AS
+            TOMCAT HTTP CONNECTOR BELOW !!!
+             -->
+         <binding port="8180"/>
+      </service-config>
+
+        <!-- readonly JMXInvoker -->
+      <service-config name="jboss:service=invoker,type=http,target=Naming,readonly=true"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/readonly/JMXInvokerServlet</attribute>
+        </delegate-config>
+         <!-- 
+            MUST BE THE SAME AS
+            TOMCAT HTTP CONNECTOR BELOW !!!
+             -->
+         <binding port="8180"/>
+      </service-config>
+
+    <!-- **************** httpha-invoker.sar*************** -->
+      <!-- EJBInvokerHA -->
+      <service-config name="jboss:service=invoker,type=httpHA"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerHAServlet</attribute>
+        </delegate-config>
+         <binding port="8180"/>
+      </service-config>
+
+      <!-- JMXInvokerHA -->
+      <service-config name="jboss:service=invoker,type=http,target=HAJNDI"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerHAServlet</attribute>
+        </delegate-config>
+         <binding port="8180"/>
+      </service-config>
+
+
+
+      <!-- ********************* jbossws.sar **************** -->
+
+      <!-- Web Service related services -->
+      <service-config name="jboss.ws:service=ServiceEndpointManager"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+        <delegate-config portName="WebServicePort" hostName="WebServiceHost">
+            <attribute name="WebServiceSecurePort">8543</attribute>
+        </delegate-config>
+        <binding port="8180" host="${jboss.bind.address}"/>
+      </service-config>
+
+      <!-- ********************* remoting **************** -->
+
+      <service-config name="jboss.remoting:service=JMXConnectorServer,protocol=rmi"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+        <delegate-config portName="RegistryPort" hostName="BindAddress"/>
+        <binding port="1190" host="${jboss.bind.address}"/>
+      </service-config>
+      
+      <service-config name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+        <delegate-config>
+           <attribute name="InvokerLocator">socket://0.0.0.0:3973</attribute>
+        </delegate-config>
+      </service-config>
+
+       <!-- *** remoting connector *** -->
+       <service-config name="jboss.remoting:service=Connector,transport=socket"
+          delegateClass="org.jboss.services.binding.XSLTConfigDelegate">
+          <delegate-config>
+             <xslt-config configName="Configuration"><![CDATA[
+               <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+                  <xsl:output method="xml" />
+                  <xsl:param name="port"/>
+
+                  <xsl:template match="/">
+                     <xsl:apply-templates/>
+                  </xsl:template>
+
+                  <xsl:template match="attribute[@name='serverBindPort']">
+                     <attribute type="java.lang.String" name="serverBindPort"><xsl:value-of select='$port'/></attribute>
+                  </xsl:template>
+
+                  <xsl:template match="*|@*">
+                     <xsl:copy>
+                        <xsl:apply-templates select="@*|node()"/>
+                     </xsl:copy>
+                  </xsl:template>
+               </xsl:stylesheet>
+          ]]>
+          </xslt-config>
+          </delegate-config>
+          <binding port="5446" />
+       </service-config>
+
+      <!-- ********************* hsqldb-ds.xml ********************** -->
+
+      <!-- Hypersonic related services
+
+            Only if using TCP setup (local file setup by default)
+
+      <service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS"
+         delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
+      >
+         <delegate-config>
+         <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[
+<xsl:stylesheet
+      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+  <xsl:output method="xml" />
+  <xsl:param name="host"/>
+  <xsl:param name="port"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="config-property[@name='ConnectionURL']">
+    <config-property type="java.lang.String" name="ConnectionURL">jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/></config-property>
+  </xsl:template>
+
+  <xsl:template match="*|@*">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>
+]]>
+         </xslt-config>
+         </delegate-config>
+         <binding host="localhost" port="1801" />
+      </service-config>
+
+      <service-config name="jboss:service=Hypersonic"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+      >
+         <delegate-config portName="Port" />
+         <binding port="1801" />
+      </service-config>
+
+      -->
+
+      <!-- jbossweb-tomcat50.sar -->
+      <service-config name="jboss.web:service=WebServer"
+         delegateClass="org.jboss.services.binding.XSLTFileDelegate"
+         >
+         <delegate-config>
+            <xslt-config configName="ConfigFile"><![CDATA[
+   <xsl:stylesheet
+         xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+     <xsl:output method="xml" />
+     <xsl:param name="port"/>
+
+     <xsl:variable name="portAJP" select="$port - 71"/>
+     <xsl:variable name="portHttps" select="$port + 363"/>
+
+     <xsl:template match="/">
+       <xsl:apply-templates/>
+     </xsl:template>
+
+      <xsl:template match = "Connector">
+         <Connector>
+            <xsl:for-each select="@*">
+            <xsl:choose>
+               <xsl:when test="(name() = 'port' and . = '8080')">
+                  <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8009')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'redirectPort')">
+                  <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8443')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
+               </xsl:otherwise>
+            </xsl:choose>
+            </xsl:for-each>
+            <xsl:apply-templates/>
+         </Connector>
+      </xsl:template>
+
+     <xsl:template match="*|@*">
+       <xsl:copy>
+         <xsl:apply-templates select="@*|node()"/>
+       </xsl:copy>
+     </xsl:template>
+   </xsl:stylesheet>
+   ]]>
+            </xslt-config>
+         </delegate-config>
+         <binding port="8180"/>
+      </service-config>
+
+      <!-- ********************* jbossweb-tomcat41.sar *****************
+
+         <service-config name="jboss.web:service=WebServer"
+            delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
+         >
+            <delegate-config>
+            <xslt-config configName="Config"><![CDATA[
+   <xsl:stylesheet
+         xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+     <xsl:output method="xml" />
+     <xsl:param name="port"/>
+
+     <xsl:variable name="portAJP" select="$port - 71"/>
+     <xsl:variable name="portHttps" select="$port + 363"/>
+
+     <xsl:template match="/">
+       <xsl:apply-templates/>
+     </xsl:template>
+
+      <xsl:template match = "Connector">
+         <Connector>
+            <xsl:for-each select="@*">
+            <xsl:choose>
+               <xsl:when test="(name() = 'port' and . = '8080')">
+                  <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8009')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'redirectPort')">
+                  <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8443')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
+               </xsl:otherwise>
+            </xsl:choose>
+            </xsl:for-each>
+            <xsl:apply-templates/>
+         </Connector>
+      </xsl:template>
+
+     <xsl:template match="*|@*">
+       <xsl:copy>
+         <xsl:apply-templates select="@*|node()"/>
+       </xsl:copy>
+     </xsl:template>
+   </xsl:stylesheet>
+   ]]>
+            </xslt-config>
+            </delegate-config>
+            <binding port="8180" />
+         </service-config>
+   -->
+
+      <!-- ********************* jboss messaging ********************** -->
+
+      <service-config name="jboss.messaging:service=Connector,transport=bisocket"
+                      delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+         <delegate-config>
+            <attribute name="Configuration"><![CDATA[
+         <config>
+            <invoker transport="bisocket">
+               <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="dataType" isParam="true">jms</attribute>
+               <attribute name="socket.check_connection" isParam="true">false</attribute>
+               <attribute name="timeout" isParam="true">0</attribute>
+               <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
+               <attribute name="serverBindPort">4557</attribute>
+               <attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
+               <attribute name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
+               <attribute name="numberOfCallRetries" isParam="true">1</attribute>
+               <attribute name="pingFrequency" isParam="true">214748364</attribute>
+               <attribute name="pingWindowFactor" isParam="true">10</attribute>
+               <attribute name="onewayThreadPool">org.jboss.jms.server.remoting.DirectThreadPool</attribute>               
+               <attribute name="stopLeaseOnFailure" isParam="true">true</attribute>
+               <attribute name="clientLeasePeriod" isParam="true">10000</attribute>
+               <attribute name="numberOfRetries" isParam="true">10</attribute>
+               <attribute name="JBM_clientMaxPoolSize" isParam="true">200</attribute>
+               <attribute name="callbackTimeout">10000</attribute> 
+            </invoker>
+            <handlers>
+               <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
+            </handlers>
+         </config>
+         ]]></attribute>
+         </delegate-config>
+         <binding port="4557"/>
+      </service-config>
+      
+   </server>
+
+
+   <!-- ********************************************************** -->
+   <!-- *                          ports-02                      * -->
+   <!-- ********************************************************** -->
+   <server name="ports-02">
+
+      <!-- ********************* jboss-service.xml ****************** -->
+
+      <service-config name="jboss:service=Naming"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port" hostName="BindAddress">
+            <attribute name="RmiPort">1298</attribute>
+         </delegate-config>
+         <binding port="1299" host="${jboss.bind.address}"/>
+      </service-config>
+
+
+      <service-config name="jboss:service=WebService"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port"/>
+         <binding port="8283"/>
+      </service-config>
+
+
+      <service-config name="jboss:service=invoker,type=jrmp"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="RMIObjectPort"/>
+         <binding port="4644"/>
+      </service-config>
+
+
+      <service-config name="jboss:service=invoker,type=pooled"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="ServerBindPort"/>
+         <!-- don't care for now -->
+         <binding port="0"/>
+      </service-config>
+
+      <!-- ********************* cluster-service.xml **************** -->
+
+      <service-config name="jboss:service=HAJNDI"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+         <delegate-config portName="Port">
+            <attribute name="RmiPort">1301</attribute>
+         </delegate-config>
+         <binding port="1300"/>
+      </service-config>
+
+      <service-config name="jboss:service=invoker,type=jrmpha"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+         <delegate-config portName="RMIObjectPort"/>
+         <binding port="4645"/>
+      </service-config>
+
+      <service-config name="jboss:service=invoker,type=pooledha"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+         <delegate-config portName="ServerBindPort"/>
+         <binding port="4648"/>
+      </service-config>
+      
+      <!-- ********************* iiop-service.xml ****************** -->
+
+      <service-config name="jboss:service=CorbaORB"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port"/>
+         <binding port="3728"/>
+      </service-config>
+
+
+      <!-- ********************* jmx-rmi-adaptor.sar **************** -->
+
+      <service-config name="jboss.jmx:type=Connector,name=RMI"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="RMIObjectPort"/>
+         <binding port="19201"/>
+      </service-config>
+
+
+      <!-- ********************* snmp-adaptor.sar ****************** -->
+
+      <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port"/>
+         <binding port="1362"/>
+      </service-config>
+      
+      <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="Port"/>
+         <binding port="1361"/>
+      </service-config>
+
+      <!-- ********************* jbossmq-service.xml **************** -->
+
+      <!-- JMS related services -->
+      <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="ServerBindPort"/>
+         <binding port="8293"/>
+      </service-config>
+
+      <service-config name="jboss.mq:service=InvocationLayer,type=OIL"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="ServerBindPort"/>
+         <binding port="8290"/>
+      </service-config>
+
+
+      <!-- ********************* jbossmq-httpil.sar **************** -->
+      <service-config name="jboss.mq:service=InvocationLayer,type=HTTP"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config portName="URLPort"/>
+         <binding port="8280"/>
+      </service-config>
+
+      <!-- **************** http-invoker.sar & httpha-invoker.sar*************** -->
+      <!-- EJBInvoker -->
+      <service-config name="jboss:service=invoker,type=http"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerServlet</attribute>
+        </delegate-config>
+         <!-- 
+            MUST BE THE SAME AS
+            TOMCAT HTTP CONNECTOR BELOW !!!
+             -->
+         <binding port="8280"/>
+      </service-config>
+
+        <!-- JMXInvoker -->
+      <service-config name="jboss:service=invoker,type=http,target=Naming"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerServlet</attribute>
+        </delegate-config>
+         <!-- 
+            MUST BE THE SAME AS
+            TOMCAT HTTP CONNECTOR BELOW !!!
+             -->
+         <binding port="8280"/>
+      </service-config>
+
+        <!-- readonly JMXInvoker -->
+      <service-config name="jboss:service=invoker,type=http,target=Naming,readonly=true"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/readonly/JMXInvokerServlet</attribute>
+        </delegate-config>
+         <!-- 
+            MUST BE THE SAME AS
+            TOMCAT HTTP CONNECTOR BELOW !!!
+             -->
+         <binding port="8280"/>
+      </service-config>
+
+    <!-- **************** httpha-invoker.sar*************** -->
+      <!-- EJBInvokerHA -->
+      <service-config name="jboss:service=invoker,type=httpHA"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/EJBInvokerHAServlet</attribute>
+        </delegate-config>
+         <binding port="8280"/>
+      </service-config>
+
+      <!-- JMXInvokerHA -->
+      <service-config name="jboss:service=invoker,type=http,target=HAJNDI"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+         >
+         <delegate-config>
+            <attribute name="InvokerURLSuffix">:${port}/invoker/JMXInvokerHAServlet</attribute>
+        </delegate-config>
+         <binding port="8280"/>
+      </service-config>
+
+
+      <!-- ********************* jbossws.sar **************** -->
+
+      <!-- Web Service related services -->
+      <service-config name="jboss.ws:service=ServiceEndpointManager"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+        <delegate-config portName="WebServicePort" hostName="WebServiceHost">
+            <attribute name="WebServiceSecurePort">8643</attribute>
+        </delegate-config>
+        <binding port="8280" host="${jboss.bind.address}"/>
+      </service-config>
+
+      <!-- ********************* remoting **************** -->
+
+      <service-config name="jboss.remoting:service=JMXConnectorServer,protocol=rmi"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+        <delegate-config portName="RegistryPort" hostName="BindAddress"/>
+        <binding port="1290" host="${jboss.bind.address}"/>
+      </service-config>
+      
+      <service-config name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+        <delegate-config>
+           <attribute name="InvokerLocator">socket://0.0.0.0:4073</attribute>
+        </delegate-config>
+      </service-config>
+
+       <!-- *** remoting connector *** -->
+       <service-config name="jboss.remoting:service=Connector,transport=socket"
+          delegateClass="org.jboss.services.binding.XSLTConfigDelegate">
+          <delegate-config>
+             <xslt-config configName="Configuration"><![CDATA[
+               <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+                  <xsl:output method="xml" />
+                  <xsl:param name="port"/>
+
+                  <xsl:template match="/">
+                     <xsl:apply-templates/>
+                  </xsl:template>
+
+                  <xsl:template match="attribute[@name='serverBindPort']">
+                     <attribute type="java.lang.String" name="serverBindPort"><xsl:value-of select='$port'/></attribute>
+                  </xsl:template>
+
+                  <xsl:template match="*|@*">
+                     <xsl:copy>
+                        <xsl:apply-templates select="@*|node()"/>
+                     </xsl:copy>
+                  </xsl:template>
+               </xsl:stylesheet>
+          ]]>
+          </xslt-config>
+          </delegate-config>
+          <binding port="6446" />
+       </service-config>
+
+	   
+      <!-- ********************* hsqldb-ds.xml ********************** -->
+
+      <!-- Hypersonic related services
+
+            Only if using TCP setup (local file setup by default)
+
+      <service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS"
+         delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
+      >
+         <delegate-config>
+         <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[
+<xsl:stylesheet
+      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+  <xsl:output method="xml" />
+  <xsl:param name="host"/>
+  <xsl:param name="port"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="config-property[@name='ConnectionURL']">
+    <config-property type="java.lang.String" name="ConnectionURL">jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/></config-property>
+  </xsl:template>
+
+  <xsl:template match="*|@*">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>
+]]>
+         </xslt-config>
+         </delegate-config>
+         <binding host="localhost" port="1901" />
+      </service-config>
+
+      <service-config name="jboss:service=Hypersonic"
+         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
+      >
+         <delegate-config portName="Port" />
+         <binding port="1901" />
+      </service-config>
+
+       -->
+
+      <!-- jbossweb-tomcat50.sar -->
+      <service-config name="jboss.web:service=WebServer"
+         delegateClass="org.jboss.services.binding.XSLTFileDelegate"
+         >
+         <delegate-config>
+            <xslt-config configName="ConfigFile"><![CDATA[
+   <xsl:stylesheet
+         xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+     <xsl:output method="xml" />
+     <xsl:param name="port"/>
+
+     <xsl:variable name="portAJP" select="$port - 71"/>
+     <xsl:variable name="portHttps" select="$port + 363"/>
+
+     <xsl:template match="/">
+       <xsl:apply-templates/>
+     </xsl:template>
+
+      <xsl:template match = "Connector">
+         <Connector>
+            <xsl:for-each select="@*">
+            <xsl:choose>
+               <xsl:when test="(name() = 'port' and . = '8080')">
+                  <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8009')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'redirectPort')">
+                  <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8443')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
+               </xsl:otherwise>
+            </xsl:choose>
+            </xsl:for-each>
+            <xsl:apply-templates/>
+         </Connector>
+      </xsl:template>
+
+     <xsl:template match="*|@*">
+       <xsl:copy>
+         <xsl:apply-templates select="@*|node()"/>
+       </xsl:copy>
+     </xsl:template>
+   </xsl:stylesheet>
+   ]]>
+            </xslt-config>
+         </delegate-config>
+         <binding port="8280"/>
+      </service-config>
+
+      <!-- ********************* jbossweb-tomcat.sar *****************
+
+         <service-config name="jboss.web:service=WebServer"
+            delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
+         >
+            <delegate-config>
+            <xslt-config configName="Config"><![CDATA[
+   <xsl:stylesheet
+         xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
+
+     <xsl:output method="xml" />
+     <xsl:param name="port"/>
+
+     <xsl:variable name="portAJP" select="$port - 71"/>
+     <xsl:variable name="portHttps" select="$port + 363"/>
+
+     <xsl:template match="/">
+       <xsl:apply-templates/>
+     </xsl:template>
+
+      <xsl:template match = "Connector">
+         <Connector>
+            <xsl:for-each select="@*">
+            <xsl:choose>
+               <xsl:when test="(name() = 'port' and . = '8080')">
+                  <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8009')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'redirectPort')">
+                  <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:when test="(name() = 'port' and . = '8443')">
+                  <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
+               </xsl:when>
+               <xsl:otherwise>
+                  <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
+               </xsl:otherwise>
+            </xsl:choose>
+            </xsl:for-each>
+            <xsl:apply-templates/>
+         </Connector>
+      </xsl:template>
+
+     <xsl:template match="*|@*">
+       <xsl:copy>
+         <xsl:apply-templates select="@*|node()"/>
+       </xsl:copy>
+     </xsl:template>
+   </xsl:stylesheet>
+   ]]>
+            </xslt-config>
+            </delegate-config>
+            <binding port="8280" />
+         </service-config>
+   -->
+
+      <!-- ********************* jboss messaging ********************** -->
+
+      <service-config name="jboss.messaging:service=Connector,transport=bisocket"
+                      delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
+         <delegate-config>
+            <attribute name="Configuration"><![CDATA[
+         <config>
+            <invoker transport="bisocket">
+               <attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
+               <attribute name="dataType" isParam="true">jms</attribute>
+               <attribute name="socket.check_connection" isParam="true">false</attribute>
+               <attribute name="timeout" isParam="true">0</attribute>
+               <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
+               <attribute name="serverBindPort">4657</attribute>
+               <attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
+               <attribute name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
+               <attribute name="numberOfCallRetries" isParam="true">1</attribute>
+               <attribute name="pingFrequency" isParam="true">214748364</attribute>
+               <attribute name="pingWindowFactor" isParam="true">10</attribute>
+               <attribute name="onewayThreadPool">org.jboss.jms.server.remoting.DirectThreadPool</attribute>               
+               <attribute name="stopLeaseOnFailure" isParam="true">true</attribute>
+               <attribute name="clientLeasePeriod" isParam="true">10000</attribute>
+               <attribute name="numberOfRetries" isParam="true">10</attribute>
+               <attribute name="JBM_clientMaxPoolSize" isParam="true">200</attribute>
+               <attribute name="callbackTimeout">10000</attribute> 
+            </invoker>
+            <handlers>
+               <handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
+            </handlers>
+         </config>
+         ]]></attribute>
+         </delegate-config>
+         <binding port="4657"/>
+      </service-config>
+      
+   </server>
+
+</service-bindings>

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/xa-mq-destinations-service.xml
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/xa-mq-destinations-service.xml	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/resources/xa-mq-destinations-service.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+
+  <!-- RECOVERY destinations -->
+
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+	 name="jboss.mq.destination:service=Queue,name=recovery">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+    <depends optional-attribute-name="SecurityManager">jboss.messaging:service=SecurityStore</depends>
+    <attribute name="SecurityConf">
+      <security>
+        <role name="guest" read="true" write="true" create="true"/>
+      </security>
+    </attribute>
+  </mbean>
+
+  <mbean code="org.jboss.mq.server.jmx.Topic"
+	 name="jboss.mq.destination:service=Topic,name=recoveryTopic">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+    <depends optional-attribute-name="SecurityManager">jboss.messaging:service=SecurityStore</depends>
+    <attribute name="SecurityConf">
+      <security>
+        <role name="guest" read="true" write="true" create="true"/>
+      </security>
+    </attribute>
+  </mbean>
+
+  <mbean code="org.jboss.mq.server.jmx.Topic"
+	 name="jboss.mq.destination:service=Topic,name=recoveryDurableTopic">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+    <depends optional-attribute-name="SecurityManager">jboss.messaging:service=SecurityStore</depends>
+    <attribute name="SecurityConf">
+      <security>
+        <role name="guest" read="true" write="true" create="true"/>
+      </security>
+    </attribute>
+  </mbean>
+
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+	 name="jboss.mq.destination:service=Queue,name=recoveryQueue">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+    <depends optional-attribute-name="SecurityManager">jboss.messaging:service=SecurityStore</depends>
+    <attribute name="SecurityConf">
+      <security>
+        <role name="guest" read="true" write="true" create="true"/>
+      </security>
+    </attribute>
+  </mbean>
+
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+         name="jboss.mq.destination:service=Queue,name=rcvQ">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+    <depends optional-attribute-name="SecurityManager">jboss.messaging:service=SecurityStore</depends>
+    <attribute name="SecurityConf">
+      <security>
+        <role name="guest" read="true" write="true" create="true"/>
+      </security>
+    </attribute>
+  </mbean>
+
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+         name="jboss.mq.destination:service=Queue,name=sndQ">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+<!--
+    <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
+    <attribute name="SecurityConf">
+      <security>
+        <role name="guest" read="true" write="true" create="true"/>
+      </security>
+    </attribute>
+-->
+  </mbean>
+
+ 
+</server>
+

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ASClientTask.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ASClientTask.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ASClientTask.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,196 @@
+package org.jboss.jbossts.qa.astests.taskdefs;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.BuildException;
+import org.jboss.jbossts.qa.astests.taskdefs.ClientAction;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Ant task for executing a chunk of java code. The interface name of the code to be executed is specified
+ * the impl field:
+ * @see ClientAction
+ *
+ * It the task completes successfully "Passed" is printed on system output, otherwise "Failed" is printed
+ */
+public class ASClientTask extends Task
+{
+    /**
+     * The text to print on standard output if the client action returned the expected result.
+     * Note that these values can be overridden on per task basis
+     * When running under the DTF the text should correspond values defined in the file
+     * nodeconfig.xml. The DTF TaskRunner controlling the test will search the output stream
+     * for this text to determine success or failure.
+     */
+    public static final String PASS = "Passed";
+    public static final String FAIL = "Failed";
+
+    private String impl;
+    private String waitFor;
+    private String name;
+    private String passText = PASS;
+    private String failText = FAIL;
+    private List<TaskProperty> params = new ArrayList<TaskProperty>();
+    private boolean abortOnFail = true;
+
+    public void execute() throws BuildException
+    {
+        ASTestConfig config = (ASTestConfig) getProject().getReference(ASTestConfig.CONFIG_REF);
+        Map<String, String> args = new HashMap<String, String> ();
+
+        for (TaskProperty param : params)
+            args.put(param.getKey(), param.getValue());
+
+        ClientAction action = null;
+
+        try
+        {
+            suspendFor(waitFor);
+            
+            action = (ClientAction) Class.forName(impl).newInstance();
+        }
+        catch (ClassCastException e)
+        {
+            System.err.println("Class " + impl + " does not implement " + ClientAction.class.getName());
+        }
+        catch (ClassNotFoundException e)
+        {
+            System.err.println("Cannot locate class " + impl);
+        }
+        catch (IllegalAccessException e)
+        {
+            e.printStackTrace();
+        }
+        catch (InstantiationException e)
+        {
+            System.err.println("Class " + impl + " cannot be instantiated: " + e.getMessage());
+        }
+
+        try
+        {
+            printResult(action.execute(config, args));
+        }
+        catch (Exception e)
+        {
+            System.out.println("Error executing test: " + e.getMessage());
+            printResult(false);
+        }
+
+    }
+
+    private void printResult(boolean passed)
+    {
+        StringBuilder sb = new StringBuilder();
+
+        if (name != null)
+        {
+            sb.append(name).append(' ');
+        }
+
+        System.out.println(sb.append(passed ? passText : failText));
+
+        if (!passed && abortOnFail)
+            throw new BuildException("Test failed");
+    }
+
+    /**
+     * Suspend the calling thread
+     * @param millis the number of milli seconds to suspend for
+     * @return false if interupted
+     * @throws IllegalArgumentException if millis is not a number or negative
+     */
+    static boolean suspendFor(String millis) throws IllegalArgumentException
+    {
+        try
+        {
+            try
+            {
+                if (millis != null)
+                    Thread.sleep(Integer.parseInt(millis));
+            }
+            catch (NumberFormatException e)
+            {
+                throw new IllegalArgumentException(e);
+            }
+
+            return true;
+        }
+        catch (InterruptedException e)
+        {
+            return false;
+        }
+    }
+
+    /**
+     * 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.jbossts.qa.astests.taskdefs.ASClientTask.PASS
+     * @param name the name of the test.
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+    /**
+     * Task property to force the task to suspend before executing the client action
+     *
+     * @param waitFor the number of milli seconds to suspend - a null value means don't suspend
+     * @throws IllegalArgumentException if waitFor is not a number or is negative
+     */
+    public void setWaitFor(String waitFor) throws IllegalArgumentException
+    {
+        this.waitFor = waitFor;
+    }
+
+    public void setAbortOnFail(String abortOnFail)
+    {
+        this.abortOnFail = "true".equals(abortOnFail);
+    }
+
+    /**
+     * Task property containing the fully qualified class name of the action to execute.
+     * This class must contain an empty constructor and implement:
+     * @see ClientAction
+     *
+     * @param impl the class name of the action that this task will instantiate and run
+     */
+    public void setImpl(String impl)
+    {
+        this.impl = impl;
+    }
+
+    /**
+     * Task parameters that are passed into the execute method of the client action
+     *
+     * @param param a task parameter
+     */
+    public void addParam(TaskProperty param)
+    {
+        params.add(param);
+    }
+
+    /**
+     * Task property defaults to
+     * see org.jboss.jbossts.qa.astests.taskdefs.ASTestConfig.PASS
+     *
+     * @param passText the text to print if the test succeeds
+     */
+    public void setPassText(String passText)
+    {
+        this.passText = passText;
+    }
+
+    /**
+     * Task property to
+     * see org.jboss.jbossts.qa.astests.taskdefs.ASTestConfig.FAIL
+     *
+     * @param failText the text to print if the test succeeds
+     */
+    public void setFailText(String failText)
+    {
+        this.failText = failText;
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ASTestConfig.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ASTestConfig.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ASTestConfig.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,324 @@
+package org.jboss.jbossts.qa.astests.taskdefs;
+
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.BuildException;
+import org.jboss.jbossts.qa.astests.recovery.ASFailureSpec;
+import org.jboss.jbossas.servermanager.Server;
+import org.jboss.jbossas.servermanager.ServerManager;
+import org.xml.sax.SAXException;
+
+import javax.naming.NamingException;
+import javax.naming.Context;
+import javax.xml.transform.TransformerException;
+import javax.xml.parsers.ParserConfigurationException;
+import java.util.*;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Ant task for capturing common configuration for a group of tests
+ * defined in an ant build script.
+ */
+public class ASTestConfig extends Task
+{
+     // arbitary handle for refering to the unique instance of the task configuration
+    public static final String CONFIG_REF = "asTestConfig";
+    // the name of the system property holding the path the product directory
+    public final static String PRODUCT_DIR_PROP = "product.dir";
+    // the location of a JBoss distribution relative to the product directory
+    private final static String AS_ROOT_DIR = "/as/";
+
+    private List<ASFailureSpec> specs = new ArrayList<ASFailureSpec>();
+    private Map<String, ASFailureSpec> specMap = new HashMap<String, ASFailureSpec>();
+    private String productDir;
+    private boolean isDebug = false;
+    private ServerManager manager = new ServerManager();
+
+    public void execute() throws BuildException
+    {
+        System.setSecurityManager(new java.rmi.RMISecurityManager());
+
+        // The Task Runner should have set the product directory
+        productDir = System.getProperty(PRODUCT_DIR_PROP);
+
+        if (productDir == null)
+            throw new BuildException("Please specify the location of the product directory via the \""+ PRODUCT_DIR_PROP + "\" system property");
+
+        productDir = Utils.toFile(productDir).getAbsolutePath();
+        
+        if (!productDir.endsWith("/"))
+            productDir += '/';
+
+        if (isDebug)
+            System.out.println("ASCrashConfig: productDir=" + productDir + " and jbossHome=" + manager.getJBossHome());
+
+        if (manager.getJBossHome() == null)
+        {
+            File jbh = Utils.toFile(productDir + AS_ROOT_DIR);
+
+            if (isDebug)
+                System.out.println("ASCrashConfig: jbh=" + jbh.getAbsolutePath() + " exists=" + jbh.exists());
+
+            if (jbh.exists())
+                setJbossHome(jbh.getAbsolutePath());
+            else
+                setJbossHome(System.getenv("JBOSS_HOME"));
+        }
+
+        // add this to the ant project so that other tasks are able to locate this
+        if (getProject().getReference(CONFIG_REF) == null)
+            getProject().addReference(CONFIG_REF, this);
+
+        ASFailureSpec[] sa = getSpecs();
+
+        // read in any failure specifications so that an ant target may look them up
+        for (ASFailureSpec fs : sa)
+            specMap.put(fs.getName(), fs);
+
+        if (isDebug)
+        {
+            StringBuilder sb = new StringBuilder();
+
+            sb.append("configuring ").append(specs.size()).append(" crash specifications:\n");
+
+            for (ASFailureSpec spec : specs)
+            {
+                sb.append("\t").append(spec).append('\n');
+            }
+
+            System.out.print(sb);
+        }
+    }
+
+    /**
+     * Task parameter to add a fault injection specification.
+     *
+     * @param spec definition of the fault
+     */
+    public void addSpec(ASFailureSpec spec)
+    {
+        specs.add(spec);
+    }
+
+    public ASFailureSpec getSpec(String spec)
+    {
+        return specMap.get(spec);
+    }
+
+    public ASFailureSpec[] getSpecs()
+    {
+        ASFailureSpec[] sa = new ASFailureSpec[specs.size()];
+
+        return specs.toArray(sa);
+    }
+
+    public ASFailureSpec[] parseSpecs(String specArg)
+    {
+        String[] specs = specArg.split(",");
+        ASFailureSpec[] fspecs = new ASFailureSpec[specs.length];
+
+        for (int i = 0; i < specs.length; i++)
+            fspecs[i] = getSpec(specs[i].trim());
+
+        return fspecs;
+    }
+
+    /**
+     * Task parameter to add a server.
+     *
+     * @param server the server
+     */
+    public void addServer(Server server)
+    {
+        manager.addServer(server);
+    }
+
+    /**
+     * JAVA_HOME to start jboss with.
+     *
+     * @param javaHome Path to the the java installation
+     */
+    public void setJavaHome(String javaHome)
+    {
+        manager.setJavaHome(javaHome);
+    }
+
+    public String getJBossHome()
+    {
+        return manager.getJBossHome();
+    }
+    
+    /**
+     * JBoss dist to start. The default is to use the AS installed with the product.
+     * If no AS can be found then the environment variable JBOSS_HOME is used
+     * 
+     * @param jbossHome Path to the the jboss installation
+     */
+    public void setJbossHome(String jbossHome)
+    {
+        manager.setJbossHome(jbossHome);
+    }
+
+    /**
+     * JVM command to use default is "java"
+     * @param jvm JVM command
+     */
+    public void setJvm(String jvm)
+    {
+        manager.setJvm(jvm);
+    }
+
+    /**
+     * The UDP group to pass to org.jboss.Main using
+     * the -u option.
+     *
+     * @param udpGroup the udp group
+     */
+    public void setUdpGroup(String udpGroup)
+    {
+        manager.setUdpGroup(udpGroup);
+    }
+
+    public void setDebug(boolean debug)
+    {
+        isDebug = debug;
+    }
+
+    /**
+     *
+     * @return the location where the product being tested is installed
+     */
+    public String getProductDir()
+    {
+        return productDir;
+    }
+
+    /**
+     * Return the nameing context that a given server is providing
+     *
+     * @param serverName the server providing the context
+     * @return a naming context
+     */
+    public Context getNamingContext(String serverName)
+    {
+        try
+        {
+            Server server = manager.getServer(serverName);
+
+            return (server != null ? new ServerWrapper(server).getNamingContext() : null);
+        }
+        catch (NamingException e)
+        {
+            e.printStackTrace();
+
+            throw new BuildException(e);
+        }
+    }
+
+    /**
+     *
+     * @param serverName the name of the server whose path is being sought
+     * @return the path to the JBoss instance corresponding to the provided name
+     */
+    public String getServerPath(String serverName)
+    {
+        return getJBossHome() + "/server/" + serverName + '/';
+    }
+
+    /**
+     * Start a JBoss instance in a new VM
+     *
+     * @param serverName name of the target instance
+     * @throws IOException If another process is already using a port required by this instance
+     * @see org.jboss.jbossas.servermanager.ServerController#startServer(org.jboss.jbossas.servermanager.Server, org.jboss.jbossas.servermanager.ServerManager)
+     */
+    public void startServer(String serverName) throws IOException
+    {
+        Server server = manager.getServer(serverName);
+
+        // Warning !server.isRunning() is not equivalent to server.isStopped()
+        // !server.isRunning() and !server.isStopped() implies that some other entity terminated the server
+        if (!server.isRunning())
+            manager.startServer(serverName);
+    }
+
+    /**
+     * @see org.jboss.jbossas.servermanager.ServerController#stopServer(org.jboss.jbossas.servermanager.Server, org.jboss.jbossas.servermanager.ServerManager)
+     */
+    public void stopServer(String serverName) throws IOException
+    {
+        Server server = manager.getServer(serverName);
+
+        if (server.isRunning())
+            manager.stopServer(serverName);
+    }
+
+    /**
+     * Stop a group of servers. Any error stopping a server will logged and then the next one in the list will be tried.
+     *
+     * @param servers the names of the servers to be stopped
+     * @see ASTestConfig#stopServer(String)
+     */
+    public void stopServers(String ... servers)
+    {
+        for (String server : servers)
+        {
+            try
+            {
+                stopServer(server);
+            }
+            catch (IOException e)
+            {
+                System.err.println("Unable to stop server " + server);
+            }
+        }
+    }
+
+    public ServerManager getServerManager()
+    {
+        return manager;
+    }
+
+    /**
+     * Configure a target AS to start with a non-default set of bindings
+     *
+     * @param serverName the server whose bindings are being configured
+     * @throws TransformerException error parsing the server bindings xml file
+     * @throws IOException error whilst locating the bindings file in the file system
+     * @throws SAXException error parsing the server bindings xml file
+     * @throws ParserConfigurationException error parsing the server bindings xml file
+     */
+    public void configureServerBinding(String serverName) throws TransformerException, IOException, SAXException, ParserConfigurationException
+    {
+        ServerWrapper server = new ServerWrapper(manager.getServer(serverName));
+        String configHome = getProductDir();
+        String mbeanServiceFile = getServerPath(serverName) + "conf/jboss-service.xml";
+        String bindingName = server.getSysProperty("server.binding.name");
+        String bindingFile = server.getSysProperty("server.binding.location");
+
+        if (bindingFile == null)
+            return;
+
+        bindingFile = configHome + bindingFile;
+
+        // if bindingName is set then it is safe to check that the AS is up via the Naming service port
+        // BTW the AS5 team has changed the behavior of the naming service port - it is opened before
+        // all the services have been configured so any target deployments may not have been initialised
+        // when the server is declared as running. Instead we force the server to use a web server port to
+        // determine if the AS is running.
+        if (bindingName == null)
+            return;
+//            bindingName = ServerBindingConfig.DEFAULT_BINDING;
+//        else
+//            server.setHasWebServer(true);
+
+        ServerBindingConfig.setBinding(mbeanServiceFile, bindingName, bindingFile);
+
+        server.setRmiPort(ServerBindingConfig.lookupRmiPort(bindingFile, bindingName, server.getRmiPort()));
+        server.setHttpPort(ServerBindingConfig.lookupHttpPort(bindingFile, bindingName, server.getHttpPort()));
+
+        System.out.println("Using: " + Context.PROVIDER_URL
+                + " = jnp://"+ server.getHost() + ':' + server.getRmiPort()
+                + " and http port " + server.getHttpPort());
+    }
+}
\ No newline at end of file

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ClientAction.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ClientAction.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ClientAction.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,29 @@
+package org.jboss.jbossts.qa.astests.taskdefs;
+
+import java.util.Map;
+
+/**
+ * General mechanism for running code during the execution of an ant target
+ */
+public interface ClientAction
+{
+    /**
+     * Execute code in the context of an ant target
+     *
+     * @param config Configuration for this execution loaded from the ant script
+     * that triggered this action
+     * @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.jbossts.qa.astests.taskdefs.ASClientTask
+     */
+    boolean execute(ASTestConfig config, Map<String, String> params);
+
+    /**
+     * Cancel any executing operation
+     *
+     * @return true if the opeartion was cancelled
+     * @throws UnsupportedOperationException Not implemented
+     */
+    boolean cancel() throws UnsupportedOperationException;
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerBindingConfig.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerBindingConfig.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerBindingConfig.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,258 @@
+package org.jboss.jbossts.qa.astests.taskdefs;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.FileWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+
+import org.w3c.dom.*;
+import org.xml.sax.SAXException;
+
+/**
+ * Helper class to read a JBoss AS bindings file
+ */
+public class ServerBindingConfig
+{
+    private static final String BINDING_MANAGER_NAME = "jboss.system:service=ServiceBindingManager";
+    private static final String BINDING_MANAGER_CLASS = "org.jboss.services.binding.ServiceBindingManager";
+    private static final String STORE_FACTORY_CLASS = "org.jboss.services.binding.XMLServicesStoreFactory";
+    public static final String DEFAULT_BINDING = "ports-01";
+
+    /**
+     * Configure an AS to start up with a non-default set of bindings.
+     *
+     * An mbean entry will be inserted into xmlFile with a name specified by bindingName.
+     * The file bindingXml will contain an entry with the name bindingName.
+     * 
+     * @param xmlFile   The file that is to recieve the binding service specification
+     * @param bindingName The name of the binding definition to use
+     * @param bindingXml file name of the file that contains a group of binding definitions
+     * @throws IOException
+     * @throws ParserConfigurationException
+     * @throws org.xml.sax.SAXException
+     * @throws TransformerException
+     */
+    public static void setBinding(String xmlFile, String bindingName, String bindingXml) throws IOException, ParserConfigurationException,
+            org.xml.sax.SAXException, TransformerException
+    {
+        String xmlFileName = Utils.toFile(xmlFile).getAbsolutePath();
+
+        System.out.println("update bindings:");
+        System.out.println("\tConf File: " + xmlFileName);
+        System.out.println("\tBinding File: " + bindingXml);
+        System.out.println("\tBinding Name: " + bindingName);
+
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        documentBuilderFactory.setNamespaceAware(true);
+        documentBuilderFactory.setValidating(false);
+
+        DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        Document doc1 = documentBuilder.parse(xmlFileName);
+        Document doc2 = documentBuilder.newDocument();
+
+        doc2.appendChild(doc2.createElement("server"));
+
+        NodeList children = doc1.getDocumentElement().getChildNodes();
+        Node server2 = doc2.getDocumentElement();
+
+        // add an mbean entry for the server binding
+        server2.appendChild(createBinding(doc2, bindingName, bindingXml));
+
+        for (int i=0; i< children.getLength(); i++)
+        {
+            Node child = children.item(i);
+
+            if ("mbean".equals(child.getNodeName()))
+            {
+                String name = ((Element) child).getAttribute("name");
+
+                // ignore the original binding since we are creating a new one
+                if (BINDING_MANAGER_NAME.equals(name))
+                    continue;
+            }
+
+            // take a detached copy of the node and add it to the new document
+            Node copy = doc2.importNode(child, true).cloneNode(true);
+
+            server2.appendChild(copy);
+        }
+
+        printDocument(doc2, xmlFileName);
+    }
+
+    private static Element createBinding(Document document, String binding, String bindingXml)
+    {
+        Element mbean = document.createElement("mbean");
+
+        mbean.setAttribute("code", BINDING_MANAGER_CLASS);
+        mbean.setAttribute("name", BINDING_MANAGER_NAME);
+
+        mbean.appendChild(createMbeanAttribute(document, "ServerName", binding));
+        mbean.appendChild(createMbeanAttribute(document, "StoreURL", bindingXml));
+        mbean.appendChild(createMbeanAttribute(document, "StoreFactoryClassName", STORE_FACTORY_CLASS));
+
+        return mbean;
+    }
+
+    private static Element createMbeanAttribute(Document document, String name, String cdata)
+    {
+        Element element = document.createElement("attribute");
+
+        element.setAttribute("name", name);
+        element.setTextContent(cdata);
+
+        return element;
+    }
+
+    public static void printDocument(Document document, String fname){
+        try{
+
+            TransformerFactory tf = TransformerFactory.newInstance();
+            Transformer transformer = tf.newTransformer();
+            DOMSource source = new DOMSource(document);
+            StreamResult result;
+
+            if (fname == null)
+                result = new StreamResult(System.out);
+            else
+                result = new StreamResult(new FileWriter(fname));
+
+            transformer.transform(source, result);
+        }
+        catch(Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    private static Document getDocument(String xmlFile)
+    {
+        Document doc = null;
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+
+        documentBuilderFactory.setNamespaceAware(true);
+        documentBuilderFactory.setValidating(false);
+
+        try
+        {
+            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+            doc = documentBuilder.parse(xmlFile);
+        }
+        catch (ParserConfigurationException e)
+        {
+            System.out.println("Unable to locate an XML doc builder: " + e.getMessage());
+        }
+        catch (Exception e)
+        {
+            System.out.println("Error parsing " + xmlFile + ' ' + e.getMessage());
+        }
+
+        return doc;
+    }
+
+    public static Node findServiceConfig(String bindingsFile, String server, String service)
+    {
+        Document doc = getDocument(bindingsFile);
+
+        if (doc == null)
+            return null;
+
+        Node node = findNode(doc.getDocumentElement(), "server", "name", server);
+
+        return (node != null ? findNode(node, "service-config", "name", service) : null);
+    }
+
+    public static String findBindingPort(Node node)
+    {
+        node = findNode(node, "binding", "port", null);
+
+        return (node != null ? ((Element) node).getAttribute("port") : null);
+    }
+
+    private static int parseInt(String intValue, int defValue, String errMsg)
+    {
+        try
+        {
+            return (intValue != null ? Integer.parseInt(intValue) : defValue);
+        }
+        catch (NumberFormatException e)
+        {
+            if (errMsg != null)
+                System.out.println(errMsg);
+
+            return defValue;
+        }
+    }
+
+    public static int lookupHttpPort(String bindingsFile, String server, int defValue)
+    {
+        Node node = findServiceConfig(bindingsFile, server, "jboss:service=invoker,type=http");
+        String port = findBindingPort(node);
+
+        return parseInt(port, defValue, "Invalid port found in service-config for binding " + server);
+    }
+
+    public static int lookupRmiPort(String bindingsFile, String server, int defValue)
+    {
+        Node node = findServiceConfig(bindingsFile, server, "jboss:service=Naming");
+        String port = findBindingPort(node);
+
+        return parseInt(port, defValue, "Invalid port found in service-config for binding " + server);
+    }
+
+    /**
+     * Find a node with a given name and having a specified attribute
+     * @param node the node to start the search from
+     * @param nodeName the name of the xml node to look for the attribute
+     * @param attrName the name of the attribute to match against
+     * @param attrValue the value of the attribute to match against. If null
+     *  the first matching node with an attribute called attrName is returned
+     * @return the matching node
+     */
+    private static Node findNode(Node node, String nodeName, String attrName, String attrValue)
+    {
+        if (node != null)
+        {
+            NodeList children = node.getChildNodes();
+
+            for (int i = 0; i < children.getLength(); i++)
+            {
+                Node child = children.item(i);
+
+                if (nodeName.equals(child.getNodeName()))
+                {
+                    // found a node of the correct type - now see if it has the given attribute
+                    String value = ((Element) child).getAttribute(attrName);
+
+                    if (attrName == null || attrValue == null || value.equals(attrValue))
+                        return child;
+                }
+            }
+
+            System.out.println("Node of type " + nodeName + " with " + attrName + '=' + attrValue + " not found");
+        }
+
+        return null;
+    }
+
+    public static void main(String[] args) throws IOException, ParserConfigurationException,
+            org.xml.sax.SAXException, TransformerException
+    {
+        if (args.length >= 3) {
+            setBinding(args[0], args[1], args[2]);
+        } else if (args.length == 2) {
+            System.out.println("Rmi port: " + lookupRmiPort(args[0], args[1], -1));
+            System.out.println("Http port: " + lookupHttpPort(args[0], args[1], -1));
+        } else {
+            System.out.println("syntax: ServerBindingConfig <conf file path> <server binding name> <path of bindings file>");
+        }
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerTask.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerTask.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerTask.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,208 @@
+package org.jboss.jbossts.qa.astests.taskdefs;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.jboss.jbossas.servermanager.Server;
+import org.jboss.jbossas.servermanager.ServerManager;
+import org.xml.sax.SAXException;
+
+import javax.xml.transform.TransformerException;
+import javax.xml.parsers.ParserConfigurationException;
+import java.util.ArrayList;
+import java.io.*;
+
+public class ServerTask extends Task
+{
+    /** the method name for starting a server */
+    public static final String START = "start";
+    public static final String STOP = "stop";
+    public static final String DEPLOY = "deploy";
+    public static final String UNDEPLOY = "undeploy";
+
+    private ArrayList<TaskProperty> deployArtifacts = new ArrayList<TaskProperty>();
+    private ArrayList<TaskProperty> undeployArtifacts = new ArrayList<TaskProperty>();
+    private String method;
+    private String serverName;
+    private String waitFor;
+
+    public void execute() throws BuildException
+    {
+        String[] servers = serverName.split(",");
+
+        try
+        {
+            if (START.equals(method))
+                startServers(servers);
+            else if (STOP.equals(method))
+                stopServers(servers);
+            else if (DEPLOY.equals(method))
+                deploy(servers);
+            else if (UNDEPLOY.equals(method))
+                undeploy(servers);
+
+            if (waitFor != null)
+                ASClientTask.suspendFor(waitFor);
+        }
+        catch (ServerTaskException e)
+        {
+            throw new BuildException(e);
+        }
+    }
+
+    /**
+     * Specify which server operation is being requested
+     * @param method currently supported methods are "start" and "stop"
+     */
+    public void setMethod(String method)
+    {
+        this.method = method;
+    }
+
+    /** the name of the server to operate on */
+    public void setServerName(String serverName)
+    {
+        this.serverName = serverName;
+    }
+
+    /** suspend after performing the task - useful for deploy operations */
+    public void setWaitFor(String waitFor)
+    {
+        this.waitFor = waitFor;
+    }
+
+    /** list of artifacts that should be deployed to this server **/
+    public void addDeploy(TaskProperty arg)
+    {
+        deployArtifacts.add(arg);
+    }
+
+    /** list of artifacts that should be undeployed from this server **/
+    public void addUndeploy(TaskProperty arg)
+    {
+        undeployArtifacts.add(arg);
+    }
+
+    private void stopServers(String ... servers) throws ServerTaskException
+    {
+        ASTestConfig config = (ASTestConfig) getProject().getReference(ASTestConfig.CONFIG_REF);
+
+        for (String name : servers)
+        {
+            try
+            {
+                config.getServerManager().stopServer(name);
+            }
+            catch (IOException e)
+            {
+                throw new ServerTaskException("Error stoping server " + name);
+            }
+        }
+
+        undeploy(servers);
+    }
+
+    private void startServers(String ... servers) throws ServerTaskException
+    {
+        ASTestConfig config = (ASTestConfig) getProject().getReference(ASTestConfig.CONFIG_REF);
+
+        deploy(servers);
+
+        for (String name : servers)
+        {
+            try
+            {
+                config.getServerManager().startServer(name);
+            }
+            catch (IOException e)
+            {
+                throw new ServerTaskException("Error starting server " + name);
+            }
+        }
+    }
+
+    private void deploy(String ... servers) throws ServerTaskException
+    {
+        ASTestConfig config = (ASTestConfig) getProject().getReference(ASTestConfig.CONFIG_REF);
+        String configHome = config.getProductDir();
+
+        // configure the AS to start with a non-default set of bindings
+        for (String name : servers)
+        {
+            // make sure the server config exists
+            config.getServerManager().getServer(name);
+            // update its bindings if required
+            try
+            {
+                config.configureServerBinding(name);
+            }
+            catch (Exception e)
+            {
+                throw new ServerTaskException("Error configuring binding for server " + name, e);
+            }
+
+            // deploy any artifacts required by this test
+            try
+            {
+                deploy(deployArtifacts, configHome, config.getServerPath(name));
+                deploy(undeployArtifacts, config.getServerPath(name), configHome);
+            }
+            catch (IOException e)
+            {
+                throw new ServerTaskException("Error deploying artifacts to server " + name, e);
+            }
+        }
+    }
+
+    private void undeploy(String ... servers) throws ServerTaskException
+    {
+        deploy(servers);
+    }
+
+    // deploy any artifacts required by this test
+    private void deploy(ArrayList<TaskProperty> artifacts, String srcDir, String dstDir) throws IOException
+    {
+        for (TaskProperty artifact : artifacts)
+        {
+            File from = Utils.toFile(srcDir + artifact.getFrom());
+
+            if (artifact.getTo() == null)
+            {
+                // delete the artifact
+                System.out.println("Deleting artifact " + from.getAbsolutePath());
+                from.delete();
+            }
+            else if (!from.exists())
+            {
+                System.out.println("Deployment source " + from.getAbsolutePath() + " does not exist");
+            }
+            else
+            {
+                File to = Utils.toFile(dstDir + artifact.getTo());
+
+                if (to.isDirectory())
+                    to = new File(to.getAbsolutePath() + '/' + from.getName());
+
+                if (!to.getParentFile().exists())
+                {
+                    // to.mkdirs() is too presumtuous
+                    System.out.println("Deployment target directory " + to.getParent() + " does not exist");
+                }
+                else
+                {
+                    System.out.println("copying from " + from.getAbsolutePath() + " to " + to.getAbsolutePath());
+
+                    InputStream in = new FileInputStream(from);
+                    OutputStream out = new FileOutputStream(to);
+                    byte[] buf = new byte[1024];
+                    int len;
+
+                    while ((len = in.read(buf)) > 0)
+                        out.write(buf, 0, len);
+
+                    in.close();
+                    out.close();
+                }
+            }
+        }
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerTaskException.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerTaskException.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerTaskException.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,56 @@
+package org.jboss.jbossts.qa.astests.taskdefs;
+
+import java.util.Collection;
+import java.util.ArrayList;
+
+public class ServerTaskException extends Exception
+{
+    Collection<String> errors = new ArrayList<String> ();
+    Exception cause;
+
+    public ServerTaskException()
+    {
+    }
+
+    public ServerTaskException(String message)
+    {
+        super(message);
+    }
+
+    public ServerTaskException(String message, Throwable cause)
+    {
+        super(message, cause);
+    }
+
+    public ServerTaskException(Throwable cause)
+    {
+        super(cause);
+    }
+
+    public void addError(String error)
+    {
+        errors.add(error);
+    }
+
+    public void setCause(Exception cause)
+    {
+        this.cause = cause;
+    }
+
+    public ServerTaskException getServerTaskException()
+    {
+        if (cause == null && errors.size() == 0)
+            return this;
+
+        StringBuilder msg = new StringBuilder();
+        String nl = System.getProperty("line.separator");
+
+        for (String error : errors)
+        {
+            msg.append(error).append(nl);
+        }
+
+        //noinspection ThrowableInstanceNeverThrown
+        return new ServerTaskException(msg.toString(), cause);
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerWrapper.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerWrapper.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/ServerWrapper.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,245 @@
+package org.jboss.jbossts.qa.astests.taskdefs;
+
+import org.jboss.jbossas.servermanager.Server;
+import org.jboss.jbossas.servermanager.Argument;
+import org.jboss.jbossas.servermanager.Property;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.InitialContext;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Properties;
+
+/**
+ * Temporary wrapper for org.jboss.jbossas.servermanager.Server
+ */
+public class ServerWrapper
+{
+    Server server;
+    private Context namingContext;
+
+    public ServerWrapper(Server server)
+    {
+        this.server = server;
+    }
+
+    public String getName()
+    {
+        return server.getName();
+    }
+
+    public void setName(String name)
+    {
+        server.setName(name);
+    }
+
+    public String getUsername()
+    {
+        return server.getUsername();
+    }
+
+    public void setUsername(String username)
+    {
+        server.setUsername(username);
+    }
+
+    public String getPassword()
+    {
+        return server.getPassword();
+    }
+
+    public void setPassword(String password)
+    {
+        server.setPassword(password);
+    }
+
+    public void addArg(Argument arg)
+    {
+        server.addArg(arg);
+    }
+
+    public String getArgs()
+    {
+        return server.getArgs();
+    }
+
+    public void addJvmArg(Argument arg)
+    {
+        server.addJvmArg(arg);
+    }
+
+    public String getJvmArgs()
+    {
+        return server.getJvmArgs();
+    }
+
+    public void addSysProperty(Property property)
+    {
+        server.addSysProperty(property);
+    }
+
+    public String getSysProperties()
+    {
+        return server.getSysProperties();
+    }
+
+    public String getSysProperty(String key)
+    {
+        //args.append("-D" + property.getKey() + "=" + property.getValue() + " ");
+        key = "-D" + key + '=';
+        for (String k : server.getSysProperties().split(" "))
+        {
+            if (k.startsWith(key))
+                return k.substring(key.length());
+        }
+
+        return null;
+    }
+
+    public void setProcess(Process process)
+    {
+        server.setProcess(process);
+    }
+
+    public boolean isRunning()
+    {
+        return server.isRunning();
+    }
+
+    public boolean isStopped()
+    {
+        return server.isStopped();
+    }
+
+    public Process getProcess()
+    {
+        return server.getProcess();
+    }
+
+    public URL getHttpUrl()
+            throws MalformedURLException
+    {
+        return server.getHttpUrl();
+    }
+
+    public String getRmiUrl()
+    {
+        return server.getRmiUrl();
+    }
+
+    public String getConfig()
+    {
+        return server.getConfig();
+    }
+
+    public void setConfig(String config)
+    {
+        server.setConfig(config);
+    }
+
+    public String getHost()
+    {
+        return server.getHost();
+    }
+
+    public void setHost(String host)
+    {
+        server.setHost(host);
+    }
+
+    public void setHttpPort(Integer httpPort)
+    {
+        server.setHttpPort(httpPort);
+    }
+
+    /**
+     * Get the httpPort
+     *
+     * @return the rmi port
+     */
+    public Integer getHttpPort()
+    {
+        try
+        {
+            return server.getHttpUrl().getPort();
+        }
+        catch (MalformedURLException e)
+        {
+            return 8080;            
+        }
+    }
+
+    public void setRmiPort(Integer rmiPort)
+    {
+        server.setRmiPort(rmiPort);
+    }
+
+    public Integer getRmiPort()
+    {
+        return server.getRmiPort();
+    }
+
+    public File getErrorLog()
+    {
+        return server.getErrorLog();
+    }
+
+    public File getOutputLog()
+    {
+        return server.getOutputLog();
+    }
+
+    public void setOutWriter(PrintWriter outlog)
+    {
+        server.setOutWriter(outlog);
+    }
+
+    public PrintWriter getOutWriter()
+    {
+        return server.getOutWriter();
+    }
+
+    public PrintWriter getErrorWriter()
+    {
+        return server.getErrorWriter();
+    }
+
+    public void setErrorWriter(PrintWriter errorlog)
+    {
+        server.setErrorWriter(errorlog);
+    }
+
+    public boolean hasWebServer()
+    {
+        return server.hasWebServer();
+    }
+
+    public void setHasWebServer(boolean hasWebServer)
+    {
+        server.setHasWebServer(hasWebServer);
+    }
+
+    public void setNamingContext(Context namingContext)
+    {
+        this.namingContext = namingContext;
+    }
+
+    public Context getNamingContext() throws NamingException
+    {
+        if (namingContext == null)
+        {
+            Properties properties = new Properties();
+
+            properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, ("org.jboss.naming.NamingContextFactory"));
+            properties.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
+            properties.setProperty(Context.PROVIDER_URL, "jnp://"+ getHost() + ':' + getRmiPort());
+
+            setNamingContext(new InitialContext(properties));
+        }
+
+        return namingContext;
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/TaskProperty.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/TaskProperty.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/TaskProperty.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,52 @@
+package org.jboss.jbossts.qa.astests.taskdefs;
+
+/**
+ * Key/value holder for passing in parameters to custom ant tasks
+ */
+public class TaskProperty
+{
+    private String key;
+    private String value;
+
+    public String getKey()
+    {
+        return key;
+    }
+
+    public void setKey(String key)
+    {
+        this.key = key;
+    }
+
+    public String getValue()
+    {
+        return value;
+    }
+
+    public void setValue(String value)
+    {
+        this.value = value;
+    }
+
+    // add some syntactic sugar to make specific use of properties more intuitive
+
+    public String getFrom()
+    {
+        return key;
+    }
+
+    public void setFrom(String from)
+    {
+        this.key = from;
+    }
+
+    public String getTo()
+    {
+        return value;
+    }
+
+    public void setTo(String to)
+    {
+        this.value = to;
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/TaskValue.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/TaskValue.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/TaskValue.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,19 @@
+package org.jboss.jbossts.qa.astests.taskdefs;
+
+/**
+ * Value holder for passing in parameters to custom ant tasks
+ */
+public class TaskValue
+{
+    String value;
+
+    public String getValue()
+    {
+        return value;
+    }
+
+    public void setValue(String value)
+    {
+        this.value = value;
+    }
+}

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/TransactionLog.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/TransactionLog.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/TransactionLog.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,148 @@
+package org.jboss.jbossts.qa.astests.taskdefs;
+
+import com.arjuna.ats.arjuna.objectstore.ObjectStore;
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.gandiva.ClassName;
+import com.arjuna.ats.arjuna.exceptions.ObjectStoreException;
+import com.arjuna.ats.arjuna.state.InputObjectState;
+import com.arjuna.ats.arjuna.AtomicAction;
+import com.arjuna.ats.arjuna.coordinator.ActionStatus;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Collection;
+
+/**
+ * Utility class for interaction with a transaction log
+ */
+public class TransactionLog
+{
+    /**
+     * Default object type for store operations
+     */
+    public static final String DEFAULT_OBJECT_TYPE = "StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction";
+
+    private ObjectStore store;
+
+    public TransactionLog(String storeDir, String impleType)
+    {
+        init(storeDir, impleType);
+    }
+
+    private void init(String storeDir, String impleType)
+    {
+        System.setProperty("com.arjuna.ats.arjuna.objectstore.objectStoreDir", storeDir);
+
+        if (impleType != null)
+            store = new ObjectStore(new ClassName(impleType), (String) null);
+        else
+            store = new ObjectStore();
+    }
+
+    /**
+     * Remove any committed objects from the storer
+     * @param objectType the type of objects that should be removed
+     * @return the number of objects that were purged
+     * @throws ObjectStoreException the store implementation was unable to remove a committed object
+     */
+    public int clearXids(String objectType) throws ObjectStoreException
+    {
+        Collection<Uid> uids = getIds(objectType);
+
+        for (Uid uid : uids)
+            store.remove_committed(uid, objectType);
+
+        return uids.size();
+    }
+
+    public Collection<Uid> getIds(String objectType) throws ObjectStoreException
+    {
+        return getIds(null, objectType);
+    }
+
+    /**
+     * Get a list object ids for a given object type
+     *
+     * @param ids holder for the returned uids
+     * @param objectType The type of object to search in the store for
+     * @return all objects of the given type
+     * @throws ObjectStoreException the store implementation was unable retrieve all types of objects
+     */
+    public Collection<Uid> getIds(Collection<Uid> ids, String objectType) throws ObjectStoreException
+    {
+        if (ids == null)
+            ids = new ArrayList<Uid> ();
+
+
+        InputObjectState types = new InputObjectState();
+
+        if (store.allTypes(types))
+        {
+            String theName;
+
+            try
+            {
+                boolean endOfList = false;
+
+                while (!endOfList)
+                {
+                    theName = types.unpackString();
+
+                    if (theName.compareTo("") == 0)
+                        endOfList = true;
+                    else
+                    {
+                        if (objectType != null && !theName.equals(objectType))
+                            continue;
+
+                        InputObjectState uids = new InputObjectState();
+
+                        if (store.allObjUids(theName, uids))
+                        {
+                            Uid theUid = new Uid(Uid.nullUid());
+
+                            try
+                            {
+                                boolean endOfUids = false;
+
+                                while (!endOfUids)
+                                {
+                                    theUid.unpack(uids);
+
+                                    if (theUid.equals(Uid.nullUid()))
+                                        endOfUids = true;
+                                    else
+                                        ids.add(theUid);
+                                }
+                            }
+                            catch (Exception e)
+                            {
+                                // end of uids!
+                            }
+                        }
+
+                        System.out.println();
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                System.err.println(e);
+
+                // end of list!
+            }
+        }
+
+        return ids;
+    }
+
+    public int getStatus(Uid uid)
+    {
+        AtomicAction action = new AtomicAction(uid);
+
+        action.activate();
+
+        return action.status();
+    }
+}
\ No newline at end of file

Added: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/Utils.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/Utils.java	                        (rev 0)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/astests/taskdefs/Utils.java	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,20 @@
+package org.jboss.jbossts.qa.astests.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();
+        }
+    }
+
+}

Added: labs/jbosstm/trunk/qa/testselections/300_AJQ_Linux.xml
===================================================================
--- labs/jbosstm/trunk/qa/testselections/300_AJQ_Linux.xml	                        (rev 0)
+++ labs/jbosstm/trunk/qa/testselections/300_AJQ_Linux.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,12 @@
+<test_selection>
+    <description>AJQ_Linux</description>
+    <os id="Linux">
+        <product id="JBossTS_JTS_JacORB_QA">
+            <test_group id="ASCrashRecovery01">
+                <test id="ASCrashRecovery01_Test01" selected="true"/>
+                <test id="ASCrashRecovery01_Test02" selected="true"/>
+                <test id="ASCrashRecovery01_Test03" selected="true"/>                
+            </test_group>
+        </product>
+    </os>
+</test_selection>

Added: labs/jbosstm/trunk/qa/testselections/301_JTAQ_Linux.xml
===================================================================
--- labs/jbosstm/trunk/qa/testselections/301_JTAQ_Linux.xml	                        (rev 0)
+++ labs/jbosstm/trunk/qa/testselections/301_JTAQ_Linux.xml	2008-08-04 10:31:05 UTC (rev 21336)
@@ -0,0 +1,12 @@
+<test_selection>
+	<description>JTAQ_Linux</description>
+	<os id="Linux">
+            <product id="JBossTS_JTA_QA">
+                <test_group id="ASCrashRecovery01">
+                    <test id="ASCrashRecovery01_Test01" selected="true"/>
+                    <test id="ASCrashRecovery01_Test02" selected="true"/>
+                    <test id="ASCrashRecovery01_Test03" selected="true"/>
+                </test_group>
+            </product>
+	</os>
+</test_selection>




More information about the jboss-svn-commits mailing list