[jboss-svn-commits] JBL Code SVN: r18783 - in labs/jbosstm/trunk/XTS/WSTX: classes/com/arjuna and 17 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Mar 9 15:24:17 EDT 2008
Author: adinn
Date: 2008-03-09 15:24:16 -0400 (Sun, 09 Mar 2008)
New Revision: 18783
Added:
labs/jbosstm/trunk/XTS/WSTX/tests/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/qa/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/qa/junit/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/qa/junit/WSTXTestRunnerServlet.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoBusinessParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoBusinessParticipantWithComplete.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoDurableParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoVolatileParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/FailureBusinessParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/FailureParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/TestSuite.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/DemoParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/DemoSynchronization.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/TestInitialisation.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/
labs/jbosstm/trunk/XTS/WSTX/tests/dd/
labs/jbosstm/trunk/XTS/WSTX/tests/dd/wstx-tests_application.xml
labs/jbosstm/trunk/XTS/WSTX/tests/dd/wstx-tests_web-app.xml
Removed:
labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/
Modified:
labs/jbosstm/trunk/XTS/WSTX/build.xml
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/Cancel.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/Close.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/Compensate.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/ConfirmWithComplete.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/Exit.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/MultiCancel.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/MultiClose.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/MultiCompensate.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/CommitExceptionInCommit.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/CommitExceptionInPrepare.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/CommitRollbackInPrepare.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/MultiParticipants.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/NestedTransaction.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/NullCommitTransaction.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/NullRollbackTransaction.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/PrintTransaction.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/ResumeNullTransaction.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/RollbackExceptionInRollback.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SingleParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendCommitTransaction.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendNullTransaction.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendResumeCommitTransaction.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendResumeParticipants.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendResumeSingleParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendTransaction.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SynchronizationParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/ThreadedTransaction.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullCommitTransaction.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullNestedCommit.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullNestedRollback.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullRollbackOnly.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullRollbackTransaction.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/SingleParticipant.java
labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/SynchronizationParticipant.java
labs/jbosstm/trunk/XTS/WSTX/xml/tests.xml
Log:
modified WSTX tests so they run under junit via a test servlet as per WS-C and WS-T. still need to fix 3 broken tests and fix problems stopping WSTX tests from running. changes for JBTM-339
Modified: labs/jbosstm/trunk/XTS/WSTX/build.xml
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/build.xml 2008-03-09 19:02:43 UTC (rev 18782)
+++ labs/jbosstm/trunk/XTS/WSTX/build.xml 2008-03-09 19:24:16 UTC (rev 18783)
@@ -28,15 +28,29 @@
<!-- Load Build Properties File -->
<property file="${com.arjuna.mw.wstx.properties}"/>
- <!-- Set internal property defaults -->
+ <!-- Set hostname and port property defaults -->
+ <property environment="env"/>
+ <property name="jboss.dir" value="${env.JBOSS_HOME}"/>
+ <property name="deploy.dir" value="${jboss.dir}/server/default/deploy"/>
+ <property name="hostname" value="localhost"/>
+ <property name="port" value="8080"/>
+
<!-- Path names -->
<property name="com.arjuna.mwlabs.wstx.src" value="classes"/>
<property name="com.arjuna.mwlabs.wstx.dest.root" value="build"/>
<property name="com.arjuna.mwlabs.wstx.dest" value="build/classes"/>
- <property name="com.arjuna.mwlabs.wstx.war.dest" value="build/webapps"/>
+ <property name="com.arjuna.mwlabs.wstx.webapps.dest" value="build/webapps"/>
<property name="com.arjuna.mwlabs.wstx.jar.dest" value="build/lib"/>
<property name="com.arjuna.mwlabs.wstx.htdocs.dest" value="build/htdocs"/>
+ <property name="com.arjuna.mwlabs.wstx.tests.src" value="tests/classes"/>
+ <property name="com.arjuna.mwlabs.wstx.tests.dd" value="tests/dd"/>
+ <property name="com.arjuna.mwlabs.wstx.tests.dest.root" value="tests/build"/>
+ <property name="com.arjuna.mwlabs.wstx.tests.dest" value="tests/build/classes"/>
+ <property name="com.arjuna.mwlabs.wstx.tests.dd.dest" value="tests/build/dd"/>
+ <property name="com.arjuna.mwlabs.wstx.tests.webapps.dest" value="tests/build/webapps"/>
+ <property name="com.arjuna.mwlabs.wstx.tests.jar.dest" value="tests/build/lib"/>
+
<property name="com.arjuna.buildsystem.dir" location="../../antbuildsystem"/>
<property name="com.arjuna.jta.install" location="../../install"/>
@@ -56,7 +70,18 @@
<property name="wsc.libs" value="ws-c.jar"/>
<property name="wscf.libs" value="wscf.jar"/>
<property name="wst.libs" value="ws-t.jar"/>
+ <property name="wstx.libs" value="${com.arjuna.mwlabs.ts.modulename}.jar"/>
+ <property name="tests.libs" value="junit.jar"/>
+ <!-- can we not just get away with wstx and junit?
+ <property name="tests.all.libs" value="${wsas.libs} ${wsc.libs} ${wscf.libs} ${wst.libs} ${wstx.libs} ${tests.libs} "/>
+ -->
+ <property name="tests.all.libs" value="${wsas.libs} ${wsc.libs} ${wscf.libs} ${wst.libs} ${wstx.libs} ${tests.libs} "/>
+
+ <path id="com.arjuna.mwlabs.wstx.tests.lib.path">
+ <fileset dir="${com.arjuna.xts.ext}" includes="${tests.libs}"/>
+ </path>
+
<!-- Define classpath builder task -->
<path id="com.arjuna.buildsystem.classpath">
<fileset dir="${com.arjuna.buildsystem.lib}" includes="${com.arjuna.buildsystem.lib.jars}"/>
@@ -77,7 +102,7 @@
<property name="com.arjuna.mwlabs.wscf.jar.dest" value="../WSCF/build/lib"/>
<property name="com.arjuna.mwlabs.wst.jar.dest" value="../WS-T/build/dev/lib"/>
- <path id="com.arjuna.mwlabs.wstx.lib.classpath">
+ <path id="com.arjuna.mwlabs.wstx.lib.classpath">
<fileset dir="${com.arjuna.jta.install.lib}" includes="${jta.lib.jars}"/>
<fileset dir="${com.arjuna.jta.install.ext}" includes="${jta.ext.jars} ${jta.ext.compile.jars}"/>
<fileset dir="${com.arjuna.xts.ext}" includes="${xts.ext.compile.jars}"/>
@@ -95,7 +120,7 @@
</tstamp>
<!-- Make the destination directory -->
<mkdir dir="${com.arjuna.mwlabs.wstx.dest}"/>
- <mkdir dir="${com.arjuna.mwlabs.wstx.war.dest}"/>
+ <mkdir dir="${com.arjuna.mwlabs.wstx.webapps.dest}"/>
</target>
<!-- Compilation targets -->
@@ -126,7 +151,7 @@
<property name="com.arjuna.mwlabs.wstx.htdocs.list" value="com.arjuna.mw.*"/>
<target name="com.arjuna.mw.wstx.war" depends="com.arjuna.mw.wstx.jar">
- <war warfile="${com.arjuna.mwlabs.wstx.war.dest}/${com.arjuna.mwlabs.ts.modulename}.war" webxml="xml/wstx_web-app.xml">
+ <war warfile="${com.arjuna.mwlabs.wstx.webapps.dest}/${com.arjuna.mwlabs.ts.modulename}.war" webxml="xml/wstx_web-app.xml">
<manifest>
<attribute name="Class-Path" value="${com.arjuna.mwlabs.ts.modulename}.jar"/>
</manifest>
@@ -198,6 +223,67 @@
</target>
+ <target name="com.arjuna.mwlabs.wstx.tests.init" depends="com.arjuna.mw.wstx.clean">
+ <!-- make the test destination directories -->
+ <mkdir dir="${com.arjuna.mwlabs.wstx.tests.dest.root}"/>
+ <mkdir dir="${com.arjuna.mwlabs.wstx.tests.dest}"/>
+ <mkdir dir="${com.arjuna.mwlabs.wstx.tests.dd.dest}"/>
+ <mkdir dir="${com.arjuna.mwlabs.wstx.tests.webapps.dest}"/>
+ <mkdir dir="${com.arjuna.mwlabs.wstx.tests.jar.dest}"/>
+ </target>
+
+ <target name="com.arjuna.mwlabs.wstx.tests.compile" depends="com.arjuna.mwlabs.wstx.tests.init, com.arjuna.mw.wstx.war">
+ <javac destdir="${com.arjuna.mwlabs.wstx.tests.dest}" debug="yes" optimize="no">
+ <classpath>
+ <pathelement path="${com.arjuna.mwlabs.wstx.jar.dest}/${com.arjuna.mwlabs.ts.modulename}.jar"/>
+ <path refid="com.arjuna.mwlabs.wstx.tests.lib.path"/>
+ <path refid="com.arjuna.mwlabs.wstx.lib.classpath"/>
+ </classpath>
+ <src path="${com.arjuna.mwlabs.wstx.tests.src}"/>
+ </javac>
+ </target>
+
+ <target name="com.arjuna.mwlabs.wstx.tests.webapps" depends="com.arjuna.mwlabs.wstx.tests.compile">
+ <copy file="${com.arjuna.mwlabs.wstx.tests.dd}/wstx-tests_web-app.xml" tofile="${com.arjuna.mwlabs.wstx.tests.dd.dest}/web-app.xml">
+ <filterset>
+ <filter token="hostname" value="${hostname}"/>
+ <filter token="port" value="${port}"/>
+ </filterset>
+ </copy>
+ <war warfile="${com.arjuna.mwlabs.wstx.tests.webapps.dest}/wstx-tests.war" webxml="${com.arjuna.mwlabs.wstx.tests.dd.dest}/web-app.xml">
+ <manifest>
+ <attribute name="Class-Path" value="${tests.all.libs}"/>
+ </manifest>
+ <classes dir="${com.arjuna.mwlabs.wstx.tests.dest}"/>
+ </war>
+ <ear earfile="${com.arjuna.mwlabs.wstx.tests.webapps.dest}/wstx-tests.ear" appxml="${com.arjuna.mwlabs.wstx.tests.dd}/wstx-tests_application.xml">
+ <fileset dir="${com.arjuna.jta.install.ext}" includes="${jta.ext.jars}"/>
+ <fileset dir="${com.arjuna.xts.ext}" includes="${xts.ext.jars} ${tests.libs}"/>
+ <!-- we don't need to include these libs if we are
+ deploying to JBossAs. The XTS libs are already
+ deployed as a sar and the JTA lib is in the app
+ server lib directory
+
+
+ <fileset dir="${com.arjuna.jta.install.lib}" includes="${jta.lib.jars}"/>
+ <fileset dir="${com.arjuna.mwlabs.wsas.jar.dest}" includes="${wsas.libs}"/>
+ <fileset dir="${com.arjuna.mwlabs.wsc.jar.dest}" includes="${wsc.libs}"/>
+ <fileset dir="${com.arjuna.mwlabs.wscf.jar.dest}" includes="${wscf.libs}"/>
+ <fileset dir="${com.arjuna.mwlabs.wst.jar.dest}" includes="${wst.libs}"/>
+ <fileset dir="${com.arjuna.mwlabs.wstx.jar.dest}" includes="${wstx.libs}"/>
+ -->
+ <fileset dir="${com.arjuna.mwlabs.wstx.tests.webapps.dest}" includes="wstx-tests.war"/>
+ </ear>
+ </target>
+
+ <target name="com.arjuna.mwlabs.wstx.tests.deploy" depends="com.arjuna.mwlabs.wstx.tests.webapps, com.arjuna.mwlabs.wstx.tests.undeploy">
+ <copy file="${com.arjuna.mwlabs.wstx.tests.webapps.dest}/wstx-tests.ear" tofile="${deploy.dir}/wstx-tests.ear"/>
+ </target>
+
+ <target name="com.arjuna.mwlabs.wstx.tests.undeploy">
+ <delete file="${deploy.dir}/wstx-tests.ear"/>
+ </target>
+
<!-- Clean targets -->
<target name="com.arjuna.mw.wstx.clean">
<echo message="Cleaning module"/>
@@ -206,6 +292,8 @@
<delete dir="${com.arjuna.mwlabs.wstx.htdocs.dest}"/>
<delete file="${com.arjuna.mwlabs.wstx.jar.dest}/${com.arjuna.mwlabs.ts.modulename}.jar"/>
<delete file="${com.arjuna.mwlabs.wstx.info.dest}"/>
+ <!-- delete the test destination directories -->
+ <delete dir="${com.arjuna.mwlabs.wstx.tests.dest.root}"/>
</target>
<!-- Short target names -->
@@ -213,4 +301,7 @@
<target name="jar" depends="com.arjuna.mw.wstx.jar"/>
<target name="war" depends="com.arjuna.mw.wstx.war"/>
<target name="clean" depends="com.arjuna.mw.wstx.clean"/>
+ <target name="tests-webapps" depends="com.arjuna.mwlabs.wstx.tests.webapps"/>
+ <target name="tests-deploy" depends="com.arjuna.mwlabs.wstx.tests.deploy"/>
+ <target name="tests-undeploy" depends="com.arjuna.mwlabs.wstx.tests.undeploy"/>
</project>
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/qa/junit/WSTXTestRunnerServlet.java (from rev 18670, labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/qa/junit/TestRunnerServlet.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/qa/junit/WSTXTestRunnerServlet.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/qa/junit/WSTXTestRunnerServlet.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,607 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (c) 2002, 2003, Arjuna Technologies Limited.
+ *
+ * WSTXTestRunnerServlet.java
+ */
+
+package com.arjuna.qa.junit;
+
+import java.io.*;
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import junit.framework.*;
+
+public class WSTXTestRunnerServlet extends HttpServlet
+{
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+
+ _testSuiteClassName = config.getInitParameter("TestSuiteClassName");
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException
+ {
+ try
+ {
+ PrintWriter writer = response.getWriter();
+
+ response.setContentType("text/html");
+ response.setHeader("Cache-Control", "no-cache");
+
+ if (request.getParameter("failednumber") != null)
+ doStatusFailed(writer, request, response);
+ else if (request.getParameter("errornumber") != null)
+ doStatusError(writer, request, response);
+ else
+ doStatus(writer, request, response);
+ }
+ catch (Exception exception)
+ {
+ log("Test Runner: doGet failed", exception);
+
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, exception.toString());
+ }
+ catch (Error error)
+ {
+ log("Test Runner: doGet failed", error);
+
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, error.toString());
+ }
+ }
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException
+ {
+ try
+ {
+ PrintWriter writer = response.getWriter();
+
+ response.setContentType("text/html");
+ response.setHeader("Cache-Control", "no-cache");
+
+ if ((_runnerThread == null) || (! _runnerThread.isAlive()))
+ {
+ _runnerThread = new RunnerThread();
+ _runnerThread.start();
+ }
+
+ if (request.getParameter("failednumber") != null)
+ doStatusFailed(writer, request, response);
+ else if (request.getParameter("errornumber") != null)
+ doStatusError(writer, request, response);
+ else
+ doStatus(writer, request, response);
+ }
+ catch (Exception exception)
+ {
+ log("Test Runner: doPost failed", exception);
+
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, exception.toString());
+ }
+ catch (Error error)
+ {
+ log("Test Runner: doPost failed", error);
+
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, error.toString());
+ }
+ }
+
+ public void doStatus(PrintWriter writer, HttpServletRequest request, HttpServletResponse response)
+ throws ServletException
+ {
+ writer.println("<HTML>");
+ writer.println("<HEAD>");
+ writer.println("<TITLE>Test Runner</TITLE>");
+ writer.println("</HEAD>");
+ writer.println("<BODY bgcolor=\"white\" style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.println("<DIV style=\"font-family: Arial, Helvetica, sans-serif; font-size: large\"> <BR>Test Runner: Status<BR> </DIV>");
+
+ writer.println("<TABLE width=\"100%\">");
+
+ writer.println("<TR><TD colspan=\"3\" align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Status</TD></TR>");
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Test suite class:</TD>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif\">" + _testSuiteClassName + "</TD>");
+ writer.println("</TR>");
+
+ if ((_runnerThread == null) || (! _runnerThread.isAlive()))
+ {
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Action:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.print("<FORM method=\"POST\" action=\"" + request.getRequestURL() + "\">");
+ writer.print("<INPUT type=\"button\" value=\"run\" onclick=\"this.form.submit()\">");
+ writer.print("</FORM>");
+ writer.println("</TD>");
+ writer.println("</TR>");
+ }
+ else
+ {
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Action:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.print("<FORM method=\"GET\" action=\"" + request.getRequestURL() + "\">");
+ writer.print("<INPUT type=\"button\" value=\"reload\" onclick=\"this.form.submit()\">");
+ writer.print("</FORM>");
+ writer.println("</TD>");
+ writer.println("</TR>");
+
+ if (_currentTest != null)
+ {
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Current test:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ encode(writer, _currentTest.toString());
+ writer.println("</TD>");
+ writer.println("</TR>");
+ }
+ }
+ writer.println("</TR>");
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Passed count:</TD>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif\">" + _passedTests.size() + "</TD>");
+ writer.println("</TR>");
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Failed count:</TD>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif\">" + _failedTests.size() + "</TD>");
+ writer.println("</TR>");
+ writer.println("<TR>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Error count:</TD>");
+ writer.println("<TD style=\"font-family: Arial, Helvetica, sans-serif\">" + _errorTests.size() + "</TD>");
+ writer.println("</TR>");
+
+ writer.println("</TABLE>");
+
+ if (! _passedTests.isEmpty())
+ {
+ writer.println("<BR>");
+
+ writer.println("<TABLE width=\"100%\">");
+
+ writer.println("<TR><TD colspan=\"3\" align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Passes</TD></TR>");
+
+ writer.println("<TR>");
+ writer.println("<TD align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Test</TD>");
+ writer.println("<TD align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Duration</TD>");
+ writer.println("</TR>");
+
+ Iterator passedTestsIterator = _passedTests.iterator();
+ while (passedTestsIterator.hasNext())
+ {
+ PassedTest passedTest = (PassedTest) passedTestsIterator.next();
+ writer.println("<TR>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ encode(writer, passedTest.test.toString());
+ writer.println("</TD>");
+ writer.print("<TD align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif\">" + passedTest.duration + " ms</TD>");
+ writer.println("</TR>");
+ }
+
+ writer.println("</TABLE>");
+ }
+
+ if (! _failedTests.isEmpty())
+ {
+ writer.println("<BR>");
+
+ writer.println("<TABLE width=\"100%\">");
+
+ writer.println("<TR><TD colspan=\"3\" align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Failures</TD></TR>");
+ writer.println("<TR>");
+ writer.println("<TD align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Test</TD>");
+ writer.println("<TD align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Duration</TD>");
+ writer.println("<TD align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Message</TD>");
+ writer.println("</TR>");
+
+ int failedNumber = 0;
+ Iterator failedTestsIterator = _failedTests.iterator();
+ while (failedTestsIterator.hasNext())
+ {
+ FailedTest failedTest = (FailedTest) failedTestsIterator.next();
+ writer.println("<TR>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.print("<A href=\"" + request.getRequestURL() + "?failednumber=" + failedNumber + "\">");
+ encode(writer, failedTest.test.toString());
+ writer.print("</A>");
+ writer.println("</TD>");
+ writer.print("<TD align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif\">" + failedTest.duration + " ms</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ encode(writer, failedTest.assertionFailedError.getMessage());
+ writer.println("</TD>");
+ writer.println("</TR>");
+ failedNumber++;
+ }
+
+ writer.println("</TABLE>");
+
+ writer.println("<BR>");
+ }
+
+ if (! _errorTests.isEmpty())
+ {
+ writer.println("<TABLE width=\"100%\">");
+ writer.println("<TR>");
+ writer.println("<TR><TD colspan=\"3\" align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Errors</TD></TR>");
+ writer.println("<TD align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Test</TD>");
+ writer.println("<TD align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Duration</TD>");
+ writer.println("<TD align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Exception/Error</TD>");
+ writer.println("</TR>");
+
+ int errorNumber = 0;
+ Iterator errorTestsIterator = _errorTests.iterator();
+ while (errorTestsIterator.hasNext())
+ {
+ ErrorTest errorTest = (ErrorTest) errorTestsIterator.next();
+ writer.println("<TR>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.print("<A href=\"" + request.getRequestURL() + "?errornumber=" + errorNumber + "\">");
+ encode(writer, errorTest.test.toString());
+ writer.print("</A>");
+ writer.println("</TD>");
+ writer.print("<TD align=\"center\" style=\"font-family: Arial, Helvetica, sans-serif\">" + errorTest.duration + " ms</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ encode(writer, errorTest.throwable.toString());
+ writer.println("</TD>");
+ writer.println("</TR>");
+ errorNumber++;
+ }
+
+ writer.println("</TABLE>");
+ }
+
+ writer.println("</BODY>");
+ writer.println("</HTML>");
+ }
+
+ public void doStatusFailed(PrintWriter writer, HttpServletRequest request, HttpServletResponse response)
+ throws ServletException
+ {
+ int failedIndex = 0;
+ FailedTest failedTest = null;
+
+ try
+ {
+ String failedIndexString = (String) request.getParameter("failednumber");
+
+ failedIndex = Integer.parseInt(failedIndexString);
+ failedTest = (FailedTest) _failedTests.get(failedIndex);
+ }
+ catch (Exception exception)
+ {
+ failedTest = null;
+ }
+
+ if (failedTest != null)
+ {
+ writer.println("<HTML>");
+ writer.println("<HEAD>");
+ writer.println("<TITLE>Test Runner</TITLE>");
+ writer.println("</HEAD>");
+ writer.println("<BODY bgcolor=\"white\" style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.println("<DIV style=\"font-family: Arial, Helvetica, sans-serif; font-size: large\"> <BR>Test Runner: Failed Status<BR> </DIV>");
+
+ writer.println("<TABLE>");
+
+ writer.print("<TR>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Test:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ encode(writer, failedTest.test.toString());
+ writer.println("</TD>");
+ writer.println("</TR>");
+
+ writer.println("<TR>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Duration:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">" + failedTest.duration + " ms</TD>");
+ writer.println("</TR>");
+
+ writer.println("<TR>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Message:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ encode(writer, failedTest.assertionFailedError.getMessage());
+ writer.println("</TD>");
+ writer.println("</TR>");
+
+ writer.print("<TR>");
+ writer.print("<TD colspan=\"2\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Stack trace:</TD>");
+ writer.println("</TR>");
+ writer.println("<TR>");
+ writer.println("<TD colspan=\"2\" style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.println("<PRE>");
+ CharArrayWriter charArrayWriter = new CharArrayWriter();
+ PrintWriter printWriter = new PrintWriter(charArrayWriter, true);
+ failedTest.assertionFailedError.printStackTrace(printWriter);
+ printWriter.close();
+ charArrayWriter.close();
+ encode(writer, charArrayWriter.toString());
+ writer.println("</PRE>");
+ writer.println("</TD>");
+ writer.println("</TR>");
+
+ writer.println("</TABLE>");
+
+ writer.println("<TABLE width=\"100%\">");
+ writer.println("<TR>");
+ writer.println("<TD align=\"left\" width=\"33%\" style=\"font-family: Arial, Helvetica, sans-serif\">");
+ if (failedIndex > 0)
+ writer.println("<A href=\"" + request.getRequestURL() + "?failednumber=" + (failedIndex - 1)+ "\">previous</A>");
+ else
+ writer.print(" ");
+ writer.println("</TD>");
+ writer.println("<TD align=\"center\" width=\"33%\" style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.println("<A href=\"" + request.getRequestURL() + "\">all</A>");
+ writer.println("</TD>");
+ writer.println("<TD align=\"right\" width=\"33%\" style=\"font-family: Arial, Helvetica, sans-serif\">");
+ if (failedIndex < (_failedTests.size() - 1))
+ writer.println("<A href=\"" + request.getRequestURL() + "?failednumber=" + (failedIndex + 1)+ "\">next</A>");
+ else
+ writer.print(" ");
+ writer.println("</TD>");
+ writer.println("</TR>");
+ writer.println("</TABLE>");
+
+ writer.println("</BODY>");
+ writer.println("</HTML>");
+ }
+ else
+ doStatus(writer, request, response);
+ }
+
+ public void doStatusError(PrintWriter writer, HttpServletRequest request, HttpServletResponse response)
+ throws ServletException
+ {
+ int errorIndex = 0;
+ ErrorTest errorTest = null;
+
+ try
+ {
+ String errorIndexString = (String) request.getParameter("errornumber");
+
+ errorIndex = Integer.parseInt(errorIndexString);
+ errorTest = (ErrorTest) _errorTests.get(errorIndex);
+ }
+ catch (Exception exception)
+ {
+ errorTest = null;
+ }
+
+ if (errorTest != null)
+ {
+ writer.println("<HTML>");
+ writer.println("<HEAD>");
+ writer.println("<TITLE>Test Runner</TITLE>");
+ writer.println("</HEAD>");
+ writer.println("<BODY bgcolor=\"white\" style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.println("<DIV style=\"font-family: Arial, Helvetica, sans-serif; font-size: large\"> <BR>Test Runner: Error Status<BR> </DIV>");
+
+ writer.println("<TABLE>");
+
+ writer.print("<TR>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Test:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ encode(writer, errorTest.test.toString());
+ writer.println("</TD>");
+ writer.println("</TR>");
+
+ writer.println("<TR>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Duration:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">" + errorTest.duration + " ms</TD>");
+ writer.println("</TR>");
+
+ writer.println("<TR>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Exception/error:</TD>");
+ writer.print("<TD style=\"font-family: Arial, Helvetica, sans-serif\">");
+ encode(writer, errorTest.throwable.toString());
+ writer.println("</TD>");
+ writer.println("</TR>");
+
+ writer.print("<TR>");
+ writer.print("<TD colspan=\"2\" style=\"font-family: Arial, Helvetica, sans-serif; font-weight: bold\">Stack trace:</TD>");
+ writer.println("</TR>");
+ writer.println("<TR>");
+ writer.println("<TD colspan=\"2\" style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.println("<PRE>");
+ CharArrayWriter charArrayWriter = new CharArrayWriter();
+ PrintWriter printWriter = new PrintWriter(charArrayWriter, true);
+ errorTest.throwable.printStackTrace(printWriter);
+ printWriter.close();
+ charArrayWriter.close();
+ encode(writer, charArrayWriter.toString());
+ writer.println("</PRE>");
+ writer.println("</TD>");
+ writer.println("</TR>");
+
+ writer.println("</TABLE>");
+
+ writer.println("<TABLE width=\"100%\">");
+ writer.println("<TR>");
+ writer.println("<TD align=\"left\" width=\"33%\" style=\"font-family: Arial, Helvetica, sans-serif\">");
+ if (errorIndex > 0)
+ writer.println("<A href=\"" + request.getRequestURL() + "?errornumber=" + (errorIndex - 1)+ "\">previous</A>");
+ else
+ writer.print(" ");
+ writer.println("</TD>");
+ writer.println("<TD align=\"center\" width=\"33%\" style=\"font-family: Arial, Helvetica, sans-serif\">");
+ writer.println("<A href=\"" + request.getRequestURL() + "\">all</A>");
+ writer.println("</TD>");
+ writer.println("<TD align=\"right\" width=\"33%\" style=\"font-family: Arial, Helvetica, sans-serif\">");
+ if (errorIndex < (_errorTests.size() - 1))
+ writer.println("<A href=\"" + request.getRequestURL() + "?errornumber=" + (errorIndex + 1)+ "\">next</A>");
+ else
+ writer.print(" ");
+ writer.println("</TD>");
+ writer.println("</TR>");
+ writer.println("</TABLE>");
+
+ writer.println("</BODY>");
+ writer.println("</HTML>");
+ }
+ else
+ doStatus(writer, request, response);
+ }
+
+ private class PassedTest
+ {
+ public Test test;
+ public long duration;
+ }
+
+ private class FailedTest
+ {
+ public Test test;
+ public long duration;
+ public AssertionFailedError assertionFailedError;
+ }
+
+ private class ErrorTest
+ {
+ public Test test;
+ public long duration;
+ public Throwable throwable;
+ }
+
+ private class RunnerThread extends Thread
+ {
+ public void run()
+ {
+ try
+ {
+ _passedTests.clear();
+ _failedTests.clear();
+ _errorTests.clear();
+
+ Class testSuiteClass = Class.forName(_testSuiteClassName);
+ TestListener testListener = new BasicTestListener();
+
+ _testResult = new TestResult();
+ _testSuite = (TestSuite) testSuiteClass.newInstance();
+
+ _testResult.addListener(testListener);
+ _testSuite.run(_testResult);
+ _testResult.removeListener(testListener);
+ }
+ catch (Exception exception)
+ {
+ log("Runner Thread: run failed", exception);
+ }
+ catch (Error error)
+ {
+ log("Runner Thread: run failed", error);
+ }
+ }
+ }
+
+ private class BasicTestListener implements TestListener
+ {
+ public void startTest(Test test)
+ {
+ _startTime = System.currentTimeMillis();
+ _failed = false;
+ _error = false;
+ _assertionFailedError = null;
+ _throwable = null;
+ _currentTest = test;
+ }
+
+ public void addError(Test test, Throwable throwable)
+ {
+ _error = true;
+ _throwable = throwable;
+ throwable.printStackTrace(System.out);
+ }
+
+ public void addFailure(Test test, AssertionFailedError assertionFailedError)
+ {
+ _failed = true;
+ _assertionFailedError = assertionFailedError;
+ assertionFailedError.printStackTrace(System.out);
+ }
+
+ public void endTest(Test test)
+ {
+ if (_failed)
+ {
+ FailedTest failedTest = new FailedTest();
+ failedTest.test = test;
+ failedTest.duration = System.currentTimeMillis() - _startTime;
+ failedTest.assertionFailedError = _assertionFailedError;
+ _failedTests.add(failedTest);
+ }
+ else if (_error)
+ {
+ ErrorTest errorTest = new ErrorTest();
+ errorTest.test = test;
+ errorTest.duration = System.currentTimeMillis() - _startTime;
+ errorTest.throwable = _throwable;
+ _errorTests.add(errorTest);
+ }
+ else
+ {
+ PassedTest passedTest = new PassedTest();
+ passedTest.test = test;
+ passedTest.duration = System.currentTimeMillis() - _startTime;
+ _passedTests.add(passedTest);
+ }
+
+ _currentTest = null;
+ }
+
+ private long _startTime = 0;
+ private boolean _failed = false;
+ private boolean _error = false;
+ private AssertionFailedError _assertionFailedError = null;
+ private Throwable _throwable = null;
+ }
+
+ private static void encode(PrintWriter writer, String string)
+ {
+ if (string != null)
+ {
+ char[] chars = string.toCharArray();
+
+ for (int index = 0; index < chars.length; index++)
+ if (chars[index] == '<')
+ writer.print("<");
+ else if (chars[index] == '>')
+ writer.print(">");
+ else if (chars[index] == '&')
+ writer.print("&");
+ else
+ writer.print(chars[index]);
+ }
+ else
+ writer.print("null");
+ }
+
+ private List _passedTests = new LinkedList();
+ private List _failedTests = new LinkedList();
+ private List _errorTests = new LinkedList();
+ private Test _currentTest = null;
+ private String _testSuiteClassName = null;
+ private RunnerThread _runnerThread = null;
+ private TestResult _testResult = null;
+ private TestSuite _testSuite = null;
+
+}
\ No newline at end of file
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoBusinessParticipant.java (from rev 18509, labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/common/DemoBusinessParticipant.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoBusinessParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoBusinessParticipant.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: DemoBusinessParticipant.java,v 1.5 2004/09/09 08:48:39 kconner Exp $
+ */
+
+package com.arjuna.wst.tests;
+
+import com.arjuna.wst.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: DemoBusinessParticipant.java,v 1.5 2004/09/09 08:48:39 kconner Exp $
+ * @since 1.0.
+ */
+
+public class DemoBusinessParticipant implements com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant
+{
+
+ public static final int COMPENSATE = 0;
+ public static final int CANCEL = 1;
+ public static final int CLOSE = 2;
+ public static final int EXIT = 3;
+
+ /*
+ * TODO does EXIT imply a memory leak? How does the participant
+ * get unregistered from the dispatcher if it isn't called during
+ * termination?
+ */
+
+ public DemoBusinessParticipant (int outcome, String id)
+ {
+ _outcome = outcome;
+ _id = id;
+ }
+
+ public final boolean passed ()
+ {
+ /*
+ * If we get a passed result and our status was EXIT then this
+ * means that one of our methods was called, which is wrong if
+ * we exited!
+ */
+
+ switch (_outcome)
+ {
+ case EXIT:
+ return !_passed;
+ default:
+ return _passed;
+ }
+ }
+
+ public void close () throws WrongStateException, SystemException
+ {
+ System.out.println(this.getClass().getName()+".close for "+this);
+
+ if (_outcome == CLOSE)
+ _passed = true;
+ }
+
+ public void cancel () throws WrongStateException, SystemException
+ {
+ System.out.println(this.getClass().getName()+".cancel for "+this);
+
+ if (_outcome == CANCEL)
+ _passed = true;
+ }
+
+ public void compensate () throws FaultedException, WrongStateException, SystemException
+ {
+ System.out.println(this.getClass().getName()+".compensate for "+this);
+
+ if (_outcome == COMPENSATE)
+ _passed = true;
+ }
+
+ public void forget () throws WrongStateException, SystemException
+ {
+ }
+
+ public void unknown () throws SystemException
+ {
+ }
+
+ public void error () throws SystemException
+ {
+ }
+
+ public String toString ()
+ {
+ try
+ {
+ return identifier();
+ }
+ catch (SystemException ex)
+ {
+ return "Unknown";
+ }
+ }
+
+ public String identifier () throws SystemException
+ {
+ return _id;
+ }
+
+ /**
+ * @return the status value.
+ */
+
+ public String status () throws SystemException
+ {
+ return "Unknown";
+ }
+
+ protected boolean _passed = false;
+ protected String _id = null;
+ protected int _outcome;
+
+}
+
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoBusinessParticipantWithComplete.java (from rev 18509, labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/common/DemoBusinessParticipantWithComplete.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoBusinessParticipantWithComplete.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoBusinessParticipantWithComplete.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002, 2003, 2004,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: DemoBusinessParticipantWithComplete.java,v 1.5 2004/09/09 08:48:40 kconner Exp $
+ */
+
+package com.arjuna.wst.tests;
+
+import com.arjuna.wst.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: DemoBusinessParticipantWithComplete.java,v 1.5 2004/09/09 08:48:40 kconner Exp $
+ * @since 1.0.
+ *
+ * Requires complete to be sent before the transaction terminates.
+ */
+
+public class DemoBusinessParticipantWithComplete extends DemoBusinessParticipant implements com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant
+{
+
+ public static final int COMPLETE = 4;
+
+ public DemoBusinessParticipantWithComplete (int outcome, String id)
+ {
+ super(outcome, id);
+ }
+
+ public void close () throws WrongStateException, SystemException
+ {
+ System.out.println(this.getClass().getName()+".close for "+this);
+
+ if (!_completed)
+ throw new SystemException();
+
+ if (_outcome == CLOSE)
+ _passed = true;
+ }
+
+ public void cancel () throws WrongStateException, SystemException
+ {
+ System.out.println(this.getClass().getName()+".cancel for "+this);
+
+ if (!_completed)
+ throw new SystemException();
+
+ if (_outcome == CANCEL)
+ _passed = true;
+ }
+
+ public void compensate () throws FaultedException, WrongStateException, SystemException
+ {
+ System.out.println(this.getClass().getName()+".compensate for "+this);
+
+ if (!_completed)
+ throw new SystemException();
+
+ if (_outcome == COMPENSATE)
+ _passed = true;
+ }
+
+ public void complete () throws WrongStateException, SystemException
+ {
+ System.out.println(this.getClass().getName()+".complete for "+this);
+
+ if (_outcome == COMPLETE)
+ _passed = true;
+
+ _completed = true;
+ }
+
+ private boolean _completed = false;
+
+}
+
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoDurableParticipant.java (from rev 18509, labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/common/DemoDurableParticipant.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoDurableParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoDurableParticipant.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: DemoDurableParticipant.java,v 1.1.2.1 2004/08/09 12:34:30 nmcl Exp $
+ */
+
+package com.arjuna.wst.tests;
+
+import com.arjuna.ats.arjuna.common.Uid;
+
+import com.arjuna.wst.*;
+
+//import com.arjuna.mw.wst.vote.*;
+
+//import com.arjuna.mw.wst.exceptions.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: DemoDurableParticipant.java,v 1.1.2.1 2004/08/09 12:34:30 nmcl Exp $
+ * @since 1.0.
+ */
+
+public class DemoDurableParticipant implements Durable2PCParticipant
+{
+
+ public DemoDurableParticipant ()
+ {
+ _passed = false;
+ }
+
+ public final boolean passed ()
+ {
+ return _passed;
+ }
+
+ public Vote prepare () throws WrongStateException, SystemException
+ {
+ System.out.println("DemoDurableParticipant.prepare for "+this);
+
+ return new Prepared();
+ }
+
+ public void commit () throws WrongStateException, SystemException
+ {
+ System.out.println("DemoDurableParticipant.commit for "+this);
+
+ _passed = true;
+ }
+
+ public void rollback () throws WrongStateException, SystemException
+ {
+ System.out.println("DemoDurableParticipant.rollback for "+this);
+
+ _passed = false;
+ }
+
+ public void unknown () throws SystemException
+ {
+ }
+
+ public void error () throws SystemException
+ {
+ }
+
+ public String toString ()
+ {
+ return identifier();
+ }
+
+ public String identifier ()
+ {
+ return _id.stringForm();
+ }
+
+ private boolean _passed;
+ private Uid _id = new Uid();
+
+}
+
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoVolatileParticipant.java (from rev 18509, labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/common/DemoVolatileParticipant.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoVolatileParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/DemoVolatileParticipant.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: DemoVolatileParticipant.java,v 1.1.2.1 2004/08/09 12:34:30 nmcl Exp $
+ */
+
+package com.arjuna.wst.tests;
+
+import com.arjuna.ats.arjuna.common.Uid;
+
+import com.arjuna.wst.*;
+
+//import com.arjuna.mw.wst.vote.*;
+
+//import com.arjuna.mw.wst.exceptions.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: DemoVolatileParticipant.java,v 1.1.2.1 2004/08/09 12:34:30 nmcl Exp $
+ * @since 1.0.
+ */
+
+public class DemoVolatileParticipant implements Volatile2PCParticipant
+{
+
+ public DemoVolatileParticipant ()
+ {
+ _passed = false;
+ }
+
+ public final boolean passed ()
+ {
+ return _passed;
+ }
+
+ public Vote prepare () throws WrongStateException, SystemException
+ {
+ System.out.println("DemoVolatileParticipant.prepare for "+this);
+
+ return new Prepared();
+ }
+
+ public void commit () throws WrongStateException, SystemException
+ {
+ System.out.println("DemoVolatileParticipant.commit for "+this);
+
+ _passed = true;
+ }
+
+ public void rollback () throws WrongStateException, SystemException
+ {
+ System.out.println("DemoVolatileParticipant.rollback for "+this);
+
+ _passed = false;
+ }
+
+ public void unknown () throws SystemException
+ {
+ }
+
+ public void error () throws SystemException
+ {
+ }
+
+ public String toString ()
+ {
+ return identifier();
+ }
+
+ public String identifier ()
+ {
+ return _id.stringForm();
+ }
+
+ private boolean _passed;
+ private Uid _id = new Uid();
+
+}
+
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/FailureBusinessParticipant.java (from rev 18509, labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/common/FailureBusinessParticipant.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/FailureBusinessParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/FailureBusinessParticipant.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: FailureBusinessParticipant.java,v 1.4 2004/09/09 08:48:39 kconner Exp $
+ */
+
+package com.arjuna.wst.tests;
+
+import com.arjuna.ats.arjuna.common.Uid;
+
+import com.arjuna.wst.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: FailureBusinessParticipant.java,v 1.4 2004/09/09 08:48:39 kconner Exp $
+ * @since 1.0.
+ */
+
+public class FailureBusinessParticipant implements com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant
+{
+
+ public static final int FAIL_IN_CLOSE = 0;
+ public static final int FAIL_IN_CANCEL = 1;
+ public static final int FAIL_IN_COMPENSATE = 2;
+
+ public FailureBusinessParticipant (int failurePoint, String id)
+ {
+ _failurePoint = failurePoint;
+ _id = id;
+ }
+
+ public final boolean passed ()
+ {
+ return _passed;
+ }
+
+ public void close () throws WrongStateException, SystemException
+ {
+ System.out.println("FailureBusinessParticipant.close for "+this);
+
+ if (_failurePoint == FAIL_IN_CLOSE)
+ throw new WrongStateException();
+
+ _passed = true;
+ }
+
+ public void cancel () throws WrongStateException, SystemException
+ {
+ System.out.println("FailureBusinessParticipant.cancel for "+this);
+
+ if (_failurePoint == FAIL_IN_CANCEL)
+ throw new WrongStateException();
+
+ _passed = true;
+ }
+
+ public void compensate () throws WrongStateException, SystemException
+ {
+ System.out.println("FailureBusinessParticipant.compensate for "+this);
+
+ if (_failurePoint == FAIL_IN_COMPENSATE)
+ throw new WrongStateException();
+
+ _passed = true;
+ }
+
+ public void forget () throws WrongStateException, SystemException
+ {
+ }
+
+ public void unknown () throws SystemException
+ {
+ }
+
+ public void error () throws SystemException
+ {
+ }
+
+ public String status () throws SystemException
+ {
+ return "Unknown";
+ }
+
+ public String toString ()
+ {
+ try
+ {
+ return identifier();
+ }
+ catch (SystemException ex)
+ {
+ return "Unknown";
+
+ }
+ }
+
+ public String identifier () throws SystemException
+ {
+ return _id;
+ }
+
+ private boolean _passed = false;
+ private String _id = null;
+ private int _failurePoint;
+
+}
+
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/FailureParticipant.java (from rev 18509, labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/common/FailureParticipant.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/FailureParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/FailureParticipant.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: FailureParticipant.java,v 1.5 2004/09/09 08:48:40 kconner Exp $
+ */
+
+package com.arjuna.wst.tests;
+
+import com.arjuna.wst.*;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: FailureParticipant.java,v 1.5 2004/09/09 08:48:40 kconner Exp $
+ * @since 1.0.
+ */
+
+public class FailureParticipant implements Durable2PCParticipant
+{
+
+ public static final int FAIL_IN_PREPARE = 0;
+ public static final int FAIL_IN_ROLLBACK = 1;
+ public static final int FAIL_IN_COMMIT = 2;
+ public static final int FAIL_IN_ONE_PHASE = 3;
+
+ public static final int WRONG_STATE = 20;
+ public static final int SYSTEM = 21;
+ public static final int NONE = 22;
+
+ public FailureParticipant (int failurePoint, int failureType)
+ {
+ _failurePoint = failurePoint;
+ _failureType = failureType;
+ _passed = false;
+ }
+
+ public final boolean passed ()
+ {
+ return _passed;
+ }
+
+ public Vote prepare () throws WrongStateException, SystemException
+ {
+ System.out.println("FailureParticipant.prepare");
+
+ if (_failurePoint == FAIL_IN_PREPARE)
+ {
+ generateException();
+
+ return new Aborted();
+ }
+ else
+ return new Prepared();
+ }
+
+ public void commit () throws WrongStateException, SystemException
+ {
+ System.out.println("FailureParticipant.commit");
+
+ if (_failurePoint == FAIL_IN_COMMIT)
+ generateException();
+
+ if (_failurePoint == FAIL_IN_PREPARE)
+ _passed = false;
+ }
+
+ public void rollback () throws WrongStateException, SystemException
+ {
+ System.out.println("FailureParticipant.rollback");
+
+ if (_failurePoint == FAIL_IN_ROLLBACK)
+ generateException();
+
+ if (_failurePoint == FAIL_IN_PREPARE)
+ _passed = true;
+ }
+
+ public void commitOnePhase () throws WrongStateException, SystemException
+ {
+ System.out.println("FailureParticipant.commitOnePhase");
+
+ if (_failurePoint == FAIL_IN_ONE_PHASE)
+ generateException();
+
+ _passed = true;
+ }
+
+ public void unknown () throws SystemException
+ {
+ }
+
+ public void error () throws SystemException
+ {
+ }
+
+ private void generateException () throws WrongStateException, SystemException
+ {
+ switch (_failureType)
+ {
+ case WRONG_STATE:
+ throw new WrongStateException();
+ case SYSTEM:
+ throw new SystemException();
+ default:
+ break;
+ }
+ }
+
+ private int _failurePoint;
+ private int _failureType;
+ private boolean _passed;
+
+}
+
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/TestSuite.java (from rev 18509, labs/jbosstm/trunk/XTS/WS-C/tests/src/com/arjuna/wsc/tests/junit/TestSuite.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/TestSuite.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/TestSuite.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008,
+ * @author JBoss Inc.
+ */
+/*
+ * TestSuite.java
+ */
+
+package com.arjuna.wst.tests;
+
+public class TestSuite extends junit.framework.TestSuite
+{
+ public TestSuite()
+ {
+ // wst basic tests
+ // this test fails because the commit is retried forever instead of an exception being generated
+ //addTest(new junit.framework.TestSuite(CommitExceptionInCommit.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.CommitExceptionInPrepare.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.CommitRollbackInPrepare.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.MultiParticipants.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.NestedTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.NullCommitTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.NullRollbackTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.PrintTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.ResumeNullTransaction.class));
+ // this test will probably fail because the rollback is tried forever instead of an exception being generated
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.RollbackExceptionInRollback.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SingleParticipant.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SuspendCommitTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SuspendNullTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SuspendResumeCommitTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SuspendResumeParticipants.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SuspendResumeSingleParticipant.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.SuspendTransaction.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.basic.ThreadedTransaction.class));
+
+ // wst BA tests
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.Cancel.class));
+ // this test errors with an unepected RollbackException from the close!
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.Close.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.Compensate.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.ConfirmWithComplete.class));
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.Exit.class));
+ // this test gets the expected SystemException under cancel but the participant does not
+ // see the cancel message
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.MultiCancel.class));
+ // this test gets the expected SystemException under close but the participant does not
+ // see the close message
+ addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.MultiClose.class));
+ // this test fails because the compensate is retried forever instead of an exception being generated
+ //addTest(new junit.framework.TestSuite(com.arjuna.wst.tests.junit.ba.MultiCompensate.class));
+
+ // wstx basic tests
+ // these don't run at present because the WSCF protocol manager code cannot process the xml
+ // in UserTwoPhaseTx.xml and TwoPhaseTxManager.xml and wstx.UserTransactionFactory tries to
+ // use these documents to identify the transaction protocol it is meant to support
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.NullCommitTransaction.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.NullNestedCommit.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.NullNestedRollback.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.NullRollbackOnly.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.NullRollbackTransaction.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.SingleParticipant.class));
+ //addTest(new junit.framework.TestSuite(com.arjuna.wstx.tests.junit.basic.SynchronizationParticipant.class));
+ }
+}
\ No newline at end of file
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba (from rev 18509, labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/ba)
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/Cancel.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/ba/Cancel.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/Cancel.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,11 +29,12 @@
* $Id: Cancel.java,v 1.3.8.1 2005/11/22 10:36:18 kconner Exp $
*/
-package com.arjuna.mwtests.wst.ba;
+package com.arjuna.wst.tests.junit.ba;
import com.arjuna.mw.wst.BusinessActivityManager;
import com.arjuna.mw.wst.UserBusinessActivity;
-import com.arjuna.mwtests.wst.common.DemoBusinessParticipant;
+import com.arjuna.wst.tests.DemoBusinessParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -41,37 +42,29 @@
* @since 1.0.
*/
-public class Cancel
+public class Cancel extends TestCase
{
-
- public static void main (String[] args)
+ public static void testCancel()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
- UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
- BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
+ UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
+ BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
String participantId = "1234";
DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.CANCEL, participantId);
-
+ try {
+
uba.begin();
bam.enlistForBusinessAgreementWithParticipantCompletion(p, participantId);
-
+ } catch (Exception eouter) {
+ try {
+ uba.cancel();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
uba.cancel();
- passed = p.passed();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ assertTrue(p.passed());
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/Close.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/ba/Close.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/Close.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,11 +29,12 @@
* $Id: Close.java,v 1.3.8.1 2005/11/22 10:36:17 kconner Exp $
*/
-package com.arjuna.mwtests.wst.ba;
+package com.arjuna.wst.tests.junit.ba;
import com.arjuna.mw.wst.BusinessActivityManager;
import com.arjuna.mw.wst.UserBusinessActivity;
-import com.arjuna.mwtests.wst.common.DemoBusinessParticipant;
+import com.arjuna.wst.tests.DemoBusinessParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -41,36 +42,28 @@
* @since 1.0.
*/
-public class Close
+public class Close extends TestCase
{
-
- public static void main (String[] args)
+ public static void testClose()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
- BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
- DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.CLOSE, "1234");
-
+ BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
+ DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.CLOSE, "1235");
+ try {
uba.begin();
- bam.enlistForBusinessAgreementWithParticipantCompletion(p, null);
-
+ bam.enlistForBusinessAgreementWithParticipantCompletion(p, p.identifier());
+ } catch (Exception eouter) {
+ try {
+ uba.cancel();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
+
uba.close();
- passed = p.passed();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ assertTrue(p.passed());
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/Compensate.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/ba/Compensate.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/Compensate.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,11 +29,12 @@
* $Id: Compensate.java,v 1.3.8.1 2005/11/22 10:36:17 kconner Exp $
*/
-package com.arjuna.mwtests.wst.ba;
+package com.arjuna.wst.tests.junit.ba;
import com.arjuna.mw.wst.BusinessActivityManager;
import com.arjuna.mw.wst.UserBusinessActivity;
-import com.arjuna.mwtests.wst.common.DemoBusinessParticipant;
+import com.arjuna.wst.tests.DemoBusinessParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -41,40 +42,32 @@
* @since 1.0.
*/
-public class Compensate
+public class Compensate extends TestCase
{
-
- public static void main (String[] args)
+ public static void testCompensate()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
- BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
+ BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
com.arjuna.wst.BAParticipantManager bpm = null;
- String participantId = "1234";
+ String participantId = "1236";
DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.COMPENSATE, participantId);
-
+ try {
uba.begin();
bpm = bam.enlistForBusinessAgreementWithParticipantCompletion(p, participantId);
bpm.completed();
+ } catch (Exception eouter) {
+ try {
+ uba.cancel();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
uba.cancel();
- passed = p.passed();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ assertTrue(p.passed());
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/ConfirmWithComplete.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/ba/ConfirmWithComplete.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/ConfirmWithComplete.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,11 +29,12 @@
* $Id: ConfirmWithComplete.java,v 1.3.8.1 2005/11/22 10:36:17 kconner Exp $
*/
-package com.arjuna.mwtests.wst.ba;
+package com.arjuna.wst.tests.junit.ba;
import com.arjuna.mw.wst.BusinessActivityManager;
import com.arjuna.mw.wst.UserBusinessActivity;
-import com.arjuna.mwtests.wst.common.DemoBusinessParticipantWithComplete;
+import com.arjuna.wst.tests.DemoBusinessParticipantWithComplete;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -41,38 +42,31 @@
* @since 1.0.
*/
-public class ConfirmWithComplete
+public class ConfirmWithComplete extends TestCase
{
- public static void main (String[] args)
+ public static void testConfirmWithComplete()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
- BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
+ BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
DemoBusinessParticipantWithComplete p = new DemoBusinessParticipantWithComplete(DemoBusinessParticipantWithComplete.COMPLETE, "1234");
-
+ try {
uba.begin();
- bam.enlistForBusinessAgreementWithCoordinatorCompletion(p, "1234");
+ bam.enlistForBusinessAgreementWithCoordinatorCompletion(p, "1237");
uba.complete();
-
+ } catch (Exception eouter) {
+ try {
+ uba.cancel();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
+
uba.cancel();
- passed = p.passed();
+ assertTrue(p.passed());
}
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
- }
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/Exit.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/ba/Exit.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/Exit.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,11 +29,12 @@
* $Id: Exit.java,v 1.3.8.1 2005/11/22 10:36:17 kconner Exp $
*/
-package com.arjuna.mwtests.wst.ba;
+package com.arjuna.wst.tests.junit.ba;
import com.arjuna.mw.wst.BusinessActivityManager;
import com.arjuna.mw.wst.UserBusinessActivity;
-import com.arjuna.mwtests.wst.common.DemoBusinessParticipant;
+import com.arjuna.wst.tests.DemoBusinessParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -41,39 +42,31 @@
* @since 1.0.
*/
-public class Exit
+public class Exit extends TestCase
{
-
- public static void main (String[] args)
+ public static void testExit()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
- BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
+ BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
com.arjuna.wst.BAParticipantManager bpm = null;
- DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.EXIT, "1234");
-
+ DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.EXIT, "1238");
+ try {
uba.begin();
- bpm = bam.enlistForBusinessAgreementWithParticipantCompletion(p, "1234");
+ bpm = bam.enlistForBusinessAgreementWithParticipantCompletion(p, "1238");
bpm.exit();
+ } catch (Exception eouter) {
+ try {
+ uba.cancel();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
uba.close();
- passed = p.passed();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ assertTrue(p.passed());
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/MultiCancel.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/ba/MultiCancel.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/MultiCancel.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,12 +29,14 @@
* $Id: MultiCancel.java,v 1.3.8.1 2005/11/22 10:36:18 kconner Exp $
*/
-package com.arjuna.mwtests.wst.ba;
+package com.arjuna.wst.tests.junit.ba;
import com.arjuna.mw.wst.BusinessActivityManager;
import com.arjuna.mw.wst.UserBusinessActivity;
-import com.arjuna.mwtests.wst.common.DemoBusinessParticipant;
-import com.arjuna.mwtests.wst.common.FailureBusinessParticipant;
+import com.arjuna.wst.tests.DemoBusinessParticipant;
+import com.arjuna.wst.tests.FailureBusinessParticipant;
+import com.arjuna.wst.SystemException;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -42,38 +44,39 @@
* @since 1.0.
*/
-public class MultiCancel
+public class MultiCancel extends TestCase
{
-
- public static void main (String[] args)
+ public static void testMultiCancel()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
- BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
- DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.CANCEL, "1234");
+ BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
+ DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.CANCEL, "1239");
FailureBusinessParticipant fp = new FailureBusinessParticipant(FailureBusinessParticipant.FAIL_IN_CANCEL, "5678");
-
+ try {
uba.begin();
- bam.enlistForBusinessAgreementWithParticipantCompletion(p, "1234");
+ bam.enlistForBusinessAgreementWithParticipantCompletion(p, "1239");
bam.enlistForBusinessAgreementWithParticipantCompletion(fp, "5678");
-
+ } catch (Exception eouter) {
+ try {
+ uba.cancel();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
+ try {
uba.close();
-
- passed = p.passed();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ } catch (SystemException ex) {
+ // we should get here
+ assertTrue(p.passed());
+ } catch (Exception eouter) {
+ try {
+ uba.cancel();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
+ fail("expected SystemError");
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/MultiClose.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/ba/MultiClose.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/MultiClose.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,12 +29,14 @@
* $Id: MultiClose.java,v 1.3.8.1 2005/11/22 10:36:18 kconner Exp $
*/
-package com.arjuna.mwtests.wst.ba;
+package com.arjuna.wst.tests.junit.ba;
import com.arjuna.mw.wst.BusinessActivityManager;
import com.arjuna.mw.wst.UserBusinessActivity;
-import com.arjuna.mwtests.wst.common.DemoBusinessParticipant;
-import com.arjuna.mwtests.wst.common.FailureBusinessParticipant;
+import com.arjuna.wst.tests.DemoBusinessParticipant;
+import com.arjuna.wst.tests.FailureBusinessParticipant;
+import com.arjuna.wst.SystemException;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -42,38 +44,41 @@
* @since 1.0.
*/
-public class MultiClose
+public class MultiClose extends TestCase
{
-
- public static void main (String[] args)
+ public static void testMultiClose()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
- BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
- DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.CLOSE, "1234");
- FailureBusinessParticipant fp = new FailureBusinessParticipant(FailureBusinessParticipant.FAIL_IN_CLOSE, "5678");
+
+ BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
+ DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.CLOSE, "1240");
+ FailureBusinessParticipant fp = new FailureBusinessParticipant(FailureBusinessParticipant.FAIL_IN_CLOSE, "5679");
+ try {
uba.begin();
- bam.enlistForBusinessAgreementWithParticipantCompletion(p, null);
- bam.enlistForBusinessAgreementWithParticipantCompletion(fp, null);
-
+ bam.enlistForBusinessAgreementWithParticipantCompletion(p, "1240");
+ bam.enlistForBusinessAgreementWithParticipantCompletion(fp, "5679");
+ } catch (Exception eouter) {
+ try {
+ uba.cancel();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
+ try {
uba.close();
-
- passed = p.passed();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ } catch (SystemException ex) {
+ // we should get here
+ assertTrue(p.passed());
+ } catch (Exception eouter) {
+ try {
+ uba.cancel();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
+ fail("expected SystemError");
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/MultiCompensate.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/ba/MultiCompensate.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/ba/MultiCompensate.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,12 +29,14 @@
* $Id: MultiCompensate.java,v 1.3.8.1 2005/11/22 10:36:18 kconner Exp $
*/
-package com.arjuna.mwtests.wst.ba;
+package com.arjuna.wst.tests.junit.ba;
import com.arjuna.mw.wst.BusinessActivityManager;
import com.arjuna.mw.wst.UserBusinessActivity;
-import com.arjuna.mwtests.wst.common.DemoBusinessParticipant;
-import com.arjuna.mwtests.wst.common.FailureBusinessParticipant;
+import com.arjuna.wst.tests.DemoBusinessParticipant;
+import com.arjuna.wst.tests.FailureBusinessParticipant;
+import com.arjuna.wst.SystemException;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -42,43 +44,44 @@
* @since 1.0.
*/
-public class MultiCompensate
+public class MultiCompensate extends TestCase
{
-
- public static void main (String[] args)
+ public static void testMultiCompensate()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
- BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
+ BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
com.arjuna.wst.BAParticipantManager bpm1 = null;
com.arjuna.wst.BAParticipantManager bpm2 = null;
- DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.COMPENSATE, "1234");
- FailureBusinessParticipant fp = new FailureBusinessParticipant(FailureBusinessParticipant.FAIL_IN_COMPENSATE, "5678");
-
+ DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.COMPENSATE, "1241");
+ FailureBusinessParticipant fp = new FailureBusinessParticipant(FailureBusinessParticipant.FAIL_IN_COMPENSATE, "5680");
+ try {
uba.begin();
- bpm1 = bam.enlistForBusinessAgreementWithParticipantCompletion(p, "1234");
- bpm2 = bam.enlistForBusinessAgreementWithParticipantCompletion(fp, "5678");
+ bpm1 = bam.enlistForBusinessAgreementWithParticipantCompletion(p, "1241");
+ bpm2 = bam.enlistForBusinessAgreementWithParticipantCompletion(fp, "5680");
bpm1.completed();
bpm2.completed();
-
+ } catch (Exception eouter) {
+ try {
+ uba.cancel();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
+ try {
uba.cancel();
-
- passed = p.passed();
+ } catch (SystemException ex) {
+ // we should get here
+ assertTrue(p.passed());
+ } catch (Exception eouter) {
+ try {
+ uba.cancel();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
+ fail("expected SystemError");
}
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
- }
-
}
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic (from rev 18509, labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic)
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/CommitExceptionInCommit.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/CommitExceptionInCommit.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/CommitExceptionInCommit.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,12 +29,13 @@
* $Id: CommitExceptionInCommit.java,v 1.6.8.1 2005/11/22 10:36:12 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.UserTransaction;
-import com.arjuna.mwtests.wst.common.DemoDurableParticipant;
-import com.arjuna.mwtests.wst.common.FailureParticipant;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import com.arjuna.wst.tests.FailureParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -42,42 +43,38 @@
* @since 1.0.
*/
-public class CommitExceptionInCommit
+public class CommitExceptionInCommit extends TestCase
{
-
- public static void main (String[] args)
+ public static void testCommitExceptionInCommit()
+ throws Throwable
{
- boolean passed = false;
-
+ UserTransaction ut = UserTransaction.getUserTransaction();
try
{
- UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
FailureParticipant p1 = new FailureParticipant(FailureParticipant.FAIL_IN_COMMIT, FailureParticipant.WRONG_STATE);
DemoDurableParticipant p2 = new DemoDurableParticipant();
ut.begin();
- tm.enlistForDurableTwoPhase(p1, null);
- tm.enlistForDurableTwoPhase(p2, null);
-
+ tm.enlistForDurableTwoPhase(p1, "failure");
+ tm.enlistForDurableTwoPhase(p2, p2.identifier());
+ } catch (Exception eouter)
+ {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
+ try {
ut.commit();
- passed = false;
+ fail("expected SystemException");
}
catch (com.arjuna.wst.SystemException ex)
- {
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ {
+ // we should arrive here!
}
-
+ }
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/CommitExceptionInPrepare.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/CommitExceptionInPrepare.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/CommitExceptionInPrepare.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,12 +29,13 @@
* $Id: CommitExceptionInPrepare.java,v 1.9.8.1 2005/11/22 10:36:11 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.UserTransaction;
-import com.arjuna.mwtests.wst.common.DemoDurableParticipant;
-import com.arjuna.mwtests.wst.common.FailureParticipant;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import com.arjuna.wst.tests.FailureParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -42,46 +43,41 @@
* @since 1.0.
*/
-public class CommitExceptionInPrepare
+public class CommitExceptionInPrepare extends TestCase
{
-
- public static void main (String[] args)
+ public static void testCommitExceptionInPrepare()
+ throws Exception
{
- boolean passed = false;
-
+ UserTransaction ut = UserTransaction.getUserTransaction();
try
{
- UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
FailureParticipant p1 = new FailureParticipant(FailureParticipant.FAIL_IN_PREPARE, FailureParticipant.WRONG_STATE);
DemoDurableParticipant p2 = new DemoDurableParticipant();
ut.begin();
- tm.enlistForDurableTwoPhase(p1, null);
- tm.enlistForDurableTwoPhase(p2, null);
-
+ tm.enlistForDurableTwoPhase(p1, "failure");
+ tm.enlistForDurableTwoPhase(p2, p2.identifier());
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
+ try {
ut.commit();
- passed = false;
+ fail("expected SystemException");
}
catch (com.arjuna.wst.SystemException ex)
{
- passed = true;
+ // we should arrive here
}
catch (com.arjuna.wst.TransactionRolledBackException ex)
{
- passed = true;
+ // or if not we should arrive here
}
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/CommitRollbackInPrepare.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/CommitRollbackInPrepare.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/CommitRollbackInPrepare.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,12 +29,13 @@
* $Id: CommitRollbackInPrepare.java,v 1.6.8.1 2005/11/22 10:36:12 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.UserTransaction;
-import com.arjuna.mwtests.wst.common.DemoDurableParticipant;
-import com.arjuna.mwtests.wst.common.FailureParticipant;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import com.arjuna.wst.tests.FailureParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -42,42 +43,38 @@
* @since 1.0.
*/
-public class CommitRollbackInPrepare
+public class CommitRollbackInPrepare extends TestCase
{
- public static void main (String[] args)
+ public static void testCommitRollbackInPrepare()
+ throws Exception
{
- boolean passed = false;
-
+ UserTransaction ut = UserTransaction.getUserTransaction();
try
{
- UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
FailureParticipant p1 = new FailureParticipant(FailureParticipant.FAIL_IN_PREPARE, FailureParticipant.NONE);
DemoDurableParticipant p2 = new DemoDurableParticipant();
ut.begin();
- tm.enlistForDurableTwoPhase(p1, null);
- tm.enlistForDurableTwoPhase(p2, null);
-
+ tm.enlistForDurableTwoPhase(p1, "failure");
+ tm.enlistForDurableTwoPhase(p2, p2.identifier());
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
+ try {
ut.commit();
- passed = false;
+ fail("expected TransactionRolledBackException");
}
catch (com.arjuna.wst.TransactionRolledBackException ex)
{
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ // we should arrive here
}
-
+ }
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/MultiParticipants.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/MultiParticipants.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/MultiParticipants.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,11 +29,12 @@
* $Id: MultiParticipants.java,v 1.6.8.1 2005/11/22 10:36:11 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.UserTransaction;
-import com.arjuna.mwtests.wst.common.DemoDurableParticipant;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -41,42 +42,33 @@
* @since 1.0.
*/
-public class MultiParticipants
+public class MultiParticipants extends TestCase
{
- public static void main (String[] args)
+ public static void testMultiParticipants()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransaction.getUserTransaction();
- TransactionManager tm = TransactionManager.getTransactionManager();
+ TransactionManager tm = TransactionManager.getTransactionManager();
DemoDurableParticipant p1 = new DemoDurableParticipant();
DemoDurableParticipant p2 = new DemoDurableParticipant();
DemoDurableParticipant p3 = new DemoDurableParticipant();
DemoDurableParticipant p4 = new DemoDurableParticipant();
-
+
ut.begin();
-
- tm.enlistForDurableTwoPhase(p1, null);
- tm.enlistForDurableTwoPhase(p2, null);
- tm.enlistForDurableTwoPhase(p3, null);
- tm.enlistForDurableTwoPhase(p4, null);
-
- ut.commit();
+ try {
+ tm.enlistForDurableTwoPhase(p1, p1.identifier());
+ tm.enlistForDurableTwoPhase(p2, p2.identifier());
+ tm.enlistForDurableTwoPhase(p3, p3.identifier());
+ tm.enlistForDurableTwoPhase(p4, p4.identifier());
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
- passed = p1.passed() && p2.passed() && p3.passed() && p4.passed();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ ut.commit();
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/NestedTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/NestedTransaction.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/NestedTransaction.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,9 +29,10 @@
* $Id: NestedTransaction.java,v 1.3.24.1 2005/11/22 10:36:12 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.UserTransaction;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -39,17 +40,16 @@
* @since 1.0.
*/
-public class NestedTransaction
+public class NestedTransaction extends TestCase
{
- public static void main (String[] args)
+ public static void testNestedTransaction()
+ throws Exception
{
- boolean passed = false;
-
+ UserTransaction ut = UserTransaction.getUserTransaction();
try
{
- UserTransaction ut = UserTransaction.getUserTransaction();
-
+
// nesting not supported, so each is a separate top-level tx.
ut.begin();
@@ -59,20 +59,26 @@
ut.commit();
ut.commit();
- }
- catch (com.arjuna.wst.UnknownTransactionException ex)
+
+ fail("expected WrongStateException");
+ }
+ catch (com.arjuna.wst.WrongStateException ex)
{
- passed = true;
+ // original test was expecting UnknownTransactionException
+ // we should get here;
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
}
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ catch (Exception eouter)
+ {
+ try {
+ ut.rollback();
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
}
-
+ }
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/NullCommitTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/NullCommitTransaction.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/NullCommitTransaction.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,9 +29,10 @@
* $Id: NullCommitTransaction.java,v 1.3.24.1 2005/11/22 10:36:12 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.UserTransaction;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -39,32 +40,16 @@
* @since 1.0.
*/
-public class NullCommitTransaction
+public class NullCommitTransaction extends TestCase
{
- public static void main (String[] args)
+ public static void testNullCommitTransaction()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransaction.getUserTransaction();
ut.begin();
ut.commit();
-
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/NullRollbackTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/NullRollbackTransaction.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/NullRollbackTransaction.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,9 +29,10 @@
* $Id: NullRollbackTransaction.java,v 1.3.24.1 2005/11/22 10:36:11 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.UserTransaction;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -39,32 +40,16 @@
* @since 1.0.
*/
-public class NullRollbackTransaction
+public class NullRollbackTransaction extends TestCase
{
- public static void main (String[] args)
+ public static void testNullRollbackTransaction()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransaction.getUserTransaction();
ut.begin();
ut.rollback();
-
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/PrintTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/PrintTransaction.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/PrintTransaction.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,9 +29,10 @@
* $Id: PrintTransaction.java,v 1.1.24.1 2005/11/22 10:36:12 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.UserTransaction;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -39,15 +40,12 @@
* @since 1.0.
*/
-public class PrintTransaction
+public class PrintTransaction extends TestCase
{
- public static void main (String[] args)
+ public static void testPrintTransaction()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransaction.getUserTransaction();
ut.begin();
@@ -57,18 +55,5 @@
ut.commit();
System.out.println("\nCurrent: "+ut);
-
- passed = true;
}
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
- }
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/ResumeNullTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/ResumeNullTransaction.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/ResumeNullTransaction.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,9 +29,10 @@
* $Id: ResumeNullTransaction.java,v 1.2.24.1 2005/11/22 10:36:12 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -39,30 +40,14 @@
* @since 1.0.
*/
-public class ResumeNullTransaction
+public class ResumeNullTransaction extends TestCase
{
- public static void main (String[] args)
+ public static void testResumeNullTransaction()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
TransactionManager ut = TransactionManager.getTransactionManager();
ut.resume(null);
-
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/RollbackExceptionInRollback.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/RollbackExceptionInRollback.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/RollbackExceptionInRollback.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,12 +29,13 @@
* $Id: RollbackExceptionInRollback.java,v 1.6.8.1 2005/11/22 10:36:12 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.UserTransaction;
-import com.arjuna.mwtests.wst.common.DemoDurableParticipant;
-import com.arjuna.mwtests.wst.common.FailureParticipant;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import com.arjuna.wst.tests.FailureParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -42,38 +43,28 @@
* @since 1.0.
*/
-public class RollbackExceptionInRollback
+public class RollbackExceptionInRollback extends TestCase
{
-
- public static void main (String[] args)
+ public static void testRollbackExceptionInRollback()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
FailureParticipant p1 = new FailureParticipant(FailureParticipant.FAIL_IN_ROLLBACK, FailureParticipant.WRONG_STATE);
DemoDurableParticipant p2 = new DemoDurableParticipant();
ut.begin();
-
- tm.enlistForDurableTwoPhase(p1, null);
- tm.enlistForDurableTwoPhase(p2, null);
-
- ut.rollback();
+ try {
+ tm.enlistForDurableTwoPhase(p1, "failure");
+ tm.enlistForDurableTwoPhase(p2, p2.identifier());
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ ut.rollback();
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SingleParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/SingleParticipant.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SingleParticipant.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,11 +29,12 @@
* $Id: SingleParticipant.java,v 1.7.8.1 2005/11/22 10:36:12 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.UserTransaction;
-import com.arjuna.mwtests.wst.common.DemoDurableParticipant;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -41,36 +42,27 @@
* @since 1.0.
*/
-public class SingleParticipant
+public class SingleParticipant extends TestCase
{
- public static void main (String[] args)
+ public static void testSingleParticipant()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
DemoDurableParticipant p = new DemoDurableParticipant();
ut.begin();
-
- tm.enlistForDurableTwoPhase(p, null);
-
- ut.commit();
+ try {
+ tm.enlistForDurableTwoPhase(p, p.identifier());
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
- passed = p.passed();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ ut.commit();
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendCommitTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/SuspendCommitTransaction.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendCommitTransaction.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,12 +29,13 @@
* $Id: SuspendCommitTransaction.java,v 1.2.24.1 2005/11/22 10:36:12 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.TxContext;
import com.arjuna.mw.wst.UserTransaction;
import com.arjuna.wst.UnknownTransactionException;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -42,39 +43,35 @@
* @since 1.0.
*/
-public class SuspendCommitTransaction
+public class SuspendCommitTransaction extends TestCase
{
- public static void main (String[] args)
+ public static void testSuspendCommitTransaction()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
- UserTransaction ut = UserTransaction.getUserTransaction();
+ UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
ut.begin();
-
+
+ try {
TxContext ctx = tm.suspend();
System.out.println("Suspended: "+ctx);
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
+ try {
ut.commit();
}
catch (UnknownTransactionException ex)
{
- passed = true;
+ // we should arrive here
}
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendNullTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/SuspendNullTransaction.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendNullTransaction.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,10 +29,11 @@
* $Id: SuspendNullTransaction.java,v 1.2.24.1 2005/11/22 10:36:11 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.TxContext;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -40,33 +41,18 @@
* @since 1.0.
*/
-public class SuspendNullTransaction
+public class SuspendNullTransaction extends TestCase
{
- public static void main (String[] args)
+ public static void testSuspendNullTransaction()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
TransactionManager ut = TransactionManager.getTransactionManager();
TxContext ctx = ut.suspend();
System.out.println("Suspended: "+ctx);
- if (ctx == null)
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ assertTrue(ctx == null);
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendResumeCommitTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/SuspendResumeCommitTransaction.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendResumeCommitTransaction.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,11 +29,12 @@
* $Id: SuspendResumeCommitTransaction.java,v 1.2.24.1 2005/11/22 10:36:11 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.TxContext;
import com.arjuna.mw.wst.UserTransaction;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -41,15 +42,12 @@
* @since 1.0.
*/
-public class SuspendResumeCommitTransaction
+public class SuspendResumeCommitTransaction extends TestCase
{
- public static void main (String[] args)
+ public static void testSuspendResumeCommitTransaction()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
@@ -64,18 +62,5 @@
System.out.println("\nResumed");
ut.commit();
-
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendResumeParticipants.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/SuspendResumeParticipants.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendResumeParticipants.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,12 +29,13 @@
* $Id: SuspendResumeParticipants.java,v 1.6.8.1 2005/11/22 10:36:12 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.TxContext;
import com.arjuna.mw.wst.UserTransaction;
-import com.arjuna.mwtests.wst.common.DemoDurableParticipant;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -42,15 +43,12 @@
* @since 1.0.
*/
-public class SuspendResumeParticipants
+public class SuspendResumeParticipants extends TestCase
{
- public static void main (String[] args)
+ public static void testSuspendResumeParticipants()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
DemoDurableParticipant p1 = new DemoDurableParticipant();
@@ -61,11 +59,11 @@
System.out.println("Starting first transaction.\n");
ut.begin();
-
- tm.enlistForDurableTwoPhase(p1, null);
- tm.enlistForDurableTwoPhase(p2, null);
- tm.enlistForDurableTwoPhase(p3, null);
- tm.enlistForDurableTwoPhase(p4, null);
+ try {
+ tm.enlistForDurableTwoPhase(p1, p1.identifier());
+ tm.enlistForDurableTwoPhase(p2, p2.identifier());
+ tm.enlistForDurableTwoPhase(p3, p3.identifier());
+ tm.enlistForDurableTwoPhase(p4, p4.identifier());
TxContext ctx = tm.suspend();
@@ -78,20 +76,13 @@
tm.resume(ctx);
System.out.println("\nCommitting first transaction.\n");
-
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
ut.commit();
-
- passed = p1.passed() && p2.passed() && p3.passed() && p4.passed();
}
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
- }
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendResumeSingleParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/SuspendResumeSingleParticipant.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendResumeSingleParticipant.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,12 +29,13 @@
* $Id: SuspendResumeSingleParticipant.java,v 1.6.8.1 2005/11/22 10:36:11 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.TxContext;
import com.arjuna.mw.wst.UserTransaction;
-import com.arjuna.mwtests.wst.common.DemoDurableParticipant;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -42,22 +43,19 @@
* @since 1.0.
*/
-public class SuspendResumeSingleParticipant
+public class SuspendResumeSingleParticipant extends TestCase
{
- public static void main (String[] args)
+ public static void testSuspendResumeSingleParticipant()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
DemoDurableParticipant p = new DemoDurableParticipant();
-
+ try {
ut.begin();
- tm.enlistForDurableTwoPhase(p, null);
+ tm.enlistForDurableTwoPhase(p, p.identifier());
TxContext ctx = tm.suspend();
@@ -66,20 +64,13 @@
tm.resume(ctx);
System.out.println("\nResumed\n");
-
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
ut.commit();
-
- passed = p.passed();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/SuspendTransaction.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SuspendTransaction.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,11 +29,12 @@
* $Id: SuspendTransaction.java,v 1.2.24.1 2005/11/22 10:36:11 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.TxContext;
import com.arjuna.mw.wst.UserTransaction;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -41,15 +42,12 @@
* @since 1.0.
*/
-public class SuspendTransaction
+public class SuspendTransaction extends TestCase
{
- public static void main (String[] args)
+ public static void testSuspendTransaction()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
@@ -58,18 +56,5 @@
TxContext ctx = tm.suspend();
System.out.println("Suspended: "+ctx);
-
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SynchronizationParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/SynchronizationParticipant.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/SynchronizationParticipant.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,12 +29,13 @@
* $Id: SynchronizationParticipant.java,v 1.7.8.1 2005/11/22 10:36:11 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.TransactionManager;
import com.arjuna.mw.wst.UserTransaction;
-import com.arjuna.mwtests.wst.common.DemoDurableParticipant;
-import com.arjuna.mwtests.wst.common.DemoVolatileParticipant;
+import com.arjuna.wst.tests.DemoDurableParticipant;
+import com.arjuna.wst.tests.DemoVolatileParticipant;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -42,38 +43,28 @@
* @since 1.0.
*/
-public class SynchronizationParticipant
+public class SynchronizationParticipant extends TestCase
{
- public static void main (String[] args)
+ public static void testSynchronizationParticipant()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
DemoDurableParticipant p = new DemoDurableParticipant();
DemoVolatileParticipant pz = new DemoVolatileParticipant();
ut.begin();
-
- tm.enlistForDurableTwoPhase(p, null);
- tm.enlistForVolatileTwoPhase(pz, null);
-
+ try {
+ tm.enlistForDurableTwoPhase(p, p.identifier());
+ tm.enlistForVolatileTwoPhase(pz, pz.identifier());
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
+ }
ut.commit();
-
- passed = p.passed();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/ThreadedTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wst/basic/ThreadedTransaction.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wst/tests/junit/basic/ThreadedTransaction.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,9 +29,10 @@
* $Id: ThreadedTransaction.java,v 1.1.24.1 2005/11/22 10:36:11 kconner Exp $
*/
-package com.arjuna.mwtests.wst.basic;
+package com.arjuna.wst.tests.junit.basic;
import com.arjuna.mw.wst.UserTransaction;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -41,9 +42,11 @@
class ThreadedObject extends Thread
{
-
+ Exception exception;
+
public ThreadedObject ()
{
+ exception = null;
}
public void run ()
@@ -68,43 +71,36 @@
}
catch (Exception ex)
{
- ex.printStackTrace();
+ ex.printStackTrace();
+ exception = ex;
}
}
}
-public class ThreadedTransaction
+public class ThreadedTransaction extends TestCase
{
- public static void main (String[] args)
+ public static void testThreadedTransaction()
+ throws Exception
{
- boolean passed = false;
- int size = 10;
- ThreadedObject objs[] = new ThreadedObject[size];
-
- try
- {
- for (int i = 0; i < size; i++)
- objs[i] = new ThreadedObject();
+ boolean passed = false;
+ int size = 10;
+ ThreadedObject objs[] = new ThreadedObject[size];
+
+ for (int i = 0; i < size; i++)
+ objs[i] = new ThreadedObject();
- for (int j = 0; j < size; j++)
- objs[j].start();
+ for (int j = 0; j < size; j++)
+ objs[j].start();
- for (int k = 0; k < size; k++)
- objs[k].join();
+ for (int k = 0; k < size; k++)
+ objs[k].join();
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ for (int k = 0; k < size; k++) {
+ if (objs[k].exception != null) {
+ throw objs[k].exception;
+ }
+ }
}
-
}
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/DemoParticipant.java (from rev 18509, labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wstx/common/DemoParticipant.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/DemoParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/DemoParticipant.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,257 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: DemoParticipant.java,v 1.4 2004/03/15 13:25:26 nmcl Exp $
+ */
+
+package com.arjuna.wstx.tests;
+
+import com.arjuna.mw.wstx.resource.Participant;
+
+import com.arjuna.mw.wscf.common.Qualifier;
+
+import com.arjuna.mw.wstx.common.*;
+
+import com.arjuna.mw.wstx.status.*;
+
+import com.arjuna.mw.wsas.completionstatus.CompletionStatus;
+
+import com.arjuna.mw.wsas.status.*;
+
+import com.arjuna.mw.wscf.model.twophase.status.*;
+
+import com.arjuna.ats.arjuna.state.*;
+
+import com.arjuna.mw.wsas.exceptions.SystemException;
+import com.arjuna.mw.wsas.exceptions.WrongStateException;
+
+import com.arjuna.mw.wstx.exceptions.HeuristicHazardException;
+import com.arjuna.mw.wstx.exceptions.HeuristicMixedException;
+import com.arjuna.mw.wstx.exceptions.HeuristicCommitException;
+import com.arjuna.mw.wstx.exceptions.HeuristicRollbackException;
+import com.arjuna.mw.wstx.exceptions.InvalidParticipantException;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: DemoParticipant.java,v 1.4 2004/03/15 13:25:26 nmcl Exp $
+ * @since 1.0.
+ */
+
+public class DemoParticipant implements Participant
+{
+
+ public DemoParticipant (TxId id)
+ {
+ _status = Active.instance();
+ _passed = false;
+ _id = id;
+ }
+
+ public final boolean passed ()
+ {
+ return _passed;
+ }
+
+ /**
+ * Prepare the participant. This is to allow
+ * an implementation to put a manager/factory entity in the loop
+ * to (possibly) improve performance, for example. So, the entity
+ * that implements this interface may be wrapping multiple
+ * implementation objects.
+ *
+ * @param Qualifier[] qualifiers Any additional information.
+ * @exception InvalidInferiorException Thrown if the inferior identity is invalid
+ * (e.g., refers to an unknown inferior.)
+ * @exception WrongStateException Thrown if the state of the inferior is such that
+ * it cannot prepare.
+ * @exception HeuristicHazardException Thrown if upon preparing, the inferior finds that
+ * some of its enlisted inferiors have return statuses which
+ * mean it cannot determine what the result of issuing prepare
+ * to them has been.
+ * @exception HeuristicMixedException Thrown if upon preparing, the inferior finds that
+ * some of its enlisted inferiors have return statuses which
+ * mean some of them cancelled and some of them confirmed.
+ * @exception SystemException Thrown if some other error occurred.
+ * @return the vote.
+ */
+
+ public Vote prepare (Qualifier[] qualifiers) throws SystemException, InvalidParticipantException, WrongStateException, HeuristicHazardException, HeuristicMixedException
+ {
+ System.out.println("DemoParticipant.prepare ( "+_id+" )");
+
+ if (_status.equals(Active.instance()))
+ {
+ _status = Prepared.instance();
+
+ return new VoteCommit();
+ }
+ else
+ throw new WrongStateException();
+ }
+
+ /**
+ * Confirm the inferior specified.
+ *
+ * @param Qualifier[] qualifiers Any additional information.
+ * @exception InvalidInferiorException Thrown if the inferior identity is invalid
+ * (e.g., refers to an unknown inferior.)
+ * @exception WrongStateException Thrown if the state of the inferior is such that
+ * it cannot confirm.
+ * @exception HeuristicHazardException Thrown if upon preparing, the inferior finds that
+ * some of its enlisted inferiors have return statuses which
+ * mean it cannot determine what the result of issuing confirm
+ * to them has been.
+ * @exception HeuristicMixedException Thrown if upon preparing, the inferior finds that
+ * some of its enlisted inferiors have return statuses which
+ * mean some of them cancelled and some of them confirmed.
+ * @exception InferiorCancelledException Thrown if the inferior cancels
+ * rather than confirms.
+ * @exception SystemException Thrown if some other error occurred.
+ */
+
+ public void commit (Qualifier[] qualifiers) throws SystemException, InvalidParticipantException, WrongStateException, HeuristicHazardException, HeuristicMixedException, HeuristicRollbackException
+ {
+ System.out.println("DemoParticipant.commit ( "+_id+" )");
+
+ if (!_status.equals(Prepared.instance()))
+ throw new WrongStateException();
+ else
+ {
+ _status = Committed.instance();
+
+ _passed = true;
+ }
+ }
+
+ public void commitOnePhase (Qualifier[] qualifiers) throws SystemException, InvalidParticipantException, WrongStateException, HeuristicHazardException, HeuristicMixedException, HeuristicRollbackException
+ {
+ System.out.println("DemoParticipant.commitOnePhase ( "+_id+" )");
+
+ if (_status.equals(Prepared.instance()))
+ throw new WrongStateException();
+ else
+ {
+ _status = Committed.instance();
+
+ _passed = true;
+ }
+ }
+
+ /**
+ * Cancel the inferior specified.
+ *
+ * @param Qualifier[] qualifiers Any additional information.
+ * @exception InvalidInferiorException Thrown if the inferior identity is invalid
+ * (e.g., refers to an unknown inferior.)
+ * @exception WrongStateException Thrown if the state of the inferior is such that
+ * it cannot cancel.
+ * @exception HeuristicHazardException Thrown if upon preparing, the inferior finds that
+ * some of its enlisted inferiors have return statuses which
+ * mean it cannot determine what the result of issuing cancel
+ * to them has been.
+ * @exception HeuristicMixedException Thrown if upon preparing, the inferior finds that
+ * some of its enlisted inferiors have return statuses which
+ * mean some of them cancelled and some of them confirmed.
+ * @exception InferiorConfirmedException Thrown if the inferior confirms
+ * rather than cancels.
+ * @exception SystemException Thrown if some other error occurred.
+ */
+
+ public void rollback (Qualifier[] qualifiers) throws SystemException, InvalidParticipantException, WrongStateException, HeuristicHazardException, HeuristicMixedException, HeuristicCommitException
+ {
+ System.out.println("DemoParticipant.rollback ( "+_id+" )");
+
+ if (!_status.equals(Prepared.instance()) || !_status.equals(Active.instance()))
+ {
+ throw new WrongStateException();
+ }
+ else
+ _status = RolledBack.instance();
+ }
+
+ /**
+ * Inform the specified inferior that it has generated a contradiction.
+ *
+ * @param Qualifier[] qualifiers Any additional qualifiers that may affect
+ * the operation.
+ * @exception InvalidInferiorException Thrown if the inferior identity is invalid.
+ * @exception WrongStateException Thrown if the inferior is in an invalid state.
+ * @exception SystemException Thrown in the event of a general fault.
+ */
+
+ public void forget (Qualifier[] qualifiers) throws SystemException, InvalidParticipantException, WrongStateException
+ {
+ System.out.println("DemoParticipant.forget ( "+_id+" )");
+ }
+
+ /**
+ * @param Qualifier[] qualifiers Any additional qualifiers that may affect
+ * the operation.
+ * @exception InvalidInferiorException Thrown if the inferior identity is invalid.
+ * @exception SystemException Thrown in the event of a general fault.
+ * @return the current status of the specified inferior.
+ */
+
+ public Status status (Qualifier[] qualifiers) throws SystemException, InvalidParticipantException
+ {
+ System.out.println("DemoParticipant.status ( "+_id+" )");
+
+ return _status;
+ }
+
+ /**
+ * @return the name of this inferior.
+ */
+
+ public String name ()
+ {
+ return "DemoParticipant";
+ }
+
+ /**
+ * These methods are required so that the coordinator can serialise and
+ * de-serialise information about the inferior during completion and
+ * recovery.
+ */
+
+ public boolean packState (OutputObjectState os)
+ {
+ return true;
+ }
+
+ public boolean unpackState (InputObjectState os)
+ {
+ return true;
+ }
+
+ private Status _status;
+ private boolean _passed;
+ private TxId _id;
+
+}
+
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/DemoSynchronization.java (from rev 18509, labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wstx/common/DemoSynchronization.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/DemoSynchronization.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/DemoSynchronization.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2002,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: DemoSynchronization.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
+ */
+
+package com.arjuna.wstx.tests;
+
+import com.arjuna.mw.wstx.resource.Synchronization;
+
+import com.arjuna.mw.wscf.common.Qualifier;
+
+import com.arjuna.mw.wstx.common.TxId;
+
+import com.arjuna.mw.wsas.completionstatus.CompletionStatus;
+
+import com.arjuna.mw.wsas.status.Status;
+
+import com.arjuna.mw.wsas.exceptions.SystemException;
+
+/**
+ * @author Mark Little (mark.little at arjuna.com)
+ * @version $Id: DemoSynchronization.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
+ * @since 1.0.
+ */
+
+public class DemoSynchronization implements Synchronization
+{
+
+ public DemoSynchronization (TxId id)
+ {
+ _tid = id;
+ }
+
+ public void beforeCompletion () throws SystemException
+ {
+ System.out.println("DemoSynchronization.beforeCompletion ( "+_tid+" )");
+ }
+
+ public void afterCompletion (CompletionStatus cs) throws SystemException
+ {
+ System.out.println("DemoSynchronization.afterCompletion ( "+_tid+", "+cs+" )");
+ }
+
+ /**
+ * @return the name of this inferior.
+ */
+
+ public String name ()
+ {
+ return "DemoSynchronization";
+ }
+
+ private TxId _tid;
+
+}
+
Added: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/TestInitialisation.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/TestInitialisation.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/TestInitialisation.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,11 @@
+package com.arjuna.wstx.tests;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: adinn
+ * Date: Mar 7, 2008
+ * Time: 1:50:50 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestInitialisation {
+}
Copied: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic (from rev 18509, labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wstx/basic)
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullCommitTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wstx/basic/NullCommitTransaction.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullCommitTransaction.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,45 +29,28 @@
* $Id: NullCommitTransaction.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
*/
-package com.arjuna.mwtests.wstx.basic;
+package com.arjuna.wstx.tests.junit.basic;
import com.arjuna.mw.wstx.UserTransaction;
import com.arjuna.mw.wstx.UserTransactionFactory;
+import junit.framework.TestCase;
-import com.arjuna.mw.wstx.exceptions.NoTransactionException;
-
/**
* @author Mark Little (mark.little at arjuna.com)
* @version $Id: NullCommitTransaction.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
* @since 1.0.
*/
-public class NullCommitTransaction
+public class NullCommitTransaction extends TestCase
{
- public static void main (String[] args)
+ public static void testNullCommitTransaction()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransactionFactory.userTransaction();
ut.begin();
ut.commit();
-
- passed = true;
}
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
- }
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullNestedCommit.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wstx/basic/NullNestedCommit.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullNestedCommit.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,31 +29,27 @@
* $Id: NullNestedCommit.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
*/
-package com.arjuna.mwtests.wstx.basic;
+package com.arjuna.wstx.tests.junit.basic;
import com.arjuna.mw.wstx.UserTransaction;
import com.arjuna.mw.wstx.UserTransactionFactory;
+import junit.framework.TestCase;
-import com.arjuna.mw.wstx.exceptions.NoTransactionException;
-import com.arjuna.mw.wstx.exceptions.TransactionRolledBackException;
-
/**
* @author Mark Little (mark.little at arjuna.com)
* @version $Id: NullNestedCommit.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
* @since 1.0.
*/
-public class NullNestedCommit
+public class NullNestedCommit extends TestCase
{
- public static void main (String[] args)
+ public static void testNullNestedCommit()
+ throws Exception
{
- boolean passed = false;
-
+ UserTransaction ut = UserTransactionFactory.userTransaction();
try
{
- UserTransaction ut = UserTransactionFactory.userTransaction();
-
ut.begin();
ut.begin();
@@ -61,18 +57,13 @@
ut.commit();
ut.commit();
-
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
}
-
-}
+ }
+}
\ No newline at end of file
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullNestedRollback.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wstx/basic/NullNestedRollback.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullNestedRollback.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,31 +29,27 @@
* $Id: NullNestedRollback.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
*/
-package com.arjuna.mwtests.wstx.basic;
+package com.arjuna.wstx.tests.junit.basic;
import com.arjuna.mw.wstx.UserTransaction;
import com.arjuna.mw.wstx.UserTransactionFactory;
+import junit.framework.TestCase;
-import com.arjuna.mw.wstx.exceptions.NoTransactionException;
-import com.arjuna.mw.wstx.exceptions.TransactionRolledBackException;
-
/**
* @author Mark Little (mark.little at arjuna.com)
* @version $Id: NullNestedRollback.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
* @since 1.0.
*/
-public class NullNestedRollback
+public class NullNestedRollback extends TestCase
{
- public static void main (String[] args)
+ public static void testNullNestedRollback()
+ throws Exception
{
- boolean passed = false;
-
- try
+ UserTransaction ut = UserTransactionFactory.userTransaction();
+ try
{
- UserTransaction ut = UserTransactionFactory.userTransaction();
-
ut.begin();
ut.begin();
@@ -61,18 +57,13 @@
ut.rollback();
ut.commit();
-
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
}
-
+ }
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullRollbackOnly.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wstx/basic/NullRollbackOnly.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullRollbackOnly.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,13 +29,13 @@
* $Id: NullRollbackOnly.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
*/
-package com.arjuna.mwtests.wstx.basic;
+package com.arjuna.wstx.tests.junit.basic;
import com.arjuna.mw.wstx.UserTransaction;
import com.arjuna.mw.wstx.UserTransactionFactory;
-import com.arjuna.mw.wstx.exceptions.NoTransactionException;
import com.arjuna.mw.wstx.exceptions.TransactionRolledBackException;
+import junit.framework.TestCase;
/**
* @author Mark Little (mark.little at arjuna.com)
@@ -43,17 +43,17 @@
* @since 1.0.
*/
-public class NullRollbackOnly
+public class NullRollbackOnly extends TestCase
{
- public static void main (String[] args)
+ public static void testNullRollbackOnly()
+ throws Exception
{
- boolean passed = false;
-
+ UserTransaction ut = UserTransactionFactory.userTransaction();
try
{
- UserTransaction ut = UserTransactionFactory.userTransaction();
-
+ ut = UserTransactionFactory.userTransaction();
+
ut.begin();
ut.setRollbackOnly();
@@ -62,17 +62,13 @@
}
catch (TransactionRolledBackException ex)
{
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ // we should get here
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
}
-
+ }
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullRollbackTransaction.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wstx/basic/NullRollbackTransaction.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/NullRollbackTransaction.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,45 +29,28 @@
* $Id: NullRollbackTransaction.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
*/
-package com.arjuna.mwtests.wstx.basic;
+package com.arjuna.wstx.tests.junit.basic;
import com.arjuna.mw.wstx.UserTransaction;
import com.arjuna.mw.wstx.UserTransactionFactory;
+import junit.framework.TestCase;
-import com.arjuna.mw.wstx.exceptions.NoTransactionException;
-
/**
* @author Mark Little (mark.little at arjuna.com)
* @version $Id: NullRollbackTransaction.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
* @since 1.0.
*/
-public class NullRollbackTransaction
+public class NullRollbackTransaction extends TestCase
{
- public static void main (String[] args)
+ public static void testNullRollbackTransaction()
+ throws Exception
{
- boolean passed = false;
-
- try
- {
UserTransaction ut = UserTransactionFactory.userTransaction();
ut.begin();
ut.rollback();
-
- passed = true;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
}
-
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/SingleParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wstx/basic/SingleParticipant.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/SingleParticipant.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,31 +29,28 @@
* $Id: SingleParticipant.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
*/
-package com.arjuna.mwtests.wstx.basic;
+package com.arjuna.wstx.tests.junit.basic;
-import com.arjuna.mwtests.wstx.common.DemoParticipant;
+import com.arjuna.wstx.tests.DemoParticipant;
import com.arjuna.mw.wstx.*;
+import junit.framework.TestCase;
-import com.arjuna.mw.wstx.exceptions.NoTransactionException;
-import com.arjuna.mw.wstx.exceptions.TransactionRolledBackException;
-
/**
* @author Mark Little (mark.little at arjuna.com)
* @version $Id: SingleParticipant.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
* @since 1.0.
*/
-public class SingleParticipant
+public class SingleParticipant extends TestCase
{
- public static void main (String[] args)
+ public static void testSingleParticipant()
+ throws Exception
{
- boolean passed = false;
-
- try
+ UserTransaction ut = UserTransactionFactory.userTransaction();
+ try
{
- UserTransaction ut = UserTransactionFactory.userTransaction();
TransactionManager tm = TransactionManagerFactory.transactionManager();
DemoParticipant p = new DemoParticipant(ut.identifier());
@@ -62,18 +59,12 @@
tm.enlist(p);
ut.commit();
-
- passed = p.passed();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
}
-
+ }
}
Modified: labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/SynchronizationParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes/com/arjuna/mwtests/wstx/basic/SynchronizationParticipant.java 2008-02-19 14:29:36 UTC (rev 18509)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/classes/com/arjuna/wstx/tests/junit/basic/SynchronizationParticipant.java 2008-03-09 19:24:16 UTC (rev 18783)
@@ -29,31 +29,29 @@
* $Id: SynchronizationParticipant.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
*/
-package com.arjuna.mwtests.wstx.basic;
+package com.arjuna.wstx.tests.junit.basic;
-import com.arjuna.mwtests.wstx.common.*;
-
import com.arjuna.mw.wstx.*;
+import com.arjuna.wstx.tests.DemoParticipant;
+import com.arjuna.wstx.tests.DemoSynchronization;
+import junit.framework.TestCase;
-import com.arjuna.mw.wstx.exceptions.NoTransactionException;
-import com.arjuna.mw.wstx.exceptions.TransactionRolledBackException;
-
/**
* @author Mark Little (mark.little at arjuna.com)
* @version $Id: SynchronizationParticipant.java,v 1.1 2002/11/25 11:00:54 nmcl Exp $
* @since 1.0.
*/
-public class SynchronizationParticipant
+public class SynchronizationParticipant extends TestCase
{
- public static void main (String[] args)
+ public static void testSynchronizationParticipant()
+ throws Exception
{
- boolean passed = false;
-
- try
+ UserTransaction ut = UserTransactionFactory.userTransaction();
+
+ try
{
- UserTransaction ut = UserTransactionFactory.userTransaction();
TransactionManager tm = TransactionManagerFactory.transactionManager();
DemoParticipant p = new DemoParticipant(ut.identifier());
DemoSynchronization s = new DemoSynchronization(ut.identifier());
@@ -64,18 +62,12 @@
tm.addSynchronization(s);
ut.commit();
-
- passed = p.passed();
+ } catch (Exception eouter) {
+ try {
+ ut.rollback();
+ } catch(Exception einner) {
+ }
+ throw eouter;
}
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
-
- if (passed)
- System.out.println("\nPassed.");
- else
- System.out.println("\nFailed.");
}
-
}
Added: labs/jbosstm/trunk/XTS/WSTX/tests/dd/wstx-tests_application.xml
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/dd/wstx-tests_application.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/dd/wstx-tests_application.xml 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,35 @@
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2006, 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 General Public License, v. 2.0.
+ 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 General Public License for more details.
+ You should have received a copy of the GNU General Public License,
+ v. 2.0 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ (C) 2005-2006,
+ @author JBoss Inc.
+-->
+
+<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
+
+<application>
+ <display-name>Arjuna WSTX Tests</display-name>
+
+ <description>Arjuna WSTX Tests</description>
+
+ <module>
+ <web>
+ <web-uri>wstx-tests.war</web-uri>
+ <context-root>/wstx-tests</context-root>
+ </web>
+ </module>
+</application>
Added: labs/jbosstm/trunk/XTS/WSTX/tests/dd/wstx-tests_web-app.xml
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/tests/dd/wstx-tests_web-app.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/tests/dd/wstx-tests_web-app.xml 2008-03-09 19:24:16 UTC (rev 18783)
@@ -0,0 +1,119 @@
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2006, 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 General Public License, v. 2.0.
+ 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 General Public License for more details.
+ You should have received a copy of the GNU General Public License,
+ v. 2.0 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ (C) 2005-2006,
+ @author JBoss Inc.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
+
+<web-app>
+ <display-name>Arjuna WSTX Tests</display-name>
+
+ <description>Arjuna WSTX Tests</description>
+
+ <!-- Initialise Arjuna TX services -->
+ <listener>
+ <listener-class>com.arjuna.webservices.wsarjtx.server.TerminationParticipantInitialisation</listener-class>
+ </listener>
+ <listener>
+ <listener-class>com.arjuna.webservices.wsarjtx.server.TerminationCoordinatorInitialisation</listener-class>
+ </listener>
+
+ <!-- Initialise WS-AT services -->
+ <listener>
+ <listener-class>com.arjuna.webservices.wsat.server.CompletionCoordinatorInitialisation</listener-class>
+ </listener>
+ <listener>
+ <listener-class>com.arjuna.webservices.wsat.server.CompletionInitiatorInitialisation</listener-class>
+ </listener>
+ <listener>
+ <listener-class>com.arjuna.webservices.wsat.server.CoordinatorInitialisation</listener-class>
+ </listener>
+ <listener>
+ <listener-class>com.arjuna.webservices.wsat.server.ParticipantInitialisation</listener-class>
+ </listener>
+
+ <!-- Initialise WS-BA services -->
+ <listener>
+ <listener-class>com.arjuna.webservices.wsba.server.CoordinatorCompletionCoordinatorInitialisation</listener-class>
+ </listener>
+ <listener>
+ <listener-class>com.arjuna.webservices.wsba.server.CoordinatorCompletionParticipantInitialisation</listener-class>
+ </listener>
+ <listener>
+ <listener-class>com.arjuna.webservices.wsba.server.ParticipantCompletionCoordinatorInitialisation</listener-class>
+ </listener>
+ <listener>
+ <listener-class>com.arjuna.webservices.wsba.server.ParticipantCompletionParticipantInitialisation</listener-class>
+ </listener>
+
+ <!-- Initialise WS-T -->
+ <listener>
+ <listener-class>com.arjuna.wst.messaging.deploy.TransactionInitialisation</listener-class>
+ </listener>
+
+ <!-- Initialise the HTTP Client -->
+ <listener>
+ <listener-class>com.arjuna.webservices.transport.http.HttpClientInitialisation</listener-class>
+ </listener>
+
+ <!-- Initialise the tests -->
+ <listener>
+ <listener-class>com.arjuna.wstx.tests.TestInitialisation</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>HTTP SOAP Service Multiplexor Servlet</servlet-name>
+ <servlet-class>com.arjuna.webservices.transport.http.HttpServiceMultiplexorServlet</servlet-class>
+ <!--
+ The BaseHttpURI and BaseHttpsURI parameters specify the default values
+ used to generate the service URIs without reference to an incoming
+ request.
+ -->
+ <init-param>
+ <param-name>BaseHttpURI</param-name>
+ <param-value>http://@hostname@:@port@/wstx-tests/soap/</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>JUnit Tests Servlet</servlet-name>
+ <servlet-class>com.arjuna.qa.junit.WSTXTestRunnerServlet</servlet-class>
+ <init-param>
+ <param-name>TestSuiteClassName</param-name>
+ <param-value>com.arjuna.wst.tests.TestSuite</param-value>
+ </init-param>
+ <load-on-startup>4</load-on-startup>
+ </servlet>
+
+ <!-- servlet mappings -->
+ <servlet-mapping>
+ <servlet-name>HTTP SOAP Service Multiplexor Servlet</servlet-name>
+ <url-pattern>/soap/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>JUnit Tests Servlet</servlet-name>
+ <url-pattern>/index.html</url-pattern>
+ </servlet-mapping>
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+</web-app>
Modified: labs/jbosstm/trunk/XTS/WSTX/xml/tests.xml
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/xml/tests.xml 2008-03-09 19:02:43 UTC (rev 18782)
+++ labs/jbosstm/trunk/XTS/WSTX/xml/tests.xml 2008-03-09 19:24:16 UTC (rev 18783)
@@ -20,19 +20,19 @@
-->
<test-definitions>
- <test name="com.arjuna.mwtests.wst.basic.NullCommitTransaction">
+ <test name="com.arjuna.wst.tests.junit.basic.NullCommitTransaction">
<parameters/>
</test>
- <test name="com.arjuna.mwtests.wst.basic.NullRollbackTransaction">
+ <test name="com.arjuna.wst.tests.junit.basic.NullRollbackTransaction">
<parameters/>
</test>
- <test name="com.arjuna.mwtests.wst.basic.NestedTransaction">
+ <test name="com.arjuna.wst.tests.junit.basic.NestedTransaction">
<parameters/>
</test>
- <test name="com.arjuna.mwtests.wst.basic.SingleParticipant">
+ <test name="com.arjuna.wst.tests.junit.basic.SingleParticipant">
<parameters/>
</test>
- <test name="com.arjuna.mwtests.wst.basic.SynchronizationTransaction">
+ <test name="com.arjuna.wst.tests.junit.basic.SynchronizationTransaction">
<parameters/>
</test>
</test-definitions>
More information about the jboss-svn-commits
mailing list