[jboss-svn-commits] JBL Code SVN: r25524 - in labs/jbosstm/trunk/XTS/sar/tests: dd and 7 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Mar 6 10:43:24 EST 2009


Author: adinn
Date: 2009-03-06 10:43:24 -0500 (Fri, 06 Mar 2009)
New Revision: 25524

Added:
   labs/jbosstm/trunk/XTS/sar/tests/dd/subordinatehandlers.xml
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/subordinate/
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/subordinate/XTSSubordinateServiceTestPortTypeImpl.java
Modified:
   labs/jbosstm/trunk/XTS/sar/tests/build.xml
   labs/jbosstm/trunk/XTS/sar/tests/dd/WEB-INF/web.xml
   labs/jbosstm/trunk/XTS/sar/tests/dd/handlers.xml
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestInterpreter.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/XTSServiceTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/XTSServiceTestBase.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/MultiParticipantPrepareAndCommitTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/MultiServicePrepareAndCommitTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/SingleParticipantPrepareAndCommitTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/subordinate/MultiParticipantPrepareAndCommitTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseAndExitTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseAndExitTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseAndExitTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/SingleCoordinatorCompletionParticipantCloseTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/SingleParticipantCompletionParticipantCloseTest.java
Log:
corrected errors in test command script interpreter and modified all tests so that they run off command scripts. added subordinate server which perfoms interposition in the context handler and modified subordinate test to use it all test scenarios are now complete as are all TOAST scritps except teh subordinate AT test -- fixes for JBTM-447 JBTM-431 and JBTM-387

Modified: labs/jbosstm/trunk/XTS/sar/tests/build.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/build.xml	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/build.xml	2009-03-06 15:43:24 UTC (rev 25524)
@@ -92,6 +92,7 @@
       <mkdir dir="${build.classes.dir}/org/jboss/jbossts/xts/servicetests/generated/wsdl/"/>
       <copy toDir="${build.classes.dir}/org/jboss/jbossts/xts/servicetests/generated/wsdl/" file="${wsdl.dir}/xtsservicetests.wsdl"/>
       <copy toDir="${build.classes.dir}/org/jboss/jbossts/xts/servicetests/service/" file="${dd.dir}/handlers.xml"/>
+      <copy toDir="${build.classes.dir}/org/jboss/jbossts/xts/servicetests/service/subordinate" file="${dd.dir}/subordinatehandlers.xml"/>
      <war warfile="${build.webapps.dir}/xtstest.war" webxml="${web.inf.dir}/web.xml">
          <classes dir="${build.classes.dir}" includes="**/*"/>
          <metainf dir="${build.meta.inf.dir}"/>

Modified: labs/jbosstm/trunk/XTS/sar/tests/dd/WEB-INF/web.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/dd/WEB-INF/web.xml	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/dd/WEB-INF/web.xml	2009-03-06 15:43:24 UTC (rev 25524)
@@ -53,6 +53,12 @@
     </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>
@@ -75,6 +81,11 @@
     </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>

Modified: labs/jbosstm/trunk/XTS/sar/tests/dd/handlers.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/dd/handlers.xml	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/dd/handlers.xml	2009-03-06 15:43:24 UTC (rev 25524)
@@ -26,7 +26,7 @@
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee">
     <handler-chain>
 	<handler>
-		<handler-name>WS Addressing Server Handler</handler-name>
+		<handler-name>WS TX Context Handler</handler-name>
 		<handler-class>com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor</handler-class>
 	</handler>
     </handler-chain>

Copied: labs/jbosstm/trunk/XTS/sar/tests/dd/subordinatehandlers.xml (from rev 25158, labs/jbosstm/trunk/XTS/sar/tests/dd/handlers.xml)
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/dd/subordinatehandlers.xml	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/dd/subordinatehandlers.xml	2009-03-06 15:43:24 UTC (rev 25524)
@@ -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>

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestInterpreter.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestInterpreter.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestInterpreter.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -57,11 +57,11 @@
  *
  * block_command ::= "block" command (block_trailing)* "endblock"
  *
- * block_trailing ::= (bind_command)? "next" command
+ * block_trailing ::= (bindings_command)? "next" command
  *
- * bind_command  ::= "bind" (bind_operation)+ "next"
+ * bindings_command  ::= "bindings" (binding_operation)+ "next"
  *
- * bind_operation ::= "set" <alphanum> <num> |
+ * binding_operation ::= "bind" <alphanum> <num> |
  *              "check" <num> <alphanum> |
  *              "output" <num>
  *
@@ -209,6 +209,9 @@
             throws WebServiceException
     {
         int size = commandList.size();
+        if (size == 0) {
+            throw new WebServiceException("empty command list");
+        }
         String command = commandList.remove(0);
         size--;
 
@@ -589,7 +592,7 @@
                     subcommandsList.add(subcommands);
                     subcommands = new ArrayList<String>();
                     subcommands.add(command);
-                } else if (command.equals("bind")) {
+                } else if (command.equals("bindings")) {
                     // create new sublist starting with bind
                     subcommandsList.add(subcommands);
                     subcommands = new ArrayList<String>();
@@ -600,6 +603,9 @@
                         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);
                 }
             }
         }
@@ -619,7 +625,7 @@
                 subresultsList = new ArrayList<String>();
                 bindCommands(subcommands, bindings);
                 processCommands(subcommands, subresultsList);
-            } else if (command.equals("bind")) {
+            } else if (command.equals("bindings")) {
                 bindResults(subcommands, subresultsList, resultsList, bindings);
             }
         }
@@ -739,17 +745,21 @@
         int size = commands.size();
         int idx;
         for (idx = 0; idx < size; idx++) {
-            String command = commands.get(idx);
-            String[] tokens = command.split(" +");
-            if (tokens[0].equals("set")) {
-                // set var idx : var <== inResults[idx]
-                if ((tokens.length != 3) || !tokens[1].matches("[0-9a-zA-Z]+") || !tokens[2].matches("[0-9]")) {
+            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 = tokens[1];
+                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(tokens[2]);
+                    resultIdx = Integer.valueOf(resultIdxString);
                 } catch (NumberFormatException nfe) {
                     throw new WebServiceException("bindResults : invalid set index " + command);
                 }
@@ -757,15 +767,20 @@
                     throw new WebServiceException("bindResults : invalid set index " + command);
                 }
                 bindings.put(var, inResults.get(resultIdx));
-            } else  if (tokens[0].equals("check")) {
-                // test value idx : ensure inResults[idx] == value
-                if ((tokens.length != 3) || !tokens[1].matches("[0-9a-zA-Z]+") || !tokens[2].matches("[0-9]")) {
+            } 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 = tokens[1];
+                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(tokens[2]);
+                    resultIdx = Integer.valueOf(resultIdxString);
                 } catch (NumberFormatException nfe) {
                     throw new WebServiceException("bindResults : invalid check index " + command);
                 }
@@ -776,14 +791,19 @@
                 if (!result.equals(val)) {
                     throw new WebServiceException("bindResults : check failed, expecting  " + val + " got " + result);
                 }
-            } else  if (tokens[0].equals("output")) {
+            } else  if (command.equals("output")) {
                 // output idx : outResults add inResults[idx];
-                if ((tokens.length != 2) || !tokens[1].matches("[0-9]")) {
+                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(tokens[1]);
+                    resultIdx = Integer.valueOf(resultIdxString);
                 } catch (NumberFormatException nfe) {
                     throw new WebServiceException("bindResults : invalid output index " + command);
                 }

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -55,7 +55,7 @@
 })
 public class XTSServiceTestPortTypeImpl implements XTSServiceTestPortType
 {
-    @Resource WebServiceContext context;
+    protected @Resource WebServiceContext context;
 
     /**
      *

Copied: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/subordinate/XTSSubordinateServiceTestPortTypeImpl.java (from rev 25507, labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java)
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/subordinate/XTSSubordinateServiceTestPortTypeImpl.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/subordinate/XTSSubordinateServiceTestPortTypeImpl.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -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 = "XTSServiceTest",
+        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

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/XTSServiceTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/XTSServiceTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/XTSServiceTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -35,4 +35,7 @@
     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";
 }

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/XTSServiceTestBase.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/XTSServiceTestBase.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/XTSServiceTestBase.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -29,4 +29,9 @@
     {
         System.err.println(this.getClass().getName() + " : " + message);
     }
+
+    public void message(String message)
+    {
+        System.out.println(this.getClass().getName() + " : " + message);
+    }
 }

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/MultiParticipantPrepareAndCommitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/MultiParticipantPrepareAndCommitTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/MultiParticipantPrepareAndCommitTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -34,6 +34,9 @@
 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
@@ -56,17 +59,11 @@
             serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+
         UserTransaction tx = UserTransactionFactory.userTransaction();
 
 
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-
-        // wait a while so the service has time to start
-
         // start the transaction
 
         try {
@@ -82,59 +79,40 @@
             return;
         }
 
-        // invoke the service and tell it to prepare and  commit
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistDurable");
-        commands.getCommandList().add("prepare");
-        commands.getCommandList().add("commit");
+        List<String> commands = new ArrayList<String>();
+        List<String> results = new ArrayList<String>();
 
-        // call the same web service multiple times -- it's ok to use the samew commands list
+        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 {
-            results = client.serve(serviceURL1, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        for (String s : results.getResultList()) {
-            error("enlistDurable " + s);
-        }
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("enlistDurable " + s);
-        }
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("enlistDurable " + s);
-        }
-
         // now commit the transaction
 
         try {
@@ -153,7 +131,7 @@
             error("commit failure " + exception);
         }
 
-        error("completed");
+        message("completed");
 
         isSuccessful = (exception == null);
     }

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/MultiServicePrepareAndCommitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/MultiServicePrepareAndCommitTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/MultiServicePrepareAndCommitTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -34,6 +34,9 @@
 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
@@ -70,15 +73,13 @@
             serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+        addDefaultBinding("service2", serviceURL2);
+        addDefaultBinding("service3", serviceURL3);
+
         UserTransaction tx = UserTransactionFactory.userTransaction();
 
 
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-
         // start the transaction
 
         try {
@@ -95,58 +96,40 @@
         }
 
         // invoke the service and tell it to prepare and  commit
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistDurable");
-        commands.getCommandList().add("prepare");
-        commands.getCommandList().add("commit");
+        List<String> commands = new ArrayList<String>();
+        List<String> results = new ArrayList<String>();
 
-        // call the same web service multiple times -- it's ok to use the samew commands list
+        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 {
-            results = client.serve(serviceURL1, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        for (String s : results.getResultList()) {
-            error("enlistDurable " + s);
-        }
-
-        try {
-            results = client.serve(serviceURL2, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("enlistDurable " + s);
-        }
-
-        try {
-            results = client.serve(serviceURL3, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("enlistDurable " + s);
-        }
-
         // now commit the transaction
 
         try {
@@ -165,7 +148,7 @@
             error("commit failure " + exception);
         }
 
-        error("completed");
+        message("completed");
 
         isSuccessful = (exception == null);
     }

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/SingleParticipantPrepareAndCommitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/SingleParticipantPrepareAndCommitTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/SingleParticipantPrepareAndCommitTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -34,6 +34,9 @@
 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
@@ -58,15 +61,10 @@
             serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+
         UserTransaction tx = UserTransactionFactory.userTransaction();
 
-
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-
         // start the transaction
 
         try {
@@ -82,27 +80,26 @@
             return;
         }
 
-        // invoke the service and tell it to prepare and  commit
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistDurable");
-        commands.getCommandList().add("prepare");
-        commands.getCommandList().add("commit");
+        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 {
-            results = client.serve(serviceURL1, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        for (String s : results.getResultList()) {
-            error("enlistDurable " + s);
-        }
-
         // now commit the transaction
 
         try {
@@ -121,7 +118,7 @@
             error("commit failure " + exception);
         }
 
-        error("completed");
+        message("completed");
 
         isSuccessful = (exception == null);
     }

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/subordinate/MultiParticipantPrepareAndCommitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/subordinate/MultiParticipantPrepareAndCommitTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/at/subordinate/MultiParticipantPrepareAndCommitTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -35,6 +35,7 @@
 import com.arjuna.wst.UnknownTransactionException;
 
 import java.util.List;
+import java.util.ArrayList;
 
 /**
  * Starts a transaction, enlists a participant with a web service with instructions to prepare and commit
@@ -52,7 +53,7 @@
         }
 
         String serviceURL1;
-        String serviceURL2;
+        String subserviceURL1;
 
         serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
 
@@ -60,22 +61,17 @@
             serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
         }
 
-        serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
+        subserviceURL1 = System.getProperty(XTSServiceTest.SUBORDINATE_SERVICE_URL1_KEY);
 
-        if (serviceURL2 == null) {
-            serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
+        if (subserviceURL1 == null) {
+            subserviceURL1 = "http://localhost:8080/xtstest/xtssubordinateservicetest1";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+        addDefaultBinding("subservice1", subserviceURL1);
+
         UserTransaction tx = UserTransactionFactory.userTransaction();
 
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-
-        // wait a while so the service has time to start
-
         // start the transaction
 
         try {
@@ -91,117 +87,40 @@
             return;
         }
 
-        // invoke the service and tell it to create a subtransaction
+        List<String> commands = new ArrayList<String>();
+        List<String> results = new ArrayList<String>();
 
-        commands = new CommandsType();
-        commands.getCommandList().add("subtransaction");
+        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("{subservice1}");
+        commands.add("block");
+        commands.add("enlistDurable");
+        commands.add("prepare");
+        commands.add("commit");
+        commands.add("next");
+        commands.add("enlistDurable");
+        commands.add("prepare");
+        commands.add("commit");
+        commands.add("endblock");
+        commands.add("endblock");
 
         try {
-            results = client.serve(serviceURL1, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("subtransaction failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        for (String s : results.getResultList()) {
-            error("subtransaction " + s);
-        }
-
-        List<String> resultList = results.getResultList();
-
-        String subTxId = resultList.get(0);
-
-        // enlist a durable participant in the original transaction and tell it to prepare and  commit
-
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistDurable");
-        commands.getCommandList().add("prepare");
-        commands.getCommandList().add("commit");
-
-        // call the web service multiple times
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("enlistDurable " + s);
-        }
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        // enlist a durable participant in the subtransaction and tell it to prepare and  commit
-
-        commands = new CommandsType();
-        commands.getCommandList().add("subtransactionserve");
-        commands.getCommandList().add(subTxId);
-        commands.getCommandList().add(serviceURL2);
-        commands.getCommandList().add("enlistDurable");
-        commands.getCommandList().add("prepare");
-        commands.getCommandList().add("commit");
-
-        // call the same web service multiple times -- it's ok to use the same commands list
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("subtransactioncommands failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("subtransactioncommands " + s);
-        }
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("subtransactioncommands failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("subtransactioncommands " + s);
-        }
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("subtransactioncommands failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("subtransactioncommands " + s);
-        }
-
         // now commit the transaction which should also commit the subtransaction
 
         try {
@@ -220,7 +139,7 @@
             error("commit failure " + exception);
         }
 
-        error("completed");
+        message("completed");
 
         isSuccessful = (exception == null);
     }

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -37,6 +37,7 @@
 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
@@ -62,18 +63,10 @@
             serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+
         UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
 
-
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-        List<String> resultsList;
-        String participantId1;
-
-
         // start the transaction
 
         try {
@@ -89,93 +82,50 @@
             return;
         }
 
-        // invoke the service to create a coordinaator completion participant
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
+        List<String> resultsList;
+        String participantId;
 
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
+        List<String> commands = new ArrayList<String>();
+        List<String> results = new ArrayList<String>();
 
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
+        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");
 
-        resultsList = results.getResultList();
-        participantId1 = resultsList.get(0);
-
-        for (String s : resultsList) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the service again to create a coordinaator completion participant and script it to complete
-        // and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
-        commands.getCommandList().add("complete");
-        commands.getCommandList().add("close");
-
         try {
-            results = client.serve(serviceURL1, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the service a third time to create a coordinaator completion participant and script it to
-        // complete and close
-
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
-        commands.getCommandList().add("complete");
-        commands.getCommandList().add("close");
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the service scripting the first participant to exit
-        commands = new CommandsType();
-        commands.getCommandList().add("exit");
-        commands.getCommandList().add(participantId1);
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("exit " + participantId1 + " " + s);
-        }
-
         // now close the activity
 
         try {
@@ -194,7 +144,7 @@
             error("commit failure " + exception);
         }
 
-        error("completed");
+        message("completed");
 
         isSuccessful = (exception == null);
     }

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantCoordinatorCompletionParticipantCloseTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -36,6 +36,9 @@
 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
@@ -60,15 +63,10 @@
             serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+
         UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
 
-
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-
         // start the transaction
 
         try {
@@ -84,72 +82,43 @@
             return;
         }
 
-        // invoke the service to create a coordinaator completion participant and script it to complete and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
-        commands.getCommandList().add("complete");
-        commands.getCommandList().add("close");
+        List<String> resultsList;
+        String participantId;
 
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
+        List<String> commands = new ArrayList<String>();
+        List<String> results = new ArrayList<String>();
 
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
+        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");
 
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the service again to create a coordinaator completion participant and script it to complete
-        // and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
-        commands.getCommandList().add("complete");
-        commands.getCommandList().add("close");
-
         try {
-            results = client.serve(serviceURL1, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the service a third time to create a coordinaator completion participant and script it to
-        // complete and close
-
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
-        commands.getCommandList().add("complete");
-        commands.getCommandList().add("close");
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
         // now close the activity
 
         try {
@@ -168,7 +137,7 @@
             error("commit failure " + exception);
         }
 
-        error("completed");
+        message("completed");
 
         isSuccessful = (exception == null);
     }

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseAndExitTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseAndExitTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -37,6 +37,7 @@
 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
@@ -62,20 +63,10 @@
             serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+
         UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
 
-
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-        List<String> resultsList;
-        String participantId1;
-        String participantId2;
-        String participantId3;
-
-
         // start the transaction
 
         try {
@@ -91,137 +82,67 @@
             return;
         }
 
-        // invoke the service to create a participant completion participant
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
+        List<String> resultsList;
+        String participantId;
 
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
+        List<String> commands = new ArrayList<String>();
+        List<String> results = new ArrayList<String>();
 
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
+        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");
 
-        resultsList = results.getResultList();
-        participantId1 = resultsList.get(0);
-
-        for (String s : resultsList) {
-            error("enlistParticipantCompletion " + s);
-        }
-
-        // invoke the service again to create a participant completion participant and script it to complete
-        // and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
-        commands.getCommandList().add("close");
-
         try {
-            results = client.serve(serviceURL1, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        resultsList = results.getResultList();
-        participantId2 = resultsList.get(0);
-
-        for (String s : results.getResultList()) {
-            error("enlistParticipantCompletion " + s);
-        }
-
-        // invoke the service a third time to create a participant completion participant and script it to
-        // complete and close
-
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
-        commands.getCommandList().add("close");
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("enlistParticipantCompletion " + s);
-        }
-
-        resultsList = results.getResultList();
-        participantId3 = resultsList.get(0);
-
-        // invoke the service scripting the first participant to exit
-        commands = new CommandsType();
-        commands.getCommandList().add("exit");
-        commands.getCommandList().add(participantId1);
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("exit " + participantId1 + " " + s);
-        }
-
-        // invoke the service scripting the second participant to copmplete
-        commands = new CommandsType();
-        commands.getCommandList().add("completed");
-        commands.getCommandList().add(participantId2);
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("completed " + participantId2 + " " + s);
-        }
-
-        // invoke the service scripting the third participant to complete
-        commands = new CommandsType();
-        commands.getCommandList().add("completed");
-        commands.getCommandList().add(participantId3);
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("completed " + participantId3 + " " + s);
-        }
-
         // now close the activity
 
         try {

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiParticipantParticipantCompletionParticipantCloseTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -37,6 +37,7 @@
 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
@@ -62,19 +63,10 @@
             serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+
         UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
 
-
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-        List<String> resultsList;
-        String participantId1;
-        String participantId2;
-        String participantId3;
-
         // start the transaction
 
         try {
@@ -90,137 +82,67 @@
             return;
         }
 
-        // invoke the service to create a coordinator completion participant and script it to close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
-        commands.getCommandList().add("close");
+        List<String> resultsList;
+        String participantId;
 
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
+        List<String> commands = new ArrayList<String>();
+        List<String> results = new ArrayList<String>();
 
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
+        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");
 
-        resultsList = results.getResultList();
-        participantId1 = resultsList.get(0);
-
-        for (String s : results.getResultList()) {
-            error("enlistPartiicpantCompletion " + s);
-        }
-
-        // invoke the service again to create a coordinaator completion participant and script it to close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
-        commands.getCommandList().add("close");
-
         try {
-            results = client.serve(serviceURL1, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        resultsList = results.getResultList();
-        participantId2 = resultsList.get(0);
-
-        for (String s : results.getResultList()) {
-            error("enlistPartiicpantCompletion " + s);
-        }
-
-        // invoke the service a third time to create a coordinaator completion participant and script it to
-        // close
-
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
-        commands.getCommandList().add("close");
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        resultsList = results.getResultList();
-        participantId3 = resultsList.get(0);
-
-        for (String s : results.getResultList()) {
-            error("enlistPartiicpantCompletion " + s);
-        }
-
-        // invoke the service scripting the first participant to complete
-        commands = new CommandsType();
-        commands.getCommandList().add("completed");
-        commands.getCommandList().add(participantId1);
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("completed " + participantId1 + " " + s);
-        }
-
-        // invoke the service scripting the second participant to copmplete
-        commands = new CommandsType();
-        commands.getCommandList().add("completed");
-        commands.getCommandList().add(participantId2);
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("completed " + participantId2 + " " + s);
-        }
-
-        // invoke the service scripting the third participant to complete
-        commands = new CommandsType();
-        commands.getCommandList().add("completed");
-        commands.getCommandList().add(participantId3);
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("completed " + participantId3 + " " + s);
-        }
-
         // now close the activity
 
         try {
@@ -239,7 +161,7 @@
             error("commit failure " + exception);
         }
 
-        error("completed");
+        message("completed");
 
         isSuccessful = (exception == null);
     }

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseAndExitTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseAndExitTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -37,6 +37,7 @@
 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
@@ -74,18 +75,12 @@
             serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+        addDefaultBinding("service2", serviceURL2);
+        addDefaultBinding("service3", serviceURL3);
+
         UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
 
-
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-        List<String> resultsList;
-        String participantId1;
-
-
         // start the transaction
 
         try {
@@ -101,93 +96,51 @@
             return;
         }
 
-        // invoke the service to create a coordinaator completion participant and script it to complete and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
-        commands.getCommandList().add("complete");
-        commands.getCommandList().add("close");
+        List<String> resultsList;
+        String participantId;
 
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
+        List<String> commands = new ArrayList<String>();
+        List<String> results = new ArrayList<String>();
 
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
+        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");
 
-        resultsList = results.getResultList();
-        participantId1 = resultsList.get(0);
-
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the second service to create a coordinator completion participant
-        // and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
-
         try {
-            results = client.serve(serviceURL2, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the third service to create a coordinaator completion participant and script it to
-        // complete and close
-
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
-        commands.getCommandList().add("complete");
-        commands.getCommandList().add("close");
-
-        try {
-            results = client.serve(serviceURL3, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the service scripting the first participant to exit
-        commands = new CommandsType();
-        commands.getCommandList().add("exit");
-        commands.getCommandList().add(participantId1);
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest : server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest : exit " + participantId1 + " " + s);
-        }
-
         // now close the activity
 
         try {

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceCoordinatorCompletionParticipantCloseTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -36,6 +36,9 @@
 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
@@ -72,15 +75,12 @@
             serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+        addDefaultBinding("service2", serviceURL2);
+        addDefaultBinding("service3", serviceURL3);
+
         UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
 
-
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-
         // start the transaction
 
         try {
@@ -96,72 +96,43 @@
             return;
         }
 
-        // invoke the service to create a coordinaator completion participant and script it to complete and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
-        commands.getCommandList().add("complete");
-        commands.getCommandList().add("close");
+        List<String> resultsList;
+        String participantId;
 
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
+        List<String> commands = new ArrayList<String>();
+        List<String> results = new ArrayList<String>();
 
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
+        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");
 
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the second service to create a coordinator completion participant and script it to complete
-        // and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
-        commands.getCommandList().add("complete");
-        commands.getCommandList().add("close");
-
         try {
-            results = client.serve(serviceURL2, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the third service to create a coordinaator completion participant and script it to
-        // complete and close
-
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
-        commands.getCommandList().add("complete");
-        commands.getCommandList().add("close");
-
-        try {
-            results = client.serve(serviceURL3, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
         // now close the activity
 
         try {

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseAndExitTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseAndExitTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -37,6 +37,7 @@
 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
@@ -74,19 +75,12 @@
             serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+        addDefaultBinding("service2", serviceURL2);
+        addDefaultBinding("service3", serviceURL3);
+
         UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
 
-
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-        List<String> resultsList;
-        String participantId1;
-        String participantId2;
-        String participantId3;
-
         // start the transaction
 
         try {
@@ -102,137 +96,67 @@
             return;
         }
 
-        // invoke the service to create a participant completion participant and script it to complete and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
+        List<String> resultsList;
+        String participantId;
 
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
+        List<String> commands = new ArrayList<String>();
+        List<String> results = new ArrayList<String>();
 
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
+        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");
 
-        resultsList = results.getResultList();
-        participantId1 = resultsList.get(0);
-
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the second service to create a participant completion participant
-        // and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
-        commands.getCommandList().add("close");
-
         try {
-            results = client.serve(serviceURL2, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        resultsList = results.getResultList();
-        participantId2 = resultsList.get(0);
-
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the third service to create a coordinaator completion participant and script it to
-        // complete and close
-
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
-        commands.getCommandList().add("close");
-
-        try {
-            results = client.serve(serviceURL3, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        resultsList = results.getResultList();
-        participantId3 = resultsList.get(0);
-
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the service scripting the first participant to exit
-        commands = new CommandsType();
-        commands.getCommandList().add("exit");
-        commands.getCommandList().add(participantId1);
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("exit " + participantId1 + " " + s);
-        }
-
-        // invoke the service scripting the second participant to copmplete
-        commands = new CommandsType();
-        commands.getCommandList().add("completed");
-        commands.getCommandList().add(participantId2);
-
-        try {
-            results = client.serve(serviceURL2, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : completed " + participantId2 + " " + s);
-        }
-
-        // invoke the service scripting the third participant to complete
-        commands = new CommandsType();
-        commands.getCommandList().add("completed");
-        commands.getCommandList().add(participantId3);
-
-        try {
-            results = client.serve(serviceURL3, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : completed " + participantId3 + " " + s);
-        }
-
         // now close the activity
 
         try {

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/MultiServiceParticipantCompletionParticipantCloseTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -37,6 +37,7 @@
 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
@@ -74,19 +75,12 @@
             serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+        addDefaultBinding("service2", serviceURL2);
+        addDefaultBinding("service3", serviceURL3);
+
         UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
 
-
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-        List<String> resultsList;
-        String participantId1;
-        String participantId2;
-        String participantId3;
-
         // start the transaction
 
         try {
@@ -102,138 +96,67 @@
             return;
         }
 
-        // invoke the service to create a coordinaator completion participant and script it to complete and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
-        commands.getCommandList().add("close");
+        List<String> resultsList;
+        String participantId;
 
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
+        List<String> commands = new ArrayList<String>();
+        List<String> results = new ArrayList<String>();
 
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
+        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");
 
-        resultsList = results.getResultList();
-        participantId1 = resultsList.get(0);
-
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the second service to create a coordinator completion participant and script it to complete
-        // and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
-        commands.getCommandList().add("close");
-
         try {
-            results = client.serve(serviceURL2, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        resultsList = results.getResultList();
-        participantId2 = resultsList.get(0);
-
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the third service to create a coordinaator completion participant and script it to
-        // complete and close
-
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
-        commands.getCommandList().add("close");
-
-        try {
-            results = client.serve(serviceURL3, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        resultsList = results.getResultList();
-        participantId3 = resultsList.get(0);
-
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
-        // invoke the service scripting the first participant to complete
-        commands = new CommandsType();
-        commands.getCommandList().add("completed");
-        commands.getCommandList().add(participantId1);
-
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("completed " + participantId1 + " " + s);
-        }
-
-        // invoke the service scripting the second participant to copmplete
-        commands = new CommandsType();
-        commands.getCommandList().add("completed");
-        commands.getCommandList().add(participantId2);
-
-        try {
-            results = client.serve(serviceURL2, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("completed " + participantId2 + " " + s);
-        }
-
-        // invoke the service scripting the third participant to complete
-        commands = new CommandsType();
-        commands.getCommandList().add("completed");
-        commands.getCommandList().add(participantId3);
-
-        try {
-            results = client.serve(serviceURL3, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
-
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        for (String s : results.getResultList()) {
-            error("completed " + participantId3 + " " + s);
-        }
-
         // now close the activity
 
         try {
@@ -252,7 +175,7 @@
             error("commit failure " + exception);
         }
 
-        error("completed");
+        message("completed");
 
         isSuccessful = (exception == null);
     }

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/SingleCoordinatorCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/SingleCoordinatorCompletionParticipantCloseTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/SingleCoordinatorCompletionParticipantCloseTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -36,6 +36,9 @@
 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
@@ -60,15 +63,10 @@
             serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+
         UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
 
-
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-
         // start the transaction
 
         try {
@@ -84,27 +82,29 @@
             return;
         }
 
-        // invoke the service to create a coordinaator completion participant and script it to complete and close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistCoordinatorCompletion");
-        commands.getCommandList().add("complete");
-        commands.getCommandList().add("close");
+        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 {
-            results = client.serve(serviceURL1, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        for (String s : results.getResultList()) {
-            error("enlistCoordinatorCompletion " + s);
-        }
-
         // now close the activity
 
         try {
@@ -123,7 +123,7 @@
             error("commit failure " + exception);
         }
 
-        error("completed");
+        message("completed");
 
         isSuccessful = (exception == null);
     }

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/SingleParticipantCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/SingleParticipantCompletionParticipantCloseTest.java	2009-03-06 13:46:32 UTC (rev 25523)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ba/SingleParticipantCompletionParticipantCloseTest.java	2009-03-06 15:43:24 UTC (rev 25524)
@@ -37,6 +37,7 @@
 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
@@ -62,15 +63,10 @@
             serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
         }
 
+        addDefaultBinding("service1", serviceURL1);
+
         UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
 
-
-        // invoke the service via the client
-
-        XTSServiceTestClient client = new XTSServiceTestClient();
-        CommandsType commands = new CommandsType();
-        ResultsType results = null;
-
         // start the transaction
 
         try {
@@ -89,51 +85,52 @@
         List<String> resultsList;
         String participantId;
 
-        // invoke the service to create a participant completion participant and script it to close
-        commands = new CommandsType();
-        commands.getCommandList().add("enlistParticipantCompletion");
-        commands.getCommandList().add("close");
+        List<String> commands = new ArrayList<String>();
+        List<String> results = new ArrayList<String>();
 
-        try {
-            results = client.serve(serviceURL1, commands);
-        } catch (Exception e) {
-            exception = e;
-        }
+        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");
 
-        if (exception != null) {
-            error("server failure " + exception);
-            return;
-        }
-
-        resultsList = results.getResultList();
-        participantId = resultsList.get(0);
-
-        for (String s : resultsList) {
-            error("enlistParticipantCompletion " + s);
-        }
-
-        // invoke the service scripting the participant to send completed now
-        commands = new CommandsType();
-        commands.getCommandList().add("completed");
-        commands.getCommandList().add(participantId);
-
+        /*
+         * 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 {
-            results = client.serve(serviceURL1, commands);
+            processCommands(commands, results);
         } catch (Exception e) {
             exception = e;
         }
 
         if (exception != null) {
-            error("server failure " + exception);
+            error("test failure " + exception);
             return;
         }
 
-        resultsList = results.getResultList();
-
-        for (String s : resultsList) {
-            error("completed(" + participantId + ") " + s);
-        }
-
         // now close the activity
 
         try {
@@ -152,7 +149,7 @@
             error("close failure " + exception);
         }
 
-        error("finished");
+        message("finished");
 
         isSuccessful = (exception == null);
     }




More information about the jboss-svn-commits mailing list