[jboss-svn-commits] JBL Code SVN: r24893 - in labs/jbosstm/trunk/XTS/sar/tests: src/org/jboss/jbossts/xts/servicetests/service and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jan 23 11:24:49 EST 2009
Author: adinn
Date: 2009-01-23 11:24:49 -0500 (Fri, 23 Jan 2009)
New Revision: 24893
Added:
labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATHeuristicRecoveryAfterDelayedCommit.txt
labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATParticipantCrashAndRecover.txt
labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java
labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest.java
labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantParticipantCompletionParticipantCloseTest.java
labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest.java
labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceParticipantCompletionParticipantCloseAndExitTest.java
labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceParticipantCompletionParticipantCloseTest.java
Removed:
labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/HeuristicRecoveryAfterDelayedCommit.txt
labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ParticipantCrashAndRecover.txt
Modified:
labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/BACrashDuringCommit.txt
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/ATMultiParticipantPrepareAndCommitTest.java
labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ATMultiServicePrepareAndCommitTest.java
labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ATSingleParticipantPrepareAndCommitTest.java
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
labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/XTSServiceTest.java
Log:
added more BA XTS Service Test scenarios and corrected some small errors in the BA scrip. renamed AT scripts to make it clear where they belong and corrected service implementation to store participant ids in statci map (since we may have multiple instances of the service bean) -- partial fixes for JBTM-431 and JBTM-387
Copied: labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATHeuristicRecoveryAfterDelayedCommit.txt (from rev 24888, labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/HeuristicRecoveryAfterDelayedCommit.txt)
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATHeuristicRecoveryAfterDelayedCommit.txt (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATHeuristicRecoveryAfterDelayedCommit.txt 2009-01-23 16:24:49 UTC (rev 24893)
@@ -0,0 +1,358 @@
+##############################################################################
+# JBoss, Home of Professional Open Source
+# Copyright 2008-9, 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
+#
+# Heuristic Recovery After Delayed Commit
+#
+# This script automates testing of a specific recovery scenario for the
+# JBossTS XTS implementation of the WS-AT 1.1 protocol using orchestration
+# rules. The 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-AT transaction
+# 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
+# Client commits WS-AT transaction
+# Coordinator initiates commit of participant P1
+# ** Rule system intercepts commit and crahses JVM
+#
+# AS reboots
+# Recovery system starts after 2 minutes
+# Recovery system recreates PREPARED WS-AT transaction coordinator
+# Recovery system recreates participant stub for P1
+# ** Rule system adds countdown(2) for P1
+# Recovery system recreates participant stub for P2
+# ** Rule system adds countdown for P2
+# Recovery system recreates participant stub for P3
+# ** Rule system adds countdown for P3
+# Recovery system calls replay of PREPARED transaction
+# ** Rule system traces PREPARED replay invocation
+#
+# Coordinator sends commit to P1
+# ** Rule system decrements P1's countdown to 1
+#
+# P1 replies with committed
+# ** Rule system intercepts committed message handler and aborts thread
+# (last 2 steps repeated while countdown is active)
+#
+# Coordinator sends commit to P2
+# ** Rule system decrements P2's countdown to 1
+#
+# P2 replies with committed
+# ** Rule system intercepts committed message handler and aborts thread
+# (last 2 steps repeated while countdown is active)
+#
+# Coordinator sends commit to P3
+# ** Rule system decrements P3's countdown to 1
+#
+# P3 replies with committed
+# ** Rule system intercepts committed message handler and aborts thread
+# (last 2 steps repeated while countdown is active)
+#
+# Coordinator times out commit and writes heuristic transaction to log
+# Recovery system sleeps
+
+# Recovery system restarts after 2 minutes
+# Recovery system recreates HEURISTIC WS-AT transaction coordinator
+# Recovery system detects existing participant stub for P1
+# Recovery system detects existing participant stub for P2
+# Recovery system detects existing participant stub for P3
+#
+# Coordinator sends commit to P1
+# ** Rule system decrements P1's countdown to 0 and removes countdown
+# P1 replies with committed
+# Coordinator sends commit to P2
+# ** Rule system decrements P2's countdown to 0 and removes countdown
+# P2 replies with committed
+# Coordinator sends commit to P3
+# ** Rule system decrements P3's countdown to 0 and removes countdown
+# P3 replies with committed
+# Coordinator clears heuristic log record and copletes 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 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
+# 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 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
+# 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:
+#
+# 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:
+# 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.ATMultiServicePrepareAndCommitTest
+# this test invokes 3 separate services registering a 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
+#
+# 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
+#
+# 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.
+#
+# JVM exit
+# replay commit for prepared transaction 7f000001:cebc:496f3b83:6e
+# replay commit for heuristic committed transaction 7f000001:cebc:496f3b83:6e
+# countdown completed for D7f000001:cebc:496f3b83:70
+# countdown completed for D7f000001:cebc:496f3b83:73
+# countdown completed for D7f000001:cebc:496f3b83:76
+# removed committed transaction
+
+#######################################################################
+# 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 stub
+# (CoordinatorEngine) is sent a commit message i.e. immediately
+# after a successful prepare. It exits the JVM, simulating a crash.
+# The trigger location is set to follow the write of recovered,
+# ensuring that the property is avaialable for test in the rule
+# condition.
+
+RULE kill JVM
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD commit
+AT SYNCHRONIZE
+BIND engine:CoordinatorEngine = $0,
+ recovered:boolean = engine.isRecovered(),
+ identifier:String = engine.getId()
+IF (NOT recovered)
+ AND
+ debug("commit on non-recovered engine " + identifier)
+DO traceln("log", "JVM exit"),
+ debug("!!!killing JVM!!!"),
+ killJVM()
+ENDRULE
+
+#######################################################################
+## rules for reboot run of AS
+
+#######################################################################
+# This rule is triggered when a participant stub (CoordinatorEngine) is
+# created from details located in the log record. It adds a countdown
+# which is tripped each time a commit is tried on the participant.
+# While the countdown is active committed messages will be blocked.
+# Note that it calls isRecovered() to detect that the stub has been
+# recreated from the log. The trigger location is set to follow the
+# write of recovered, ensuring that the property is avaialable for
+# test in the rule condition.
+
+RULE add coordinator engine countdown
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD <init>(String, boolean, W3CEndpointReference, boolean, State)
+AFTER WRITE recovered
+BIND engine:CoordinatorEngine = $0,
+ recovered:boolean = engine.isRecovered(),
+ identifier:String = engine.getId()
+IF recovered
+DO debug("adding countdown for " + identifier),
+ addCountDown(identifier, 1)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a recovered participant stub
+# (CoordinatorEngine) is sent a commit message. This happens during
+# replay of a prepared TX from the log. It decrements the countdown. First
+# time round this takes it from 1 to 0 but leaves it in place. Second
+# time round it removes it allowing committed messages to flow.
+
+RULE countdown at commit
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD commit
+AFTER SYNCHRONIZE
+BIND engine:CoordinatorEngine = $0,
+ recovered:boolean = engine.isRecovered(),
+ identifier:String = engine.getId()
+IF recovered
+ AND
+ debug("commit on recovered engine " + identifier)
+ AND
+ debug("counting down")
+ AND
+ countDown(identifier)
+DO debug("countdown completed for " + identifier),
+ traceln("log", "countdown completed for " + identifier)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when a recovered participant stub
+# (CoordinatorEngine) is sent a committed message i.e. in the handler
+# thread which responds to a COMMITTED message from a participant.
+# If it detects a countdown registered using the participant id it
+# forces an early return stopping delivery of the COMMITTED message.
+
+RULE drop committed message
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD committed(Notification, AddressingProperties, ArjunaContext)
+AT ENTRY
+BIND engine:CoordinatorEngine = $0,
+ recovered:boolean = engine.isRecovered(),
+ identifier:String = engine.getId()
+IF recovered
+ AND
+ debug("committed on recovered engine " + identifier)
+ AND
+ getCountDown(identifier)
+DO debug("dropping committed message for " + identifier),
+ return
+ENDRULE
+
+#######################################################################
+# This rule is triggered when the recovery system finds the PREPARED
+# transaction 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.at.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 commit for prepared transaction " + uid),
+ traceln("log", "replay commit for prepared transaction " + uid)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when the recovery system finds the COMMITTED
+# transaction 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 heuristic committed replay
+CLASS org.jboss.jbossts.xts.recovery.coordinator.at.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.COMMITTED
+DO debug("replaying commit for heuristic committed transaction " + uid),
+ traceln("log", "replay commit for heuristic committed transaction " + uid)
+ENDRULE
+
+#######################################################################
+# This rule is triggered when the recovery system deletes the COMMITTED
+# transaction 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 transaction " + uid),
+ debug("removed committed transaction " + uid),
+ debug("!!!killing JVM!!!"),
+ killJVM()
+ENDRULE
Copied: labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATParticipantCrashAndRecover.txt (from rev 24792, labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ParticipantCrashAndRecover.txt)
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATParticipantCrashAndRecover.txt (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ATParticipantCrashAndRecover.txt 2009-01-23 16:24:49 UTC (rev 24893)
@@ -0,0 +1,295 @@
+##############################################################################
+# JBoss, Home of Professional Open Source
+# Copyright 2008-9, 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
+#
+# Participant Recovery with Remote Coordinator
+#
+# This script automates testing of a specific recovery scenario for the
+# JBossTS XTS implementation of the WS-AT 1.1 protocol using orchestration
+# rules. The basic scenario employs a client (XTS Service Test program)
+# and 2 web services located in one JVM/AS and a coordinator located in another
+# JVM/AS but it is possible for the lcinet and web services to be lcoated in
+# separate JVMs/ASs. The scenario is as follows (note ** AS<n> indicates
+# intercession by a TOAST rule executed in a specific AS):
+#
+# AS1 boots
+# AS2 boots
+# AS1 Client starts a WS-AT transaction talking to coordinator in AS2
+# AS1 Client invokes web service 1
+# AS1 Web service 1 registers as participant P1
+# AS1 Client invokes web service 2
+# AS1 Web service 2 registers as participant P2
+# AS1 Client commits WS-AT transaction
+#
+# AS2 Coordinator initiates commit of participant P1
+# AS2 Coordinator sends commit to P1
+#
+# AS1 P1 receives commit
+# ** AS1 Rule system intercepts commit and crashes JVM
+#
+# AS2 Coordinator attempts to resend message
+# ** AS2 Rule system suspends coordinator waiting on incoming prepared
+# message from P1
+# (commit messages continue to be resent in the meantime)
+#
+# AS1 reboots
+# AS1 Recovery system starts after 2 minutes
+# AS1 Recovery system recreates PREPARED WS-AT participant P1
+# ** AS1 Rule system traces recreate
+# AS1 Participant P1 resends prepared
+# AS1 Participant P1 receives commit for P1
+# AS1 Participant P1 sends committed
+#
+# AS2 Participant stub receives committed message for P1
+# ** AS2 Rule system signals coordinator clearing wait
+# ** AS2 rule system traces receipt of committed message for P1
+#
+# AS2 Coordinator detects committed from P1
+# AS2 Coordinator sends commit for P2
+# AS2 Coordinator receives committed from P2
+# AS2 Coordinator completes transaction
+# ** AS2 Rule system traces successful completion
+#
+# Use of this script
+#
+# The default way of exercising this test is to deploy the xtstest war
+# to AS1 and configure it to run the relevant XTS Service Test. It is
+# actually possible to use 1, 2, 3 or more participants and multiple
+# participants may be registered by a single web service or by independent
+# web services. If required the web service(s) may be located in a a separate
+# AS to the one running the XTS Service test.
+#
+# The test should crash AS1 at the point of commit. At AS1 reboot the rest of
+# the test should run automatically. AS2 should be killed after the
+# transaction is successfuly terminated. Still need to work out how to
+# automatically terminate AS1 automatically but exit of AS2 is a signal
+# that AS1 can be killed.
+#
+# !!! N.B. this test currently fails because JBossWS Native fails to cope
+# !!! with requests for services while they are bootstrapping
+#
+# The JVMs hosting AS1 and AS2 both need to be configured to run a TOAST
+# agent supplied with this script. If the web service(s) is relocated
+# to AS3 then it needs to be configured to run the TOAST agent instead of
+# AS1 (rules only refer to participant and coordinator code, not to the
+# XTS service test code).
+#
+# The client AS (AS1) needs to be pointed at the coordinator AS (AS2). 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)
+#
+# 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 AS1, the client AS. n.b. if the client is colocated with
+# the seb service(s) then this property must be left undefined at AS1 reboot
+# otherwise the client will run again, starting a new TX which may interfere
+# with recovery of the crashed participants.
+#
+# Available tests include:
+#
+# org.jboss.jbossts.xts.servicetests.test.ATSingleParticipantPrepareAndCommitTest
+# this test invokes a single web service registering 1 participant
+# the location of service is defined by defining a system property:
+# org.jboss.jbossts.xts.servicetests.ServiceURL1
+# which should be set to something like
+# http://baz.bar.org:8080/xtstest/xtsservicetest1
+#
+# org.jboss.jbossts.xts.servicetests.test.ATMultiParticipantPrepareAndCommitTest
+# this test invokes a single service registering 3 participants
+# the location of service is defined by defining a system property:
+# org.jboss.jbossts.xts.servicetests.ServiceURL1
+# which should be set to something like
+# http://baz.bar.org:8080/xtstest/xtsservicetest1
+#
+# org.jboss.jbossts.xts.servicetests.test.ATMultiServicePrepareAndCommitTest
+# this test invokes 3 separate services registering a participant for 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
+# which should be set to something like
+# http://mumble.bar.org:8080/xtstest/xtsservicetest1
+# http://mumble.bar.org:8080/xtstest/xtsservicetest2
+# http://mumble.bar.org:8080/xtstest/xtsservicetest3
+# if you are feeling really adventurous you can host the services
+# in different ASs
+# http://mumble.bar.org:8080/xtstest/xtsservicetest1
+# http://grumble.bar.org:8080/xtstest/xtsservicetest1
+# http://bletch.bar.org:8080/xtstest/xtsservicetest1
+#
+# Expected output AS1
+# -------------------
+#
+# After the first boot AS1 should exit leaving the following in file testlog1
+#
+# JVM exit
+#
+# After reboot AS1 should add output in the following format in file testlog1.
+# Clearly the ids for the TX/participants may vary and the number of
+# ??? lines will depend upon the number of participants employed.
+#
+# JVM exit
+# replay commit for prepared transaction 7f000001:cebc:496f3b83:6e
+# replay commit for heuristic committed transaction 7f000001:cebc:496f3b83:6e
+# countdown completed for D7f000001:cebc:496f3b83:70
+# countdown completed for D7f000001:cebc:496f3b83:73
+# countdown completed for D7f000001:cebc:496f3b83:76
+# removed committed transaction
+#
+# Expected output AS2
+# -------------------
+# ???
+
+######################################################################
+# AS1 Rule set
+#######################################################################
+# 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("log1", "testlog1")
+ENDRULE
+
+
+#######################################################################
+# This rule is triggered in the AS1 when a non-recovered WS-AT
+# participant receives a commit message. It causes the JVM to crash.
+# The trigger point is the start of the method.
+RULE crash unrecovered participant at commit
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD commit
+AT ENTRY
+BIND engine:ParticipantEngine = $0,
+ recovered:boolean = engine.isRecovered(),
+ identifier:String = engine.getId()
+IF (NOT recovered)
+ AND
+ debug("commit on non-recovered participant engine " + identifier)
+DO debug("!!!killing JVM!!!"),
+ killJVM()
+ENDRULE
+
+#######################################################################
+# This rule is triggered in the AS1 when a recovered WS-AT participant
+# is recreated from the log. It traces the call to allow success of the
+# test to be detected.
+# The trigger point is the end of the constructor so that the rule can
+# safely read all the fields.
+
+RULE trace recovered participant recreate
+CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
+METHOD <init>(Participant, id, State, W3CEndpointReference, boolean)
+AFTER WRITE persisted
+BIND engine:ParticipantEngine = $0,
+ recovered:boolean = engine.isRecovered(),
+ identifier:String = engine.getId()
+IF recovered
+DO debug("recreated recovered participant engine " + identifier)
+ENDRULE
+
+
+######################################################################
+# AS2 Rule set
+#######################################################################
+# This rule opens a file for the trace output during XTS startup
+
+RULE open trace file
+CLASS org.jboss.jbossts.XTSService
+METHOD start()
+BIND NOTHING
+IF TRUE
+DO openTrace("log2", "testlog2")
+ENDRULE
+
+######################################################################
+# This rule is triggered in AS2 when a participant stub
+# (CoordinatorEngine) first posts a commit message to the participant.
+# The coordinator thread suspends until a committed message is received
+# from the participant. This ensures that it waits until AS1
+# has restarted allowing the transaction to then complete. The
+# condition tests whether a flag with key "firstCommit" has been set.
+# By default this is clear so the condition is true first time the
+# rule is called. The action sets te flag causing the condition to
+# evaluate to false on subsequent commit calls.
+# The trigger point is just before calling waitForState.
+
+RULE suspend coordinator after sending first commit
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD commit
+LINE 330
+BIND engine:CoordinatorEngine = $0,
+ identifier:String = engine.getId()
+IF (NOT flagged("firstCommit"))
+DO debug("coordinator waiting for participant to resend prepare" + identifier),
+ flag("firstCommit"),
+ waitFor(identifier)
+ENDRULE
+
+#######################################################################
+
+# This rule is triggered when a committed message is received from P1.
+# This indicates that the participant has been recreated and
+# successfully responded to a commit message after reboot of AS1. The
+# rule uses a call to signal to wake up the coordinator which was
+# suspended when the first commit was sent. This call only returns true
+# if the identifier is for P1 and the coordinator has not already been
+# signalled. Note that the call to signal is made in the condition to
+# avoid a race between threads handling successive committed messages.
+# If instead the condition called waiting() and the action called
+# signal() then, depending upon scheduling, both threads might find the
+# condition to be true before one of them could execute signal().
+# Although this would be harmless in this case it could be significant
+# when using other rules.
+# The triogger point is at the sttart of the method.
+
+RULE signal waiting coordinator
+CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
+METHOD committed
+AT ENTRY
+BIND engine : CoordinatorEngine = $0,
+ identifier:String = engine.getId()
+IF debug("received committed for participant " + identifier)
+ AND
+ signal(identifier)
+DO debug("signalled coordinator waiting on " + identifier)
+ENDRULE
Modified: labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/BACrashDuringCommit.txt
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/BACrashDuringCommit.txt 2009-01-23 16:14:14 UTC (rev 24892)
+++ labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/BACrashDuringCommit.txt 2009-01-23 16:24:49 UTC (rev 24893)
@@ -154,14 +154,14 @@
# 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
+# org.jboss.jbossts.xts.servicetests.ServiceURL1
# 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
+# org.jboss.jbossts.xts.servicetests.ServiceURL1
# if this is not set the value used defaults to
# http://localhost:8080/xtstest/xtsservicetest1
#
@@ -169,7 +169,7 @@
# 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
+# org.jboss.jbossts.xts.servicetests.ServiceURL1
# if this is not set the value used defaults to
# http://localhost:8080/xtstest/xtsservicetest1
#
@@ -177,7 +177,7 @@
# 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
+# org.jboss.jbossts.xts.servicetests.ServiceURL1
# if this is not set the value used defaults to
# http://localhost:8080/xtstest/xtsservicetest1
#
@@ -384,7 +384,7 @@
BIND engine:CoordinatorEngine = $0,
recovered:boolean = engine.isRecovered(),
identifier:String = engine.getId()
-IF recovered
+IF NOT recovered
DO debug("received exit message for participant completion participant stub " + identifier),
traceln("log", "received exit message for participant completion participant stub " + identifier)
ENDRULE
@@ -401,7 +401,7 @@
BIND engine:CoordinatorEngine = $0,
recovered:boolean = engine.isRecovered(),
identifier:String = engine.getId()
-IF recovered
+IF NOT recovered
DO debug("received exit message for coordinator completion participant stub " + identifier),
traceln("log", "received exit message for coordinator completion participant stub " + identifier)
ENDRULE
Deleted: labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/HeuristicRecoveryAfterDelayedCommit.txt
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/HeuristicRecoveryAfterDelayedCommit.txt 2009-01-23 16:14:14 UTC (rev 24892)
+++ labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/HeuristicRecoveryAfterDelayedCommit.txt 2009-01-23 16:24:49 UTC (rev 24893)
@@ -1,358 +0,0 @@
-##############################################################################
-# JBoss, Home of Professional Open Source
-# Copyright 2008-9, 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
-#
-# Heuristic Recovery After Delayed Commit
-#
-# This script automates testing of a specific recovery scenario for the
-# JBossTS XTS implementation of the WS-AT 1.1 protocol using orchestration
-# rules. The 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-AT transaction
-# 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
-# Client commits WS-AT transaction
-# Coordinator initiates commit of participant P1
-# ** Rule system intercepts commit and crahses JVM
-#
-# AS reboots
-# Recovery system starts after 2 minutes
-# Recovery system recreates PREPARED WS-AT transaction coordinator
-# Recovery system recreates participant stub for P1
-# ** Rule system adds countdown(2) for P1
-# Recovery system recreates participant stub for P2
-# ** Rule system adds countdown for P2
-# Recovery system recreates participant stub for P3
-# ** Rule system adds countdown for P3
-# Recovery system calls replay of PREPARED transaction
-# ** Rule system traces PREPARED replay invocation
-#
-# Coordinator sends commit to P1
-# ** Rule system decrements P1's countdown to 1
-#
-# P1 replies with committed
-# ** Rule system intercepts committed message handler and aborts thread
-# (last 2 steps repeated while countdown is active)
-#
-# Coordinator sends commit to P2
-# ** Rule system decrements P2's countdown to 1
-#
-# P2 replies with committed
-# ** Rule system intercepts committed message handler and aborts thread
-# (last 2 steps repeated while countdown is active)
-#
-# Coordinator sends commit to P3
-# ** Rule system decrements P3's countdown to 1
-#
-# P3 replies with committed
-# ** Rule system intercepts committed message handler and aborts thread
-# (last 2 steps repeated while countdown is active)
-#
-# Coordinator times out commit and writes heuristic transaction to log
-# Recovery system sleeps
-
-# Recovery system restarts after 2 minutes
-# Recovery system recreates HEURISTIC WS-AT transaction coordinator
-# Recovery system detects existing participant stub for P1
-# Recovery system detects existing participant stub for P2
-# Recovery system detects existing participant stub for P3
-#
-# Coordinator sends commit to P1
-# ** Rule system decrements P1's countdown to 0 and removes countdown
-# P1 replies with committed
-# Coordinator sends commit to P2
-# ** Rule system decrements P2's countdown to 0 and removes countdown
-# P2 replies with committed
-# Coordinator sends commit to P3
-# ** Rule system decrements P3's countdown to 0 and removes countdown
-# P3 replies with committed
-# Coordinator clears heuristic log record and copletes 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 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
-# 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 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
-# 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:
-#
-# 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:
-# 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.ATMultiServicePrepareAndCommitTest
-# this test invokes 3 separate services registering a 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
-#
-# 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
-#
-# 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.
-#
-# JVM exit
-# replay commit for prepared transaction 7f000001:cebc:496f3b83:6e
-# replay commit for heuristic committed transaction 7f000001:cebc:496f3b83:6e
-# countdown completed for D7f000001:cebc:496f3b83:70
-# countdown completed for D7f000001:cebc:496f3b83:73
-# countdown completed for D7f000001:cebc:496f3b83:76
-# removed committed transaction
-
-#######################################################################
-# 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 stub
-# (CoordinatorEngine) is sent a commit message i.e. immediately
-# after a successful prepare. It exits the JVM, simulating a crash.
-# The trigger location is set to follow the write of recovered,
-# ensuring that the property is avaialable for test in the rule
-# condition.
-
-RULE kill JVM
-CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
-METHOD commit
-AT SYNCHRONIZE
-BIND engine:CoordinatorEngine = $0,
- recovered:boolean = engine.isRecovered(),
- identifier:String = engine.getId()
-IF (NOT recovered)
- AND
- debug("commit on non-recovered engine " + identifier)
-DO traceln("log", "JVM exit"),
- debug("!!!killing JVM!!!"),
- killJVM()
-ENDRULE
-
-#######################################################################
-## rules for reboot run of AS
-
-#######################################################################
-# This rule is triggered when a participant stub (CoordinatorEngine) is
-# created from details located in the log record. It adds a countdown
-# which is tripped each time a commit is tried on the participant.
-# While the countdown is active committed messages will be blocked.
-# Note that it calls isRecovered() to detect that the stub has been
-# recreated from the log. The trigger location is set to follow the
-# write of recovered, ensuring that the property is avaialable for
-# test in the rule condition.
-
-RULE add coordinator engine countdown
-CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
-METHOD <init>(String, boolean, W3CEndpointReference, boolean, State)
-AFTER WRITE recovered
-BIND engine:CoordinatorEngine = $0,
- recovered:boolean = engine.isRecovered(),
- identifier:String = engine.getId()
-IF recovered
-DO debug("adding countdown for " + identifier),
- addCountDown(identifier, 1)
-ENDRULE
-
-#######################################################################
-# This rule is triggered when a recovered participant stub
-# (CoordinatorEngine) is sent a commit message. This happens during
-# replay of a prepared TX from the log. It decrements the countdown. First
-# time round this takes it from 1 to 0 but leaves it in place. Second
-# time round it removes it allowing committed messages to flow.
-
-RULE countdown at commit
-CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
-METHOD commit
-AFTER SYNCHRONIZE
-BIND engine:CoordinatorEngine = $0,
- recovered:boolean = engine.isRecovered(),
- identifier:String = engine.getId()
-IF recovered
- AND
- debug("commit on recovered engine " + identifier)
- AND
- debug("counting down")
- AND
- countDown(identifier)
-DO debug("countdown completed for " + identifier),
- traceln("log", "countdown completed for " + identifier)
-ENDRULE
-
-#######################################################################
-# This rule is triggered when a recovered participant stub
-# (CoordinatorEngine) is sent a committed message i.e. in the handler
-# thread which responds to a COMMITTED message from a participant.
-# If it detects a countdown registered using the participant id it
-# forces an early return stopping delivery of the COMMITTED message.
-
-RULE drop committed message
-CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
-METHOD committed(Notification, AddressingProperties, ArjunaContext)
-AT ENTRY
-BIND engine:CoordinatorEngine = $0,
- recovered:boolean = engine.isRecovered(),
- identifier:String = engine.getId()
-IF recovered
- AND
- debug("committed on recovered engine " + identifier)
- AND
- getCountDown(identifier)
-DO debug("dropping committed message for " + identifier),
- return
-ENDRULE
-
-#######################################################################
-# This rule is triggered when the recovery system finds the PREPARED
-# transaction 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.at.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 commit for prepared transaction " + uid),
- traceln("log", "replay commit for prepared transaction " + uid)
-ENDRULE
-
-#######################################################################
-# This rule is triggered when the recovery system finds the COMMITTED
-# transaction 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 heuristic committed replay
-CLASS org.jboss.jbossts.xts.recovery.coordinator.at.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.COMMITTED
-DO debug("replaying commit for heuristic committed transaction " + uid),
- traceln("log", "replay commit for heuristic committed transaction " + uid)
-ENDRULE
-
-#######################################################################
-# This rule is triggered when the recovery system deletes the COMMITTED
-# transaction 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 transaction " + uid),
- debug("removed committed transaction " + uid),
- debug("!!!killing JVM!!!"),
- killJVM()
-ENDRULE
Deleted: labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ParticipantCrashAndRecover.txt
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ParticipantCrashAndRecover.txt 2009-01-23 16:14:14 UTC (rev 24892)
+++ labs/jbosstm/trunk/XTS/sar/tests/dd/scripts/ParticipantCrashAndRecover.txt 2009-01-23 16:24:49 UTC (rev 24893)
@@ -1,295 +0,0 @@
-##############################################################################
-# JBoss, Home of Professional Open Source
-# Copyright 2008-9, 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
-#
-# Participant Recovery with Remote Coordinator
-#
-# This script automates testing of a specific recovery scenario for the
-# JBossTS XTS implementation of the WS-AT 1.1 protocol using orchestration
-# rules. The basic scenario employs a client (XTS Service Test program)
-# and 2 web services located in one JVM/AS and a coordinator located in another
-# JVM/AS but it is possible for the lcinet and web services to be lcoated in
-# separate JVMs/ASs. The scenario is as follows (note ** AS<n> indicates
-# intercession by a TOAST rule executed in a specific AS):
-#
-# AS1 boots
-# AS2 boots
-# AS1 Client starts a WS-AT transaction talking to coordinator in AS2
-# AS1 Client invokes web service 1
-# AS1 Web service 1 registers as participant P1
-# AS1 Client invokes web service 2
-# AS1 Web service 2 registers as participant P2
-# AS1 Client commits WS-AT transaction
-#
-# AS2 Coordinator initiates commit of participant P1
-# AS2 Coordinator sends commit to P1
-#
-# AS1 P1 receives commit
-# ** AS1 Rule system intercepts commit and crashes JVM
-#
-# AS2 Coordinator attempts to resend message
-# ** AS2 Rule system suspends coordinator waiting on incoming prepared
-# message from P1
-# (commit messages continue to be resent in the meantime)
-#
-# AS1 reboots
-# AS1 Recovery system starts after 2 minutes
-# AS1 Recovery system recreates PREPARED WS-AT participant P1
-# ** AS1 Rule system traces recreate
-# AS1 Participant P1 resends prepared
-# AS1 Participant P1 receives commit for P1
-# AS1 Participant P1 sends committed
-#
-# AS2 Participant stub receives committed message for P1
-# ** AS2 Rule system signals coordinator clearing wait
-# ** AS2 rule system traces receipt of committed message for P1
-#
-# AS2 Coordinator detects committed from P1
-# AS2 Coordinator sends commit for P2
-# AS2 Coordinator receives committed from P2
-# AS2 Coordinator completes transaction
-# ** AS2 Rule system traces successful completion
-#
-# Use of this script
-#
-# The default way of exercising this test is to deploy the xtstest war
-# to AS1 and configure it to run the relevant XTS Service Test. It is
-# actually possible to use 1, 2, 3 or more participants and multiple
-# participants may be registered by a single web service or by independent
-# web services. If required the web service(s) may be located in a a separate
-# AS to the one running the XTS Service test.
-#
-# The test should crash AS1 at the point of commit. At AS1 reboot the rest of
-# the test should run automatically. AS2 should be killed after the
-# transaction is successfuly terminated. Still need to work out how to
-# automatically terminate AS1 automatically but exit of AS2 is a signal
-# that AS1 can be killed.
-#
-# !!! N.B. this test currently fails because JBossWS Native fails to cope
-# !!! with requests for services while they are bootstrapping
-#
-# The JVMs hosting AS1 and AS2 both need to be configured to run a TOAST
-# agent supplied with this script. If the web service(s) is relocated
-# to AS3 then it needs to be configured to run the TOAST agent instead of
-# AS1 (rules only refer to participant and coordinator code, not to the
-# XTS service test code).
-#
-# The client AS (AS1) needs to be pointed at the coordinator AS (AS2). 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)
-#
-# 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 AS1, the client AS. n.b. if the client is colocated with
-# the seb service(s) then this property must be left undefined at AS1 reboot
-# otherwise the client will run again, starting a new TX which may interfere
-# with recovery of the crashed participants.
-#
-# Available tests include:
-#
-# org.jboss.jbossts.xts.servicetests.test.ATSingleParticipantPrepareAndCommitTest
-# this test invokes a single web service registering 1 participant
-# the location of service is defined by defining a system property:
-# org.jboss.jbossts.xts.servicetests.ServiceURL
-# which should be set to something like
-# http://baz.bar.org:8080/xtstest/xtsservicetest1
-#
-# org.jboss.jbossts.xts.servicetests.test.ATMultiParticipantPrepareAndCommitTest
-# this test invokes a single service registering 3 participants
-# the location of service is defined by defining a system property:
-# org.jboss.jbossts.xts.servicetests.ServiceURL
-# which should be set to something like
-# http://baz.bar.org:8080/xtstest/xtsservicetest1
-#
-# org.jboss.jbossts.xts.servicetests.test.ATMultiServicePrepareAndCommitTest
-# this test invokes 3 separate services registering a participant for 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
-# which should be set to something like
-# http://mumble.bar.org:8080/xtstest/xtsservicetest1
-# http://mumble.bar.org:8080/xtstest/xtsservicetest2
-# http://mumble.bar.org:8080/xtstest/xtsservicetest3
-# if you are feeling really adventurous you can host the services
-# in different ASs
-# http://mumble.bar.org:8080/xtstest/xtsservicetest1
-# http://grumble.bar.org:8080/xtstest/xtsservicetest1
-# http://bletch.bar.org:8080/xtstest/xtsservicetest1
-#
-# Expected output AS1
-# -------------------
-#
-# After the first boot AS1 should exit leaving the following in file testlog1
-#
-# JVM exit
-#
-# After reboot AS1 should add output in the following format in file testlog1.
-# Clearly the ids for the TX/participants may vary and the number of
-# ??? lines will depend upon the number of participants employed.
-#
-# JVM exit
-# replay commit for prepared transaction 7f000001:cebc:496f3b83:6e
-# replay commit for heuristic committed transaction 7f000001:cebc:496f3b83:6e
-# countdown completed for D7f000001:cebc:496f3b83:70
-# countdown completed for D7f000001:cebc:496f3b83:73
-# countdown completed for D7f000001:cebc:496f3b83:76
-# removed committed transaction
-#
-# Expected output AS2
-# -------------------
-# ???
-
-######################################################################
-# AS1 Rule set
-#######################################################################
-# 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("log1", "testlog1")
-ENDRULE
-
-
-#######################################################################
-# This rule is triggered in the AS1 when a non-recovered WS-AT
-# participant receives a commit message. It causes the JVM to crash.
-# The trigger point is the start of the method.
-RULE crash unrecovered participant at commit
-CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
-METHOD commit
-AT ENTRY
-BIND engine:ParticipantEngine = $0,
- recovered:boolean = engine.isRecovered(),
- identifier:String = engine.getId()
-IF (NOT recovered)
- AND
- debug("commit on non-recovered participant engine " + identifier)
-DO debug("!!!killing JVM!!!"),
- killJVM()
-ENDRULE
-
-#######################################################################
-# This rule is triggered in the AS1 when a recovered WS-AT participant
-# is recreated from the log. It traces the call to allow success of the
-# test to be detected.
-# The trigger point is the end of the constructor so that the rule can
-# safely read all the fields.
-
-RULE trace recovered participant recreate
-CLASS com.arjuna.wst11.messaging.engines.ParticipantEngine
-METHOD <init>(Participant, id, State, W3CEndpointReference, boolean)
-AFTER WRITE persisted
-BIND engine:ParticipantEngine = $0,
- recovered:boolean = engine.isRecovered(),
- identifier:String = engine.getId()
-IF recovered
-DO debug("recreated recovered participant engine " + identifier)
-ENDRULE
-
-
-######################################################################
-# AS2 Rule set
-#######################################################################
-# This rule opens a file for the trace output during XTS startup
-
-RULE open trace file
-CLASS org.jboss.jbossts.XTSService
-METHOD start()
-BIND NOTHING
-IF TRUE
-DO openTrace("log2", "testlog2")
-ENDRULE
-
-######################################################################
-# This rule is triggered in AS2 when a participant stub
-# (CoordinatorEngine) first posts a commit message to the participant.
-# The coordinator thread suspends until a committed message is received
-# from the participant. This ensures that it waits until AS1
-# has restarted allowing the transaction to then complete. The
-# condition tests whether a flag with key "firstCommit" has been set.
-# By default this is clear so the condition is true first time the
-# rule is called. The action sets te flag causing the condition to
-# evaluate to false on subsequent commit calls.
-# The trigger point is just before calling waitForState.
-
-RULE suspend coordinator after sending first commit
-CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
-METHOD commit
-LINE 330
-BIND engine:CoordinatorEngine = $0,
- identifier:String = engine.getId()
-IF (NOT flagged("firstCommit"))
-DO debug("coordinator waiting for participant to resend prepare" + identifier),
- flag("firstCommit"),
- waitFor(identifier)
-ENDRULE
-
-#######################################################################
-
-# This rule is triggered when a committed message is received from P1.
-# This indicates that the participant has been recreated and
-# successfully responded to a commit message after reboot of AS1. The
-# rule uses a call to signal to wake up the coordinator which was
-# suspended when the first commit was sent. This call only returns true
-# if the identifier is for P1 and the coordinator has not already been
-# signalled. Note that the call to signal is made in the condition to
-# avoid a race between threads handling successive committed messages.
-# If instead the condition called waiting() and the action called
-# signal() then, depending upon scheduling, both threads might find the
-# condition to be true before one of them could execute signal().
-# Although this would be harmless in this case it could be significant
-# when using other rules.
-# The triogger point is at the sttart of the method.
-
-RULE signal waiting coordinator
-CLASS com.arjuna.wst11.messaging.engines.CoordinatorEngine
-METHOD committed
-AT ENTRY
-BIND engine : CoordinatorEngine = $0,
- identifier:String = engine.getId()
-IF debug("received committed for participant " + identifier)
- AND
- signal(identifier)
-DO debug("signalled coordinator waiting on " + identifier)
-ENDRULE
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 16:14:14 UTC (rev 24892)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/service/XTSServiceTestPortTypeImpl.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -288,13 +288,13 @@
}
/**
- * a table used ot retain a handle on enlisted participants so that they can be driven by the client to
+ * a table used to retain a handle on enlisted participants so that they can be driven by the client to
* perform actions not contained in the original command script.
*/
- private HashMap<String, ScriptedTestParticipant> participantMap = new HashMap<String, ScriptedTestParticipant>();
+ private static HashMap<String, ScriptedTestParticipant> participantMap = new HashMap<String, ScriptedTestParticipant>();
/**
- * a table used ot retain a handle on managers for enlisted BA participants.
+ * a table used to retain a handle on managers for enlisted BA participants.
*/
- private HashMap<String, BAParticipantManager> managerMap = new HashMap<String, BAParticipantManager>();
+ private static HashMap<String, BAParticipantManager> managerMap = new HashMap<String, BAParticipantManager>();
}
\ No newline at end of file
Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ATMultiParticipantPrepareAndCommitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ATMultiParticipantPrepareAndCommitTest.java 2009-01-23 16:14:14 UTC (rev 24892)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ATMultiParticipantPrepareAndCommitTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -43,14 +43,20 @@
public void run() {
- // wait a while so the service has time to start
-
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// ignore
}
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
UserTransaction tx = UserTransactionFactory.userTransaction();
@@ -60,6 +66,8 @@
CommandsType commands = new CommandsType();
ResultsType results = null;
+ // wait a while so the service has time to start
+
// start the transaction
try {
@@ -84,7 +92,7 @@
// call the same web service multiple times -- it's ok to use the samew commands list
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+ results = client.serve(serviceURL1, commands);
} catch (Exception e) {
exception = e;
}
@@ -99,7 +107,7 @@
}
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+ results = client.serve(serviceURL1, commands);
} catch (Exception e) {
exception = e;
}
@@ -114,7 +122,7 @@
}
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+ results = client.serve(serviceURL1, commands);
} catch (Exception e) {
exception = e;
}
Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ATMultiServicePrepareAndCommitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ATMultiServicePrepareAndCommitTest.java 2009-01-23 16:14:14 UTC (rev 24892)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ATMultiServicePrepareAndCommitTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -51,6 +51,26 @@
// ignore
}
+ String serviceURL1;
+ String serviceURL2;
+ String serviceURL3;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+ serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
+ serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ if (serviceURL2 == null) {
+ serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
+ }
+
+ if (serviceURL3 == null) {
+ serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
+ }
+
UserTransaction tx = UserTransactionFactory.userTransaction();
@@ -84,7 +104,7 @@
// call the same web service multiple times -- it's ok to use the samew commands list
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+ results = client.serve(serviceURL1, commands);
} catch (Exception e) {
exception = e;
}
@@ -99,7 +119,7 @@
}
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest2", commands);
+ results = client.serve(serviceURL2, commands);
} catch (Exception e) {
exception = e;
}
@@ -114,7 +134,7 @@
}
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest3", commands);
+ results = client.serve(serviceURL3, commands);
} catch (Exception e) {
exception = e;
}
Modified: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ATSingleParticipantPrepareAndCommitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ATSingleParticipantPrepareAndCommitTest.java 2009-01-23 16:14:14 UTC (rev 24892)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/ATSingleParticipantPrepareAndCommitTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -51,6 +51,14 @@
// ignore
}
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
UserTransaction tx = UserTransactionFactory.userTransaction();
@@ -82,7 +90,7 @@
commands.getCommandList().add("commit");
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+ results = client.serve(serviceURL1, commands);
} catch (Exception e) {
exception = e;
}
Added: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -0,0 +1,208 @@
+/*
+ * 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 multipleparticipants with instructions to prepare and commit
+ * without error then gets one of them to exit before closing
+ */
+public class BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest 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
+ }
+
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ 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 {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest : txbegin failure " + exception);
+ return;
+ }
+
+ // invoke the service to create a coordinaator completion participant
+ commands = new CommandsType();
+ commands.getCommandList().add("enlistCoordinatorCompletion");
+
+ try {
+ results = client.serve(serviceURL1, commands);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId1 = resultsList.get(0);
+
+ for (String s : resultsList) {
+ System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest : 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);
+ } 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 : 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) {
+ System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest : 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 {
+ 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("BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest : commit failure " + exception);
+ }
+
+ System.out.println("BAMultiParticipantCoordinatorCompletionParticipantCloseAndExitTest : completed");
+ }
+
+ public boolean isSuccessful() {
+ return isSuccessful;
+ }
+
+ public Exception getException() {
+ return exception;
+ }
+}
\ No newline at end of file
Modified: 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 2009-01-23 16:14:14 UTC (rev 24892)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantCoordinatorCompletionParticipantCloseTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -35,7 +35,7 @@
import com.arjuna.wst.UnknownTransactionException;
/**
- * Starts a transaction and enlists a single participant with instructions to prepare and commit
+ * Starts a transaction and enlists mulitple participants swith instructions to prepare and commit
* without error
*/
public class BAMultiParticipantCoordinatorCompletionParticipantCloseTest implements XTSServiceTest
@@ -53,6 +53,14 @@
// ignore
}
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
@@ -84,7 +92,7 @@
commands.getCommandList().add("close");
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+ results = client.serve(serviceURL1, commands);
} catch (Exception e) {
exception = e;
}
@@ -106,7 +114,7 @@
commands.getCommandList().add("close");
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+ results = client.serve(serviceURL1, commands);
} catch (Exception e) {
exception = e;
}
@@ -129,7 +137,7 @@
commands.getCommandList().add("close");
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+ results = client.serve(serviceURL1, commands);
} catch (Exception e) {
exception = e;
}
Added: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -0,0 +1,254 @@
+/*
+ * 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 multipleparticipants with instructions to prepare and commit
+ * without error then gets one of them to exit before closing
+ */
+public class BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest 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
+ }
+
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ 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 {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : txbegin failure " + exception);
+ return;
+ }
+
+ // invoke the service to create a participant completion participant
+ commands = new CommandsType();
+ commands.getCommandList().add("enlistParticipantCompletion");
+
+ try {
+ results = client.serve(serviceURL1, commands);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId1 = resultsList.get(0);
+
+ for (String s : resultsList) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : 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);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId2 = resultsList.get(0);
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : 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) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : 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) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : 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) {
+ 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(serviceURL1, 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 {
+ 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("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : commit failure " + exception);
+ }
+
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseAndExitTest : 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/BAMultiParticipantParticipantCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantParticipantCompletionParticipantCloseTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiParticipantParticipantCompletionParticipantCloseTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -0,0 +1,253 @@
+/*
+ * 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 mulitple participants swith instructions to prepare and commit
+ * without error
+ */
+public class BAMultiParticipantParticipantCompletionParticipantCloseTest 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
+ }
+
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ 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 {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : txbegin failure " + exception);
+ return;
+ }
+
+ // invoke the service to create a coordinator completion participant and script it to close
+ commands = new CommandsType();
+ commands.getCommandList().add("enlistPartiicpantCompletion");
+ commands.getCommandList().add("close");
+
+ try {
+ results = client.serve(serviceURL1, commands);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId1 = resultsList.get(0);
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : enlistPartiicpantCompletion " + s);
+ }
+
+ // invoke the service again to create a coordinaator completion participant and script it to close
+ commands = new CommandsType();
+ commands.getCommandList().add("enlistPartiicpantCompletion");
+ commands.getCommandList().add("close");
+
+ try {
+ results = client.serve(serviceURL1, commands);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId2 = resultsList.get(0);
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : 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("enlistPartiicpantCompletion");
+ commands.getCommandList().add("close");
+
+ try {
+ results = client.serve(serviceURL1, commands);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId3 = resultsList.get(0);
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : 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) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : server failure " + exception);
+ return;
+ }
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : 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) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : server failure " + exception);
+ return;
+ }
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : 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) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : server failure " + exception);
+ return;
+ }
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : completed " + participantId3 + " " + 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("BAMultiParticipantParticipantCompletionParticipantCloseTest : commit failure " + exception);
+ }
+
+ System.out.println("BAMultiParticipantParticipantCompletionParticipantCloseTest : 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/BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -0,0 +1,220 @@
+/*
+ * 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 in each of multiple services with instructions to
+ * prepare and commit without error
+ */
+public class BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest 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
+ }
+
+ String serviceURL1;
+ String serviceURL2;
+ String serviceURL3;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+ serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
+ serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ if (serviceURL2 == null) {
+ serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
+ }
+
+ if (serviceURL3 == null) {
+ serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
+ }
+
+ 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 {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest : 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(serviceURL1, commands);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId1 = resultsList.get(0);
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest : 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);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest : 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) {
+ System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest : 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 {
+ 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("BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest : commit failure " + exception);
+ }
+
+ System.out.println("BAMultiServiceCoordinatorCompletionParticipantCloseAndExitTest : completed");
+ }
+
+ public boolean isSuccessful() {
+ return isSuccessful;
+ }
+
+ public Exception getException() {
+ return exception;
+ }
+}
\ No newline at end of file
Modified: 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 2009-01-23 16:14:14 UTC (rev 24892)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceCoordinatorCompletionParticipantCloseTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -35,8 +35,8 @@
import com.arjuna.wst.UnknownTransactionException;
/**
- * Starts a transaction and enlists a single participant with instructions to prepare and commit
- * without error
+ * Starts a transaction and enlists a single participant in each of multiple services with instructions to
+ * prepare and commit without error
*/
public class BAMultiServiceCoordinatorCompletionParticipantCloseTest implements XTSServiceTest
{
@@ -53,6 +53,26 @@
// ignore
}
+ String serviceURL1;
+ String serviceURL2;
+ String serviceURL3;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+ serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
+ serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ if (serviceURL2 == null) {
+ serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
+ }
+
+ if (serviceURL3 == null) {
+ serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
+ }
+
UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
@@ -84,7 +104,7 @@
commands.getCommandList().add("close");
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+ results = client.serve(serviceURL1, commands);
} catch (Exception e) {
exception = e;
}
@@ -106,7 +126,7 @@
commands.getCommandList().add("close");
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest2", commands);
+ results = client.serve(serviceURL2, commands);
} catch (Exception e) {
exception = e;
}
@@ -129,7 +149,7 @@
commands.getCommandList().add("close");
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest3", commands);
+ results = client.serve(serviceURL3, commands);
} catch (Exception e) {
exception = e;
}
Added: labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceParticipantCompletionParticipantCloseAndExitTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceParticipantCompletionParticipantCloseAndExitTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceParticipantCompletionParticipantCloseAndExitTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -0,0 +1,267 @@
+/*
+ * 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 in each of multiple services with instructions to
+ * prepare and commit without error
+ */
+public class BAMultiServiceParticipantCompletionParticipantCloseAndExitTest 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
+ }
+
+ String serviceURL1;
+ String serviceURL2;
+ String serviceURL3;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+ serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
+ serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ if (serviceURL2 == null) {
+ serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
+ }
+
+ if (serviceURL3 == null) {
+ serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
+ }
+
+ 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 {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseAndExitTest : 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(serviceURL1, commands);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId1 = resultsList.get(0);
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseAndExitTest : 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);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId2 = resultsList.get(0);
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseAndExitTest : 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) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId3 = resultsList.get(0);
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseAndExitTest : 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("BAMultiServiceParticipantCompletionParticipantCloseAndExitTest : server failure " + exception);
+ return;
+ }
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseAndExitTest : 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 {
+ 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("BAMultiServiceParticipantCompletionParticipantCloseAndExitTest : commit failure " + exception);
+ }
+
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseAndExitTest : 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/BAMultiServiceParticipantCompletionParticipantCloseTest.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceParticipantCompletionParticipantCloseTest.java (rev 0)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BAMultiServiceParticipantCompletionParticipantCloseTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -0,0 +1,269 @@
+/*
+ * 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 in each of multiple services with instructions to
+ * prepare and commit without error
+ */
+public class BAMultiServiceParticipantCompletionParticipantCloseTest 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
+ }
+
+ String serviceURL1;
+ String serviceURL2;
+ String serviceURL3;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+ serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
+ serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
+ if (serviceURL2 == null) {
+ serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
+ }
+
+ if (serviceURL3 == null) {
+ serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
+ }
+
+ 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 {
+ ba.begin();
+ } catch (WrongStateException e) {
+ exception = e;
+ } catch (SystemException e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : 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(serviceURL1, commands);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId1 = resultsList.get(0);
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : 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);
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ if (exception != null) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId2 = resultsList.get(0);
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : 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) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : server failure " + exception);
+ return;
+ }
+
+ resultsList = results.getResultList();
+ participantId3 = resultsList.get(0);
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : 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) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : server failure " + exception);
+ return;
+ }
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : 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) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : server failure " + exception);
+ return;
+ }
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : 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("BAMultiServiceParticipantCompletionParticipantCloseTest : server failure " + exception);
+ return;
+ }
+
+ for (String s : results.getResultList()) {
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : completed " + participantId3 + " " + 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("BAMultiServiceParticipantCompletionParticipantCloseTest : commit failure " + exception);
+ }
+
+ System.out.println("BAMultiServiceParticipantCompletionParticipantCloseTest : completed");
+ }
+
+ public boolean isSuccessful() {
+ return isSuccessful;
+ }
+
+ public Exception getException() {
+ return exception;
+ }
+}
\ No newline at end of file
Modified: 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 2009-01-23 16:14:14 UTC (rev 24892)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BASingleCoordinatorCompletionParticipantCloseTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -53,6 +53,14 @@
// ignore
}
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
@@ -84,7 +92,7 @@
commands.getCommandList().add("close");
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+ results = client.serve(serviceURL1, commands);
} catch (Exception e) {
exception = e;
}
Modified: 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 2009-01-23 16:14:14 UTC (rev 24892)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/BASingleParticipantCompletionParticipantCloseTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -55,6 +55,14 @@
// ignore
}
+ String serviceURL1;
+
+ serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
+
+ if (serviceURL1 == null) {
+ serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
+ }
+
UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
@@ -88,7 +96,7 @@
commands.getCommandList().add("close");
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+ results = client.serve(serviceURL1, commands);
} catch (Exception e) {
exception = e;
}
@@ -111,7 +119,7 @@
commands.getCommandList().add(participantId);
try {
- results = client.serve("http://localhost:8080/xtstest/xtsservicetest1", commands);
+ results = client.serve(serviceURL1, commands);
} catch (Exception e) {
exception = e;
}
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-01-23 16:14:14 UTC (rev 24892)
+++ labs/jbosstm/trunk/XTS/sar/tests/src/org/jboss/jbossts/xts/servicetests/test/XTSServiceTest.java 2009-01-23 16:24:49 UTC (rev 24893)
@@ -29,4 +29,10 @@
public void run();
public boolean isSuccessful();
public Exception getException();
+
+ // System properties which can be set to configure the behaviour of tests
+
+ public static final String SERVICE_URL1_KEY = "org.jboss.jbossts.xts.servicetests.serviceURL1";
+ public static final String SERVICE_URL2_KEY = "org.jboss.jbossts.xts.servicetests.serviceURL2";
+ public static final String SERVICE_URL3_KEY = "org.jboss.jbossts.xts.servicetests.serviceURL3";
}
More information about the jboss-svn-commits
mailing list