[jboss-svn-commits] JBL Code SVN: r37661 - in labs/jbosstm/trunk/XTS/sar/tests/arquillian: src/test/java/org/jboss/jbossts/xts/crash/test and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Oct 24 04:49:59 EDT 2011


Author: zhfeng
Date: 2011-10-24 04:49:58 -0400 (Mon, 24 Oct 2011)
New Revision: 37661

Added:
   labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/SingleParticipantPrepareAndCommit.java
   labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/TestATCrashDuringOnePhaseCommitSuite.java
   labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/WatchRecoveryATCrashDuringOnePhaseCommit.java
   labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/lib/
   labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/lib/byteman.jar
   labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/scripts/
   labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/scripts/ATCrashDuringOnePhaseCommit.txt
Removed:
   labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/at/
   labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/ba/
Modified:
   labs/jbosstm/trunk/XTS/sar/tests/arquillian/
   labs/jbosstm/trunk/XTS/sar/tests/arquillian/pom.xml
   labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/arquillian.xml
Log:
JBTM-817 update add byteman and script to crash tests


Property changes on: labs/jbosstm/trunk/XTS/sar/tests/arquillian
___________________________________________________________________
Modified: svn:ignore
   - target
.project
.settings
.classpath

   + target
.project
.settings
.classpath
testlog


Modified: labs/jbosstm/trunk/XTS/sar/tests/arquillian/pom.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/pom.xml	2011-10-23 20:34:53 UTC (rev 37660)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/pom.xml	2011-10-24 08:49:58 UTC (rev 37661)
@@ -1,211 +1,253 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- JBoss, Home of Professional Open Source Copyright 2009, Red Hat Middleware 
-	LLC, and individual contributors as indicated by the @author tags. See the 
-	copyright.txt in the distribution for a full listing of individual contributors. 
-	This copyrighted material is made available to anyone wishing to use, modify, 
-	copy, or redistribute it subject to the terms and conditions of the GNU Lesser 
-	General Public License, v. 2.1. This program is distributed in the hope that 
-	it will be useful, but WITHOUT A WARRANTY; without even the implied warranty 
-	of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 
-	General Public License for more details. You should have received a copy 
-	of the GNU Lesser General Public License, v.2.1 along with this distribution; 
-	if not, write to the Free Software Foundation, Inc., 51 Franklin Street, 
-	Fifth Floor, Boston, MA 02110-1301, USA. (C) 2009 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<!--
+   <modelVersion>4.0.0</modelVersion>
+
+   <groupId>org.jboss.as.quickstarts</groupId>
+   <artifactId>xtstest</artifactId>
+   <version>7.0.1-SNAPSHOT</version>
+   <packaging>war</packaging>
+   -->
+   <!--
 	<parent>
 		<groupId>org.jboss.narayana.xts</groupId>
 		<artifactId>xts-all</artifactId>
 		<version>5.0.0.M2-SNAPSHOT</version>
 		<relativePath>../pom.xml</relativePath>
 	</parent>
-    <modelVersion>4.0.0</modelVersion>
+	-->
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.jboss.narayana.xts</groupId>
 	<artifactId>xtstest</artifactId>
 	<name>xts crash recovery tests</name>
 	<description>xts crash recovery tests</description>
 	<packaging>war</packaging>
+	<version>5.0.0.M2-SNAPSHOT</version>
+	<licenses>
+		<license>
+			<name>Apache License, Version 2.0</name>
+			<distribution>repo</distribution>
+			<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
+		</license>
+	</licenses>
 	<properties>
-		<!-- For arquillian -->
-		<jbossHome>${env.JBOSS_HOME}</jbossHome>
-	</properties>
-	<build>
-		<finalName>${project.artifactId}</finalName>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-deploy-plugin</artifactId>
-				<version>2.6</version>
-				<configuration>
-					<skip>true</skip>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-war-plugin</artifactId>
-				<version>2.1.1</version>
-				<configuration>
-					<!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
-					<failOnMissingWebXml>false</failOnMissingWebXml>
-					<archive>
-						<manifestEntries>
-							<Dependencies>org.jboss.xts,org.jboss.ws.cxf.jbossws-cxf-client services export</Dependencies>
-						</manifestEntries>
-					</archive>
-				</configuration>
-			</plugin>
-			<!-- JBoss AS plugin to deploy war as a convenience -->
-			<plugin>
-				<groupId>org.jboss.as.plugins</groupId>
-				<artifactId>jboss-as-maven-plugin</artifactId>
-				<version>7.0.0.CR1</version>
-			</plugin>
-			<!-- Compiler plugin enforces Java 1.6 compatibility and activates annotation 
-				processors -->
-	  <plugin>
-		  <groupId>org.apache.maven.plugins</groupId>
-		  <artifactId>maven-compiler-plugin</artifactId>
-		  <version>2.3.2</version>
-		  <configuration>
-			  <source>1.6</source>
-			  <target>1.6</target>
-		  </configuration>
-	  </plugin>
-  </plugins>
-  </build>
-  <dependencyManagement>
-	  <dependencies>
-		  <!-- Define the version of JBoss' Java EE 6 APIs we want to import. Any 
-				dependencies from org.jboss.spec will have their version defined by this 
-				BOM -->
-	  <!-- JBoss distributes a complete set of Java EE 6 APIs including a Bill 
-				of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection) 
-				of artifacts. We use this here so that we always get the correct versions 
-				of artifacts. Here we use the jboss-javaee-web-6.0 stack (you can read this 
-				as the JBoss stack of the Java EE Web Profile 6 APIs), and we use version 
-				2.0.0.Beta1 which is the latest release of the stack. You can actually use 
-				this stack with any version of JBoss AS that implements Java EE 6, not just 
-				JBoss AS 7! -->
+		<!-- Explicitly declaring the source encoding eliminates the following 
+		 message: -->
+	  <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered 
+		 resources, i.e. build is platform dependent! -->
+	  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	  <!-- Timestamp format for the maven.build.timestamp property -->
+	  <!-- You can reference property in pom.xml or filtered resources (must 
+		 enable third-party plugin if using Maven < 2.1) -->
+	  <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
+	  <!-- Specify the JBoss AS directory to be the JBOSS_HOME environment 
+		 variable -->
+	  <jboss.home>${env.JBOSS_HOME}</jboss.home>
+	  <bytemanHome>${env.BYTEMAN_HOME}</bytemanHome>
+  </properties>
+  <repositories>
+	  <!-- The JBoss Community public repository is a composite repository 
+		 of several major repositories -->
+	  <!-- see http://community.jboss.org/wiki/MavenGettingStarted-Users -->
+	  <repository>
+		  <id>jboss-public-repository</id>
+		  <name>JBoss Repository</name>
+		  <url>http://repository.jboss.org/nexus/content/groups/public</url>
+		  <!-- These optional flags are designed to speed up your builds by 
+			reducing remote server calls -->
+		 <releases>
+			 <enabled>true</enabled>
+		 </releases>
+		 <snapshots>
+			 <enabled>false</enabled>
+		 </snapshots>
+	 </repository>
+ </repositories>
+ <pluginRepositories>
+	 <pluginRepository>
+		 <id>jboss-public-repository</id>
+		 <name>JBoss Repository</name>
+		 <url>http://repository.jboss.org/nexus/content/groups/public</url>
+		 <releases>
+			 <enabled>true</enabled>
+		 </releases>
+		 <snapshots>
+			 <enabled>false</enabled>
+		 </snapshots>
+	 </pluginRepository>
+ </pluginRepositories>
+ <dependencyManagement>
+	 <dependencies>
+		 <!-- Define the version of JBoss' Java EE 6 APIs we want to import. 
+			Any dependencies from org.jboss.spec will have their version defined by this 
+			BOM -->
+		 <!-- JBoss distributes a complete set of Java EE 6 APIs including 
+			a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or 
+			a collection) of artifacts. We use this here so that we always get the correct 
+			versions of artifacts. Here we use the jboss-javaee-web-6.0 stack (you can 
+			read this as the JBoss stack of the Java EE Web Profile 6 APIs), and we use 
+			version 2.0.0.Beta1 which is the latest release of the stack. You can actually 
+			use this stack with any version of JBoss AS that implements Java EE 6, not 
+			just JBoss AS 7! -->
+		 <dependency>
+			 <groupId>org.jboss.spec</groupId>
+			 <artifactId>jboss-javaee-web-6.0</artifactId>
+			 <version>2.0.0.Final</version>
+			 <type>pom</type>
+			 <scope>import</scope>
+		 </dependency>
+	 </dependencies>
+ </dependencyManagement>
+ <dependencies>
+	 <!-- First declare the APIs we depend on and need for compilation.
+		 All of them are provided by JBoss AS 7 -->
+	<!-- Import the injection annotations -->
 	  <dependency>
-		  <groupId>org.jboss.spec</groupId>
-		  <artifactId>jboss-javaee-web-6.0</artifactId>
-		  <version>2.0.0.CR1</version>
-		  <type>pom</type>
-		  <scope>import</scope>
+		  <groupId>javax.inject</groupId>
+		  <artifactId>javax.inject</artifactId>
+		  <version>1</version>
+		  <scope>provided</scope>
 	  </dependency>
+
+	  <!-- Import the EJB API, we use provided scope as the API is included 
+		 in JBoss AS 7 -->
+	  <dependency>
+		  <groupId>org.jboss.spec.javax.ejb</groupId>
+		  <artifactId>jboss-ejb-api_3.1_spec</artifactId>
+		  <scope>provided</scope>
+	  </dependency>
+
+	  <!-- Needed for running tests (you may also use TestNG) -->
+	  <dependency>
+		  <groupId>junit</groupId>
+		  <artifactId>junit</artifactId>
+		  <version>4.8.1</version>
+		  <scope>test</scope>
+	  </dependency>
+
+	  <!-- Optional, but highly recommended -->
+	  <!-- Arquillian allows you to test enterprise code such as EJBs and 
+		 Transactional(JTA) JPA from JUnit/TestNG -->
+	  <dependency>
+		  <groupId>org.jboss.arquillian.junit</groupId>
+		  <artifactId>arquillian-junit-container</artifactId>
+		  <version>1.0.0.CR5</version>
+		  <scope>test</scope>
+	  </dependency>
+
+	  <dependency>
+		  <groupId>org.jboss.narayana.xts</groupId>
+		  <artifactId>jbossxts</artifactId>
+		  <version>5.0.0.M2-SNAPSHOT</version>
+		  <scope>provided</scope>
+	  </dependency>
+	  <dependency>
+		  <groupId>org.jboss.logging</groupId>
+		  <artifactId>jboss-logging</artifactId>
+		  <scope>provided</scope>
+		  <version>3.0.0.Beta5</version>
+	  </dependency>
+	  <dependency>
+		  <groupId>org.jboss.logging</groupId>
+		  <artifactId>jboss-logging-processor</artifactId>
+		  <scope>provided</scope>
+		  <version>1.0.0.Beta6</version>
+	  </dependency>
   </dependencies>
-  </dependencyManagement>
-  <dependencies>
-	<!-- Import the injection annotations -->
-	<dependency>
-		<groupId>javax.inject</groupId>
-		<artifactId>javax.inject</artifactId>
-		<version>1</version>
-		<scope>provided</scope>
-	</dependency>
-	<!-- We will provide some tests to check the quickstart deploys ok -->
-	<dependency>
-		<groupId>junit</groupId>
-		<artifactId>junit</artifactId>
-		<version>4.8.1</version>
-		<scope>test</scope>
-	</dependency>
-	<!-- Arquillian allows you to test the example inside a container -->
-	<dependency>
-		<groupId>org.jboss.arquillian.junit</groupId>
-		<artifactId>arquillian-junit-container</artifactId>
-		<version>1.0.0.CR1</version>
-		<scope>test</scope>
-	</dependency>
-	<!--
-	<dependency>
-		<groupId>org.jboss.arquillian.extension</groupId>
-		<artifactId>arquillian-extension-byteman</artifactId>
-		<version>1.0.0.Alpha5</version>
-		<scope>test</scope>
-	</dependency>
-	-->
-	<dependency>
-		<groupId>org.jboss.narayana.xts</groupId>
-		<artifactId>jbossxts</artifactId>
-		<scope>provided</scope>
-	</dependency>
-	<dependency>
-		<groupId>org.jboss.logging</groupId>
-		<artifactId>jboss-logging</artifactId>
-		<scope>provided</scope>
-	</dependency>
-	<dependency>
-		<groupId>org.jboss.logging</groupId>
-		<artifactId>jboss-logging-processor</artifactId>
-		<scope>provided</scope>
-	</dependency>
-	<!-- Import the EJB API, we use provided scope as the API is included in 
-			JBoss AS 7 -->
-	<dependency>
-		<groupId>org.jboss.spec.javax.ejb</groupId>
-		<artifactId>jboss-ejb-api_3.1_spec</artifactId>
-		<scope>provided</scope>
-	</dependency>
-</dependencies>
-<profiles>
-	<profile>
-		<!-- The default profile skips all tests, though you can tune it 
+  <build>
+	  <!-- Maven will append the version to the finalName (which is the name 
+		 given to the generated war, and hence the context root) -->
+	  <finalName>${project.artifactId}</finalName>
+	  <plugins>
+		  <!-- Compiler plugin enforces Java 1.6 compatibility and activates 
+			annotation processors -->
+		 <plugin>
+			 <artifactId>maven-compiler-plugin</artifactId>
+			 <version>2.3.1</version>
+			 <configuration>
+				 <source>1.6</source>
+				 <target>1.6</target>
+			 </configuration>
+		 </plugin>
+		 <plugin>
+			 <artifactId>maven-war-plugin</artifactId>
+			 <version>2.1.1</version>
+			 <configuration>
+				 <!-- Java EE 6 doesn't require web.xml, Maven needs to catch 
+				  up! -->
+			   <failOnMissingWebXml>false</failOnMissingWebXml>
+			   <archive>
+				   <manifestEntries>
+					   <Dependencies>deployment.arquillian-service,org.jboss.xts,org.jboss.ws.cxf.jbossws-cxf-client services export</Dependencies>
+				   </manifestEntries>
+			   </archive>
+		   </configuration>
+	   </plugin>
+   </plugins>
+   </build>
+
+   <profiles>
+	   <profile>
+		   <!-- The default profile skips all tests, though you can tune it 
 			to run just unit tests based on a custom pattern -->
-	  <!-- Seperate profiles are provided for running all tests, including 
+		 <!-- Seperate profiles are provided for running all tests, including 
 			Arquillian tests that execute in the specified container -->
-	  <id>default</id>
-	  <activation>
-		  <activeByDefault>true</activeByDefault>
-	  </activation>
-	  <build>
-		  <plugins>
-			  <plugin>
-				  <artifactId>maven-surefire-plugin</artifactId>
-				  <version>2.7.2</version>
-				  <configuration>
-					  <skip>true</skip>
-				  </configuration>
-			  </plugin>
-			  <!-- The JBoss AS plugin deploys your war to a local JBoss 
+		 <id>default</id>
+		 <activation>
+			 <activeByDefault>true</activeByDefault>
+		 </activation>
+		 <build>
+			 <plugins>
+				 <plugin>
+					 <artifactId>maven-surefire-plugin</artifactId>
+					 <version>2.7.2</version>
+					 <configuration>
+						 <skip>true</skip>
+					 </configuration>
+				 </plugin>
+				 <!-- The JBoss AS plugin deploys your war to a local JBoss 
 				  AS container -->
-		  <!-- To use, set the JBOSS_HOME environment variable and run: 
+			   <!-- To use, set the JBOSS_HOME environment variable and run: 
 				  mvn package jboss-as:deploy -->
-		  <plugin>
-			  <groupId>org.jboss.as.plugins</groupId>
-			  <artifactId>jboss-as-maven-plugin</artifactId>
-			  <version>7.0.0.CR1</version>
-		  </plugin>
-	  </plugins>
-  </build>
-	</profile>
-	<profile>
-		<!-- An optional Arquillian testing profile that executes tests in your 
-				JBoss AS instance -->
-	  <!-- This profile will start a new JBoss AS instance, and execute the 
-				test, shutting it down when done -->
-	  <!-- Run with: mvn clean test -Parq-jbossas-managed -->
-	  <id>arq-jbossas-managed</id>
-	  <dependencies>
-		  <dependency>
-			  <groupId>org.jboss.as</groupId>
-			  <artifactId>jboss-as-arquillian-container-managed</artifactId>
-			  <version>7.0.0.CR1</version>
-			  <scope>test</scope>
-		  </dependency>
-	  </dependencies>
-  </profile>
-  <profile>
-	  <!-- An optional Arquillian testing profile that executes tests in a remote 
-				JBoss AS instance -->
-	  <!-- Run with: mvn clean test -Parq-jbossas-remote -->
-	  <id>arq-jbossas-remote</id>
-	  <dependencies>
-		  <dependency>
-			  <groupId>org.jboss.as</groupId>
-			  <artifactId>jboss-as-arquillian-container-remote</artifactId>
-			  <version>7.0.0.CR1</version>
-			  <scope>test</scope>
-		  </dependency>
-	  </dependencies>
-  </profile>
-  </profiles>
+			   <plugin>
+				   <groupId>org.jboss.as.plugins</groupId>
+				   <artifactId>jboss-as-maven-plugin</artifactId>
+				   <version>7.0.1.Final</version>
+			   </plugin>
+		   </plugins>
+	   </build>
+   </profile>
+
+   <profile>
+	   <!-- An optional Arquillian testing profile that executes tests 
+			in your JBoss AS instance -->
+		 <!-- This profile will start a new JBoss AS instance, and execute the
+			  test, shutting it down when done -->
+		 <!-- Run with: mvn clean test -Parq-jbossas-managed -->
+		 <id>arq-jbossas-managed</id>
+		 <dependencies>
+			 <dependency>
+				 <groupId>org.jboss.as</groupId>
+				 <artifactId>jboss-as-arquillian-container-managed</artifactId>
+				 <version>7.0.2.Final</version>
+				 <scope>test</scope>
+			 </dependency>
+		 </dependencies>
+	 </profile>
+
+	 <profile>
+		 <!-- An optional Arquillian testing profile that executes tests 
+			in a remote JBoss AS instance -->
+		 <!-- Run with: mvn clean test -Parq-jbossas-remote -->
+		 <id>arq-jbossas-remote</id>
+		 <dependencies>
+			 <dependency>
+				 <groupId>org.jboss.as</groupId>
+				 <artifactId>jboss-as-arquillian-container-remote</artifactId>
+				 <version>7.0.2.Final</version>
+				 <scope>test</scope>
+			 </dependency>
+		 </dependencies>
+	 </profile>
+ </profiles>
 </project>

Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/SingleParticipantPrepareAndCommit.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/SingleParticipantPrepareAndCommit.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/SingleParticipantPrepareAndCommit.java	2011-10-24 08:49:58 UTC (rev 37661)
@@ -0,0 +1,41 @@
+package org.jboss.jbossts.xts.crash.test;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.jbossts.xts.servicetests.bean.XTSServiceTestRunnerBean;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class SingleParticipantPrepareAndCommit {
+
+	@Inject
+	private XTSServiceTestRunnerBean testRunner;
+
+	@Deployment @TargetsContainer("container-at-crash-during-one-phase-commit")
+	public static Archive<?> createTestArchive() {
+		WebArchive archive = ShrinkWrap.
+		createFromZipFile(WebArchive.class, new File("target/xtstest.war"));
+		return archive;	
+	}
+
+
+	@Test(expected = Exception.class)
+	public void runTest() throws Exception {
+		String testName = 
+			"org.jboss.jbossts.xts.servicetests.test.at.SingleParticipantPrepareAndCommitTest";
+
+		testRunner.runTest(testName);
+
+		fail("this should be crash by byteman script");
+	}
+}

Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/TestATCrashDuringOnePhaseCommitSuite.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/TestATCrashDuringOnePhaseCommitSuite.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/TestATCrashDuringOnePhaseCommitSuite.java	2011-10-24 08:49:58 UTC (rev 37661)
@@ -0,0 +1,14 @@
+package org.jboss.jbossts.xts.crash.test;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+ at RunWith(Suite.class)
+ at Suite.SuiteClasses({
+	SingleParticipantPrepareAndCommit.class,
+	WatchRecoveryATCrashDuringOnePhaseCommit.class
+})
+
+public class TestATCrashDuringOnePhaseCommitSuite {
+
+}

Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/WatchRecoveryATCrashDuringOnePhaseCommit.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/WatchRecoveryATCrashDuringOnePhaseCommit.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/crash/test/WatchRecoveryATCrashDuringOnePhaseCommit.java	2011-10-24 08:49:58 UTC (rev 37661)
@@ -0,0 +1,18 @@
+package org.jboss.jbossts.xts.crash.test;
+
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+import org.jboss.arquillian.junit.Arquillian;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class WatchRecoveryATCrashDuringOnePhaseCommit {
+	
+	@TargetsContainer("container-at-crash-during-one-phase-commit")
+	
+	@Test
+	public void watch() throws Exception {
+		// wait recovery to happen
+		Thread.sleep(3 * 60 * 1000);
+	}
+}

Modified: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/arquillian.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/arquillian.xml	2011-10-23 20:34:53 UTC (rev 37660)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/arquillian.xml	2011-10-24 08:49:58 UTC (rev 37661)
@@ -1,19 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/schema/arquillian
 	http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
-
-	<!-- Uncomment to have test archives exported to the file system for inspection -->
 	<engine>
-		<property name="deploymentExportPath">target/exploded-artifact-for-inspection</property>
-	</engine>
-
+       	<property name="maxTestClassesBeforeRestart">1</property>
+   </engine>
 	<!-- Example configuration for a remote JBoss AS 7 instance -->
-	<container qualifier="jboss" default="true">
+	<container qualifier="container-at-crash-during-one-phase-commit" default="true">
 		<protocol type="jmx-as7">
 			<property name="executionType">REMOTE</property>
 		</protocol>
 		<configuration>
 			<property name="serverConfig">standalone-xts.xml</property>
+			<property name="javaVmArguments">-Djboss.modules.system.pkgs=org.jboss.byteman -Dorg.jboss.byteman.transform.all -javaagent:target/test-classes/lib/byteman.jar=script:target/test-classes/scripts/ATCrashDuringOnePhaseCommit.txt,boot:target/test-classes/lib/byteman.jar,listener:true</property>
 		</configuration>
 	</container>
 

Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/lib/byteman.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/lib/byteman.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/scripts/ATCrashDuringOnePhaseCommit.txt
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/scripts/ATCrashDuringOnePhaseCommit.txt	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/scripts/ATCrashDuringOnePhaseCommit.txt	2011-10-24 08:49:58 UTC (rev 37661)
@@ -0,0 +1,444 @@
+##############################################################################
+# JBoss, Home of Professional Open Source
+# Copyright 2009, Red Hat Middleware LLC, and individual contributors
+# by the @authors tag. See the copyright.txt in the distribution for a
+# full listing of individual contributors.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+# @authors Andrew Dinn
+#
+# AT Crash During One PhaseCommit
+#
+# This script automates testing of a specific recovery scenario for the
+# JBossTS XTS implementation of the WS-AT 1.1 protocol using orchestration
+# rules. The scenario employs a client, coordinator and 1 web service
+# running in a single JVM. It is also possible to run the test using
+# separate JVMs for the coordinator and participant web service but this
+# requires incluson of some extra rules which make sure the coordinator
+# and participant JVMs both crash.
+# The general scenario differentiates between events happening in the
+# coordinator JVM (AS1) and events happening in the participant JVM (AS2)
+# and rules are categorised according as to which AS they apply to.
+# The scenario is as follows (** indicates intercession by a Byteman rule):
+#
+# AS1 boots
+# AS2 boots
+# Client starts a WS-AT activity (AS1 or AS2 or even AS3)
+# Client invokes web service
+# Web service registers participant P1 (AS2)
+#
+# Client initiates transaction commit
+#
+# Coordinator initiates prepare of participant P1
+# ** AS1 Rule system traces dispatch of prepare to P1
+# ** AS2 Rule system traces receipt of prepare by P1
+# ** AS2 Rule system traces dispatch of prepared by P1
+# ** AS1 Rule system traces receipt of prepared from P1
+#
+# Coordinator sends commit of participant P1
+# -- Extra steps when AS1 != AS2
+# ** AS1 Rule system intercepts after send of commit
+#    has completed and kills AS1 JVM
+# -- End of extra steps
+# Participant P1 receives commit
+# ** AS2 Rule system intercepts commit and kills AS2 JVM
+#
+# -- Extra steps when AS1 != AS2
+# Coordinator resends commit of participant P1
+# ** AS1 Rule system intercepts commit and kills AS1 JVM
+# AS1 reboots
+# -- End of extra steps
+#
+# -- Extra steps when AS1 != AS2
+# AS1 reboots
+# -- End of extra steps
+#
+# AS2 reboots
+#
+# AS2 Recovery system starts after 2 minutes
+# Recovery system recreates participant stub for P1
+# ** AS2 Rule system traces create
+#
+# Participant P1 sends GetStatus to coordinator
+# ** AS2 Rule system traces dispatch of prepared by P1
+# Coordinator receives GetStatus message
+# ** AS1 Rule system traces receipt of GetStatus
+# Coordinator responds with rollback
+# ** AS1 Rule system traces send of rollback
+# -- Extra steps when AS1 != AS2
+# ** AS1 Rule system intercepts _after_ send of
+#    rollback has completed and kills AS1 JVM
+# -- End of extra steps
+# Participant P1 receives rollback
+# ** AS2 Rule system traces receipt of rollback
+# Participant P2 calls rollback
+# ** AS2 Rule system traces rollback call and then kills AS2 JVM
+#
+# Use of this script
+#
+# The default way of exercising this test is to deploy the xtstest war
+# to a single AS and configure it to run the relevant XTS Service Test.
+# The web service and coordinator will be located with the client.
+# The web service, client (i.e. the XTS Service Test which drives
+# the test) and coordinator service can optionally be located in separate
+# ASs. The participant AS should crash when a commit request is received.
+# If the coordinator is in a separate AS it need not be crashed.
+# At reboot of AS2 the rest of the test should run
+# automatically. The participant AS should be killed after the
+# participant recovery is attempted and the participant is rollback.
+# If the coordinator is in a separate AS then it will need to be killed
+# by the test driver
+#
+# This script needs to be passed to a Byteman agent in the JVM running
+# the coordinator service both at first boot and at reboot. Output will be
+# written to file testlog in the working directory of the AS.
+# If the participant is not running in the same JVM as the coordinator then
+# this script needs and the supplementary script ATCrashDuringOnePhaseCommitExtra.txt
+# needs to be passed to a Byteman agent in the JVM running the coordinator.
+# This script on its own eneds ot bepassed to a Byteman agent runing in the
+# participant JVM. Ouptut from the participant will be written to file
+# testlog in the working directory of this second JVM.
+#
+# XTS Service tests which can operate with this scenario can be selected for
+# execution at AS boot by the XTSServiceTestRunnerBean by setting system
+# property
+#    org.jboss.jbossts.xts.servicetests.XTSServiceTestName
+# to the name of a class which will execute the test. This property must
+# be defined in the JVM running the AS to which the xtstest war is deployed
+# i.e. the client AS. n.b. if the client is colocated with the coordinator or
+# participant then this property must be left undefined at AS reboot otherwise
+# the client will run again, starting a new TX which may interfere with
+# recovery of the crashed TX.
+#
+# Available tests include:
+#
+# org.jboss.jbossts.xts.servicetests.test.at.SingleParticipantPrepareAndCommitTest
+# this test invokes a single service registering a single participant
+# the location of participant web service is defined by defining a system property:
+#    org.jboss.jbossts.xts.servicetests.ServiceURL1
+# if this is not set the value used defaults to
+#    http://localhost:8080/xtstest/xtsservicetest1
+#
+# If the client is run in a different AS to the coordinator then the client
+# AS needs to be pointed at the coordinator AS. The easiest
+# way to do this is to define the system property
+#
+#    org.jboss.jbossts.xts11.coordinatorURL
+#
+# to something like
+#
+#    http://foo.bar.org:8080/ws-c11/soap/ActivationCoordinator
+#
+# or alternatively to redefine one or more of the component properties
+#
+#    org.jboss.jbossts.xts11.coordinator.host
+#    org.jboss.jbossts.xts11.coordinator.port
+#    org.jboss.jbossts.xts11.coordinator.path
+#
+# (you probably only need to reset the host component)
+#
+# Expected output
+#
+# After the first boot AS1 and AS2 should exit. File testlog written by
+# the coordinator AS (AS1) should contain output in the following format:
+#
+#   prepare sent for cordinator engine XXXXXX
+#   prepared received for cordinator engine XXXXXX
+#   commit sent for cordinator engine XXXXXX
+#   JVM exit
+#
+# File testlog written by the participant AS (AS2) should contain output
+# in the following format:
+#
+#   prepare received for participant engine XXXXXX
+#   prepared sent for participant engine XXXXXX
+#   commit received for participant engine XXXXXX
+#   JVM exit
+#
+# After reboot file testlog written by the coordinator AS (AS1) should
+# contain output in the following format:
+#
+#   prepare sent for cordinator engine XXXXXX
+#   prepared received for cordinator engine XXXXXX
+#   commit sent for cordinator engine XXXXXX
+#   JVM exit
+#   prepared received for unknown participant XXXXXX
+#   rollback sent for participant XXXXXX
+#
+# After reboot file testlog written by the participant AS (AS2) should
+# contain output in the following format:
+#
+#   prepare received for participant XXXXXX
+#   prepared sent for participant XXXXXX
+#   commit received for participant XXXXXX
+#   JVM exit
+#   created recovered participant engine XXXXXX
+#   prepared sent for recovered participant engine XXXXXX
+#   rollback received for recovered participant XXXXXX
+#   rollback called for participant XXXXXX
+#   JVM exit
+#
+#######################################################################
+# This rule opens a file for the trace output during XTS startup
+# It will be opened for append at reboot so messages from both runs
+# will go to this file. n.b. this runs in both AS1 and AS2 so it is
+# important to ensure that they employ different working directories.
+# If not then the second open will trash the first one.
+#
+RULE open trace file
+CLASS org.jboss.jbossts.XTSService
+METHOD start()
+BIND NOTHING
+IF TRUE
+DO openTrace("log", "testlog")
+ENDRULE
+
+#######################################################################
+## rules for first run of coordinator AS (AS1)
+
+#######################################################################
+# This rule is triggered when a non-recovered coordinator engine
+# (CoordinatorEngine) is requested to send a prepare message. It
+# traces the call.
+
+RULE trace coordinator prepare
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD prepare
+AT INVOKE waitForState
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF NOT recovered
+DO debug("prepare sent for coordinator engine " + identifier),
+   traceln("log", "prepare sent for coordinator engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered coordinator engine
+# (CoordinatorEngine) receives a prepared message. It traces the call.
+
+RULE trace coordinator prepared
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD prepared(Notification, MAP, ArjunaContext)
+AT ENTRY
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF NOT recovered
+DO debug("prepared received for coordinator engine " + identifier),
+   traceln("log", "prepared received for coordinator engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered after a non-recovered coordinator engine
+# (CoordinatorEngine) has sent a commit message. It exits the JVM,
+# simulating a crash. This needs to go in a separate
+# script used for the coordinator when it is not co-located with the
+# participant.
+
+# RULE kill JVM at commit
+# CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+#METHOD commit
+# AT INVOKE waitForState
+# BIND engine:CoordinatorEngine = $0,
+#      recovered:boolean = engine.isRecovered(),
+#      identifier:String = engine.getId()
+# IF (NOT recovered)
+#    AND
+#    debug("commit sent for coordinator engine " + identifier)
+#    AND
+#    traceln("log", "commit sent for coordinator engine " + identifier)
+# DO traceln("log", "JVM exit"),
+#    debug("!!!killing JVM!!!"),
+#    killJVM()
+# ENDRULE
+
+#######################################################################
+## rules for first run of participant AS (AS1)
+
+#######################################################################
+# This rule is triggered when a non-recovered participant engine
+# (ParticipantEngine) receives a prepare message. It traces the call.
+
+RULE trace participant prepare
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD prepare
+AT SYNCHRONIZE
+BIND engine:ParticipantEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF NOT recovered
+DO debug("prepare received for participant engine " + identifier),
+   traceln("log", "prepare received for participant engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered participant engine
+# (ParticipantEngine) sends a prepared message. It traces the call.
+
+RULE trace participant prepared
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD sendPrepared(boolean)
+AT INVOKE updateResendPeriod
+BIND engine:ParticipantEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF NOT recovered
+DO debug("prepared sent for participant engine " + identifier),
+   traceln("log", "prepared sent for participant engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered participant engine
+# (ParticipantEngine) receives a commit message. It exits the JVM,
+# simulating a crash.
+
+RULE kill JVM at commit
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD commit
+AT SYNCHRONIZE
+BIND engine:ParticipantEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF (NOT recovered)
+   AND
+   debug("commit received for participant engine " + identifier)
+   AND
+   traceln("log", "commit received for participant engine " + identifier)
+DO traceln("log", "JVM exit"),
+   debug("!!!killing JVM!!!"),
+   killJVM()
+ENDRULE
+
+#######################################################################
+## rules for reboot run of coordinator AS (AS1)
+
+#######################################################################
+# This rule is triggered when a coordinator processor
+# (CoordinatorProcessorImpl) receives a prepared message for an
+# unknown coordinator. It traces the call.
+
+RULE trace unknown participant prepared
+CLASS com.arjuna.wst11.messaging.CoordinatorProcessorImpl
+METHOD prepared
+AT INVOKE sendRollback
+BIND identifier:String = $3.getInstanceIdentifier().getInstanceIdentifier()
+IF TRUE
+DO debug("prepared received for unknown participant " + identifier),
+   traceln("log", "prepared received for unknown participant " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a coordinator processor
+# (CoordinatorProcessorImpl) sends a rollback prepared message for an
+# unknown coordinator. It traces the call.
+
+RULE trace participant rollback
+CLASS com.arjuna.wst11.messaging.CoordinatorProcessorImpl
+METHOD sendRollback
+AT INVOKE sendRollback
+BIND identifier:String = $2.getInstanceIdentifier().getInstanceIdentifier()
+IF TRUE
+DO debug("rollback send for participant " + identifier),
+   traceln("log", "rollback sent for participant " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a coordinator processor
+# (CoordinatorProcessorImpl) has sent a rollback prepared message for an
+# unknown coordinator. It exits the JVM. This needs to go in a separate
+# script used for the coordinator when it is not co-located with the
+# participant.
+
+# RULE trace unknown participant prepared
+# CLASS com.arjuna.wst11.messaging.CoordinatorProcessorImpl
+# METHOD prepared
+# AFTER INVOKE sendRollback
+# BIND NOTHING
+# IF TRUE
+# DO debug("!!!killing JVM!!!"),
+#    traceln("log", "JVM exit")
+# ENDRULE
+
+#######################################################################
+## rules for reboot run of participant AS (AS2)
+
+#######################################################################
+# This rule is triggered when a participant engine (ParticipantEngine)
+# is created from details located in the log record. It traces the
+# create operation. The trigger location is at entry but the rule
+# should only be triggered after calling the super constructor
+
+RULE trace participant engine create
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD <init>(Participant, String, State, W3CEndpointReference, boolean)
+AT ENTRY
+BIND identifier = $1,
+     recovered=$5
+IF recovered
+DO debug("created recovered participant engine " + identifier),
+   traceln("log", "created recovered participant engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a recovered participant engine
+# (ParticipantEngine) sends a prepared message. It traces the call.
+
+RULE trace recovered participant prepared
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD sendPrepared(boolean)
+AT INVOKE updateResendPeriod
+BIND engine:ParticipantEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF recovered
+DO debug("prepared sent for recovered participant engine " + identifier),
+   traceln("log", "prepared sent for recovered participant engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a recovered participant engine
+# (ParticipantEngine) receives a rollback request. It traces the call.
+
+RULE trace recovered participant rollback
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD rollback
+AFTER SYNCHRONIZE
+BIND engine:ParticipantEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF recovered
+DO debug("rollback received for recovered participant " + identifier),
+   traceln("log", "rollback received for recovered participant " + identifier)
+ENDRULE
+
+
+#######################################################################
+# This rule is triggered when a recovered participant engine
+# (ParticipantEngine) forgets a participant afer performing a rollback.
+# It kills the JVM.
+
+RULE kill JVM after rollback
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD rollback
+AFTER INVOKE forget
+BIND NOTHING
+IF TRUE
+DO debug("!!!killing JVM!!!"),
+   traceln("log", "JVM exit"),
+   killJVM()
+ENDRULE



More information about the jboss-svn-commits mailing list