[jboss-svn-commits] JBL Code SVN: r32108 - in labs/jbosstm/trunk/txbridge: tests and 10 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Mar 16 07:43:52 EDT 2010
Author: jhalliday
Date: 2010-03-16 07:43:51 -0400 (Tue, 16 Mar 2010)
New Revision: 32108
Added:
labs/jbosstm/trunk/txbridge/tests/dd/inbound/
labs/jbosstm/trunk/txbridge/tests/dd/inbound/jaxws-handlers-server.xml
labs/jbosstm/trunk/txbridge/tests/dd/inbound/jboss-beans.xml
labs/jbosstm/trunk/txbridge/tests/dd/inbound/web.xml
labs/jbosstm/trunk/txbridge/tests/dd/outbound/
labs/jbosstm/trunk/txbridge/tests/dd/outbound/service-web.xml
labs/jbosstm/trunk/txbridge/tests/dd/outbound/web.xml
labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/
labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/client/
labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/client/TestClient.java
labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/client/TestService.java
labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/service/
labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/service/TestServiceImpl.java
labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/utility/
labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/utility/TestDurableParticipant.java
labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/utility/TestVolatileParticipant.java
Removed:
labs/jbosstm/trunk/txbridge/tests/dd/jaxws-handlers-client.xml
labs/jbosstm/trunk/txbridge/tests/dd/jaxws-handlers-server.xml
labs/jbosstm/trunk/txbridge/tests/dd/jboss-beans.xml
labs/jbosstm/trunk/txbridge/tests/dd/web.xml
Modified:
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/outbound/BridgeXAResource.java
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/outbound/OutboundBridgeManager.java
labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/outbound/OutboundBridgeRecoveryManager.java
labs/jbosstm/trunk/txbridge/tests/build.xml
labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/client/TestClient.java
labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/service/TestServiceImpl.java
Log:
Additions to the txbridge test harness. JBTM-44
Modified: labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/outbound/BridgeXAResource.java
===================================================================
--- labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/outbound/BridgeXAResource.java 2010-03-16 09:45:35 UTC (rev 32107)
+++ labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/outbound/BridgeXAResource.java 2010-03-16 11:43:51 UTC (rev 32108)
@@ -106,7 +106,7 @@
try
{
bridgeWrapper = BridgeWrapper.recover(bridgeWrapperId);
- // TODO: check for null!
+ // rollback and commit will deal with bridgeWrapper == null cases via ensureRecoveryIsDoneIfNeeded
}
catch(UnknownTransactionException unknownTransactionException)
{
@@ -118,6 +118,36 @@
}
/**
+ * Attempts to reconnect the BridgeWrapper if it's not already connected.
+ * If XTS is not ready yet, throws the specified Exception.
+ *
+ * @param exceptionCode a XAException status code.
+ * @throws XAException if XTS recovery is not complete.
+ */
+ private void ensureRecoveryIsDoneIfNeeded(int exceptionCode) throws XAException
+ {
+ if(bridgeWrapper == null) {
+ // XTS recovery was not ready when deserialization ran. maybe it's ready now, so try again...
+ try
+ {
+ bridgeWrapper = BridgeWrapper.recover(bridgeWrapperId);
+ if(bridgeWrapper == null) {
+ // nope, still not ready...
+ throw new XAException(exceptionCode);
+ }
+ }
+ catch(UnknownTransactionException unknownTransactionException)
+ {
+ log.error("Unable to recover subordinate transaction id="+bridgeWrapperId, unknownTransactionException);
+ XAException xaException = new XAException(XAException.XAER_NOTA);
+ xaException.initCause(unknownTransactionException);
+ throw xaException;
+ }
+ }
+ }
+
+
+ /**
* Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.
*
* @param xid A global transaction identifier
@@ -162,6 +192,10 @@
{
log.trace("rollback(Xid="+xid+")");
+ // if XTS has not finished recovery yet we can't throw XA_RETRY here.
+ // We'll settle for RMFAIL which has transient semantics.
+ ensureRecoveryIsDoneIfNeeded(XAException.XAER_RMFAIL);
+
try
{
bridgeWrapper.rollback();
@@ -183,6 +217,9 @@
{
log.trace("commit(Xid="+xid+", onePhase="+onePhase+")");
+ // if XTS has not finished recovery yet we wont be able to complete until it does.
+ ensureRecoveryIsDoneIfNeeded(XAException.XA_RETRY);
+
try
{
if(onePhase)
Modified: labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/outbound/OutboundBridgeManager.java
===================================================================
--- labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/outbound/OutboundBridgeManager.java 2010-03-16 09:45:35 UTC (rev 32107)
+++ labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/outbound/OutboundBridgeManager.java 2010-03-16 11:43:51 UTC (rev 32108)
@@ -51,6 +51,8 @@
{
private static final Logger log = Logger.getLogger(OutboundBridgeManager.class);
+ public static String BRIDGEWRAPPER_PREFIX = "txbridge_";
+
// maps JTA Tx Id to OutboundBridge instance.
private static final ConcurrentMap<Uid, org.jboss.jbossts.txbridge.outbound.OutboundBridge> outboundBridgeMappings = new ConcurrentHashMap<Uid, org.jboss.jbossts.txbridge.outbound.OutboundBridge>();
@@ -114,7 +116,7 @@
}
// TODO: allow params to be configurable, or at least pass timeout down.
- BridgeWrapper bridgeWrapper = BridgeWrapper.create(0, false);
+ BridgeWrapper bridgeWrapper = BridgeWrapper.create(BRIDGEWRAPPER_PREFIX, 0, false);
org.jboss.jbossts.txbridge.outbound.OutboundBridge outboundBridge = new org.jboss.jbossts.txbridge.outbound.OutboundBridge(bridgeWrapper);
XAResource xaResource = new org.jboss.jbossts.txbridge.outbound.BridgeXAResource(externalTxId, bridgeWrapper);
Modified: labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/outbound/OutboundBridgeRecoveryManager.java
===================================================================
--- labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/outbound/OutboundBridgeRecoveryManager.java 2010-03-16 09:45:35 UTC (rev 32107)
+++ labs/jbosstm/trunk/txbridge/src/org/jboss/jbossts/txbridge/outbound/OutboundBridgeRecoveryManager.java 2010-03-16 11:43:51 UTC (rev 32108)
@@ -23,6 +23,7 @@
import com.arjuna.ats.arjuna.recovery.RecoveryManager;
import com.arjuna.ats.arjuna.recovery.RecoveryModule;
import org.apache.log4j.Logger;
+import org.jboss.jbossts.xts.bridge.at.BridgeWrapper;
/**
* Integrates with JBossAS MC lifecycle and JBossTS recovery manager to provide
@@ -76,6 +77,8 @@
{
log.trace("periodicWorkSecondPass()");
- // TODO BridgeWrapper recovery scan for orphans - pending JBTM-725 work.
+ BridgeWrapper[] bridgeWrappers = BridgeWrapper.scan(OutboundBridgeManager.BRIDGEWRAPPER_PREFIX);
+ // TODO: do something useful with the results.
+
}
}
Modified: labs/jbosstm/trunk/txbridge/tests/build.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/build.xml 2010-03-16 09:45:35 UTC (rev 32107)
+++ labs/jbosstm/trunk/txbridge/tests/build.xml 2010-03-16 11:43:51 UTC (rev 32108)
@@ -34,11 +34,17 @@
<path id="build-prereqs">
<fileset dir="../../build/extlib">
+
+ <!-- TODO remove old names -->
<include name="servlet-api.jar"/>
+ <include name="jta.jar"/>
+ <include name="jboss-ejb-api.jar"/>
+
+ <include name="jboss-servlet-api_3.0_spec.jar"/>
<include name="log4j.jar"/>
- <include name="jta.jar"/>
- <include name="jpa-api.jar"/>
- <include name="jboss-ejb-api.jar"/>
+ <include name="jboss-transaction-api_1.1_spec.jar"/>
+ <include name="hibernate-jpa-2.0-api.jar"/>
+ <include name="jboss-ejb-api_3.1_spec.jar"/>
<include name="junit.jar"/>
</fileset>
@@ -86,28 +92,41 @@
<target name="dist" depends="compile"
description="generate the distribution">
- <copy file="${dd}/jaxws-handlers-server.xml"
- todir="${build}/classes/org/jboss/jbossts/txbridge/tests/service"/>
-
- <jar destfile="${build}/txbridge-tests-service.jar">
+ <copy file="dd/inbound/jaxws-handlers-server.xml"
+ todir="${build}/classes/org/jboss/jbossts/txbridge/tests/inbound/service"/>
+ <jar destfile="${build}/txbridge-inbound-tests-service.jar">
<fileset dir="${build}/classes">
- <include name="org/jboss/jbossts/txbridge/tests/service/*"/>
- <include name="org/jboss/jbossts/txbridge/tests/utility/*"/>
+ <include name="org/jboss/jbossts/txbridge/tests/inbound/service/*"/>
+ <include name="org/jboss/jbossts/txbridge/tests/inbound/utility/*"/>
</fileset>
- <metainf dir="dd">
+ <metainf dir="dd/inbound">
<include name="jboss-beans.xml"/>
</metainf>
</jar>
- <copy file="${dd}/jaxws-handlers-client.xml"
- todir="${build}/classes/org/jboss/jbossts/txbridge/tests/client"/>
+ <war warfile="${build}/txbridge-inbound-tests-client.war" webxml="dd/inbound/web.xml">
+ <classes dir="${build}/classes">
+ <include name="org/jboss/jbossts/txbridge/tests/inbound/client/*"/>
+ </classes>
+ </war>
- <war warfile="${build}/txbridge-tests-client.war" webxml="${dd}/web.xml">
+ <copy file="dd/outbound/jaxws-handlers-server.xml"
+ todir="${build}/classes/org/jboss/jbossts/txbridge/tests/outbound/service"/>
+ <war warfile="${build}/txbridge-outbound-tests-service.war" webxml="dd/outbound/service-web.xml">
<classes dir="${build}/classes">
- <include name="org/jboss/jbossts/txbridge/tests/client/*"/>
+ <include name="org/jboss/jbossts/txbridge/tests/outbound/service/*"/>
+ <include name="org/jboss/jbossts/txbridge/tests/outbound/utility/*"/>
</classes>
</war>
+ <copy file="dd/outbound/jaxws-handlers-client.xml"
+ todir="${build}/classes/org/jboss/jbossts/txbridge/tests/outbound/client"/>
+ <war warfile="${build}/txbridge-outbound-tests-client.war" webxml="${dd}/outbound/web.xml">
+ <classes dir="${build}/classes">
+ <include name="org/jboss/jbossts/txbridge/tests/outbound/client/*"/>
+ </classes>
+ </war>
+
</target>
<!-- ##################################################################################### -->
@@ -115,13 +134,30 @@
<property name="jbossas.home" location="/home/jhalli/IdeaProjects/jboss/jbossas_trunk/build/target/jboss-6.0.0-SNAPSHOT"/>
<property name="jbossas.server" value="default"/>
- <target name="deploy-service" depends="dist" description="deploy EJB to JBossAS">
- <copy file="${build}/txbridge-tests-service.jar" todir="${jbossas.home}/server/${jbossas.server}/deploy"/>
+ <target name="deploy-inbound-service" depends="dist" description="deploy EJB to JBossAS">
+ <copy file="${build}/txbridge-inbound-tests-service.jar"
+ todir="${jbossas.home}/server/${jbossas.server}/deploy"
+ overwrite="true"/>
</target>
- <target name="deploy-client" depends="dist" description="deploy Servlet to JBossAS">
- <copy file="${build}/txbridge-tests-client.war" todir="${jbossas.home}/server/${jbossas.server}/deploy"/>
+ <!-- http://localhost:8080/txbridge-inbound-tests-client/testclient -->
+ <target name="deploy-inbound-client" depends="dist" description="deploy Servlet to JBossAS">
+ <copy file="${build}/txbridge-inbound-tests-client.war"
+ todir="${jbossas.home}/server/${jbossas.server}/deploy"
+ overwrite="true"/>
</target>
+ <target name="deploy-outbound-service" depends="dist" description="deploy WS to JBossAS">
+ <copy file="${build}/txbridge-outbound-tests-service.war"
+ todir="${jbossas.home}/server/${jbossas.server}/deploy"
+ overwrite="true"/>
+ </target>
+
+ <target name="deploy-outbound-client" depends="dist" description="deploy Servlet to JBossAS">
+ <copy file="${build}/txbridge-outbound-tests-client.war"
+ todir="${jbossas.home}/server/${jbossas.server}/deploy"
+ overwrite="true"/>
+ </target>
+
</project>
Copied: labs/jbosstm/trunk/txbridge/tests/dd/inbound/jaxws-handlers-server.xml (from rev 32033, labs/jbosstm/trunk/txbridge/tests/dd/jaxws-handlers-server.xml)
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/dd/inbound/jaxws-handlers-server.xml (rev 0)
+++ labs/jbosstm/trunk/txbridge/tests/dd/inbound/jaxws-handlers-server.xml 2010-03-16 11:43:51 UTC (rev 32108)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2007, 2009
+ * @author JBoss Inc.
+-->
+
+<!-- Server side config file for inbound bridging -->
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
+
+ <handler-chain>
+ <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
+
+ <!-- JSR 181 does not seem to directly define how the handler chain is constructed from this xml,
+ although JSR 109 6.2.2.3 seems to indicate the parser is required to maintain the declared ordering.
+ JSR 224 9.3.2 says the constructed chain is then invoked in reverse order for inbound requests.
+ Since we need the HeaderContextProcessor to be invoked before the InboundBridgeHandler,
+ we therefore list the InboundBridgeHandler first -->
+
+ <handler>
+ <handler-name>TransactionBridgeHandler</handler-name>
+ <handler-class>org.jboss.jbossts.txbridge.inbound.JaxWSTxInboundBridgeHandler</handler-class>
+ </handler>
+
+ <handler>
+ <handler-name>WebServicesTxContextHandler</handler-name>
+ <handler-class>com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor</handler-class>
+ </handler>
+
+ </handler-chain>
+</handler-chains>
Copied: labs/jbosstm/trunk/txbridge/tests/dd/inbound/jboss-beans.xml (from rev 32035, labs/jbosstm/trunk/txbridge/tests/dd/jboss-beans.xml)
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/dd/inbound/jboss-beans.xml (rev 0)
+++ labs/jbosstm/trunk/txbridge/tests/dd/inbound/jboss-beans.xml 2010-03-16 11:43:51 UTC (rev 32108)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * and individual contributors as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2010
+ * @author JBoss, by Red Hat.
+-->
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="TxBridgeTests" class="org.jboss.jbossts.txbridge.tests.inbound.utility.TestXAResourceRecoveryHelper">
+
+ <constructor factoryClass="org.jboss.jbossts.txbridge.tests.inbound.utility.TestXAResourceRecoveryHelper" factoryMethod="getInstance"/>
+
+ <depends>jboss.xts:service=XTSService</depends>
+
+ <depends>jboss:service=TransactionManager</depends>
+
+ </bean>
+
+</deployment>
\ No newline at end of file
Copied: labs/jbosstm/trunk/txbridge/tests/dd/inbound/web.xml (from rev 32035, labs/jbosstm/trunk/txbridge/tests/dd/web.xml)
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/dd/inbound/web.xml (rev 0)
+++ labs/jbosstm/trunk/txbridge/tests/dd/inbound/web.xml 2010-03-16 11:43:51 UTC (rev 32108)
@@ -0,0 +1,38 @@
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * and individual contributors as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2010
+ * @author JBoss, by Red Hat.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+ <display-name>XML Transaction Bridge Inbound Test Client</display-name>
+
+ <description>XML Transaction Bridge Inbound Test Client</description>
+
+ <servlet>
+ <servlet-name>Inbound Test Client Servlet</servlet-name>
+ <servlet-class>org.jboss.jbossts.txbridge.tests.inbound.client.TestClient</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Inbound Test Client Servlet</servlet-name>
+ <url-pattern>/testclient</url-pattern>
+ </servlet-mapping>
+</web-app>
Deleted: labs/jbosstm/trunk/txbridge/tests/dd/jaxws-handlers-client.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/dd/jaxws-handlers-client.xml 2010-03-16 09:45:35 UTC (rev 32107)
+++ labs/jbosstm/trunk/txbridge/tests/dd/jaxws-handlers-client.xml 2010-03-16 11:43:51 UTC (rev 32108)
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2007, 2009
- * @author JBoss Inc.
--->
-
-<!-- Client side config file for outbound bridging -->
-<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
-
- <handler-chain>
- <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
-
- <!-- JSR 181 does not seem to directly define how the handler chain is constructed from this xml,
- although JSR 109 6.2.2.3 seems to indicate the parser is required to maintain the declared ordering.
-
- Since we need the OutboundBridgeHandler to be invoked before the HeaderContextProcessor,
- we list them in that order -->
-
- <handler>
- <handler-name>TransactionBridgeHandler</handler-name>
- <handler-class>org.jboss.jbossts.txbridge.outbound.JaxWSTxOutboundBridgeHandler</handler-class>
- </handler>
-
- <handler>
- <handler-name>WebServicesTxContextHandler</handler-name>
- <handler-class>com.arjuna.mw.wst11.client.JaxWSHeaderContextProcessor</handler-class>
- </handler>
-
- </handler-chain>
-</handler-chains>
Deleted: labs/jbosstm/trunk/txbridge/tests/dd/jaxws-handlers-server.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/dd/jaxws-handlers-server.xml 2010-03-16 09:45:35 UTC (rev 32107)
+++ labs/jbosstm/trunk/txbridge/tests/dd/jaxws-handlers-server.xml 2010-03-16 11:43:51 UTC (rev 32108)
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2007, 2009
- * @author JBoss Inc.
--->
-
-<!-- Server side config file for inbound bridging -->
-<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
-
- <handler-chain>
- <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
-
- <!-- JSR 181 does not seem to directly define how the handler chain is constructed from this xml,
- although JSR 109 6.2.2.3 seems to indicate the parser is required to maintain the declared ordering.
- JSR 224 9.3.2 says the constructed chain is then invoked in reverse order for inbound requests.
- Since we need the HeaderContextProcessor to be invoked before the InboundBridgeHandler,
- we therefore list the InboundBridgeHandler first -->
-
- <handler>
- <handler-name>TransactionBridgeHandler</handler-name>
- <handler-class>org.jboss.jbossts.txbridge.inbound.JaxWSTxInboundBridgeHandler</handler-class>
- </handler>
-
- <handler>
- <handler-name>WebServicesTxContextHandler</handler-name>
- <handler-class>com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor</handler-class>
- </handler>
-
- </handler-chain>
-</handler-chains>
Deleted: labs/jbosstm/trunk/txbridge/tests/dd/jboss-beans.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/dd/jboss-beans.xml 2010-03-16 09:45:35 UTC (rev 32107)
+++ labs/jbosstm/trunk/txbridge/tests/dd/jboss-beans.xml 2010-03-16 11:43:51 UTC (rev 32108)
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates,
- * and individual contributors as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2010
- * @author JBoss, by Red Hat.
--->
-
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <bean name="TxBridgeTests" class="org.jboss.jbossts.txbridge.tests.inbound.utility.TestXAResourceRecoveryHelper">
-
- <constructor factoryClass="org.jboss.jbossts.txbridge.tests.inbound.utility.TestXAResourceRecoveryHelper" factoryMethod="getInstance"/>
-
- <depends>jboss.xts:service=XTSService</depends>
-
- <depends>jboss:service=TransactionManager</depends>
-
- </bean>
-
-</deployment>
\ No newline at end of file
Added: labs/jbosstm/trunk/txbridge/tests/dd/outbound/service-web.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/dd/outbound/service-web.xml (rev 0)
+++ labs/jbosstm/trunk/txbridge/tests/dd/outbound/service-web.xml 2010-03-16 11:43:51 UTC (rev 32108)
@@ -0,0 +1,38 @@
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * and individual contributors as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2010
+ * @author JBoss, by Red Hat.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+ <display-name>XML Transaction Bridge Outbound Test Service</display-name>
+
+ <description>XML Transaction Bridge Outbound Test Service</description>
+
+ <servlet>
+ <servlet-name>Outbound Test Service Servlet</servlet-name>
+ <servlet-class>org.jboss.jbossts.txbridge.tests.outbound.service.TestServiceImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Outbound Test Service Servlet</servlet-name>
+ <url-pattern>/TestServiceImpl/*</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: labs/jbosstm/trunk/txbridge/tests/dd/outbound/web.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/dd/outbound/web.xml (rev 0)
+++ labs/jbosstm/trunk/txbridge/tests/dd/outbound/web.xml 2010-03-16 11:43:51 UTC (rev 32108)
@@ -0,0 +1,38 @@
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * and individual contributors as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2010
+ * @author JBoss, by Red Hat.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+ <display-name>XML Transaction Bridge Outbound Test Client</display-name>
+
+ <description>XML Transaction Bridge Outbound Test Client</description>
+
+ <servlet>
+ <servlet-name>Outbound Test Client Servlet</servlet-name>
+ <servlet-class>org.jboss.jbossts.txbridge.tests.outbound.client.TestClient</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Outbound Test Client Servlet</servlet-name>
+ <url-pattern>/testclient</url-pattern>
+ </servlet-mapping>
+</web-app>
Deleted: labs/jbosstm/trunk/txbridge/tests/dd/web.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/dd/web.xml 2010-03-16 09:45:35 UTC (rev 32107)
+++ labs/jbosstm/trunk/txbridge/tests/dd/web.xml 2010-03-16 11:43:51 UTC (rev 32108)
@@ -1,38 +0,0 @@
-<!--
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates,
- * and individual contributors as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2010
- * @author JBoss, by Red Hat.
--->
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
- <display-name>XML Transaction Bridge Test Client</display-name>
-
- <description>XML Transaction Bridge Test Client</description>
-
- <servlet>
- <servlet-name>Test Client Servlet</servlet-name>
- <servlet-class>org.jboss.jbossts.txbridge.tests.inbound.client.TestClient</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>Test Client Servlet</servlet-name>
- <url-pattern>/testclient</url-pattern>
- </servlet-mapping>
-</web-app>
Modified: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/client/TestClient.java
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/client/TestClient.java 2010-03-16 09:45:35 UTC (rev 32107)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/client/TestClient.java 2010-03-16 11:43:51 UTC (rev 32108)
@@ -62,8 +62,8 @@
{
try
{
- URL wsdlLocation = new URL("http://localhost:8080/txbridge-tests-service/TestServiceImpl?wsdl");
- QName serviceName = new QName("http://service.tests.txbridge.jbossts.jboss.org/", "TestServiceImplService");
+ URL wsdlLocation = new URL("http://localhost:8080/txbridge-inbound-tests-service/TestServiceImpl?wsdl");
+ QName serviceName = new QName("http://service.inbound.tests.txbridge.jbossts.jboss.org/", "TestServiceImplService");
Service service = Service.create(wsdlLocation, serviceName);
testService = service.getPort(TestService.class);
Modified: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/service/TestServiceImpl.java
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/service/TestServiceImpl.java 2010-03-16 09:45:35 UTC (rev 32107)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/service/TestServiceImpl.java 2010-03-16 11:43:51 UTC (rev 32108)
@@ -21,14 +21,20 @@
package org.jboss.jbossts.txbridge.tests.inbound.service;
import org.apache.log4j.Logger;
+import org.jboss.jbossts.txbridge.tests.inbound.utility.TestSynchronization;
import org.jboss.jbossts.txbridge.tests.inbound.utility.TestXAResource;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
import javax.jws.HandlerChain;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.transaction.TransactionManager;
+
/**
* Implementation of a web service used by txbridge test cases.
*
@@ -53,6 +59,7 @@
TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
try {
+ tm.getTransaction().registerSynchronization(new TestSynchronization());
tm.getTransaction().enlistResource(new TestXAResource());
} catch(Exception e) {
log.error("could not enlist resource", e);
Copied: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/client/TestClient.java (from rev 32035, labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/client/TestClient.java)
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/client/TestClient.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/client/TestClient.java 2010-03-16 11:43:51 UTC (rev 32108)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * and individual contributors as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2010,
+ * @author JBoss, by Red Hat.
+ */
+package org.jboss.jbossts.txbridge.tests.outbound.client;
+
+import com.arjuna.ats.jta.exceptions.RollbackException;
+import org.apache.log4j.Logger;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.transaction.UserTransaction;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URL;
+
+/**
+ * Servlet which includes test methods for exercising the txbridge.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-01
+ */
+public class TestClient extends HttpServlet
+{
+ private static Logger log = Logger.getLogger(TestClient.class);
+
+ private UserTransaction userTransaction;
+ private ServletContext context;
+ private TestService testService;
+
+ /**
+ * Initialise the servlet.
+ * @param config The servlet configuration.
+ */
+ public void init(final ServletConfig config)
+ throws ServletException
+ {
+ try
+ {
+ Context ic = new InitialContext();
+ userTransaction = (UserTransaction) ic.lookup("java:comp/UserTransaction");
+
+ URL wsdlLocation = new URL("http://localhost:8080/txbridge-outbound-tests-service/TestServiceImpl?wsdl");
+ QName serviceName = new QName("http://service.outbound.tests.txbridge.jbossts.jboss.org/", "TestServiceImplService");
+
+ Service service = Service.create(wsdlLocation, serviceName);
+ testService = service.getPort(TestService.class);
+
+ context = config.getServletContext();
+ }
+ catch(Exception e)
+ {
+ throw new ServletException(e);
+ }
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+ String param = request.getParameter("param");
+
+ log.info("param: "+param);
+
+ try
+ {
+ log.info("starting the transaction...");
+
+ userTransaction.begin();
+
+ log.info("transaction ID= " + userTransaction.toString());
+
+ log.info("calling business Web Services...");
+
+ //////////////////////
+
+ testService.doStuff();
+
+ //////////////////////
+
+ log.info("calling commit on the transaction...");
+
+ userTransaction.commit();
+ }
+ catch (final RollbackException re)
+ {
+ log.info("Transaction rolled back") ;
+ }
+ catch (Exception e)
+ {
+ log.info("problem: ", e);
+ }
+
+ PrintWriter out = response.getWriter();
+ out.println("done");
+ out.close();
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/client/TestService.java
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/client/TestService.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/client/TestService.java 2010-03-16 11:43:51 UTC (rev 32108)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * and individual contributors as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2010,
+ * @author JBoss, by Red Hat.
+ */
+package org.jboss.jbossts.txbridge.tests.outbound.client;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * Interface for a web service used by txbridge test cases. Client side version.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-03
+ */
+ at WebService
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+ at HandlerChain(file = "jaxws-handlers-client.xml") // relative path from the class file
+public interface TestService
+{
+ public void doStuff();
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/service/TestServiceImpl.java
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/service/TestServiceImpl.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/service/TestServiceImpl.java 2010-03-16 11:43:51 UTC (rev 32108)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * and individual contributors as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2010,
+ * @author JBoss, by Red Hat.
+ */
+package org.jboss.jbossts.txbridge.tests.outbound.service;
+
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.mw.wst11.TransactionManager;
+import com.arjuna.mw.wst11.TransactionManagerFactory;
+import com.arjuna.mw.wst11.UserTransactionFactory;
+import com.arjuna.wst.Durable2PCParticipant;
+import com.arjuna.wst.Volatile2PCParticipant;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.jbossts.txbridge.tests.outbound.utility.TestDurableParticipant;
+import org.jboss.jbossts.txbridge.tests.outbound.utility.TestVolatileParticipant;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * Implementation of a web service used by txbridge test cases.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-03
+ */
+ at WebService
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+ at HandlerChain(file = "jaxws-handlers-server.xml") // relative path from the class file
+public class TestServiceImpl
+{
+ private static Logger log = Logger.getLogger(TestServiceImpl.class);
+
+ @WebMethod
+ public void doStuff()
+ {
+ log.trace("doStuff()");
+
+ String transactionId = UserTransactionFactory.userTransaction().toString();
+
+ try {
+ TransactionManager tm = TransactionManagerFactory.transactionManager();
+
+ Volatile2PCParticipant volatileParticipant = new TestVolatileParticipant();
+ tm.enlistForVolatileTwoPhase(volatileParticipant, "org.jboss.jbossts.txbridge.tests.outbound.Volatile:" + new Uid().toString());
+
+ Durable2PCParticipant durableParticipant = new TestDurableParticipant();
+ tm.enlistForDurableTwoPhase(durableParticipant, "org.jboss.jbossts.txbridge.tests.outbound.Durable:" + new Uid().toString());
+
+ } catch(Exception e) {
+ log.error("could not enlist participant", e);
+ }
+
+ }
+}
Added: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/utility/TestDurableParticipant.java
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/utility/TestDurableParticipant.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/utility/TestDurableParticipant.java 2010-03-16 11:43:51 UTC (rev 32108)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * and individual contributors as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2010,
+ * @author JBoss, by Red Hat.
+ */
+package org.jboss.jbossts.txbridge.tests.outbound.utility;
+
+import com.arjuna.wst.*;
+import org.apache.log4j.Logger;
+
+import java.io.Serializable;
+
+/**
+ * Implementation of Durable2PCParticipant for use in tx test cases.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-03
+ */
+public class TestDurableParticipant implements Durable2PCParticipant, Serializable
+{
+ private static Logger log = Logger.getLogger(TestDurableParticipant.class);
+
+ /**
+ * Perform any work necessary to allow it to either commit or rollback
+ * the work performed by the Web service under the scope of the
+ * transaction. The implementation is free to do whatever it needs to in
+ * order to fulfill the implicit contract between it and the coordinator.
+ *
+ * @return an indication of whether it can prepare or not.
+ * @see com.arjuna.wst.Vote
+ */
+ @Override
+ public Vote prepare() throws WrongStateException, SystemException
+ {
+ log.trace("prepare()");
+ return new Prepared();
+ }
+
+ /**
+ * The participant should make permanent the work that it controls.
+ */
+ @Override
+ public void commit() throws WrongStateException, SystemException
+ {
+ log.trace("commit()");
+ }
+
+ /**
+ * The participant should undo the work that it controls. The participant
+ * will then return an indication of whether or not it succeeded.
+ */
+ @Override
+ public void rollback() throws WrongStateException, SystemException
+ {
+ log.trace("rollback()");
+ }
+
+ /**
+ * During recovery the participant can enquire as to the status of the
+ * transaction it was registered with. If that transaction is no longer
+ * available (has rolled back) then this operation will be invoked by the
+ * coordination service.
+ */
+ @Override
+ public void unknown() throws SystemException
+ {
+ log.trace("unknown()");
+ }
+
+ /**
+ * During recovery the participant can enquire as to the status of the
+ * transaction it was registered with. If an error occurs (e.g., the
+ * transaction service is unavailable) then this operation will be invoked.
+ */
+ @Override
+ public void error() throws SystemException
+ {
+ log.trace("error()");
+ }
+}
Added: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/utility/TestVolatileParticipant.java
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/utility/TestVolatileParticipant.java (rev 0)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/utility/TestVolatileParticipant.java 2010-03-16 11:43:51 UTC (rev 32108)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * and individual contributors as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2010,
+ * @author JBoss, by Red Hat.
+ */
+package org.jboss.jbossts.txbridge.tests.outbound.utility;
+
+import com.arjuna.wst.*;
+import org.apache.log4j.Logger;
+
+/**
+ * Implementation of Volatile2PCParticipant for use in tx test cases.
+ *
+ * @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-03
+ */
+public class TestVolatileParticipant implements Volatile2PCParticipant
+{
+ private static Logger log = Logger.getLogger(TestVolatileParticipant.class);
+
+ /**
+ * Perform any work necessary to allow it to either commit or rollback
+ * the work performed by the Web service under the scope of the
+ * transaction. The implementation is free to do whatever it needs to in
+ * order to fulfill the implicit contract between it and the coordinator.
+ *
+ * @return an indication of whether it can prepare or not.
+ * @see com.arjuna.wst.Vote
+ */
+ @Override
+ public Vote prepare() throws WrongStateException, SystemException
+ {
+ log.trace("prepare()");
+ return new Prepared();
+ }
+
+ /**
+ * The participant should make permanent the work that it controls.
+ */
+ @Override
+ public void commit() throws WrongStateException, SystemException
+ {
+ log.trace("commit()");
+ }
+
+ /**
+ * The participant should undo the work that it controls. The participant
+ * will then return an indication of whether or not it succeeded.
+ */
+ @Override
+ public void rollback() throws WrongStateException, SystemException
+ {
+ log.trace("rollback()");
+ }
+
+ /**
+ * During recovery the participant can enquire as to the status of the
+ * transaction it was registered with. If that transaction is no longer
+ * available (has rolled back) then this operation will be invoked by the
+ * coordination service.
+ */
+ @Override
+ public void unknown() throws SystemException
+ {
+ log.trace("unknown()");
+ }
+
+ /**
+ * During recovery the participant can enquire as to the status of the
+ * transaction it was registered with. If an error occurs (e.g., the
+ * transaction service is unavailable) then this operation will be invoked.
+ */
+ @Override
+ public void error() throws SystemException
+ {
+ log.trace("error()");
+ }
+}
More information about the jboss-svn-commits
mailing list