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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jan 23 09:23:44 EST 2009


Author: adinn
Date: 2009-01-23 09:23:44 -0500 (Fri, 23 Jan 2009)
New Revision: 24888

Added:
   labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/BACrashDuringCommit.txt
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantCoordinatorCompletionParticipantCloseTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceCoordinatorCompletionParticipantCloseTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BASingleCoordinatorCompletionParticipantCloseTest.java
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BASingleParticipantCompletionParticipantCloseTest.java
Modified:
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionCoordinatorEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionCoordinatorEngine.java
   labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/HeuristicRecoveryAfterDelayedCommit.txt
   labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/bean/XTSServiceTestRunnerBean.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/service/recovery/TestBARecoveryModule.java
Log:
added service tests for a variety BA scenarios, ensured BA service test XTS recovery module is installed and provided script to crash BA at close and trace subsequent recovery -- partially fixes JBTM-431

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionCoordinatorEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionCoordinatorEngine.java	2009-01-23 14:12:56 UTC (rev 24887)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionCoordinatorEngine.java	2009-01-23 14:23:44 UTC (rev 24888)
@@ -950,6 +950,15 @@
     }
 
     /**
+     * check whether this participant's details have been recovered from the log
+     * @return true if the participant is recovered otherwise false
+     */
+    public boolean isRecovered()
+    {
+        return recovered;
+    }
+    
+    /**
      * Change the state and notify any listeners.
      * @param state The new state.
      */

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionCoordinatorEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionCoordinatorEngine.java	2009-01-23 14:12:56 UTC (rev 24887)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionCoordinatorEngine.java	2009-01-23 14:23:44 UTC (rev 24888)
@@ -810,6 +810,15 @@
     }
 
     /**
+     * check whether this participant's details have been recovered from the log
+     * @return true if the participant is recovered otherwise false
+     */
+    public boolean isRecovered()
+    {
+        return recovered;
+    }
+    
+    /**
      * Change the state and notify any listeners.
      * @param state The new state.
      */

Added: labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/BACrashDuringCommit.txt
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/BACrashDuringCommit.txt	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/BACrashDuringCommit.txt	2009-01-23 14:23:44 UTC (rev 24888)
@@ -0,0 +1,519 @@
+##############################################################################
+# JBoss, Home of Professional Open Source
+# Copyright 2009, Red Hat Middleware LLC, and individual contributors
+# by the @authors tag. See the copyright.txt in the distribution for a
+# full listing of individual contributors.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+# @authors Andrew Dinn
+#
+# BA Crash During Commit
+#
+# This script automates testing of a specific recovery scenario for the
+# JBossTS XTS implementation of the WS-BA 1.1 protocol using orchestration
+# rules. The basic scenario employs a coordinator and 3 web services
+# running in a single JVM but other variants are possible (see below). The
+# scenario is as follows (** indicates intercession by a TOAST rule):
+#
+# AS boots
+# Cient starts a WS-BA activity
+# Client invokes web service 1
+# Web service 1 registers participant P1
+# Client invokes web service 2
+# Web service 2 registers participant P2
+# Client invokes web service 3
+# Web service 3 registers participant P3
+#
+# Alternative A (assumes participant completion participants)
+# Client invokes web service 1 with command P1 complete
+# Web service sends completed for participant 1
+# ** Rule system traces receipt of completed
+# Client invokes web service 2 with command P2 complete
+# Web service sends completed for participant 2
+# ** Rule system traces receipt of completed
+# Client invokes web service 3 with command P3 complete
+# Web service sends completed for participant 3
+# ** Rule system traces receipt of completed
+# End Alternative A
+#
+# Alternative B
+# Client invokes web service 1 with command P1 exit
+# Web service sends exit for participant 1
+# ** Rule system traces receipt of exit
+# Coordinator sends exited for participant 1
+# ** Rule system traces send of exited
+# <possibly repeat for other participants>
+# End Alternative B
+# Client closes WS-BA activity
+#
+# Alternative C (assumes coordinator completion participants)
+# Coordinator initiates complete of participant P1
+# P1 replies with completed
+# ** Rule system traces receipt of completed
+# Coordinator initiates complete of participant P2
+# P2 replies with completed
+# ** Rule system traces receipt of completed
+# Coordinator initiates complete of participant P3
+# P3 replies with completed
+# ** Rule system traces receipt of completed
+# End Alternative C
+# Coordinator initiates close of participant P1
+# ** Rule system intercepts commit and crahses JVM
+#
+# AS reboots
+# Recovery system starts after 2 minutes
+# Recovery system recreates PREPARED WS-BA activity coordinator
+# ** Rule system traces create
+# Recovery system recreates participant stub for P1
+# ** Rule system traces create
+# Recovery system recreates participant stub for P2
+# ** Rule system traces create
+# Recovery system recreates participant stub for P3
+# ** Rule system traces create
+# Recovery system calls replay of PREPARED transaction
+# ** Rule system traces PREPARED replay invocation
+#
+# Coordinator sends commit to P1
+# P1 replies with committed
+# ** Rule system traces receipt ofcommitted
+#
+# Coordinator sends commit to P2
+# P2 replies with committed
+# ** Rule system traces receipt ofcommitted
+#
+# Coordinator sends commit to P3
+# P3 replies with committed
+# ** Rule system traces receipt ofcommitted
+#
+# Coordinator clears heuristic log record and completes commit
+# ** Rule system detects completed commit and kills JVM
+#
+# Use of this script
+#
+# The default way of exercising this test is to deploy the xtstest war
+# to a single AS and configure it to run the relevant XTS Service Test.
+# The web services and coordinator will be located with the client.
+# The number of participants can actually be 2, 3 or more. The
+# web service(s), client (i.e. the XTS Service Test which drives
+# the test) and coordinator service can optionally be located in separate
+# ASs. It is also possible to use just a single web service and have the
+# client register multiple participants. The coordinator AS should crash
+# when the client commits. At reboot the rest of the test should run
+# automatically and the server should be killed after a the heuristic
+# transaction is successfuly replayed.
+#
+# n.b. this test is not appropriate foir the case where only one participant
+# is registered since the coordinator employs the one phase optimization,
+# omitting to log the activity. In this case the lone participant should be
+# automatically compensated at restart.
+#
+# This script allows for registration of either participant completion
+# or coordinator completion participants (alternatives A or C). It is
+# legitimate to mix the different types. However, if participant completion
+# participants are used then the client must script the participants
+# to perform a complete. It is also possible to script an exit for
+# either type of participant (alternative B). In this case the completed
+# message should not be traced.
+#
+# This script needs to be passed to a TOAST agent in the JVM running
+# the coordinator service both at first boot and at reboot. Output will be
+# written to file testlog in the working directory of the AS. n.b. the rules in
+# this script only refer to code executed by the coordinator. If the client
+# (the selected XTS Service Test) or the web services are located in another
+# AS/JVM then the other JVM does not require a TOAST agent or script.
+#
+# XTS Service tests which can operate with this scenario can be selected for
+# execution at AS boot by the XTSServiceTestRunnerBean by setting system
+# property
+#    org.jboss.jbossts.xts.servicetests.XTSServiceTestName
+# to the name of a class which will execute the test. This property must
+# be defined in the JVM running the AS to which the xtstest war is deployed
+# i.e. the client AS. n.b. if the client is colocated with the coordinator then
+# this property must be left undefined at AS reboot otherwise the client
+# will run again, starting a new TX which may interfere with recovery of the
+# crashed TX.
+#
+# Available tests include:
+#
+# Tests still to be written include:
+#
+# org.jboss.jbossts.xts.servicetests.test.BAMultiCoordinatorCompletionParticipantCloseTest
+# this test invokes a single service registering 3 coordinator completion participants
+# the location of service is defined by defining a system property:
+#    org.jboss.jbossts.xts.servicetests.ServiceURL
+# if this is not set the value used defaults to
+#    http://localhost:8080/xtstest/xtsservicetest1
+#
+# org.jboss.jbossts.xts.servicetests.test.BAMultiParticipantCompletionParticipantCloseTest
+# this test invokes a single service registering 3 participant completion participants
+# the location of service is defined by defining a system property:
+#    org.jboss.jbossts.xts.servicetests.ServiceURL
+# if this is not set the value used defaults to
+#    http://localhost:8080/xtstest/xtsservicetest1
+#
+# org.jboss.jbossts.xts.servicetests.test.BAMultiCoordinatorCompletionParticipantExitAndCloseTest
+# this test invokes a single service registering 3 coordinator completion participants
+# it sends an exit to the first participant before closing the activity
+# the location of service is defined by defining a system property:
+#    org.jboss.jbossts.xts.servicetests.ServiceURL
+# if this is not set the value used defaults to
+#    http://localhost:8080/xtstest/xtsservicetest1
+#
+# org.jboss.jbossts.xts.servicetests.test.BAMultiParticipantCompletionParticipantExitAndCloseTest
+# this test invokes a single service registering 3 participant completion participants
+# it sends an exit to the first participant before closing the activity
+# the location of service is defined by defining a system property:
+#    org.jboss.jbossts.xts.servicetests.ServiceURL
+# if this is not set the value used defaults to
+#    http://localhost:8080/xtstest/xtsservicetest1
+#
+# org.jboss.jbossts.xts.servicetests.test.BAMultiServiceCoordinatorCompletionParticipantCloseTest
+# this test invokes 3 separate services registering a coordinator completion participant with each service
+# the location of service is defined by defining by system properties:
+#    org.jboss.jbossts.xts.servicetests.ServiceURL1
+#    org.jboss.jbossts.xts.servicetests.ServiceURL2
+#    org.jboss.jbossts.xts.servicetests.ServiceURL3
+# if these are not set the values used default to
+#    http://localhost:8080/xtstest/xtsservicetest1
+#    http://localhost:8080/xtstest/xtsservicetest2
+#    http://localhost:8080/xtstest/xtsservicetest3
+#
+# org.jboss.jbossts.xts.servicetests.test.BAMultiServiceParticipantCompletionParticipantCloseTest
+# this test invokes 3 separate services registering a participant completion participant with each service
+# the location of service is defined by defining by system properties:
+#    org.jboss.jbossts.xts.servicetests.ServiceURL1
+#    org.jboss.jbossts.xts.servicetests.ServiceURL2
+#    org.jboss.jbossts.xts.servicetests.ServiceURL3
+# if these are not set the values used default to
+#    http://localhost:8080/xtstest/xtsservicetest1
+#    http://localhost:8080/xtstest/xtsservicetest2
+#    http://localhost:8080/xtstest/xtsservicetest3
+#
+# org.jboss.jbossts.xts.servicetests.test.BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest
+# this test invokes 3 separate services registering a coordinator completion participant with each service
+# it sends an exit to the first participant before closing the activity
+# the location of service is defined by defining by system properties:
+#    org.jboss.jbossts.xts.servicetests.ServiceURL1
+#    org.jboss.jbossts.xts.servicetests.ServiceURL2
+#    org.jboss.jbossts.xts.servicetests.ServiceURL3
+# if these are not set the values used default to
+#    http://localhost:8080/xtstest/xtsservicetest1
+#    http://localhost:8080/xtstest/xtsservicetest2
+#    http://localhost:8080/xtstest/xtsservicetest3
+#
+# org.jboss.jbossts.xts.servicetests.test.BAMultiServiceParticipantCompletionParticipantCloseAndExitTest
+# this test invokes 3 separate services registering a participant completion participant with each service
+# it sends an exit to the first participant before closing the activity
+# the location of service is defined by defining by system properties:
+#    org.jboss.jbossts.xts.servicetests.ServiceURL1
+#    org.jboss.jbossts.xts.servicetests.ServiceURL2
+#    org.jboss.jbossts.xts.servicetests.ServiceURL3
+# if these are not set the values used default to
+#    http://localhost:8080/xtstest/xtsservicetest1
+#    http://localhost:8080/xtstest/xtsservicetest2
+#    http://localhost:8080/xtstest/xtsservicetest3
+#
+# If the client is run in a different AS to the coordinator then the client
+# AS needs to be pointed at the coordinator AS. The easiest
+# way to do this is to define the system property
+#
+#    org.jboss.jbossts.xts11.coordinatorURL
+#
+# to something like
+#
+#    http://foo.bar.org:8080/ws-c11/soap/ActivationCoordinator
+#
+# or alternatively to redefine one or more of the component properties
+#
+#    org.jboss.jbossts.xts11.coordinator.host
+#    org.jboss.jbossts.xts11.coordinator.port
+#    org.jboss.jbossts.xts11.coordinator.path
+#
+# (you probably only need to reset the host component)
+#
+# Expected output
+#
+# After the first boot the JVM should exit leaving the following in file testlog
+#
+#   completed received for participant XXXXXX
+#   completed received for participant XXXXXX
+#   completed received for participant XXXXXX
+#   JVM exit
+#
+# After reboot the JVM should exit leaving output in the following format in file
+# testlog. Clearly the ids for the TX/participants may vary and the number of
+# countdown completed lines will depend upon the number of participants employed.
+#
+#   completed received for participant XXXXXX
+#   completed received for participant XXXXXX
+#   completed received for participant XXXXXX
+#   JVM exit
+#   blah de blah
+#
+#######################################################################
+# This rule opens a file for the trace output during XTS startup
+# It will be opened for append at reboot so messages from both runs
+# will go to this file
+#
+RULE open trace file
+CLASS org.jboss.jbossts.XTSService
+METHOD start()
+BIND NOTHING
+IF TRUE
+DO openTrace("log", "testlog")
+ENDRULE
+
+#######################################################################
+## rules for first run of AS
+
+#######################################################################
+# This rule is triggered when a non-recovered participant completion
+# participant stub (ParticipantCompletionCoordinatorEngine) is sent
+# a close message. It exits the JVM, simulating a crash.
+# The trigger location is on entry
+
+RULE kill JVM at participant completion close
+CLASS com.arjuna.wst11.messaging.engines.ParticipantCompletionCoordinatorEngine
+METHOD close
+AT ENTRY
+BIND engine:ParticipantCompletionCoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF (NOT recovered)
+   AND
+   debug("close on non-recovered participant completion engine " + identifier)
+DO traceln("log", "JVM exit"),
+   debug("!!!killing JVM!!!"),
+   killJVM()
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered coordinator completion
+# participant stub (CoordinatorCompletionCoordinatorEngine) is sent
+# a close message. It exits the JVM, simulating a crash.
+# The trigger location is on entry
+
+RULE kill JVM at participant completion close
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine
+METHOD close
+AT ENTRY
+BIND engine:CoordinatorCompletionCoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF (NOT recovered)
+DO traceln("log", "JVM exit"),
+   debug("close on non-recovered coordinator completion engine " + identifier),
+   debug("!!!killing JVM!!!"),
+   killJVM()
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered coordinator completion
+# participant stub (CoordinatorCompletionCoordinatorEngine) is requested
+# to send a complete message. t traces the call.
+
+RULE trace coordinator completion close
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine
+METHOD complete
+AFTER SYNCHRONIZE
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF NOT recovered
+DO debug("close on recovered coordinator completion participant engine " + identifier),
+   traceln("log", "close on recovered coordinator completion participant engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered participant completion
+# participant stub (ParticipantCompletionCoordinatorEngine) receives a
+# completed message. It traces the call.
+
+RULE trace participant completion completed
+CLASS com.arjuna.wst11.messaging.engines.ParticipantCompletionCoordinatorEngine
+METHOD completed(NotificationType, AddressingProperties, ArjunaContext)
+AT ENTRY
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF NOT recovered
+DO debug("received completed message for participant completion participant stub " + identifier),
+   traceln("log", "received completed message for participant completion participant stub " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered coordinator completion
+# participant stub (CoordinatorCompletionCoordinatorEngine) receives a
+# completed message. It traces the call.
+
+RULE trace coordinator completion completed
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine
+METHOD completed(NotificationType, AddressingProperties, ArjunaContext)
+AT ENTRY
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF NOT recovered
+DO debug("received completed message for coordinator completion participant stub " + identifier),
+   traceln("log", "received completed message for coordinator completion participant stub " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered participant completion
+# participant stub (ParticipantCompletionCoordinatorEngine) receives an
+# exit message. It traces the call.
+
+RULE trace participant completion exit
+CLASS com.arjuna.wst11.messaging.engines.ParticipantCompletionCoordinatorEngine
+METHOD exit(NotificationType, AddressingProperties, ArjunaContext)
+AT ENTRY
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF recovered
+DO debug("received exit message for participant completion participant stub " + identifier),
+   traceln("log", "received exit message for participant completion participant stub " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a non-recovered coordinator completion
+# participant stub (CoordinatorCompletionCoordinatorEngine) receives an
+# exit message. It traces the call.
+
+RULE trace coordinator completion exit
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine
+METHOD exit(NotificationType, AddressingProperties, ArjunaContext)
+AT ENTRY
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF recovered
+DO debug("received exit message for coordinator completion participant stub " + identifier),
+   traceln("log", "received exit message for coordinator completion participant stub " + identifier)
+ENDRULE
+
+#######################################################################
+## rules for reboot run of AS
+
+#######################################################################
+# This rule is triggered when a participant completion participant stub
+# (ParticipantCompletionCoordinatorEngine) is created from details
+# located in the log record. It traces the create operation
+# The trigger location is at entry but the rule should only be triggered
+# after calling the super constructor
+RULE trace participant completion engine create
+CLASS com.arjuna.wst11.messaging.engines.ParticipantCompletionCoordinatorEngine
+METHOD <init>(String, boolean, W3CEndpointReference, State, boolean)
+AT ENTRY
+BIND identifier = $1,
+     recovered=$4
+IF recovered
+DO debug("created recovered participant completion participant stub " + identifier),
+   trace("log", "created recovered participant completion participant stub " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a coordinator completion participant stub
+# (CoordinatorCompletionCoordinatorEngine) is created from details
+# located in the log record. It traces the create operation
+# The trigger location is at entry but the rule should only be triggered
+# after calling the super constructor
+RULE trace coordinator completion engine create
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine
+METHOD <init>(String, boolean, W3CEndpointReference, State, boolean)
+AT ENTRY
+BIND identifier = $1,
+     recovered=$4
+IF recovered
+DO debug("created recovered coordinator completion participant stub " + identifier),
+   trace("log", "created recovered coordinator completion participant stub " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a recovered participant completion
+# participant stub (ParticipantCompletionCoordinatorEngine) is requested
+# to send a close message. This happens during replay of a prepared TX from
+# the log. It traces the call.
+
+RULE trace participant completion close
+CLASS com.arjuna.wst11.messaging.engines.ParticipantCompletionCoordinatorEngine
+METHOD close
+AFTER SYNCHRONIZE
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF recovered
+DO debug("close on recovered participant completion participant engine " + identifier),
+   traceln("log", "close on recovered participant completion participant engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a recovered coordinator completion
+# participant stub (CoordinatorCompletionCoordinatorEngine) is requested
+# to send a close message. This happens during replay of a prepared TX from
+# the log. It traces the call.
+
+RULE trace coordinator completion close
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine
+METHOD close
+AFTER SYNCHRONIZE
+BIND engine:CoordinatorEngine = $0,
+     recovered:boolean = engine.isRecovered(),
+     identifier:String = engine.getId()
+IF recovered
+DO debug("close on recovered coordinator completion participant engine " + identifier),
+   traceln("log", "close on recovered coordinator completion participant engine " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when the recovery system finds a PREPARED
+# activity in the log and reruns the phase 2 commit operation.
+# It prints a message which can be used to verify that the test has
+# progressed as expected.
+
+RULE trace prepared replay
+CLASS org.jboss.jbossts.xts.recovery.coordinator.ba.RecoverACCoordinator
+METHOD replayPhase2
+AT INVOKE phase2Commit
+BIND coordinator = $0,
+     uid : Uid = coordinator.identifier(),
+     status : int = coordinator.status()
+IF (status == com.arjuna.ats.arjuna.coordinator.ActionStatus.PREPARED)
+     OR
+     (status == com.arjuna.ats.arjuna.coordinator.ActionStatus.COMMITTING)
+DO debug("replaying close for prepared activity " + uid),
+   traceln("log", "replaying close for prepared activity " + uid)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when the recovery system deletes the COMMITTED
+# activity from the log. It prints a message which can be used to
+# verify that the test has completed. As a convenience itt also kills
+# the JVM to halt the test.
+
+RULE trace remove committed state
+CLASS com.arjuna.ats.arjuna.coordinator.BasicAction
+METHOD updateState
+AFTER CALL remove_committed
+BIND action : BasicAction = $0,
+     uid  = action.get_uid()
+IF TRUE
+DO traceln("log", "removed committed activity " + uid),
+   debug("removed committed transaction " + uid),
+   debug("!!!killing JVM!!!"),
+   killJVM()
+ENDRULE

Modified: labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/HeuristicRecoveryAfterDelayedCommit.txt
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/HeuristicRecoveryAfterDelayedCommit.txt	2009-01-23 14:12:56 UTC (rev 24887)
+++ labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/HeuristicRecoveryAfterDelayedCommit.txt	2009-01-23 14:23:44 UTC (rev 24888)
@@ -100,7 +100,7 @@
 # The default way of exercising this test is to deploy the xtstest war
 # to a single AS and configure it to run the relevant XTS Service Test.
 # The web services and coordinator will be located with the client.
-# The number of participants can actually be 1, 2, 3 or more. The
+# The number of participants can actually be 2, 3 or The
 # web service(s), client (i.e. the XTS Service Test which drives
 # the test) and coordinator service can optionally be located in separate
 # ASs. It possible to use just a single web service and have the client
@@ -109,6 +109,11 @@
 # automatically and the server should be killed after a the heuristic
 # transaction is successfuly replayed.
 #
+# n.b. this test is not appropriate foir the case where only one participant
+# is registered since the coordiantor employs the one phase optimization,
+# omitting to log the transaction. In this case the participant should be
+# rolled back at restart.
+#
 # This script needs to be passed to a TOAST agent in the JVM running
 # the coordinator service both at first boot and at reboot. Output will be
 # written to file testlog in the working directory of the AS. n.b. the rules in
@@ -129,13 +134,6 @@
 #
 # Available tests include:
 #
-# org.jboss.jbossts.xts.servicetests.test.ATSingleParticipantPrepareAndCommitTest
-# this test invokes a single service registering 1 participant
-# the location of service is defined by defining a system property:
-#    org.jboss.jbossts.xts.servicetests.ServiceURL
-# if this is not set the value used defaults to
-#    http://localhost:8080/xtstest/xtsservicetest1
-#
 # org.jboss.jbossts.xts.servicetests.test.ATMultiParticipantPrepareAndCommitTest
 # this test invokes a single service registering 3 participant
 # the location of service is defined by defining a system property:

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/bean/XTSServiceTestRunnerBean.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/bean/XTSServiceTestRunnerBean.java	2009-01-23 14:12:56 UTC (rev 24887)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/bean/XTSServiceTestRunnerBean.java	2009-01-23 14:23:44 UTC (rev 24888)
@@ -24,6 +24,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.jbossts.xts.servicetests.test.XTSServiceTest;
 import org.jboss.jbossts.xts.servicetests.service.recovery.TestATRecoveryModule;
+import org.jboss.jbossts.xts.servicetests.service.recovery.TestBARecoveryModule;
 
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
@@ -81,6 +82,7 @@
         // ensure that the xts service test AT recovery helper module is registered
         
         TestATRecoveryModule.register();
+        TestBARecoveryModule.register();
 
         if (testName != null) {
             log.info("Starting XTS Service Test " + testName);
@@ -139,8 +141,9 @@
         // ensure that the xts service test AT recovery helper module is unregistered
 
         TestATRecoveryModule.unregister();
+        TestBARecoveryModule.unregister();
 
-               log.info("Stopped XTSServiceTestRunner");
+        log.info("Stopped XTSServiceTestRunner");
     }
 
     private final Logger log = org.jboss.logging.Logger.getLogger(XTSServiceTestRunnerBean.class);

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-01-23 14:12:56 UTC (rev 24887)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java	2009-01-23 14:23:44 UTC (rev 24888)
@@ -136,7 +136,7 @@
             } catch (Exception e) {
                 throw new WebServiceException("enlistVolatile failed ", e);
             }
-            for (;idx < size; idx++) {
+            for (idx = 1;idx < size; idx++) {
                 participant.addCommand(commandList.get(idx));
             }
             participantMap.put(id, participant);
@@ -152,7 +152,7 @@
             } catch (Exception e) {
                 throw new WebServiceException("enlistCoordinatorCompletion failed ", e);
             }
-            for (;idx < size; idx++) {
+            for (idx = 1;idx < size; idx++) {
                 participant.addCommand(commandList.get(idx));
             }
             participantMap.put(id, participant);
@@ -168,7 +168,7 @@
             } catch (Exception e) {
                 throw new WebServiceException("enlistParticipantCompletion failed ", e);
             }
-            for (;idx < size; idx++) {
+            for (idx = 1;idx < size; idx++) {
                 participant.addCommand(commandList.get(idx));
             }
             participantMap.put(id, participant);

Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/recovery/TestBARecoveryModule.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/recovery/TestBARecoveryModule.java	2009-01-23 14:12:56 UTC (rev 24887)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/recovery/TestBARecoveryModule.java	2009-01-23 14:23:44 UTC (rev 24888)
@@ -58,51 +58,6 @@
         }
     }
 
-    /**
-     * called during recovery processing to allow an application to identify a participant id
-     * belonging to one of its participants and recreate the participant by deserializing
-     * it from the supplied object input stream. n.b. this is only appropriate in case the
-     * participant was originally saved using serialization.
-     *
-     * @param id     the id used when the participant was created
-     * @param stream a stream from which the application should deserialise the participant
-     *               if it recognises that the id belongs to the module's application
-     * @return
-     * @throws Exception if an error occurs deserializing the durable participant
-     */
-    public Durable2PCParticipant deserialize(String id, ObjectInputStream stream) throws Exception {
-        if (id.startsWith(Constants.PARTICIPANT_ID_PREFIX + "DurableTestParticipant")) {
-            System.out.println("xts service test : attempting to deserialize WS-AT participant " + id);
-            DurableTestParticipant participant = (DurableTestParticipant)stream.readObject();
-            System.out.println("xts service test : deserialized WS-AT participant " + id);
-            return participant;
-        }
-
-        return null;
-    }
-
-    /**
-     * called during recovery processing to allow an application to identify a participant id
-     * belonging to one of its participants and use the saved recovery state to recreate the
-     * participant. n.b. this is only appropriate in case the participant was originally saved
-     * after being converted to a byte array using the PersistibleATParticipant interface.
-     *
-     * @param id            the id used when the participant was created
-     * @param recoveryState a byte array returned form the original participant via a call to
-     *                      method getRecoveryState of interface PersistableATParticipant
-     * @return
-     * @throws Exception if an error occurs converting the recoveryState back to a
-     *                   durable participant
-     */
-    public Durable2PCParticipant recreate(String id, byte[] recoveryState) throws Exception {
-        if (id.startsWith(Constants.PARTICIPANT_ID_PREFIX)) {
-            // this should not get called -- test WS-AT participants are saved and restored
-            // using serialization
-            throw new Exception("xts service test : invalid request to recreate() WS-AT participant " + id);
-        }
-        return null;
-    }
-
     public BusinessAgreementWithParticipantCompletionParticipant deserializeParticipantCompletionParticipant(String id, ObjectInputStream stream) throws Exception {
         if (id.startsWith(Constants.PARTICIPANT_ID_PREFIX + "ParticipantCompletionParticipant")) {
             System.out.println("xts service test : attempting to deserialize WS-BA participant completion participant " + id);

Added: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantCoordinatorCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantCoordinatorCompletionParticipantCloseTest.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantCoordinatorCompletionParticipantCloseTest.java	2009-01-23 14:23:44 UTC (rev 24888)
@@ -0,0 +1,174 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test;
+
+import org.jboss.jbossts.xts.servicetests.service.XTSServiceTestServiceManager;
+import org.jboss.jbossts.xts.servicetests.client.XTSServiceTestClient;
+import org.jboss.jbossts.xts.servicetests.generated.CommandsType;
+import org.jboss.jbossts.xts.servicetests.generated.ResultsType;
+import com.arjuna.mw.wst11.UserTransactionFactory;
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+/**
+ * Starts a transaction and enlists a single participant with instructions to prepare and commit
+ * without error
+ */
+public class BAMultiParticipantCoordinatorCompletionParticipantCloseTest implements XTSServiceTest
+{
+    private boolean isSuccessful = false;
+    private Exception exception;
+
+    public void run() {
+
+        // wait a while so the service has time to start
+
+        try {
+            Thread.sleep(5000);
+        } catch (InterruptedException e) {
+            // ignore
+        }
+
+        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 {
+            ba.begin();
+        } catch (WrongStateException e) {
+            exception = e;
+        } catch (SystemException e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseTest : txbegin failure " + exception);
+            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");
+
+        try {
+            results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+        } catch (Exception e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseTest : server failure " + exception);
+            return;
+        }
+
+        for (String s : results.getResultList()) {
+            System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseTest : 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("http://localhost:8080/xtstest/xtsservicetest1", commands);
+        } catch (Exception e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseTest : server failure " + exception);
+            return;
+        }
+
+        for (String s : results.getResultList()) {
+            System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseTest : 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("http://localhost:8080/xtstest/xtsservicetest1", commands);
+        } catch (Exception e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseTest : server failure " + exception);
+            return;
+        }
+
+        for (String s : results.getResultList()) {
+            System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseTest : enlistCoordinatorCompletion " + s);
+        }
+
+        // now close the activity
+
+        try {
+            ba.close();
+        } catch (TransactionRolledBackException e) {
+            exception = e;
+        } catch (UnknownTransactionException e) {
+            exception = e;
+        } catch (SystemException e) {
+            exception = e;
+        } catch (WrongStateException e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseTest : commit failure " + exception);
+        }
+
+        System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseTest : completed");
+    }
+
+    public boolean isSuccessful() {
+        return isSuccessful;
+    }
+
+    public Exception getException() {
+        return exception;
+    }
+}
\ No newline at end of file

Added: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceCoordinatorCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceCoordinatorCompletionParticipantCloseTest.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceCoordinatorCompletionParticipantCloseTest.java	2009-01-23 14:23:44 UTC (rev 24888)
@@ -0,0 +1,174 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test;
+
+import org.jboss.jbossts.xts.servicetests.service.XTSServiceTestServiceManager;
+import org.jboss.jbossts.xts.servicetests.client.XTSServiceTestClient;
+import org.jboss.jbossts.xts.servicetests.generated.CommandsType;
+import org.jboss.jbossts.xts.servicetests.generated.ResultsType;
+import com.arjuna.mw.wst11.UserTransactionFactory;
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+/**
+ * Starts a transaction and enlists a single participant with instructions to prepare and commit
+ * without error
+ */
+public class BAMultiServiceCoordinatorCompletionParticipantCloseTest implements XTSServiceTest
+{
+    private boolean isSuccessful = false;
+    private Exception exception;
+
+    public void run() {
+
+        // wait a while so the service has time to start
+
+        try {
+            Thread.sleep(5000);
+        } catch (InterruptedException e) {
+            // ignore
+        }
+
+        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 {
+            ba.begin();
+        } catch (WrongStateException e) {
+            exception = e;
+        } catch (SystemException e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseTest : txbegin failure " + exception);
+            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");
+
+        try {
+            results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+        } catch (Exception e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseTest : server failure " + exception);
+            return;
+        }
+
+        for (String s : results.getResultList()) {
+            System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseTest : 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("http://localhost:8080/xtstest/xtsservicetest2", commands);
+        } catch (Exception e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseTest : server failure " + exception);
+            return;
+        }
+
+        for (String s : results.getResultList()) {
+            System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseTest : 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("http://localhost:8080/xtstest/xtsservicetest3", commands);
+        } catch (Exception e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseTest : server failure " + exception);
+            return;
+        }
+
+        for (String s : results.getResultList()) {
+            System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseTest : enlistCoordinatorCompletion " + s);
+        }
+
+        // now close the activity
+
+        try {
+            ba.close();
+        } catch (TransactionRolledBackException e) {
+            exception = e;
+        } catch (UnknownTransactionException e) {
+            exception = e;
+        } catch (SystemException e) {
+            exception = e;
+        } catch (WrongStateException e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseTest : commit failure " + exception);
+        }
+
+        System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseTest : completed");
+    }
+
+    public boolean isSuccessful() {
+        return isSuccessful;
+    }
+
+    public Exception getException() {
+        return exception;
+    }
+}
\ No newline at end of file

Added: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BASingleCoordinatorCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BASingleCoordinatorCompletionParticipantCloseTest.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BASingleCoordinatorCompletionParticipantCloseTest.java	2009-01-23 14:23:44 UTC (rev 24888)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test;
+
+import org.jboss.jbossts.xts.servicetests.service.XTSServiceTestServiceManager;
+import org.jboss.jbossts.xts.servicetests.client.XTSServiceTestClient;
+import org.jboss.jbossts.xts.servicetests.generated.CommandsType;
+import org.jboss.jbossts.xts.servicetests.generated.ResultsType;
+import com.arjuna.mw.wst11.UserTransactionFactory;
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+/**
+ * Starts a transaction and enlists a single participant with instructions to prepare and commit
+ * without error
+ */
+public class BASingleCoordinatorCompletionParticipantCloseTest implements XTSServiceTest
+{
+    private boolean isSuccessful = false;
+    private Exception exception;
+
+    public void run() {
+
+        // wait a while so the service has time to start
+
+        try {
+            Thread.sleep(5000);
+        } catch (InterruptedException e) {
+            // ignore
+        }
+
+        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 {
+            ba.begin();
+        } catch (WrongStateException e) {
+            exception = e;
+        } catch (SystemException e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BASingleCoordinatorCompletionParticipantCloseTest : txbegin failure " + exception);
+            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");
+
+        try {
+            results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+        } catch (Exception e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BASingleCoordinatorCompletionParticipantCloseTest : server failure " + exception);
+            return;
+        }
+
+        for (String s : results.getResultList()) {
+            System.out.println("BASingleCoordinatorCompletionParticipantCloseTest : enlistCoordinatorCompletion " + s);
+        }
+
+        // now close the activity
+
+        try {
+            ba.close();
+        } catch (TransactionRolledBackException e) {
+            exception = e;
+        } catch (UnknownTransactionException e) {
+            exception = e;
+        } catch (SystemException e) {
+            exception = e;
+        } catch (WrongStateException e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BASingleCoordinatorCompletionParticipantCloseTest : commit failure " + exception);
+        }
+
+        System.out.println("BASingleCoordinatorCompletionParticipantCloseTest : completed");
+    }
+
+    public boolean isSuccessful() {
+        return isSuccessful;
+    }
+
+    public Exception getException() {
+        return exception;
+    }
+}
\ No newline at end of file

Added: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BASingleParticipantCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BASingleParticipantCompletionParticipantCloseTest.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BASingleParticipantCompletionParticipantCloseTest.java	2009-01-23 14:23:44 UTC (rev 24888)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2009,
+ * @author JBoss Inc.
+ */
+
+package org.jboss.jbossts.xts.servicetests.test;
+
+import org.jboss.jbossts.xts.servicetests.service.XTSServiceTestServiceManager;
+import org.jboss.jbossts.xts.servicetests.client.XTSServiceTestClient;
+import org.jboss.jbossts.xts.servicetests.generated.CommandsType;
+import org.jboss.jbossts.xts.servicetests.generated.ResultsType;
+import com.arjuna.mw.wst11.UserTransactionFactory;
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.mw.wst11.UserBusinessActivityFactory;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import java.util.List;
+
+/**
+ * Starts a transaction and enlists a single participant with instructions to prepare and commit
+ * without error
+ */
+public class BASingleParticipantCompletionParticipantCloseTest implements XTSServiceTest
+{
+    private boolean isSuccessful = false;
+    private Exception exception;
+
+    public void run() {
+
+        // wait a while so the service has time to start
+
+        try {
+            Thread.sleep(5000);
+        } catch (InterruptedException e) {
+            // ignore
+        }
+
+        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 {
+            ba.begin();
+        } catch (WrongStateException e) {
+            exception = e;
+        } catch (SystemException e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BASingleParticipantCompletionParticipantCloseTest : txbegin failure " + exception);
+            return;
+        }
+
+        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");
+
+        try {
+            results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+        } catch (Exception e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BASingleParticipantCompletionParticipantCloseTest : server failure " + exception);
+            return;
+        }
+
+        resultsList = results.getResultList();
+        participantId = resultsList.get(0);
+
+        for (String s : resultsList) {
+            System.out.println("BASingleParticipantCompletionParticipantCloseTest : enlistParticipantCompletion " + s);
+        }
+
+        // invoke the service scripting the participant to send completed now
+        commands = new CommandsType();
+        commands.getCommandList().add("completed");
+        commands.getCommandList().add(participantId);
+
+        try {
+            results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+        } catch (Exception e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BASingleParticipantCompletionParticipantCloseTest : server failure " + exception);
+            return;
+        }
+
+        resultsList = results.getResultList();
+
+        for (String s : resultsList) {
+            System.out.println("BASingleParticipantCompletionParticipantCloseTest : completed(" + participantId + ") " + s);
+        }
+
+        // now close the activity
+
+        try {
+            ba.close();
+        } catch (TransactionRolledBackException e) {
+            exception = e;
+        } catch (UnknownTransactionException e) {
+            exception = e;
+        } catch (SystemException e) {
+            exception = e;
+        } catch (WrongStateException e) {
+            exception = e;
+        }
+
+        if (exception != null) {
+            System.out.println("BASingleParticipantCompletionParticipantCloseTest : close failure " + exception);
+        }
+
+        System.out.println("BASingleParticipantCompletionParticipantCloseTest : finished");
+
+        isSuccessful = true;
+    }
+
+    public boolean isSuccessful() {
+        return isSuccessful;
+    }
+
+    public Exception getException() {
+        return exception;
+    }
+}
\ No newline at end of file




More information about the jboss-svn-commits mailing list