[jboss-svn-commits] JBL Code SVN: r37588 - in labs/jbosstm/trunk/XTS/sar/tests: arquillian and 41 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Oct 18 04:07:25 EDT 2011
Author: zhfeng
Date: 2011-10-18 04:07:24 -0400 (Tue, 18 Oct 2011)
New Revision: 37588
Added:
labs/jbosstm/trunk/XTS/sar/tests/arquillian/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/pom.xml
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/bean/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/bean/XTSServiceTestRunner.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/bean/XTSServiceTestRunnerBean.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/client/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/client/XTSServiceTestClient.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/ejb/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/ejb/XTSServiceTestRunnerEJB.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/ejb/XTSServiceTestRunnerEJBImpl.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/CommandsType.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/ObjectFactory.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/ResultsType.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/XTSServiceTestPortType.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/XTSServiceTestService.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/package-info.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/Constants.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestInterpreter.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestServiceManager.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/CoordinatorCompletionTestParticipant.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/DurableTestParticipant.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/ParticipantCompletionTestParticipant.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/ScriptedTestParticipant.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/VolatileTestParticipant.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/recovery/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/recovery/TestATRecoveryModule.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/recovery/TestBARecoveryModule.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/subordinate/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/subordinate/XTSSubordinateServiceTestPortTypeImpl.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/XTSServiceTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/XTSServiceTestBase.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/MultiParticipantPrepareAndCommitTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/MultiServicePrepareAndCommitTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/SingleParticipantPrepareAndCommitTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseAndExitTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseAndExitTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseAndExitTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/SingleCoordinatorCompletionParticipantCloseTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/SingleParticipantCompletionParticipantCloseTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantCoordinatorCompletionParticipantCloseTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantParticipantCompletionParticipantCloseAndExitTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantParticipantCompletionParticipantCloseTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/webbean/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/webbean/XTSHTTPServiceTestRunner.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/META-INF/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/beans.xml
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/xts/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/xts/servicetests/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/xts/servicetests/service/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/xts/servicetests/service/handlers.xml
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/xts/servicetests/service/subordinate/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/xts/servicetests/service/subordinate/subordinatehandlers.xml
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/web.xml
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/wsdl/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/wsdl/xtsservicetests.wsdl
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/servicetests/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/servicetests/test/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/servicetests/test/SingleParticipantPrepareAndCommitTest.java
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/
labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/arquillian.xml
Log:
update to add xts sar arquillian tests
Property changes on: labs/jbosstm/trunk/XTS/sar/tests/arquillian
___________________________________________________________________
Added: svn:ignore
+ target
.project
.settings
.classpath
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/pom.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/pom.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/pom.xml 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,210 @@
+<?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">
+ <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>
+ <artifactId>xtstest</artifactId>
+ <name>xts crash recovery tests</name>
+ <description>xts crash recovery tests</description>
+ <packaging>war</packaging>
+ <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.jts</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! -->
+ <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>
+ </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>
+ </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
+ to run just unit tests based on a custom pattern -->
+ <!-- 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
+ AS container -->
+ <!-- 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>
+</project>
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/bean/XTSServiceTestRunner.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/bean/XTSServiceTestRunner.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/bean/XTSServiceTestRunner.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat, Inc. and/or its affiliates,
+ * 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) 2011,
+ * @author JBoss, by Red Hat.
+ */
+package org.jboss.jbossts.xts.servicetests.bean;
+
+public interface XTSServiceTestRunner {
+ public void runTest(String testName) throws Exception;
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/bean/XTSServiceTestRunnerBean.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/bean/XTSServiceTestRunnerBean.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/bean/XTSServiceTestRunnerBean.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.bean;
+
+import org.jboss.logging.Logger;
+import org.jboss.jbossts.xts.servicetests.ejb.XTSServiceTestRunnerEJB;
+import javax.inject.Inject;
+
+/**
+ * A service bean used to run XTS service tests at JBoss startup. A specific test is configurerd by setting an
+ * environment variable. It will normally execute in a JVM configured to use the Byteman agent and an appropriately
+ * defined Byteman rule set.
+ */
+
+public class XTSServiceTestRunnerBean implements XTSServiceTestRunner
+{
+
+ private final Logger log = org.jboss.logging.Logger.getLogger(XTSServiceTestRunnerBean.class);
+
+ @Inject
+ private XTSServiceTestRunnerEJB testRunnerEJB;
+
+ public void runTest(String testName) throws Exception {
+ log.info("XTSServiceTestRunnerBean");
+ testRunnerEJB.runTest(testName);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/client/XTSServiceTestClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/client/XTSServiceTestClient.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/client/XTSServiceTestClient.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.client;
+
+import org.jboss.jbossts.xts.servicetests.generated.XTSServiceTestPortType;
+import org.jboss.jbossts.xts.servicetests.generated.CommandsType;
+import org.jboss.jbossts.xts.servicetests.generated.ResultsType;
+import org.jboss.jbossts.xts.servicetests.generated.XTSServiceTestService;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.Handler;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
+
+import com.arjuna.mw.wst11.client.JaxWSHeaderContextProcessor;
+
+/**
+ * A convenience class used to invoke an XTS ServiceTest server.
+ */
+
+public class XTSServiceTestClient
+{
+ /**
+ * all Clients employ a single service instance from which to clone port instances
+ */
+ final private static XTSServiceTestService service = new XTSServiceTestService();
+
+ /**
+ * each Client caches a ready-configured port
+ */
+ private XTSServiceTestPortType port;
+
+ /**
+ * create a client which can be used to make repeated invocations of the test web service methods
+ */
+ @SuppressWarnings("rawtypes")
+ public XTSServiceTestClient()
+ {
+ // create a port and configure it with the WS context handler
+ port = service.getXTSServiceTestPortType();
+ List<Handler> handlerChain = new ArrayList<Handler>();
+ handlerChain.add(new JaxWSHeaderContextProcessor());
+ ((BindingProvider)port).getBinding().setHandlerChain(handlerChain);
+ }
+
+ /**
+ * invoke a web service at a specified URL
+ * @param serverURL
+ * @param commands a list of operations to be performed by the web service
+ * @return a list of zero or more results identifying the outcomes of the operations
+ */
+ public synchronized ResultsType serve(String serverURL, CommandsType commands)
+ {
+
+ Map<String, Object> requestProperties = ((BindingProvider)port).getRequestContext();
+ requestProperties.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serverURL);
+
+ @SuppressWarnings("unused")
+ CommandsType commandsType = new CommandsType();
+ return port.serve(commands);
+ }
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/ejb/XTSServiceTestRunnerEJB.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/ejb/XTSServiceTestRunnerEJB.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/ejb/XTSServiceTestRunnerEJB.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.xts.servicetests.ejb;
+
+public interface XTSServiceTestRunnerEJB {
+ public void runTest(String testName) throws Exception;
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/ejb/XTSServiceTestRunnerEJBImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/ejb/XTSServiceTestRunnerEJBImpl.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/ejb/XTSServiceTestRunnerEJBImpl.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat, Inc. and/or its affiliates,
+ * 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) 2011,
+ * @author JBoss, by Red Hat.
+ */
+package org.jboss.jbossts.xts.servicetests.ejb;
+
+import javax.ejb.Stateless;
+
+import org.jboss.jbossts.xts.servicetests.service.recovery.TestATRecoveryModule;
+import org.jboss.jbossts.xts.servicetests.service.recovery.TestBARecoveryModule;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import org.jboss.logging.Logger;
+
+ at Stateless
+public class XTSServiceTestRunnerEJBImpl implements XTSServiceTestRunnerEJB {
+
+ @SuppressWarnings("rawtypes")
+ public void runTest(String testName) throws Exception {
+ log.info("Starting XTSServiceTestRunner");
+
+ // ensure that the xts service test AT recovery helper module is registered
+ TestATRecoveryModule.register();
+ TestBARecoveryModule.register();
+
+ if(testName != null) {
+ log.info("XTSServiceTestRunner run test " + testName);
+ Class testClass;
+ ClassLoader cl = XTSServiceTestRunnerEJBImpl.class.getClassLoader();
+
+ try {
+ testClass = cl.loadClass(testName);
+ } catch (ClassNotFoundException cnfe) {
+ log.warn("XTSServiceTestRunner : cannot find test class " + testName, cnfe);
+ throw new Exception("XTSServiceTestRunner : cannot find test class " + testName, cnfe);
+ }
+
+ try {
+ testInstance = (XTSServiceTest)testClass.newInstance();
+ } catch (InstantiationException ie) {
+ log.warn("XTSServiceTestRunner : cannot instantiate test class " + testName, ie);
+ throw new Exception("XTSServiceTestRunner : cannot instantiate test class " + testName, ie);
+ } catch (IllegalAccessException iae) {
+ log.warn("XTSServiceTestRunner : cannot access constructor for test class " + testName, iae);
+ throw new Exception("XTSServiceTestRunner : cannot access constructor for test class " + testName, iae);
+ }
+
+ // since we are running in the AS startup thread we need a separate thread for the test
+
+ testThread = new Thread() {
+ @SuppressWarnings("unused")
+ private XTSServiceTest test = testInstance;
+ public void run()
+ {
+ testInstance.run();
+ }
+ };
+
+ testThread.start();
+
+ if (testThread != null) {
+ log.info("Joining test thread " + testName);
+
+ testThread.join();
+
+ log.info("Joined test thread " + testName);
+ }
+ }
+ // ensure that the xts service test AT recovery helper module is unregistered
+
+ TestATRecoveryModule.unregister();
+ TestBARecoveryModule.unregister();
+
+ log.info("Stopped XTSServiceTestRunner");
+ }
+
+ private final Logger log = org.jboss.logging.Logger.getLogger(XTSServiceTestRunnerEJBImpl.class);
+
+ private XTSServiceTest testInstance;
+
+ private Thread testThread;
+
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/CommandsType.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/CommandsType.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/CommandsType.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,71 @@
+
+package org.jboss.jbossts.xts.servicetests.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlList;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for commandsType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="commandsType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="commandList" type="{http://jbossts.jboss.org/xts/servicetests/generated}commandList"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "commandsType", propOrder = {
+ "commandList"
+})
+public class CommandsType {
+
+ @XmlList
+ @XmlElement(required = true)
+ protected List<String> commandList;
+
+ /**
+ * Gets the value of the commandList property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the commandList property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getCommandList().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getCommandList() {
+ if (commandList == null) {
+ commandList = new ArrayList<String>();
+ }
+ return this.commandList;
+ }
+
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/ObjectFactory.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/ObjectFactory.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/ObjectFactory.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,71 @@
+
+package org.jboss.jbossts.xts.servicetests.generated;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.jboss.jbossts.xts.servicetests.generated package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+ at XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _Commands_QNAME = new QName("http://jbossts.jboss.org/xts/servicetests/generated", "commands");
+ private final static QName _Results_QNAME = new QName("http://jbossts.jboss.org/xts/servicetests/generated", "results");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.jboss.jbossts.xts.servicetests.generated
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link CommandsType }
+ *
+ */
+ public CommandsType createCommandsType() {
+ return new CommandsType();
+ }
+
+ /**
+ * Create an instance of {@link ResultsType }
+ *
+ */
+ public ResultsType createResultsType() {
+ return new ResultsType();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link CommandsType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://jbossts.jboss.org/xts/servicetests/generated", name = "commands")
+ public JAXBElement<CommandsType> createCommands(CommandsType value) {
+ return new JAXBElement<CommandsType>(_Commands_QNAME, CommandsType.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link ResultsType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://jbossts.jboss.org/xts/servicetests/generated", name = "results")
+ public JAXBElement<ResultsType> createResults(ResultsType value) {
+ return new JAXBElement<ResultsType>(_Results_QNAME, ResultsType.class, null, value);
+ }
+
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/ResultsType.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/ResultsType.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/ResultsType.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,71 @@
+
+package org.jboss.jbossts.xts.servicetests.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlList;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for resultsType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="resultsType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="resultList" type="{http://jbossts.jboss.org/xts/servicetests/generated}resultList"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "resultsType", propOrder = {
+ "resultList"
+})
+public class ResultsType {
+
+ @XmlList
+ @XmlElement(required = true)
+ protected List<String> resultList;
+
+ /**
+ * Gets the value of the resultList property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the resultList property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getResultList().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getResultList() {
+ if (resultList == null) {
+ resultList = new ArrayList<String>();
+ }
+ return this.resultList;
+ }
+
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/XTSServiceTestPortType.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/XTSServiceTestPortType.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/XTSServiceTestPortType.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,34 @@
+
+package org.jboss.jbossts.xts.servicetests.generated;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.2-hudson-182-RC1
+ * Generated source version: 2.0
+ *
+ */
+ at WebService(name = "XTSServiceTestPortType", targetNamespace = "http://jbossts.jboss.org/xts/servicetests/generated")
+ at SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public interface XTSServiceTestPortType {
+
+
+ /**
+ *
+ * @param commands
+ * @return
+ * returns org.jboss.jbossts.xts.servicetests.generated.ResultsType
+ */
+ @WebMethod
+ @WebResult(name = "results", targetNamespace = "http://jbossts.jboss.org/xts/servicetests/generated", partName = "results")
+ public ResultsType serve(
+ @WebParam(name = "commands", targetNamespace = "http://jbossts.jboss.org/xts/servicetests/generated", partName = "commands")
+ CommandsType commands);
+
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/XTSServiceTestService.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/XTSServiceTestService.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/XTSServiceTestService.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,58 @@
+
+package org.jboss.jbossts.xts.servicetests.generated;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Logger;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.2-hudson-182-RC1
+ * Generated source version: 2.0
+ *
+ */
+ at WebServiceClient(name = "XTSServiceTestService", targetNamespace = "http://jbossts.jboss.org/xts/servicetests/generated", wsdlLocation = "wsdl/xtsservicetests.wsdl")
+public class XTSServiceTestService
+ extends Service
+{
+
+ private final static URL XTSSERVICETESTSERVICE_WSDL_LOCATION;
+ private final static Logger logger = Logger.getLogger(org.jboss.jbossts.xts.servicetests.generated.XTSServiceTestService.class.getName());
+
+ static {
+ URL url = null;
+ try {
+ URL baseUrl;
+ baseUrl = org.jboss.jbossts.xts.servicetests.generated.XTSServiceTestService.class.getResource(".");
+ url = new URL(baseUrl, "wsdl/xtsservicetests.wsdl");
+ } catch (MalformedURLException e) {
+ logger.warning("Failed to create URL for the wsdl Location: 'wsdl/xtsservicetests.wsdl', retrying as a local file");
+ logger.warning(e.getMessage());
+ }
+ XTSSERVICETESTSERVICE_WSDL_LOCATION = url;
+ }
+
+ public XTSServiceTestService(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ public XTSServiceTestService() {
+ super(XTSSERVICETESTSERVICE_WSDL_LOCATION, new QName("http://jbossts.jboss.org/xts/servicetests/generated", "XTSServiceTestService"));
+ }
+
+ /**
+ *
+ * @return
+ * returns XTSServiceTestPortType
+ */
+ @WebEndpoint(name = "XTSServiceTestPortType")
+ public XTSServiceTestPortType getXTSServiceTestPortType() {
+ return super.getPort(new QName("http://jbossts.jboss.org/xts/servicetests/generated", "XTSServiceTestPortType"), XTSServiceTestPortType.class);
+ }
+
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/package-info.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/package-info.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/generated/package-info.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,2 @@
+ at javax.xml.bind.annotation.XmlSchema(namespace = "http://jbossts.jboss.org/xts/servicetests/generated")
+package org.jboss.jbossts.xts.servicetests.generated;
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/Constants.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/Constants.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/Constants.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,10 @@
+package org.jboss.jbossts.xts.servicetests.service;
+
+/**
+ * Constant values used by the test code
+ */
+public class Constants
+{
+ public static final String PARTICIPANT_ID_PREFIX = "org.jboss.jbossts.xts.servicetests.";
+ public static final String TRANSACTION_ID_PREFIX = "transaction.";
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestInterpreter.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestInterpreter.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestInterpreter.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,911 @@
+package org.jboss.jbossts.xts.servicetests.service;
+
+import org.jboss.jbossts.xts.servicetests.service.participant.*;
+import org.jboss.jbossts.xts.servicetests.client.XTSServiceTestClient;
+import org.jboss.jbossts.xts.servicetests.generated.CommandsType;
+import org.jboss.jbossts.xts.servicetests.generated.ResultsType;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+
+import com.arjuna.wst11.BAParticipantManager;
+import com.arjuna.mw.wst.TxContext;
+import com.arjuna.mw.wst11.*;
+import com.arjuna.wst.SystemException;
+
+import javax.xml.ws.WebServiceException;
+import javax.xml.namespace.QName;
+
+/**
+ * A class which provides the ability to interpret XTS service test commands. Each of the XTS service test
+ * classes imnplementing a specific test extends this class so that it can drive the test from a command
+ * script. Each of the XTS service test endpoints employs an instance of this class to process comands
+ * which are dispatched to it either from one of the test class instances or recursively via another
+ * intermediate service.
+ *
+ * The interpreter executes a list of Strings which represents one or more commands each with its own
+ * sequence of associated arguments. It returns a list of strings indicating the outcome of processing
+ * the commands. It throws an exception if command processing fails.
+ *
+ * A simple command comprises a list of Strings headed by one of a fixed set of command keywords followed by
+ * zero or more argument strings. Command arguments are either simple string literals or bound variable references.
+ * A variable reference is an alphanumeric variable name bracketed by '{' and '}' characters. The interpreter
+ * resolves this to a string value by looking up the variable in its binding list and uses this vale as the
+ * argument for th command. It is possible to seed the binding list with default values before processing a
+ * sequence of commands. Alternatively, bindings may be added during execution of block commands.
+ *
+ * A block commands comprises a list of Strings headed by the keyword "block" and terminated by the keyword
+ * "endblock". Intervening elements of the list comprise simple commands separated either by "next" keywords
+ * or by bind commands terminated with a "next" keyword. A bind commands is a list of strings headed by keyword
+ * "bind" and succeeded by a sequence of bind operations. A bind operation operates on the results returned from
+ * the last executed command and comes in one of three formats:
+ * <ul>
+ * <li>set var idx
+ * <li>check idx value/{var}"
+ * <li>output idx
+ * </ul>
+ * A set operation binds a variable to the nth result returned in the results list of the previously executed
+ * command. A check operation checks that the nth result returned in the results list of the previously executed
+ * command has a specific value, throwing an exception if not. An output operation appends the nth result returned
+ * in the results list of the previously executed command to the results list for the block command.
+ *
+ * The command syntax is defined as follows:
+ *
+ * <pre>
+ * command ::= simple_command | block_command ==> resultList
+ *
+ * block_command ::= "block" command (block_trailing)* "endblock"
+ *
+ * block_trailing ::= (bindings_command)? "next" command
+ *
+ * bindings_command ::= "bindings" (binding_operation)+ "next"
+ *
+ * binding_operation ::= "bind" <alphanum> <num> |
+ * "check" <num> <alphanum> |
+ * "output" <num>
+ *
+ * simple_command :=
+ * "enlistDurable" (ATParticipantInstruuction)* ==> DurableId ;
+ * "enlistVolatile" (ATParticipantInstruuction)* ==> VolatileId ;
+ * "enlistCoordinatorCompletion" (BACoordinatorCompletionInstruuction)* ==> BACoordinatorCompletionId ;
+ * "enlistParticipantCompletion" (BAParticipantCompletionInstruuction)* ==> BAParticipantCompletionId ;
+ * "addCommands" ((DurableId | VolatileId) (ATParticipantInstruuction)* ==> "ok" |
+ * ((BAParticipantCompletionId | BACoordinatorCompletionId) BACoordinatorCompletionInstruuction)*) ==> "ok" ;
+ * "fail" (BAParticipantCompletionId | BACoordinatorCompletionId) ==> "ok" ;
+ * "exit" (BAParticipantCompletionId | BACoordinatorCompletionId) ==> "ok" ;
+ * "cannotComplete" BAParticipantCompletionId ==> "ok" ;
+ * "completed" BAParticipantCompletionId ==> "ok" ;
+ * "serve" URL command ==> resultsList
+ * "subtransaction" ==> subtransactionId ;
+ * "subactivity" ==> subactivityId ;
+ * "subtransactioncommands" subtransactionId serviceURL (command) ;
+ * "subactivitycommands" subactivityId serviceURL (command)
+ *
+ * ATParticipantInstruuction ::=
+ * "prepare" ;
+ * "prepareSystemException" ;
+ * "prepareWrongStateException" ;
+ * "commit" ;
+ * "commitSystemException" ;
+ * "commitWrongStateException"
+ *
+ * BAParticipantCompletionInstruuction ::=
+ * "close" ;
+ * "closeSystemException" ;
+ * "closeWrongStateException" ;
+ * "cancel" ;
+ * "cancelSystemException" ;
+ * "cancelWrongStateException" ;
+ * "cancelFaultedException" ;
+ * "compensate" ;
+ * "compensateSystemException" ;
+ * "compensateWrongStateException" ;
+ * "compensateFaultedException"
+ *
+ * BAParticipantCompletionInstruuction ::=
+ * "complete" ;
+ * "completeSystemException" ;
+ * "completeWrongStateException" ;
+ *
+ * DurableId ::=
+ * "org.jboss.jbossts.xts.servicetests.DurableTestParticipant.<num>"
+ * VolatileId ::=
+ * "org.jboss.jbossts.xts.servicetests.VolatileTestParticipant.<num>"
+ * BACoordinatorCompletionId ::=
+ * "org.jboss.jbossts.xts.servicetests.CoordinatorCompletionTestParticipant.<num>"
+ * BAParticipantCompletionId ::=
+ * "org.jboss.jbossts.xts.servicetests.ParticipantCompletionTestParticipant.<num>"
+ *
+ * subtransactionId is a String of the form
+ * "transaction.at.<num>"
+ *
+ * subactivityId is a String of the form
+ * "transaction.ba.<num>"
+ *</pre>
+ * where
+ *
+ * <num> is a sequence of base 10 digits and <alphanum> is a sequence of
+ * alphanumeric characters
+ *
+ * serviceURL is a URL identifying an instance of the test service to which commands are to be
+ * recursively dispatched within the relevant subtransaction or subactivity
+ */
+public class XTSServiceTestInterpreter
+{
+ /// public API
+
+ /**
+ * lookup (or create and index) then return a service implementation keyed by a specific servlet path
+ * @param servletPath the key used to identify a service obtained from an HTTP request's servlet path
+ * @return the associated service instance
+ */
+ public static synchronized XTSServiceTestInterpreter getService(String servletPath)
+ {
+ XTSServiceTestInterpreter service = serviceMap.get(servletPath);
+ if (service == null) {
+ service = new XTSServiceTestInterpreter();
+ serviceMap.put(servletPath, service);
+ }
+
+ return service;
+ }
+
+ /**
+ * simple command interpreter which executes the commands in the command list, inserting the
+ * corresponding results in the results list. n.b. this method should only ever be invoked
+ * from within an AT or BA transaction.
+ *
+ * @param commandList a list of command strings
+ * @param resultsList a list into which results strings are to be inserted
+ */
+ public void processCommands(List<String> commandList, List<String> resultsList)
+ throws WebServiceException
+ {
+ HashMap<String, String> bindings = new HashMap<String, String>(defaultBindings);
+ processCommands(commandList, resultsList, bindings);
+ }
+
+ /**
+ * add a binding to the default binding set used to supply command parameters
+ * @param var
+ * @param val
+ */
+ public void addDefaultBinding(String var, String val)
+ {
+ defaultBindings.put(var, val);
+ }
+
+ /// overrideable methods
+
+ /**
+ * set up a specific service instance with all the values it requires
+ */
+
+ protected XTSServiceTestInterpreter()
+ {
+ participantMap = new HashMap<String, ScriptedTestParticipant>();
+ managerMap = new HashMap<String, BAParticipantManager>();
+ subordinateTransactionMap = new HashMap<String, TxContext>();
+ subordinateActivityMap = new HashMap<String, TxContext>();
+ defaultBindings = new HashMap<String, String>();
+ client = null;
+ }
+
+ /// implementation of the interpreter functionality
+
+ /**
+ * simple command interpreter which executes the commands in the command list, inserting the
+ * corresponding results in the results list and using the supplied bindings list
+ * to provide values for any parameters supplied in the commands and to bind any results
+ * obtained by executing the commands
+ *
+ * @param commandList a list of command strings
+ * @param resultsList a list into which results strings are to be inserted
+ * @param bindings a list of bound variables to be substituted into commands
+ * or updated with new bindings
+ */
+ @SuppressWarnings("unused")
+ private void processCommands(List<String> commandList, List<String> resultsList, HashMap<String, String> bindings)
+ throws WebServiceException
+ {
+ int size = commandList.size();
+ if (size == 0) {
+ throw new WebServiceException("empty command list");
+ }
+ String command = commandList.remove(0);
+ size--;
+
+ // check against each of the possible commands
+
+ if (command.equals("block")) {
+ // we don't bind the command block immediately since bindings may be produced
+ // by intermediate bind commands
+ processCommandBlock(commandList, resultsList, bindings);
+ } else {
+ int idx = 0;
+ if (command.equals("enlistDurable")) {
+// enlistment commands
+ bindCommands(commandList, bindings);
+ String id = participantId("DurableTestParticipant");
+ DurableTestParticipant participant = new DurableTestParticipant(id);
+ TransactionManager txman = TransactionManagerFactory.transactionManager();
+ try {
+ txman.enlistForDurableTwoPhase(participant, id);
+ } catch (Exception e) {
+ throw new WebServiceException("enlistDurable failed ", e);
+ }
+ for (idx = 0; idx < size; idx++) {
+ participant.addCommand(commandList.get(idx));
+ }
+ participantMap.put(id, participant);
+ resultsList.add(id);
+ } else if (command.equals("enlistVolatile")) {
+ bindCommands(commandList, bindings);
+ String id = participantId("VolatileTestParticipant");
+ VolatileTestParticipant participant = new VolatileTestParticipant(id);
+ TransactionManager txman = TransactionManagerFactory.transactionManager();
+ try {
+ txman.enlistForVolatileTwoPhase(participant, id);
+ } catch (Exception e) {
+ throw new WebServiceException("enlistVolatile failed ", e);
+ }
+ for (idx = 0; idx < size; idx++) {
+ participant.addCommand(commandList.get(idx));
+ }
+ participantMap.put(id, participant);
+ resultsList.add(id);
+ } else if (command.equals("enlistCoordinatorCompletion")) {
+ bindCommands(commandList, bindings);
+ String id = participantId("CoordinatorCompletionParticipant");
+ CoordinatorCompletionTestParticipant participant = new CoordinatorCompletionTestParticipant(id);
+ BusinessActivityManager baman = BusinessActivityManagerFactory.businessActivityManager();
+ try {
+ BAParticipantManager partMan;
+ partMan = baman.enlistForBusinessAgreementWithCoordinatorCompletion(participant, id);
+ managerMap.put(id, partMan);
+ } catch (Exception e) {
+ throw new WebServiceException("enlistCoordinatorCompletion failed ", e);
+ }
+ for (idx = 0; idx < size; idx++) {
+ participant.addCommand(commandList.get(idx));
+ }
+ participantMap.put(id, participant);
+ resultsList.add(id);
+ } else if (command.equals("enlistParticipantCompletion")) {
+ bindCommands(commandList, bindings);
+ String id = participantId("ParticipantCompletionParticipant");
+ ParticipantCompletionTestParticipant participant = new ParticipantCompletionTestParticipant(id);
+ BusinessActivityManager baman = BusinessActivityManagerFactory.businessActivityManager();
+ try {
+ BAParticipantManager partMan;
+ partMan = baman.enlistForBusinessAgreementWithParticipantCompletion(participant, id);
+ managerMap.put(id, partMan);
+ } catch (Exception e) {
+ throw new WebServiceException("enlistParticipantCompletion failed ", e);
+ }
+ for (idx = 0; idx < size; idx++) {
+ participant.addCommand(commandList.get(idx));
+ }
+ participantMap.put(id, participant);
+ resultsList.add(id);
+ } else if (command.equals("addCommands")) {
+// add extra commands to a participant script
+ bindCommands(commandList, bindings);
+ String id = commandList.remove(idx);
+ size--;
+ ScriptedTestParticipant participant = participantMap.get(id);
+ if (participant != null) {
+ for (idx = 0; idx < size; idx++)
+ {
+ participant.addCommand(commandList.get(idx));
+ }
+ resultsList.add("ok");
+ } else {
+ throw new WebServiceException("addCommands failed to find participant " + id);
+ }
+ } else if (command.equals("exit")) {
+// initiate BA manager activities
+ bindCommands(commandList, bindings);
+ String id = commandList.remove(idx);
+ size--;
+ ScriptedTestParticipant participant = participantMap.get(id);
+ if (participant != null ) {
+ if (participant instanceof ParticipantCompletionTestParticipant) {
+ ParticipantCompletionTestParticipant baparticipant = (ParticipantCompletionTestParticipant)participant;
+ BAParticipantManager manager = managerMap.get(id);
+ try {
+ manager.exit();
+ } catch (Exception e) {
+ throw new WebServiceException("exit " + id + " failed with exception " + e);
+ }
+ resultsList.add("ok");
+ } else {
+ throw new WebServiceException("exit invalid participant type " + id);
+ }
+ } else {
+ throw new WebServiceException("exit unknown participant " + id);
+ }
+ } else if (command.equals("completed")) {
+ bindCommands(commandList, bindings);
+ String id = commandList.remove(idx);
+ size--;
+ ScriptedTestParticipant participant = participantMap.get(id);
+ if (participant != null ) {
+ if (participant instanceof ParticipantCompletionTestParticipant) {
+ ParticipantCompletionTestParticipant baparticipant = (ParticipantCompletionTestParticipant)participant;
+ BAParticipantManager manager = managerMap.get(id);
+ try {
+ manager.completed();
+ resultsList.add("ok");
+ } catch (Exception e) {
+ throw new WebServiceException("completed " + id + " failed with exception " + e);
+ }
+ } else {
+ throw new WebServiceException("completed invalid participant type " + id);
+ }
+ } else {
+ throw new WebServiceException("completed unknown participant " + id);
+ }
+ } else if (command.equals("fail")) {
+ bindCommands(commandList, bindings);
+ String id = commandList.remove(idx);
+ size--;
+ ScriptedTestParticipant participant = participantMap.get(id);
+ if (participant != null ) {
+ if (participant instanceof ParticipantCompletionTestParticipant) {
+ ParticipantCompletionTestParticipant baparticipant = (ParticipantCompletionTestParticipant)participant;
+ BAParticipantManager manager = managerMap.get(id);
+ QName qname = new QName("http://jbossts.jboss.org/xts/servicetests/", "fail");
+ try {
+ manager.fail(qname);
+ resultsList.add("ok");
+ } catch (Exception e) {
+ throw new WebServiceException("fail " + id + " failed with exception " + e);
+ }
+ } else {
+ throw new WebServiceException("fail invalid participant type " + id);
+ }
+ } else {
+ throw new WebServiceException("fail unknown participant " + id);
+ }
+ } else if (command.equals("cannotComplete")) {
+ bindCommands(commandList, bindings);
+ String id = commandList.remove(idx);
+ size--;
+ ScriptedTestParticipant participant = participantMap.get(id);
+ if (participant != null ) {
+ if (participant instanceof ParticipantCompletionTestParticipant) {
+ ParticipantCompletionTestParticipant baparticipant = (ParticipantCompletionTestParticipant)participant;
+ BAParticipantManager manager = managerMap.get(id);
+ try {
+ manager.cannotComplete();
+ resultsList.add("ok");
+ } catch (Exception e) {
+ throw new WebServiceException("cannotComplete " + id + " failed with exception " + e);
+ }
+ } else {
+ throw new WebServiceException("cannotComplete invalid participant type " + id);
+ }
+ } else {
+ throw new WebServiceException("cannotComplete unknown participant " + id);
+ }
+ } else if (command.equals("serve")) {
+// dispatch commands to a server for execution
+ // we should find a web service URL and a list of commands to dispatch to that service
+ String url = commandList.remove(idx);
+ size--;
+ // we throw an error if the server url is unbound but we allow
+ // unbound variables in the command list passed on to the server
+ // since they may be bound by bind commands in the command list
+ // being served.
+
+ url = bindCommand(url, bindings, true);
+
+ bindCommands(commandList, bindings, false);
+
+ CommandsType newCommands = new CommandsType();
+ List<String> newCommandList = newCommands.getCommandList();
+ for (int i = 0; i < size; i++) {
+ newCommandList.add(commandList.get(i));
+ }
+ ResultsType subResults = serveSubordinate(url, newCommands);
+ List<String> subResultsList = subResults.getResultList();
+ size = subResultsList.size();
+ for (idx = 0; idx < size; idx++) {
+ resultsList.add(subResultsList.get(idx));
+ }
+ } else if (command.equals("subtransaction")) {
+// create subordinate AT transaction
+// this is surplus to requirements since we should really be running against a service which uses
+// the subordinate interposition JaxWS handler to install a subordinate transaction before
+// entering the service method. we ought to test that handler rather than hand crank the
+// interposition in the service
+ TxContext currentTx;
+ TxContext newTx;
+ try {
+ currentTx = TransactionManager.getTransactionManager().currentTransaction();
+ } catch (SystemException e) {
+ throw new WebServiceException("subtransaction currentTransaction() failed with exception " + e);
+ }
+
+ try {
+ UserTransaction userTransaction = UserTransactionFactory.userSubordinateTransaction();
+ userTransaction.begin();
+ newTx = TransactionManager.getTransactionManager().currentTransaction();
+ } catch (Exception e) {
+ throw new WebServiceException("subtransaction begin() failed with exception " + e);
+ }
+ String id = transactionId("at");
+ subordinateTransactionMap.put(id, newTx);
+ resultsList.add(id);
+ } else if (command.equals("subactivity")) {
+// create subordinate BA transaction
+// this is surplus ot requirements since we should really be running against a service which uses
+// the subordinate interposition JaxWS handler to install a subordinate activity before
+// entering the service method. we ought to test that handler rather than hand crank the
+// interposition in the service
+ TxContext currentTx;
+ TxContext newTx;
+ try {
+ currentTx = BusinessActivityManagerFactory.businessActivityManager().currentTransaction();
+ } catch (SystemException e) {
+ throw new WebServiceException("subtransaction currentTransaction() failed with exception " + e);
+ }
+
+ try {
+ UserBusinessActivity userBusinessActivity = UserBusinessActivityFactory.userBusinessActivity();
+ // this is nto implemented yet!!!
+ // userBusinessActivity.beginSubordinate();
+ // and this will fail with a WrongStateException
+ userBusinessActivity.begin();
+ newTx = BusinessActivityManager.getBusinessActivityManager().currentTransaction();
+ } catch (Exception e) {
+ throw new WebServiceException("subtransaction begin() failed with exception " + e);
+ }
+ String id = transactionId("ba");
+ subordinateActivityMap.put(id, newTx);
+ resultsList.add(id);
+ } else if (command.equals("subtransactionserve")) {
+// dispatch commands in a subordinate transaction or activity
+ // we should find the id of a subordinate transaction, a web service URL
+ // and a list of commands to dispatch to that transaction
+ // the txid and url must be resolved if supplied as bindings
+ String txId = bindCommand(commandList.remove(idx), bindings, true);
+ size--;
+ String url = bindCommand(commandList.remove(idx), bindings, true);
+ size--;
+
+ TxContext newTx = subordinateTransactionMap.get(txId);
+ if (newTx != null) {
+ try {
+ TransactionManager.getTransactionManager().resume(newTx);
+ } catch (Exception e) {
+ throw new WebServiceException("subtransactioncommands resume() failed with exception " + e);
+ }
+ } else {
+ throw new WebServiceException("subtransactioncommands unknown subordinate transaction id " + txId);
+ }
+ // ok, now we install the relevant transaction and then just pass the commands on to
+ // the web service
+
+ // we allow unresolved variable references in the rest of the command list as
+ // they may be satisfied by embedded bind commands
+
+ bindCommands(commandList, bindings, false);
+
+ CommandsType newCommands = new CommandsType();
+ List<String> newCommandList = newCommands.getCommandList();
+ for (int i = 0; i < size; i++) {
+ newCommandList.add(commandList.get(i));
+ }
+ ResultsType subResults = serveSubordinate(url, newCommands);
+ List<String> subResultsList = subResults.getResultList();
+ size = subResultsList.size();
+ for (idx = 0; idx < size; idx++) {
+ resultsList.add(subResultsList.get(idx));
+ }
+ } else if (command.equals("subactivityserve")) {
+// dispatch commands in a subordinate transaction or activity
+ // we should find the id of a subordinate transaction, a web service URL
+ // and a list of commands to dispatch to that transaction
+ // the txid and url must be resolved if supplied as bindings
+ String txId = bindCommand(commandList.remove(idx), bindings, true);
+ size--;
+ String url = bindCommand(commandList.remove(idx), bindings, true);
+ size--;
+
+ TxContext newTx = subordinateActivityMap.get(txId);
+ if (newTx != null) {
+ try {
+ TransactionManager.getTransactionManager().resume(newTx);
+ } catch (Exception e) {
+ throw new WebServiceException("subactivitycommands resume() failed with exception " + e);
+ }
+ } else {
+ throw new WebServiceException("subactivitycommands unknown subordinate transaction id " + txId);
+ }
+ // ok, now we install the relevant transaction and then just pass the commands on to
+ // the web service
+
+ // we allow unresolved variable references in the rest of the command list as
+ // they may be satisfied by embedded bind commands
+
+ bindCommands(commandList, bindings, false);
+
+ CommandsType newCommands = new CommandsType();
+ List<String> newCommandList = newCommands.getCommandList();
+ for (int i = 0; i < size; i++) {
+ newCommandList.add(commandList.get(i));
+ }
+ ResultsType subResults = serveSubordinate(url, newCommands);
+ List<String> subResultsList = subResults.getResultList();
+ size = subResultsList.size();
+ for (idx = 0; idx < size; idx++) {
+ resultsList.add(subResultsList.get(idx));
+ }
+ }
+ }
+ }
+
+ /**
+ * execute a block of commands by recursively executing each embedded command list. results are
+ * verified and bound to command variables in accordance with embedded bind commands. command
+ * variable references in embedded command lists are substituted with the corresponding bound
+ * values before recursive execution is performed.
+ *
+ * @param commandList
+ * @param resultsList
+ * @throws WebServiceException
+ */
+ private void processCommandBlock(List<String> commandList, List<String> resultsList, HashMap<String, String> bindings)
+ throws WebServiceException
+ {
+ // break up the command block into a list of nested command lists. successive command lists will
+ // be separated by a "next" or "bind" command. the block will be terminated by an "endblock" command.
+ // nested commands may themselves be block commands.
+
+ List<List<String>> subcommandsList = new ArrayList<List<String>>();
+ List<String> subcommands = new ArrayList<String>();
+ // each subcommand list needs to start with next or bind
+ subcommands.add("next");
+ int size = commandList.size();
+ int depth = 0;
+ int idx;
+ for (idx = 0; idx < size; idx++)
+ {
+ String command = commandList.get(idx);
+ if (depth > 0) {
+ // track nesting levels
+ if (command.equals("block")) {
+ depth++;
+ } else if (command.equals("endblock")) {
+ depth--;
+ }
+ subcommands.add(command);
+ } else {
+ if (command.equals("block")) {
+ // add nested block command to sublist
+ subcommands.add(command);
+ depth++;
+ } else if (command.equals("next")) {
+ // create new sublist starting with next
+ subcommandsList.add(subcommands);
+ subcommands = new ArrayList<String>();
+ subcommands.add(command);
+ } else if (command.equals("bindings")) {
+ // create new sublist starting with bind
+ subcommandsList.add(subcommands);
+ subcommands = new ArrayList<String>();
+ subcommands.add(command);
+ } else if (command.equals("endblock")) {
+ // should be at end of commandlist
+ if (idx != size - 1) {
+ throw new WebServiceException("block commands reached endblock before end of block list");
+ }
+ subcommandsList.add(subcommands);
+ } else {
+ // just append command to current subcommands list
+ subcommands.add(command);
+ }
+ }
+ }
+ // ok, we should have a list of command lists all starting with either next or bind
+ // now we execute each next command list in turn after substituting bound variables
+ // of the form $xxx and we execute each bind command list by testing result values
+ // against literals or binding result values to variables and possibly outputting
+ // results to the global results list
+
+ List<String> subresultsList = null;
+ size = subcommandsList.size();
+
+ for (idx = 0; idx < size; idx++) {
+ subcommands = subcommandsList.get(idx);
+ String command = subcommands.remove(0);
+ if (command.equals("next")) {
+ subresultsList = new ArrayList<String>();
+ bindCommands(subcommands, bindings);
+ processCommands(subcommands, subresultsList);
+ } else if (command.equals("bindings")) {
+ bindResults(subcommands, subresultsList, resultsList, bindings);
+ }
+ }
+
+ resultsList.addAll(subresultsList);
+ }
+
+ /**
+ * for each command in the command list which contains variable references substitute a command containing
+ * the value for the variable found in bindings. variables are mentioned by wrappng their name in braces.
+ *
+ * @param commands the list of commands to be processed
+ * @param bindings a map from variable names to the associated values
+ * @throws WebServiceException if a variable reference is invalidly formatted or refers
+ * to an unbound variable
+ */
+ private void bindCommands(List<String> commands, HashMap<String, String> bindings)
+ throws WebServiceException
+ {
+ bindCommands(commands, bindings, true);
+ }
+ /**
+ * for each command in the command list which contains variable references substitute a command containing
+ * the value for the variable found in bindings. variables are mentioned by wrappng their name in braces.
+ *
+ * @param commands the list of commands to be processed
+ * @param bindings a map from variable names to the associated values
+ * @param mustResolve is true if references to unbound variables should result in a thrown exception and false
+ * if they should be tolerated by being left unsubstituted
+ * @throws WebServiceException if a variable reference is invalidly formatted or refers
+ * to an unbound variable when mustResolve is true
+ */
+ private void bindCommands(List<String> commands, HashMap<String, String> bindings, boolean mustResolve)
+ throws WebServiceException
+ {
+ int size = commands.size();
+ int idx;
+ for (idx = 0; idx < size; idx++) {
+ // pop the command and append either the original or a substituted copy
+ String command = commands.remove(0);
+ String newCommand = bindCommand(command, bindings, mustResolve);
+ commands.add(newCommand.toString());
+ }
+ }
+
+ /**
+ * substitute any bound variables found in the supplied command
+ * @param command the command to be substituted
+ * @param bindings the map from currently bound variables to their string values
+ * @param mustResolve is true if references to unbound variables should result in a thrown exception and false
+ * if they should be tolerated by being left unsubstituted
+ * @return the substituted command or the original command if it contains no variable references
+ * @throws WebServiceException if a variable reference is invalidly formatted or refers
+ * to an unbound variable
+ */
+ private String bindCommand(String command, HashMap<String, String> bindings, boolean mustResolve)
+ throws WebServiceException
+ {
+ if (command.contains("{")) {
+ StringBuffer newCommandBuffer = new StringBuffer();
+ int len = command.length();
+ int pos = 0;
+ while (pos < len) {
+ char c = command.charAt(pos);
+ if (c == '{') {
+ // must have room for at least one character and a closing brace
+ if (pos > len-2) {
+ throw new WebServiceException("bindCommand : invalid variable reference " + command + " @ " + pos);
+ }
+ // brace cannot be next character so start search at pos+2
+ int endpos = command.indexOf('}', pos + 2);
+ if (endpos < 0) {
+ throw new WebServiceException("bindCommand : invalid variable reference " + command + " @ " + pos);
+ }
+ String var = command.substring(pos + 1, endpos);
+ // var must be alphanumeric
+ if (!var.matches("[0-9a-zA-Z]+")) {
+ throw new WebServiceException("bindCommand : invalid variable name " + command + " @ " + pos);
+ }
+ String val = bindings.get(var);
+ if (val == null) {
+ if (mustResolve) {
+ throw new WebServiceException("bindCommand : unbound variable " + command + " @ " + pos);
+ } else {
+ newCommandBuffer.append('{');
+ newCommandBuffer.append(var);
+ newCommandBuffer.append('}');
+ }
+ } else {
+ newCommandBuffer.append(val);
+ }
+ pos = endpos+1;
+ } else {
+ newCommandBuffer.append(c);
+ }
+ }
+ return newCommandBuffer.toString();
+ } else {
+ return command;
+ }
+ }
+
+ /**
+ * process each command in the binding commands list. binding commands include "set var idx"
+ * which binds a variable to a value obtained from inResults, "check idx value" which checks that a
+ * value obtaind from inResults has a given value and "output idx", which inserts a value obtained
+ * from inResults into outResults.
+ * @param commands
+ * @param inResults
+ * @param outResults
+ * @param bindings
+ * @throws WebServiceException
+ */
+ private void bindResults(List<String> commands, List<String> inResults, List<String> outResults, HashMap<String, String> bindings)
+ throws WebServiceException
+ {
+ int size = commands.size();
+ int idx;
+ for (idx = 0; idx < size; idx++) {
+ String command = commands.get(idx).trim();
+ if (command.equals("bind")) {
+ // bind var idx : var <== inResults[idx]
+ if (idx + 2 >= size) {
+ throw new WebServiceException("bindResults : invalid set format " + command);
+ }
+ String var = commands.get(idx + 1).trim();
+ String resultIdxString = commands.get(idx + 2).trim();
+ idx += 2;
+ if (!var.matches("[0-9a-zA-Z]+") || !resultIdxString.matches("[0-9]")) {
+ throw new WebServiceException("bindResults : invalid set format " + command);
+ }
+ Integer resultIdx;
+ try {
+ resultIdx = Integer.valueOf(resultIdxString);
+ } catch (NumberFormatException nfe) {
+ throw new WebServiceException("bindResults : invalid set index " + command);
+ }
+ if (resultIdx < 0 || resultIdx >= inResults.size()) {
+ throw new WebServiceException("bindResults : invalid set index " + command);
+ }
+ bindings.put(var, inResults.get(resultIdx));
+ } else if (command.equals("check")) {
+ // check value idx : ensure inResults[idx] == value
+ if (idx + 2 >= size) {
+ throw new WebServiceException("bindResults : invalid check format " + command);
+ }
+ String val = commands.get(idx + 1).trim();
+ String resultIdxString = commands.get(idx + 2).trim();
+ if (!resultIdxString.matches("[0-9]")) {
+ throw new WebServiceException("bindResults : invalid set format " + command);
+ }
+ idx += 2;
+ Integer resultIdx;
+ try {
+ resultIdx = Integer.valueOf(resultIdxString);
+ } catch (NumberFormatException nfe) {
+ throw new WebServiceException("bindResults : invalid check index " + command);
+ }
+ if (resultIdx < 0 || resultIdx >= inResults.size()) {
+ throw new WebServiceException("bindResults : invalid check index " + command);
+ }
+ String result = inResults.get(idx);
+ if (!result.equals(val)) {
+ throw new WebServiceException("bindResults : check failed, expecting " + val + " got " + result);
+ }
+ } else if (command.equals("output")) {
+ // output idx : outResults add inResults[idx];
+ if (idx + 1 >= size) {
+ throw new WebServiceException("bindResults : invalid output format " + command);
+ }
+ String resultIdxString = commands.get(idx + 1).trim();
+ idx += 1;
+ if (!resultIdxString.matches("[0-9]")) {
+ throw new WebServiceException("bindResults : invalid set format " + command);
+ }
+ Integer resultIdx;
+ try {
+ resultIdx = Integer.valueOf(resultIdxString);
+ } catch (NumberFormatException nfe) {
+ throw new WebServiceException("bindResults : invalid output index " + command);
+ }
+ if (resultIdx < 0 || resultIdx >= inResults.size()) {
+ throw new WebServiceException("bindResults : invalid output index " + command);
+ }
+ String result = inResults.get(idx);
+ outResults.add(result);
+ } else {
+ throw new WebServiceException("bindResults : invalid bind commmand " + command);
+ }
+ }
+ }
+
+ /**
+ * utiilty method provided to simplify recursive dispatch of commands to another web service. this is
+ * intended to be used to create and drive participants in subordinate transactions
+ * @param url
+ * @param commands
+ * @return
+ */
+ private ResultsType serveSubordinate(String url, CommandsType commands)
+ {
+ return getClient().serve(url, commands);
+ }
+
+ private synchronized XTSServiceTestClient getClient()
+ {
+ if (client == null) {
+ client = new XTSServiceTestClient();
+ }
+
+ return client;
+ }
+
+ /**
+ * counter used to conjure up participant names
+ */
+
+ private static int nextId = 0;
+
+ /**
+ * obtain a new participant name starting with a prefix recognised by the recovery code and terminated
+ * with the supplied suffix and a unique trailing number
+ * @param suffix a component to be added to the name before the counter identifying the type of
+ * participant
+ * @return
+ */
+
+ private synchronized String participantId(String suffix)
+ {
+ return Constants.PARTICIPANT_ID_PREFIX + suffix + "." + nextId++;
+ }
+
+ /**
+ * obtain a new transaction name starting with a transaction prefix and terminated
+ * with the supplied suffix and a unique trailing number
+ * @param suffix a component to be added to the name before the counter identifying the type of
+ * transaction
+ * @return
+ */
+ private synchronized String transactionId(String suffix)
+ {
+ return Constants.TRANSACTION_ID_PREFIX + suffix + "." + nextId++;
+ }
+
+ /**
+ * map used to identify specific service implementations with server url paths
+ */
+
+ static private HashMap<String, XTSServiceTestInterpreter> serviceMap = new HashMap<String, XTSServiceTestInterpreter>();
+
+ /**
+ * a table used to retain a handle on enlisted participants so that they can be driven by the client to
+ * perform actions not contained in the original command script.
+ */
+ private HashMap<String, ScriptedTestParticipant> participantMap;
+
+ /**
+ * a table used to retain a handle on managers for enlisted BA participants.
+ */
+ private HashMap<String, BAParticipantManager> managerMap;
+
+ /**
+ * a table used to retain a handle on AT subordinate transactions
+ */
+ private HashMap<String, TxContext> subordinateTransactionMap;
+
+ /**
+ * a table used to retain a handle on BA subactivities
+ */
+ private HashMap<String, TxContext> subordinateActivityMap;
+
+ /**
+ * a table of default command variable bindings
+ */
+ private HashMap<String, String> defaultBindings;
+
+ /**
+ * a client used to propagate requests recursively from within subtransactions or subactivities
+ */
+
+ private XTSServiceTestClient client;
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.service;
+
+import org.jboss.jbossts.xts.servicetests.generated.ObjectFactory;
+import org.jboss.jbossts.xts.servicetests.generated.ResultsType;
+import org.jboss.jbossts.xts.servicetests.generated.CommandsType;
+import org.jboss.jbossts.xts.servicetests.generated.XTSServiceTestPortType;
+
+import javax.jws.*;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+
+/**
+ * A general purpose web service used to test the WSAT and WSBA services. It implements
+ * a single service method which accepts a command list and returns a reesult list. This
+ * can be used to register participants and script their behaviour.
+ */
+ at WebService(targetNamespace = "http://jbossts.jboss.org/xts/servicetests/generated",
+ wsdlLocation = "WEB-INF/wsdl/xtsservicetests.wsdl",
+ serviceName = "XTSServiceTestService",
+ portName = "XTSServiceTestPortType",
+ name = "XTSServiceTestPortType"
+ )
+ at SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+// @EndpointConfig(configName = "Standard WSAddressing Endpoint")
+ at HandlerChain(file="handlers.xml")
+ at XmlSeeAlso({
+ ObjectFactory.class
+})
+public class XTSServiceTestPortTypeImpl implements XTSServiceTestPortType
+{
+ protected @Resource WebServiceContext context;
+
+ /**
+ *
+ * @param commands
+ * @return
+ * returns org.jboss.jbossts.xts.servicetests.generated.ResultsType
+ */
+ @WebMethod
+ @WebResult(name = "results", targetNamespace = "http://jbossts.jboss.org/xts/servicetests/generated", partName = "results")
+ public ResultsType serve(
+ @WebParam(name = "commands", targetNamespace = "http://jbossts.jboss.org/xts/servicetests/generated", partName = "commands")
+ CommandsType commands)
+ {
+ ResultsType results = new ResultsType();
+ List<String> resultsList = results.getResultList();
+ List<String> commandList = commands.getCommandList();
+
+ MessageContext messageContext = context.getMessageContext();
+ HttpServletRequest servletRequest = ((HttpServletRequest)messageContext.get(MessageContext.SERVLET_REQUEST));
+ String path = servletRequest.getServletPath();
+
+ System.out.println("service " + path);
+ for (String s : commandList)
+ {
+ System.out.println(" command " + s);
+ }
+
+ XTSServiceTestInterpreter service = XTSServiceTestInterpreter.getService(path);
+ service.processCommands(commandList, resultsList);
+
+ return results;
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestServiceManager.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestServiceManager.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestServiceManager.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.service;
+
+import javax.xml.ws.Endpoint;
+
+/**
+ * A convenience class used to dynamically deploy XTS ServiceTest Service instances
+ *
+ * Unfortunately, this cannot be used because JBossWS does not support the Endpoint API
+ */
+public class XTSServiceTestServiceManager
+{
+ public static void publish(String url)
+ {
+ Endpoint.publish(url, new XTSServiceTestPortTypeImpl());
+ }
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/CoordinatorCompletionTestParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/CoordinatorCompletionTestParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/CoordinatorCompletionTestParticipant.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,47 @@
+package org.jboss.jbossts.xts.servicetests.service.participant;
+
+import com.arjuna.wst.*;
+
+import java.io.Serializable;
+
+/**
+ * A scriptable coordinator completion participant for use by the XTSServiceTest service.
+ */
+
+ at SuppressWarnings("serial")
+public class CoordinatorCompletionTestParticipant extends ParticipantCompletionTestParticipant
+ implements BusinessAgreementWithCoordinatorCompletionParticipant, Serializable
+{
+ /**
+ *
+ */
+
+ // constructor for recovery only
+ protected CoordinatorCompletionTestParticipant()
+ {
+ }
+
+ public CoordinatorCompletionTestParticipant(String id)
+ {
+ super(id);
+ }
+
+ public void complete() throws WrongStateException, SystemException {
+ for (String s : commands) {
+ if (s.equals("complete")) {
+ commands.remove(s);
+ return;
+ } else if (s.equals("completeWrongStateException")) {
+ commands.remove(s);
+ throw new WrongStateException("CoordinatorCompletionTestParticipant complete : " + id);
+ } else if (s.equals("completeSystemException")) {
+ commands.remove(s);
+ throw new SystemException("CoordinatorCompletionTestParticipant complete : " + id);
+ }
+ }
+
+ // default behaviour is just to complete
+
+ return;
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/DurableTestParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/DurableTestParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/DurableTestParticipant.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,96 @@
+package org.jboss.jbossts.xts.servicetests.service.participant;
+
+import com.arjuna.wst.*;
+
+import java.io.Serializable;
+
+/**
+ * A scriptable durable participant for use by the XTSServiceTest service.
+ */
+
+ at SuppressWarnings("serial")
+public class DurableTestParticipant
+ extends ScriptedTestParticipant
+ implements Durable2PCParticipant, Serializable
+{
+ // constructor for recovery only
+ protected DurableTestParticipant()
+ {
+ }
+
+ public DurableTestParticipant(String id)
+ {
+ super(id);
+ }
+
+ public Vote prepare() throws WrongStateException, SystemException {
+ for (String s : commands) {
+ if (s.equals("prepare")) {
+ commands.remove(s);
+ return new Prepared();
+ } else if (s.equals("prepareReadOnly")) {
+ commands.remove(s);
+ return new ReadOnly();
+ } else if (s.equals("prepareAbort")) {
+ commands.remove(s);
+ return new Aborted();
+ } else if (s.equals("prepareWrongStateException")) {
+ commands.remove(s);
+ throw new WrongStateException("DurableTestParticipant prepare : " + id);
+ } else if (s.equals("prepareSystemException")) {
+ commands.remove(s);
+ throw new SystemException("DurableTestParticipant prepare : " + id);
+ }
+ }
+
+ // default behaviour is just to prepare
+
+ return new Prepared();
+ }
+
+ public void commit() throws WrongStateException, SystemException {
+ for (String s : commands) {
+ if (s.equals("commit")) {
+ commands.remove(s);
+ return;
+ } else if (s.equals("commitWrongStateException")) {
+ commands.remove(s);
+ throw new WrongStateException("DurableTestParticipant commit : " + id);
+ } else if (s.equals("commitSystemException")) {
+ commands.remove(s);
+ throw new SystemException("DurableTestParticipant commit : " + id);
+ }
+ }
+
+ // default behaviour is just to commit
+
+ return;
+ }
+
+ public void rollback() throws WrongStateException, SystemException {
+ for (String s : commands) {
+ if (s.equals("rollback")) {
+ commands.remove(s);
+ return;
+ } else if (s.equals("rollbackWrongStateException")) {
+ commands.remove(s);
+ throw new WrongStateException("DurableTestParticipant rollback : " + id);
+ } else if (s.equals("rollbackSystemException")) {
+ commands.remove(s);
+ throw new SystemException("DurableTestParticipant rollback : " + id);
+ }
+ }
+
+ // default behaviour is just to rollback
+
+ return;
+ }
+
+ public void unknown() throws SystemException {
+ // do nothing
+ }
+
+ public void error() throws SystemException {
+ // do nothing
+ }
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/ParticipantCompletionTestParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/ParticipantCompletionTestParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/ParticipantCompletionTestParticipant.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,105 @@
+package org.jboss.jbossts.xts.servicetests.service.participant;
+
+import com.arjuna.wst.*;
+
+import java.io.Serializable;
+
+/**
+ * A scriptable participant completion participant for use by the XTSServiceTest service.
+ */
+
+ at SuppressWarnings("serial")
+public class ParticipantCompletionTestParticipant
+ extends ScriptedTestParticipant
+ implements BusinessAgreementWithParticipantCompletionParticipant, Serializable
+{
+ // constructor for recovery only
+ protected ParticipantCompletionTestParticipant()
+ {
+ }
+
+ public ParticipantCompletionTestParticipant(String id)
+ {
+ super(id);
+ }
+
+ public void addCommand(String command)
+ {
+ commands.add(command);
+ }
+
+ public void close() throws WrongStateException, SystemException {
+ for (String s : commands) {
+ if (s.equals("close")) {
+ commands.remove(s);
+ return;
+ } else if (s.equals("closeWrongStateException")) {
+ commands.remove(s);
+ throw new WrongStateException("ParticipantCompletionTestParticipant close : " + id);
+ } else if (s.equals("closeSystemException")) {
+ commands.remove(s);
+ throw new SystemException("ParticipantCompletionTestParticipant close : " + id);
+ }
+ }
+
+ // default behaviour is just to complete
+
+ return;
+ }
+
+ public void cancel() throws FaultedException, WrongStateException, SystemException {
+ for (String s : commands) {
+ if (s.equals("cancel")) {
+ commands.remove(s);
+ return;
+ } else if (s.equals("cancelFaultedException")) {
+ commands.remove(s);
+ throw new FaultedException("ParticipantCompletionTestParticipant cancel : " + id);
+ } else if (s.equals("cancelWrongStateException")) {
+ commands.remove(s);
+ throw new WrongStateException("ParticipantCompletionTestParticipant cancel : " + id);
+ } else if (s.equals("cancelSystemException")) {
+ commands.remove(s);
+ throw new SystemException("ParticipantCompletionTestParticipant cancel : " + id);
+ }
+ }
+
+ // default behaviour is just to complete
+
+ return;
+ }
+
+ public void compensate() throws FaultedException, WrongStateException, SystemException {
+ for (String s : commands) {
+ if (s.equals("compensate")) {
+ commands.remove(s);
+ return;
+ } else if (s.equals("compensateFaultedException")) {
+ commands.remove(s);
+ throw new FaultedException("ParticipantCompletionTestParticipant compensate : " + id);
+ } else if (s.equals("compensateWrongStateException")) {
+ commands.remove(s);
+ throw new WrongStateException("ParticipantCompletionTestParticipant compensate : " + id);
+ } else if (s.equals("compensateSystemException")) {
+ commands.remove(s);
+ throw new SystemException("ParticipantCompletionTestParticipant compensate : " + id);
+ }
+ }
+
+ // default behaviour is just to complete
+
+ return;
+ }
+
+ public String status() throws SystemException {
+ return null;
+ }
+
+ public void unknown() throws SystemException {
+ // do nothing for now
+ }
+
+ public void error() throws SystemException {
+ // do nothing for now
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/ScriptedTestParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/ScriptedTestParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/ScriptedTestParticipant.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,37 @@
+package org.jboss.jbossts.xts.servicetests.service.participant;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.Serializable;
+
+/**
+ * Generic participant class which enables scripting of participant behaviour via a list of commands
+ */
+
+ at SuppressWarnings("serial")
+public class ScriptedTestParticipant implements Serializable {
+
+ protected String id;
+ protected List<String> commands;
+
+ // constructor for recovery only
+ protected ScriptedTestParticipant()
+ {
+ }
+
+ protected ScriptedTestParticipant(String id)
+ {
+ this.id = id;
+ commands = new ArrayList<String>();
+ }
+
+ public void addCommand(String command)
+ {
+ commands.add(command);
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/VolatileTestParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/VolatileTestParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/participant/VolatileTestParticipant.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,94 @@
+package org.jboss.jbossts.xts.servicetests.service.participant;
+
+import com.arjuna.wst.*;
+
+
+/**
+ * A scriptable non-durable participant for use by the XTSServiceTest service.
+ */
+ at SuppressWarnings("serial")
+public class VolatileTestParticipant
+ extends ScriptedTestParticipant
+ implements Volatile2PCParticipant
+{
+ public VolatileTestParticipant(String id)
+ {
+ super(id);
+ }
+
+ public void addCommand(String command)
+ {
+ commands.add(command);
+ }
+
+ public Vote prepare() throws WrongStateException, SystemException {
+ for (String s : commands) {
+ if (s.equals("prepare")) {
+ commands.remove(s);
+ return new Prepared();
+ } else if (s.equals("prepareReadOnly")) {
+ commands.remove(s);
+ return new ReadOnly();
+ } else if (s.equals("prepareAbort")) {
+ commands.remove(s);
+ return new Aborted();
+ } else if (s.equals("prepareWrongStateException")) {
+ commands.remove(s);
+ throw new WrongStateException("DurableTestParticipant prepare : " + id);
+ } else if (s.equals("prepareSystemException")) {
+ commands.remove(s);
+ throw new SystemException("DurableTestParticipant prepare : " + id);
+ }
+ }
+
+ // default behaviour is just to prepare
+
+ return new Prepared();
+ }
+
+ public void commit() throws WrongStateException, SystemException {
+ for (String s : commands) {
+ if (s.equals("commit")) {
+ commands.remove(s);
+ return;
+ } else if (s.equals("commitWrongStateException")) {
+ commands.remove(s);
+ throw new WrongStateException("DurableTestParticipant commit : " + id);
+ } else if (s.equals("commitSystemException")) {
+ commands.remove(s);
+ throw new SystemException("DurableTestParticipant commit : " + id);
+ }
+ }
+
+ // default behaviour is just to commit
+
+ return;
+ }
+
+ public void rollback() throws WrongStateException, SystemException {
+ for (String s : commands) {
+ if (s.equals("rollback")) {
+ commands.remove(s);
+ return;
+ } else if (s.equals("rollbackWrongStateException")) {
+ commands.remove(s);
+ throw new WrongStateException("DurableTestParticipant rollback : " + id);
+ } else if (s.equals("rollbackSystemException")) {
+ commands.remove(s);
+ throw new SystemException("DurableTestParticipant rollback : " + id);
+ }
+ }
+
+ // default behaviour is just to rollback
+
+ return;
+ }
+
+ public void unknown() throws SystemException {
+ // do nothing
+ }
+
+ public void error() throws SystemException {
+ // do nothing
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/recovery/TestATRecoveryModule.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/recovery/TestATRecoveryModule.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/recovery/TestATRecoveryModule.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,105 @@
+package org.jboss.jbossts.xts.servicetests.service.recovery;
+
+import org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryModule;
+import org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager;
+import org.jboss.jbossts.xts.servicetests.service.Constants;
+import org.jboss.jbossts.xts.servicetests.service.participant.DurableTestParticipant;
+import com.arjuna.wst.Durable2PCParticipant;
+
+import java.io.ObjectInputStream;
+
+/**
+ * Application-specific WS-AT participant recovery manager for service test application, This class
+ * is responsible for recreating application-specific durable participants from records
+ * logged at prepare time.
+ */
+public class TestATRecoveryModule implements XTSATRecoveryModule
+{
+ /**
+ * the singleton recovery module
+ */
+ private static TestATRecoveryModule theRecoveryModule = null;
+
+ /**
+ * a count of how many xts test services are currently installed
+ */
+ private static int serviceCount = 0;
+
+ /**
+ * called during deployment of a test service to ensure the recovery module for the
+ * test service is installed whenever any of the services is active
+ */
+ public static void register()
+ {
+ if (theRecoveryModule == null) {
+ theRecoveryModule = new TestATRecoveryModule();
+ }
+ if (serviceCount == 0) {
+ XTSATRecoveryManager.getRecoveryManager().registerRecoveryModule(theRecoveryModule);
+ }
+ serviceCount++;
+ }
+
+ /**
+ * called during undeployment of a test service to ensure the recovery module for
+ * the test is deinstalled once none of the services is active
+ */
+ public static void unregister()
+ {
+ if (serviceCount > 0) {
+ serviceCount--;
+ if (serviceCount == 0) {
+ XTSATRecoveryManager.getRecoveryManager().unregisterRecoveryModule(theRecoveryModule);
+ }
+ }
+ }
+
+ /**
+ * called during recovery processing to allow an application to identify a participant id
+ * belonging to one of its participants and recreate the participant by deserializing
+ * it from the supplied object input stream. n.b. this is only appropriate in case the
+ * participant was originally saved using serialization.
+ *
+ * @param id the id used when the participant was created
+ * @param stream a stream from which the application should deserialise the participant
+ * if it recognises that the id belongs to the module's application
+ * @return
+ * @throws Exception if an error occurs deserializing the durable participant
+ */
+ public Durable2PCParticipant deserialize(String id, ObjectInputStream stream) throws Exception {
+ if (id.startsWith(Constants.PARTICIPANT_ID_PREFIX + "DurableTestParticipant")) {
+ System.out.println("xts service test : attempting to deserialize WS-AT participant " + id);
+ DurableTestParticipant participant = (DurableTestParticipant)stream.readObject();
+ System.out.println("xts service test : deserialized WS-AT participant " + id);
+ return participant;
+ }
+
+ return null;
+ }
+
+ /**
+ * called during recovery processing to allow an application to identify a participant id
+ * belonging to one of its participants and use the saved recovery state to recreate the
+ * participant. n.b. this is only appropriate in case the participant was originally saved
+ * after being converted to a byte array using the PersistibleATParticipant interface.
+ *
+ * @param id the id used when the participant was created
+ * @param recoveryState a byte array returned form the original participant via a call to
+ * method getRecoveryState of interface PersistableATParticipant
+ * @return
+ * @throws Exception if an error occurs converting the recoveryState back to a
+ * durable participant
+ */
+ public Durable2PCParticipant recreate(String id, byte[] recoveryState) throws Exception {
+ if (id.startsWith(Constants.PARTICIPANT_ID_PREFIX)) {
+ // this should not get called -- test WS-AT participants are saved and restored
+ // using serialization
+ throw new Exception("xts service test : invalid request to recreate() WS-AT participant " + id);
+ }
+ return null;
+ }
+
+ public void endScan()
+ {
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/recovery/TestBARecoveryModule.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/recovery/TestBARecoveryModule.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/recovery/TestBARecoveryModule.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,104 @@
+package org.jboss.jbossts.xts.servicetests.service.recovery;
+
+import org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryModule;
+import org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager;
+import org.jboss.jbossts.xts.servicetests.service.Constants;
+import com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant;
+import com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant;
+
+import java.io.ObjectInputStream;
+
+/**
+ * Application-specific WS-AT participant recovery manager for service test application, This class
+ * is responsible for recreating application-specific durable participants from records
+ * logged at prepare time.
+ */
+public class TestBARecoveryModule implements XTSBARecoveryModule
+{
+ /**
+ * the singleton recovery module
+ */
+ private static TestBARecoveryModule theRecoveryModule = null;
+
+ /**
+ * a count of how many xts demo services are currently installed
+ */
+ private static int serviceCount = 0;
+
+ /**
+ * called during deployment of a test service to ensure the recovery module for the
+ * test is installed whenever any of the services is active
+ */
+ public static void register()
+ {
+ if (theRecoveryModule == null) {
+ theRecoveryModule = new TestBARecoveryModule();
+ }
+ if (serviceCount == 0) {
+ XTSBARecoveryManager.getRecoveryManager().registerRecoveryModule(theRecoveryModule);
+ }
+ serviceCount++;
+ }
+
+ /**
+ * called during undeployment of a test service to ensure the recovery module for
+ * the test is deinstalled once none of the services is active
+ */
+ public static void unregister()
+ {
+ if (serviceCount > 0) {
+ serviceCount--;
+ if (serviceCount == 0) {
+ XTSBARecoveryManager.getRecoveryManager().unregisterRecoveryModule(theRecoveryModule);
+ }
+ }
+ }
+
+ public BusinessAgreementWithParticipantCompletionParticipant deserializeParticipantCompletionParticipant(String id, ObjectInputStream stream) throws Exception {
+ if (id.startsWith(Constants.PARTICIPANT_ID_PREFIX + "ParticipantCompletionParticipant")) {
+ System.out.println("xts service test : attempting to deserialize WS-BA participant completion participant " + id);
+ BusinessAgreementWithParticipantCompletionParticipant participant
+ = (BusinessAgreementWithParticipantCompletionParticipant)stream.readObject();
+ System.out.println("xts service test : deserialized WS-BA participant completion participant " + id);
+ return participant;
+ }
+
+ return null;
+ }
+
+ public BusinessAgreementWithParticipantCompletionParticipant recreateParticipantCompletionParticipant(String id, byte[] recoveryState) throws Exception {
+ if (id.startsWith(Constants.PARTICIPANT_ID_PREFIX + "ParticipantCompletionParticipant")) {
+ // this should not get called -- test WS-BA participants are saved and restored
+ // using serialization
+ throw new Exception("xts service test : invalid request to recreate() WS-BA participant completion participant " + id);
+ }
+
+ return null;
+ }
+
+ public BusinessAgreementWithCoordinatorCompletionParticipant deserializeCoordinatorCompletionParticipant(String id, ObjectInputStream stream) throws Exception {
+ if (id.startsWith(Constants.PARTICIPANT_ID_PREFIX + "CoordinatorCompletionParticipant")) {
+ System.out.println("xts service test : attempting to deserialize WS-BA coordinator completion participant " + id);
+ BusinessAgreementWithCoordinatorCompletionParticipant participant
+ = (BusinessAgreementWithCoordinatorCompletionParticipant)stream.readObject();
+ System.out.println("xts service test : deserialized WS-BA coordinator completion participant " + id);
+ return participant;
+ }
+
+ return null;
+ }
+
+ public BusinessAgreementWithCoordinatorCompletionParticipant recreateCoordinatorCompletionParticipant(String id, byte[] recoveryState) throws Exception {
+ if (id.startsWith(Constants.PARTICIPANT_ID_PREFIX + "CoordinatorCompletionParticipant")) {
+ // this should not get called -- test WS-BA participants are saved and restored
+ // using serialization
+ throw new Exception("xts service test : invalid request to recreate() WS-BA coordinator completion participant " + id);
+ }
+
+ return null;
+ }
+
+ public void endScan()
+ {
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/subordinate/XTSSubordinateServiceTestPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/subordinate/XTSSubordinateServiceTestPortTypeImpl.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/service/subordinate/XTSSubordinateServiceTestPortTypeImpl.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.service.subordinate;
+
+import org.jboss.jbossts.xts.servicetests.generated.ObjectFactory;
+import org.jboss.jbossts.xts.servicetests.generated.ResultsType;
+import org.jboss.jbossts.xts.servicetests.generated.CommandsType;
+import org.jboss.jbossts.xts.servicetests.generated.XTSServiceTestPortType;
+import org.jboss.jbossts.xts.servicetests.service.XTSServiceTestInterpreter;
+
+import javax.jws.*;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+
+/**
+ * A general purpose web service used to test the WSAT and WSBA services. It implements
+ * a single service method which accepts a command list and returns a reesult list. This
+ * can be used to register participants and script their behaviour. This differs from the
+ * service in the parent package only in one detail It employs a handler which checks for
+ * an existing context, creates a subordinate transaction and installs the subordinate
+ * context.
+ */
+ at WebService(targetNamespace = "http://jbossts.jboss.org/xts/servicetests/generated",
+ wsdlLocation = "WEB-INF/wsdl/xtsservicetests.wsdl",
+ serviceName = "XTSServiceTestService",
+ portName = "XTSServiceTestPortType",
+ name = "XTSServiceTestPortType"
+ )
+ at SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+// @EndpointConfig(configName = "Standard WSAddressing Endpoint")
+ at HandlerChain(file="subordinatehandlers.xml")
+ at XmlSeeAlso({
+ ObjectFactory.class
+})
+public class XTSSubordinateServiceTestPortTypeImpl implements XTSServiceTestPortType
+{
+ protected @Resource WebServiceContext context;
+
+ /**
+ *
+ * @param commands
+ * @return
+ * returns org.jboss.jbossts.xts.servicetests.generated.ResultsType
+ */
+ @WebMethod
+ @WebResult(name = "results", targetNamespace = "http://jbossts.jboss.org/xts/servicetests/generated", partName = "results")
+ public ResultsType serve(
+ @WebParam(name = "commands", targetNamespace = "http://jbossts.jboss.org/xts/servicetests/generated", partName = "commands")
+ CommandsType commands)
+ {
+ ResultsType results = new ResultsType();
+ List<String> resultsList = results.getResultList();
+ List<String> commandList = commands.getCommandList();
+
+ MessageContext messageContext = context.getMessageContext();
+ HttpServletRequest servletRequest = ((HttpServletRequest)messageContext.get(MessageContext.SERVLET_REQUEST));
+ String path = servletRequest.getServletPath();
+
+ System.out.println("service " + path);
+ for (String s : commandList)
+ {
+ System.out.println(" command " + s);
+ }
+
+ XTSServiceTestInterpreter service = XTSServiceTestInterpreter.getService(path);
+ service.processCommands(commandList, resultsList);
+
+ return results;
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/XTSServiceTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/XTSServiceTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/XTSServiceTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test;
+
+/**
+ * API implemented by classes which are used to execute a specific XTS service test
+ */
+public interface XTSServiceTest
+{
+ public void run();
+ public boolean isSuccessful();
+ public Exception getException();
+
+ // System properties which can be set to configure the behaviour of tests
+
+ public static final String SERVICE_URL1_KEY = "org.jboss.jbossts.xts.servicetests.serviceURL1";
+ public static final String SERVICE_URL2_KEY = "org.jboss.jbossts.xts.servicetests.serviceURL2";
+ public static final String SERVICE_URL3_KEY = "org.jboss.jbossts.xts.servicetests.serviceURL3";
+ public static final String SUBORDINATE_SERVICE_URL1_KEY = "org.jboss.jbossts.xts.servicetests.subordinate.serviceURL1";
+ public static final String SUBORDINATE_SERVICE_URL2_KEY = "org.jboss.jbossts.xts.servicetests.subordinate.sserviceURL2";
+ public static final String SUBORDINATE_SERVICE_URL3_KEY = "org.jboss.jbossts.xts.servicetests.subordinate.sserviceURL3";
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/XTSServiceTestBase.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/XTSServiceTestBase.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/XTSServiceTestBase.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,37 @@
+package org.jboss.jbossts.xts.servicetests.test;
+
+import org.jboss.jbossts.xts.servicetests.service.XTSServiceTestInterpreter;
+
+/**
+ * Class providing default behaviour for specific XTSServiceTest implementations. n.b. this class
+ * extends
+ */
+public class XTSServiceTestBase extends XTSServiceTestInterpreter
+{
+ protected boolean isSuccessful;
+ protected Exception exception;
+
+ protected XTSServiceTestBase()
+ {
+ isSuccessful = false;
+ exception = null;
+ }
+
+ public boolean isSuccessful() {
+ return isSuccessful; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Exception getException() {
+ return exception; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void error(String message)
+ {
+ System.err.println(this.getClass().getName() + " : " + message);
+ }
+
+ public void message(String message)
+ {
+ System.out.println(this.getClass().getName() + " : " + message);
+ }
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/MultiParticipantPrepareAndCommitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/MultiParticipantPrepareAndCommitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/MultiParticipantPrepareAndCommitTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.at;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserTransactionFactory;
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlist several participants for the same web service with instructions to
+ * prepare and commit without error
+ */
+public class MultiParticipantPrepareAndCommitTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ public void run() {
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+
+ UserTransaction tx = UserTransactionFactory.userTransaction();
+
+
+ // start the transaction
+
+ try {
+ tx.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistDurable");
+ commands.add("prepare");
+ commands.add("commit");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistDurable");
+ commands.add("prepare");
+ commands.add("commit");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistDurable");
+ commands.add("prepare");
+ commands.add("commit");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now commit the transaction
+
+ try {
+ tx.commit();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ message("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/MultiServicePrepareAndCommitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/MultiServicePrepareAndCommitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/MultiServicePrepareAndCommitTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.at;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserTransactionFactory;
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlist a single participants for each of several web services with instructions to
+ * prepare and commit without error
+ */
+public class MultiServicePrepareAndCommitTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+ String serviceURL2;
+ String serviceURL3;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+ serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
+ serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ if (serviceURL2 == null) {
+ serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
+ }
+
+ if (serviceURL3 == null) {
+ serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+ addDefaultBinding("service2", serviceURL2);
+ addDefaultBinding("service3", serviceURL3);
+
+ UserTransaction tx = UserTransactionFactory.userTransaction();
+
+
+ // start the transaction
+
+ try {
+ tx.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ // invoke the service and tell it to prepare and commit
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistDurable");
+ commands.add("prepare");
+ commands.add("commit");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service2}");
+ commands.add("enlistDurable");
+ commands.add("prepare");
+ commands.add("commit");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service3}");
+ commands.add("enlistDurable");
+ commands.add("prepare");
+ commands.add("commit");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now commit the transaction
+
+ try {
+ tx.commit();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ message("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/SingleParticipantPrepareAndCommitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/SingleParticipantPrepareAndCommitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/at/SingleParticipantPrepareAndCommitTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.at;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserTransactionFactory;
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists a single participant with instructions to prepare and commit
+ * without error
+ */
+public class SingleParticipantPrepareAndCommitTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+
+ UserTransaction tx = UserTransactionFactory.userTransaction();
+
+ // start the transaction
+
+ try {
+ tx.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistDurable");
+ commands.add("prepare");
+ commands.add("commit");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now commit the transaction
+
+ try {
+ tx.commit();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ message("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists multipleparticipants with instructions to prepare and commit
+ * without error then gets one of them to exit before closing
+ */
+public class MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P1");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("exit");
+ commands.add("{P1}");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ message("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists mulitple participants swith instructions to prepare and commit
+ * without error
+ */
+public class MultiParticipantCoordinatorCompletionParticipantCloseTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ message("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseAndExitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseAndExitTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,163 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists multipleparticipants with instructions to prepare and commit
+ * without error then gets one of them to exit before closing
+ */
+public class MultiParticipantParticipantCompletionParticipantCloseAndExitTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P1");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P2");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P3");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("exit");
+ commands.add("{P1}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("completed");
+ commands.add("{P2}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("completed");
+ commands.add("{P3}");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ error("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,163 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists mulitple participants swith instructions to prepare and commit
+ * without error
+ */
+public class MultiParticipantParticipantCompletionParticipantCloseTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P1");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P2");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P3");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("completed");
+ commands.add("{P1}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("completed");
+ commands.add("{P2}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("completed");
+ commands.add("{P3}");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ message("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseAndExitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseAndExitTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,161 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists a single participant in each of multiple services with instructions to
+ * prepare and commit without error
+ */
+public class MultiServiceCoordinatorCompletionParticipantCloseAndExitTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+ String serviceURL2;
+ String serviceURL3;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+ serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
+ serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ if (serviceURL2 == null) {
+ serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
+ }
+
+ if (serviceURL3 == null) {
+ serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+ addDefaultBinding("service2", serviceURL2);
+ addDefaultBinding("service3", serviceURL3);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P1");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service2}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service3}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("exit");
+ commands.add("{P1}");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ error("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,153 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists a single participant in each of multiple services with instructions to
+ * prepare and commit without error
+ */
+public class MultiServiceCoordinatorCompletionParticipantCloseTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+ String serviceURL2;
+ String serviceURL3;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+ serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
+ serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ if (serviceURL2 == null) {
+ serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
+ }
+
+ if (serviceURL3 == null) {
+ serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+ addDefaultBinding("service2", serviceURL2);
+ addDefaultBinding("service3", serviceURL3);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service2}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service3}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ error("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseAndExitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseAndExitTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,177 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists a single participant in each of multiple services with instructions to
+ * prepare and commit without error
+ */
+public class MultiServiceParticipantCompletionParticipantCloseAndExitTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+ String serviceURL2;
+ String serviceURL3;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+ serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
+ serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ if (serviceURL2 == null) {
+ serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
+ }
+
+ if (serviceURL3 == null) {
+ serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+ addDefaultBinding("service2", serviceURL2);
+ addDefaultBinding("service3", serviceURL3);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P1");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service2}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P2");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service3}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P3");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("exit");
+ commands.add("{P1}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service2}");
+ commands.add("completed");
+ commands.add("{P2}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service3}");
+ commands.add("completed");
+ commands.add("{P3}");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ error("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,177 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists a single participant in each of multiple services with instructions to
+ * prepare and commit without error
+ */
+public class MultiServiceParticipantCompletionParticipantCloseTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+ String serviceURL2;
+ String serviceURL3;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+ serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
+ serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ if (serviceURL2 == null) {
+ serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
+ }
+
+ if (serviceURL3 == null) {
+ serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+ addDefaultBinding("service2", serviceURL2);
+ addDefaultBinding("service3", serviceURL3);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P1");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service2}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P2");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service3}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P3");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("completed");
+ commands.add("{P1}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service2}");
+ commands.add("completed");
+ commands.add("{P2}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service3}");
+ commands.add("completed");
+ commands.add("{P3}");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ message("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/SingleCoordinatorCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/SingleCoordinatorCompletionParticipantCloseTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/SingleCoordinatorCompletionParticipantCloseTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists a single participant with instructions to prepare and commit
+ * without error
+ */
+public class SingleCoordinatorCompletionParticipantCloseTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ message("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/SingleParticipantCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/SingleParticipantCompletionParticipantCloseTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/SingleParticipantCompletionParticipantCloseTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists a single participant with instructions to prepare and commit
+ * without error
+ */
+public class SingleParticipantCompletionParticipantCloseTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P1");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("completed");
+ commands.add("{P1}");
+ commands.add("endblock");
+
+ /*
+ * this can also be done by calling serve with a single block command
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("block");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bind");
+ commands.add("P1");
+ commands.add("0");
+ commands.add("next");
+ commands.add("completed");
+ commands.add("{P1}");
+ commands.add("endblock");
+ */
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("close failure " + exception);
+ }
+
+ message("finished");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba.subordinate;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists a cooprdinator completion participant with instructions to complete and close
+ * without error then gets the web service to start a subordinate transaction and enlist several cooprdinator
+ * completion participants for a second web service in the subtransaction with no instructions. The subordinate
+ * participants are then told to exit. This checks that the subordinate coordinator works ok when all its
+ * participants are read only and hence that no subordinate tx is logged at commit
+ */
+public class MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+ String subserviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ subserviceURL1 = System.getProperty(XTSServiceTest.SUBORDINATE_SERVICE_URL1_KEY);
+
+ if (subserviceURL1 == null) {
+ subserviceURL1 = "http://localhost:8080/xtstest/xtssubordinateservicetest1";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+ addDefaultBinding("subservice1", subserviceURL1);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P1");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P2");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P3");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("exit");
+ commands.add("{P2}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("exit");
+ commands.add("{P3}");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ message("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantCoordinatorCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantCoordinatorCompletionParticipantCloseTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantCoordinatorCompletionParticipantCloseTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,153 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba.subordinate;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists a cooprdinator completion participant with instructions to complete and close
+ * without error then gets the web service to start a subordinate transaction and enlist several cooprdinator
+ * completion participants for a second web service in the subtransaction also with instructions to complete
+ * and close without error
+ */
+public class MultiParticipantCoordinatorCompletionParticipantCloseTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+ String subserviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ subserviceURL1 = System.getProperty(XTSServiceTest.SUBORDINATE_SERVICE_URL1_KEY);
+
+ if (subserviceURL1 == null) {
+ subserviceURL1 = "http://localhost:8080/xtstest/xtssubordinateservicetest1";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+ addDefaultBinding("subservice1", subserviceURL1);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P1");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("enlistCoordinatorCompletion");
+ commands.add("complete");
+ commands.add("close");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ message("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantParticipantCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantParticipantCompletionParticipantCloseAndExitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantParticipantCompletionParticipantCloseAndExitTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba.subordinate;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists a cooprdinator completion participant with instructions to complete and close
+ * without error then gets the web service to start a subordinate transaction and enlist several cooprdinator
+ * completion participants for a second web service in the subtransaction with no instructions. The subordinate
+ * participants are then told to exit. This checks that the subordinate coordinator works ok when all its
+ * participants are read only and hence that no subordinate tx is logged at commit
+ */
+public class MultiParticipantParticipantCompletionParticipantCloseAndExitTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+ String subserviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ subserviceURL1 = System.getProperty(XTSServiceTest.SUBORDINATE_SERVICE_URL1_KEY);
+
+ if (subserviceURL1 == null) {
+ subserviceURL1 = "http://localhost:8080/xtstest/xtssubordinateservicetest1";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+ addDefaultBinding("subservice1", subserviceURL1);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P1");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P2");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P3");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("completed");
+ commands.add("{P1}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("exit");
+ commands.add("{P2}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("exit");
+ commands.add("{P3}");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ message("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantParticipantCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantParticipantCompletionParticipantCloseTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/test/ba/subordinate/MultiParticipantParticipantCompletionParticipantCloseTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,173 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test.ba.subordinate;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTestBase;
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Starts a transaction and enlists a cooprdinator completion participant with instructions to complete and close
+ * without error then gets the web service to start a subordinate transaction and enlist several cooprdinator
+ * completion participants for a second web service in the subtransaction also with instructions to complete
+ * and close without error
+ */
+public class MultiParticipantParticipantCompletionParticipantCloseTest extends XTSServiceTestBase implements XTSServiceTest
+{
+ @SuppressWarnings("unused")
+ public void run() {
+
+ // wait a while so the service has time to start
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+
+ String serviceURL1;
+ String subserviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ subserviceURL1 = System.getProperty(XTSServiceTest.SUBORDINATE_SERVICE_URL1_KEY);
+
+ if (subserviceURL1 == null) {
+ subserviceURL1 = "http://localhost:8080/xtstest/xtssubordinateservicetest1";
+ }
+
+ addDefaultBinding("service1", serviceURL1);
+ addDefaultBinding("subservice1", subserviceURL1);
+
+ UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
+
+ // start the transaction
+
+ try {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("txbegin failure " + exception);
+ return;
+ }
+
+ List<String> resultsList;
+ String participantId;
+
+ List<String> commands = new ArrayList<String>();
+ List<String> results = new ArrayList<String>();
+
+ commands.add("block");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P1");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P2");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("enlistParticipantCompletion");
+ commands.add("close");
+ commands.add("bindings");
+ commands.add("bind");
+ commands.add("P3");
+ commands.add("0");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{service1}");
+ commands.add("completed");
+ commands.add("{P1}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("completed");
+ commands.add("{P2}");
+ commands.add("next");
+ commands.add("serve");
+ commands.add("{subservice1}");
+ commands.add("completed");
+ commands.add("{P3}");
+ commands.add("endblock");
+
+ try {
+ processCommands(commands, results);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("test failure " + exception);
+ return;
+ }
+
+ // now close the activity
+
+ try {
+ ba.close();
+ } catch (TransactionRolledBackException e) {
+ exception = e;
+ } catch (UnknownTransactionException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ } catch (WrongStateException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ error("commit failure " + exception);
+ }
+
+ message("completed");
+
+ isSuccessful = (exception == null);
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/webbean/XTSHTTPServiceTestRunner.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/webbean/XTSHTTPServiceTestRunner.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/java/org/jboss/jbossts/xts/servicetests/webbean/XTSHTTPServiceTestRunner.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,205 @@
+package org.jboss.jbossts.xts.servicetests.webbean;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
+
+/**
+ * a servlet which allows XTS Servcie tests to be run via a web form
+ *
+ * this is provided for use during testing. Service tests are normally expected to be run at AS boot
+ * via XTSServiceTestRunnerBean
+ */
+ at SuppressWarnings("serial")
+public class XTSHTTPServiceTestRunner extends HttpServlet
+{
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+ }
+
+ protected String getContentType()
+ {
+ return "text/html";
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException
+ {
+ PrintWriter writer = response.getWriter();
+
+ response.setContentType(getContentType());
+ response.setHeader("Cache-Control", "no-cache");
+
+ doStatus(writer, request, response);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException
+ {
+ PrintWriter writer = response.getWriter();
+
+ response.setContentType(getContentType());
+ response.setHeader("Cache-Control", "no-cache");
+
+ if ((_runnerThread == null) || (! _runnerThread.isAlive()))
+ {
+ _testClassName = request.getParameter("TestClassName");
+
+ if (_testClassName != null) {
+ Class testClass;
+ ClassLoader cl = XTSHTTPServiceTestRunner.class.getClassLoader();
+
+ try {
+ testClass = cl.loadClass(_testClassName);
+ } catch (ClassNotFoundException cnfe) {
+ throw new ServletException("XTSHTTPServicetestRunner : cannot find test class " + _testClassName, cnfe);
+ }
+
+ try {
+ _currentTest = (XTSServiceTest)testClass.newInstance();
+ } catch (InstantiationException ie) {
+ throw new ServletException("XTSHTTPServicetestRunner : cannot instantiate test class " + _testClassName, ie);
+ } catch (IllegalAccessException iae) {
+ throw new ServletException("XTSHTTPServicetestRunner : cannot access constructor for test class " + _testClassName, iae);
+ }
+
+ // since we are running in the AS startup thread we need a separate thread for the test
+
+ _runnerThread = new Thread() {
+ public void run()
+ {
+ _currentTest.run();
+ }
+ };
+
+ _runnerThread.start();
+ }
+ }
+
+ doStatus(writer, request, response);
+ }
+
+ public void doStatus(PrintWriter writer, HttpServletRequest request, HttpServletResponse response)
+ throws ServletException {
+ writer.println("<HTML>");
+ writer.println("<HEAD>");
+ writer.println("<TITLE>Test Runner</TITLE>");
+ writer.println("</HEAD>");
+ writer.println("<BODY bgcolor=\"white\" style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.println("<DIV style=\"font-family: Arial, Helvetica, sans-serif; font-size: large\"> <BR>Test Runner: Status<BR> </DIV>");
+
+ writer.println("<TABLE width=\"100%\">");
+
+ if ((_runnerThread == null) || (! _runnerThread.isAlive()))
+ {
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Action:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.print("<FORM method=\"POST\" action=\"" + request.getRequestURL() + "\">");
+ writer.print("<INPUT type=\"button\" value=\"run\" onclick=\"this.form.submit()\">");
+ writer.print(" : <INPUT type=\"text\" name=\"TestClassName\"maxlength=\"2000\" size=\"60\">");
+ writer.print("</FORM>");
+ writer.println("</TD>");
+ writer.println("</TR>");
+ if (_runnerThread != null && !_runnerThread.isAlive()) {
+ if (_currentTest != null)
+ {
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Current test:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ encode(writer, _testClassName.toString());
+ writer.println("</TD>");
+ writer.println("</TR>");
+ if (_currentTest.isSuccessful()) {
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Status:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.print("success!");
+ writer.println("</TD>");
+ writer.println("</TR>");
+ } else {
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Status:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.print("fail!");
+ writer.println("</TD>");
+ writer.println("</TR>");
+ if (_currentTest.getException() != null) {
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Exception:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.println("Exception:<BR/>");
+ encode(writer, _currentTest.getException().toString());
+ writer.println("</TD>");
+ writer.println("</TR>");
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Action:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.print("<FORM method=\"GET\" action=\"" + request.getRequestURL() + "\">");
+ writer.print("<INPUT type=\"button\" value=\"reload\" onclick=\"this.form.submit()\">");
+ writer.print("</FORM>");
+ writer.println("</TD>");
+ writer.println("</TR>");
+ if (_runnerThread != null && _currentTest != null)
+ {
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Current test:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ encode(writer, _testClassName.toString());
+ writer.println("</TD>");
+ writer.println("</TR>");
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Status:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.print("running");
+ writer.println("</TD>");
+ writer.println("</TR>");
+ }
+ }
+ writer.println("</TABLE>");
+
+
+ writer.println("</BODY>");
+ writer.println("</HTML>");
+ }
+
+
+ protected static void encode(PrintWriter writer, String string)
+ {
+ if (string != null)
+ {
+ char[] chars = string.toCharArray();
+
+ for (int index = 0; index < chars.length; index++)
+ if (chars[index] == '<')
+ writer.print("<");
+ else if (chars[index] == '>')
+ writer.print(">");
+ else if (chars[index] == '&')
+ writer.print("&");
+ else
+ writer.print(chars[index]);
+ }
+ else
+ writer.print("null");
+ }
+
+ protected XTSServiceTest _currentTest = null;
+ protected String _testClassName = null;
+ protected Thread _runnerThread = null;
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/beans.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/beans.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/beans.xml 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,18 @@
+ <!-- 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 -->
+<!-- Marker file indicating CDI should be enabled -->
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/xts/servicetests/service/handlers.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/xts/servicetests/service/handlers.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/xts/servicetests/service/handlers.xml 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,33 @@
+<?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,
+ @author JBoss Inc.
+-->
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-name>WS TX Context Handler</handler-name>
+ <handler-class>com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor</handler-class>
+ </handler>
+ </handler-chain>
+</handler-chains>
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/xts/servicetests/service/subordinate/subordinatehandlers.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/xts/servicetests/service/subordinate/subordinatehandlers.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/classes/org/jboss/jbossts/xts/servicetests/service/subordinate/subordinatehandlers.xml 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,33 @@
+<?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,
+ @author JBoss Inc.
+-->
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-name>WS TX Subordinate Context Handler</handler-name>
+ <handler-class>com.arjuna.mw.wst11.service.JaxWSSubordinateHeaderContextProcessor</handler-class>
+ </handler>
+ </handler-chain>
+</handler-chains>
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/web.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/web.xml 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,92 @@
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ as indicated by the @author tags.
+ See the copyright.txt in the distribution for a full listing
+ of individual contributors.
+ This copyrighted material is made available to anyone wishing to use,
+ modify, copy, or redistribute it subject to the terms and conditions
+ of the GNU Lesser General Public License, v. 2.1.
+ This program is distributed in the hope that it will be useful, but WITHOUT A
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public License,
+ v.2.1 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+
+ (C) 2009,
+ @author JBoss Inc.
+-->
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+ <display-name>XTS Service Tests Service</display-name>
+
+ <description>XTS Service Tests Service</description>
+
+ <!-- Initialise test services -->
+ <!--
+ <listener>
+ <listener-class>org.jboss.jbossts.xts.servicetests.bean.XTSServiceTestRunnerBean</listener-class>
+ </listener>
+ -->
+
+ <!-- Define Server endpoints and implementation classes -->
+ <servlet>
+ <servlet-name>XTS_Service_Test_Service_One</servlet-name>
+ <servlet-class>org.jboss.jbossts.xts.servicetests.service.XTSServiceTestPortTypeImpl</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>XTS_Service_Test_Service_Two</servlet-name>
+ <servlet-class>org.jboss.jbossts.xts.servicetests.service.XTSServiceTestPortTypeImpl</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>XTS_Service_Test_Service_Three</servlet-name>
+ <servlet-class>org.jboss.jbossts.xts.servicetests.service.XTSServiceTestPortTypeImpl</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>XTS_Service_Test_Subordinate_Service_One</servlet-name>
+ <servlet-class>org.jboss.jbossts.xts.servicetests.service.subordinate.XTSSubordinateServiceTestPortTypeImpl</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>XTS_Service_Test_Web_Runner</servlet-name>
+ <servlet-class>org.jboss.jbossts.xts.servicetests.webbean.XTSHTTPServiceTestRunner</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!-- Define Server Endpoint Mappings -->
+ <servlet-mapping>
+ <servlet-name>XTS_Service_Test_Service_One</servlet-name>
+ <url-pattern>/xtsservicetest1</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>XTS_Service_Test_Service_Two</servlet-name>
+ <url-pattern>/xtsservicetest2</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>XTS_Service_Test_Service_Three</servlet-name>
+ <url-pattern>/xtsservicetest3</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>XTS_Service_Test_Subordinate_Service_One</servlet-name>
+ <url-pattern>/xtssubordinateservicetest1</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>XTS_Service_Test_Web_Runner</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/wsdl/xtsservicetests.wsdl
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/wsdl/xtsservicetests.wsdl (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/main/webapp/WEB-INF/wsdl/xtsservicetests.wsdl 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,104 @@
+<?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,
+ @author JBoss Inc.
+--><!--
+ a specification for a service which can be used to dispatch a SOAP 1.1 SoapFault
+ to an arbitrary client
+-->
+<definitions
+ targetNamespace="http://jbossts.jboss.org/xts/servicetests/generated"
+ xmlns:s="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://jbossts.jboss.org/xts/servicetests/generated"
+ xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsaw="http://www.w3.org/2006/02/addressing/wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/" >
+ <types>
+ <s:schema
+ targetNamespace="http://jbossts.jboss.org/xts/servicetests/generated"
+ xmlns="http://jbossts.jboss.org/xts/servicetests/generated">
+ <s:simpleType name="commandList">
+ <s:list itemType="s:string"/>
+ </s:simpleType>
+
+ <s:simpleType name="resultList">
+ <s:list itemType="s:string">
+ </s:list>
+ </s:simpleType>
+
+ <s:complexType name="commandsType">
+ <s:sequence>
+ <s:element name="commandList" type="commandList"/>
+ </s:sequence>
+ </s:complexType>
+
+ <s:complexType name="resultsType">
+ <s:sequence>
+ <s:element name="resultList" type="resultList"/>
+ </s:sequence>
+ </s:complexType>
+
+ <s:element name="commands" type="commandsType"/>
+
+ <s:element name="results" type="resultsType"/>
+
+ <!--
+ <s:import namespace="http://schemas.xmlsoap.org/soap/envelope/"
+ schemaLocation="http://schemas.xmlsoap.org/soap/envelope"/>
+ -->
+ </s:schema>
+ </types>
+
+ <message name="Commands">
+ <part name="commands" element="tns:commands" />
+ </message>
+
+ <message name="Results">
+ <part name="results" element="tns:results" />
+ </message>
+
+ <portType name="XTSServiceTestPortType">
+ <operation name="serve">
+ <input name="Commands" message="tns:Commands" />
+ <output name="Results" message="tns:Results" />
+ </operation>
+ </portType>
+
+ <binding name="XTSServiceTestPort_SOAPBinding" type="tns:XTSServiceTestPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="serve">
+ <input message="tns:Commands">
+ <soap:body use="literal"/>
+ </input>
+ <output message="tns:Commands">
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="XTSServiceTestService">
+ <port binding="tns:XTSServiceTestPort_SOAPBinding" name="XTSServiceTestPortType">
+ <wsaw:UsingAddressing required="true"/>
+ <soap:address location="http://localhost:9000/xtsservicetests/XTSServiceTestService"/>
+ </port>
+ </service>
+</definitions>
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/servicetests/test/SingleParticipantPrepareAndCommitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/servicetests/test/SingleParticipantPrepareAndCommitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/java/org/jboss/jbossts/xts/servicetests/test/SingleParticipantPrepareAndCommitTest.java 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +1,44 @@
+package org.jboss.jbossts.xts.servicetests.test;
+
+import java.io.File;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+//import org.jboss.arquillian.framework.byteman.api.BMRule;
+//import org.jboss.arquillian.framework.byteman.api.BMRules;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.jbossts.xts.servicetests.bean.XTSServiceTestRunnerBean;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/*
+ at BMRules(
+ @BMRule(
+ name = "Throw exception on success",
+ targetClass = "SingleParticipantPrepareAndCommitTest",
+ targetMethod = "ATCrashDuringOnePhaseCommit",
+ action = "throw new java.lang.RuntimeException()")
+)
+*/
+
+ at RunWith(Arquillian.class)
+public class SingleParticipantPrepareAndCommitTest extends XTSServiceTestBase {
+ @Inject
+ private XTSServiceTestRunnerBean testRunner;
+
+ @Deployment
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.
+ createFromZipFile(WebArchive.class, new File("../xtstest.war"));
+
+ return archive;
+ }
+
+ @Test
+ public void ATCrashDuringOnePhaseCommit() throws Exception {
+ testRunner.runTest("SingleParticipantPrepareAndCommitTest");
+ }
+
+}
Added: labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/arquillian.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/arquillian.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/arquillian/src/test/resources/arquillian.xml 2011-10-18 08:07:24 UTC (rev 37588)
@@ -0,0 +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>
+
+ <!-- Example configuration for a remote JBoss AS 7 instance -->
+ <container qualifier="jboss" default="true">
+ <protocol type="jmx-as7">
+ <property name="executionType">REMOTE</property>
+ </protocol>
+ </container>
+
+</arquillian>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list