[jboss-svn-commits] JBL Code SVN: r20137 - in labs/jbosstm/trunk/XTS/WS-T/tests: src/com/arjuna/wst11 and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri May 23 10:26:49 EDT 2008
Author: adinn
Date: 2008-05-23 10:26:48 -0400 (Fri, 23 May 2008)
New Revision: 20137
Added:
labs/jbosstm/trunk/XTS/WS-T/tests/dd/ws-t11-tests_web-app.xml
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestInitialisation.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestNoExceptionBAPMParticipant.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestNoExceptionBusinessActivityTerminator.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestNoExceptionCompletionCoordinatorParticipant.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestSystemExceptionBAPMParticipant.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestSystemExceptionBusinessActivityTerminator.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestSystemExceptionCompletionCoordinatorParticipant.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestTransactionRolledBackExceptionBusinessActivityTerminator.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestTransactionRolledBackExceptionCompletionCoordinatorParticipant.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestUnknownTransactionExceptionBusinessActivityTerminator.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestUnknownTransactionExceptionCompletionCoordinatorParticipant.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestUtil.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestWrongStateExceptionBAPMParticipant.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithCoordinatorCompletionCoordinatorTestCase.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithCoordinatorCompletionParticipantTestCase.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithParticipantCompletionCoordinatorTestCase.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithParticipantCompletionParticipantTestCase.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/CompletionCoordinatorTestCase.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/CompletionParticipantTestCase.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCompletionCoordinatorProcessor.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCompletionInitiatorCallback.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCoordinatorCompletionCoordinatorProcessor.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCoordinatorCompletionParticipantProcessor.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCoordinatorProcessor.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestParticipantCompletionCoordinatorProcessor.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestParticipantCompletionParticipantProcessor.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestParticipantProcessor.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestSuite.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TwoPCCoordinatorTestCase.java
labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TwoPCParticipantTestCase.java
Log:
new WS-T 1.1 unit test sources and web.xml file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/dd/ws-t11-tests_web-app.xml
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/dd/ws-t11-tests_web-app.xml (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/dd/ws-t11-tests_web-app.xml 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,53 @@
+<!--
+ 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 Web Services Transaction Tests</display-name>
+
+ <description>Arjuna Web Services Transaction Tests</description>
+
+ <!-- Initialise the tests -->
+ <listener>
+ <listener-class>com.arjuna.wst11.tests.TestInitialisation</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>JUnit Tests Servlet</servlet-name>
+ <servlet-class>com.arjuna.qa.junit.TestRunnerServlet</servlet-class>
+ <init-param>
+ <param-name>TestSuiteClassName</param-name>
+ <param-value>com.arjuna.wst11.tests.junit.TestSuite</param-value>
+ </init-param>
+ <load-on-startup>4</load-on-startup>
+ </servlet>
+
+ <!-- servlet mappings -->
+ <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>
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestInitialisation.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestInitialisation.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestInitialisation.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,310 @@
+package com.arjuna.wst11.tests;
+
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletContextEvent;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+import javax.xml.namespace.QName;
+
+import com.arjuna.webservices11.ServiceRegistry;
+
+import com.arjuna.wst.Participant;
+import com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant;
+import com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant;
+
+import com.arjuna.webservices11.wsat.ParticipantInboundEvents;
+import com.arjuna.webservices11.wsba.ParticipantCompletionParticipantInboundEvents;
+import com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents;
+import com.arjuna.webservices11.wsat.processors.CompletionCoordinatorProcessor;
+import com.arjuna.webservices11.wsat.processors.ParticipantProcessor;
+import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
+import com.arjuna.webservices11.wsarjtx.processors.TerminationCoordinatorProcessor;
+import com.arjuna.webservices11.wsarjtx.ArjunaTX11Constants;
+import com.arjuna.webservices11.wsba.processors.ParticipantCompletionParticipantProcessor;
+import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionParticipantProcessor;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+
+import com.arjuna.wst11.messaging.engines.ParticipantEngine;
+import com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine;
+import com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine;
+
+import com.arjuna.wst11.CompletionCoordinatorParticipant;
+import com.arjuna.wst11.BAParticipantManager;
+import com.arjuna.wst11.BusinessActivityTerminator;
+
+
+import com.arjuna.wst.tests.TestPreparedVoteParticipant;
+import com.arjuna.wst.tests.TestAbortedVoteParticipant;
+import com.arjuna.wst.tests.TestReadOnlyVoteParticipant;
+import com.arjuna.wst.tests.TestNoExceptionParticipant;
+import com.arjuna.wst.tests.TestTransactionRolledBackExceptionParticipant;
+import com.arjuna.wst.tests.TestWrongStateExceptionParticipant;
+import com.arjuna.wst.tests.TestSystemExceptionParticipant;
+
+import com.arjuna.wst.tests.TestSystemExceptionBusinessAgreementWithParticipantCompletionParticipant;
+import com.arjuna.wst.tests.TestWrongStateExceptionBusinessAgreementWithParticipantCompletionParticipant;
+import com.arjuna.wst.tests.TestNoExceptionBusinessAgreementWithParticipantCompletionParticipant;
+import com.arjuna.wst.tests.TestFaultedExceptionBusinessAgreementWithParticipantCompletionParticipant;
+
+import com.arjuna.wst.tests.TestSystemExceptionBusinessAgreementWithCoordinatorCompletionParticipant;
+import com.arjuna.wst.tests.TestWrongStateExceptionBusinessAgreementWithCoordinatorCompletionParticipant;
+import com.arjuna.wst.tests.TestNoExceptionBusinessAgreementWithCoordinatorCompletionParticipant;
+import com.arjuna.wst.tests.TestFaultedExceptionBusinessAgreementWithCoordinatorCompletionParticipant;
+
+/**
+ * listener class to set up WSTX 1.1 tests
+ */
+
+public class TestInitialisation implements ServletContextListener
+{
+ private final CompletionCoordinatorParticipant testNoExceptionCompletionCoordinatorParticipant = new TestNoExceptionCompletionCoordinatorParticipant(getCoordinatorCompletionParticipantEndpoint(TestUtil.NOEXCEPTION_TRANSACTION_IDENTIFIER));
+ private final CompletionCoordinatorParticipant testTransactionRolledExceptionCompletionCoordinatorParticipant = new TestTransactionRolledBackExceptionCompletionCoordinatorParticipant(getCoordinatorCompletionParticipantEndpoint(TestUtil.TRANSACTIONROLLEDBACKEXCEPTION_TRANSACTION_IDENTIFIER));
+ private final CompletionCoordinatorParticipant testUnknownTransactionExceptionCompletionCoordinatorParticipant = new TestUnknownTransactionExceptionCompletionCoordinatorParticipant(getCoordinatorCompletionParticipantEndpoint(TestUtil.UNKNOWNTRANSACTIONEXCEPTION_TRANSACTION_IDENTIFIER));
+ private final CompletionCoordinatorParticipant testSystemExceptionCompletionCoordinatorParticipant = new TestSystemExceptionCompletionCoordinatorParticipant(getCoordinatorCompletionParticipantEndpoint(TestUtil.SYSTEMEXCEPTION_TRANSACTION_IDENTIFIER));
+
+ private final Participant testPreparedVoteParticipant = new TestPreparedVoteParticipant();
+ private final Participant testAbortedVoteParticipant = new TestAbortedVoteParticipant();
+ private final Participant testReadOnlyParticipant = new TestReadOnlyVoteParticipant();
+ private final Participant testNoExceptionParticipant = new TestNoExceptionParticipant();
+ private final Participant testTransactionRolledBackExceptionParticipant = new TestTransactionRolledBackExceptionParticipant();
+ private final Participant testWrongStateExceptionParticipant = new TestWrongStateExceptionParticipant();
+ private final Participant testSystemExceptionParticipant = new TestSystemExceptionParticipant();
+
+ private ParticipantInboundEvents testPreparedVoteParticipantEngine;
+ private ParticipantInboundEvents testAbortedVoteParticipantEngine;
+ private ParticipantInboundEvents testReadOnlyParticipantEngine;
+ private ParticipantInboundEvents testNoExceptionParticipantEngine;
+ private ParticipantInboundEvents testTransactionRolledBackExceptionParticipantEngine;
+ private ParticipantInboundEvents testWrongStateExceptionParticipantEngine;
+ private ParticipantInboundEvents testSystemExceptionParticipantEngine;
+
+ private final BusinessAgreementWithParticipantCompletionParticipant testSystemExceptionBusinessAgreementWithParticipantCompletionParticipant = new TestSystemExceptionBusinessAgreementWithParticipantCompletionParticipant();
+ private final BusinessAgreementWithParticipantCompletionParticipant testWrongStateExceptionBusinessAgreementWithParticipantCompletionParticipant = new TestWrongStateExceptionBusinessAgreementWithParticipantCompletionParticipant();
+ private final BusinessAgreementWithParticipantCompletionParticipant testNoExceptionBusinessAgreementWithParticipantCompletionParticipant = new TestNoExceptionBusinessAgreementWithParticipantCompletionParticipant();
+ private final BusinessAgreementWithParticipantCompletionParticipant testFaultedExceptionBusinessAgreementWithParticipantCompletionParticipant = new TestFaultedExceptionBusinessAgreementWithParticipantCompletionParticipant();
+
+ private ParticipantCompletionParticipantInboundEvents testSystemExceptionBusinessAgreementWithParticipantCompletionParticipantEngine;
+ private ParticipantCompletionParticipantInboundEvents testWrongStateExceptionBusinessAgreementWithParticipantCompletionParticipantEngine;
+ private ParticipantCompletionParticipantInboundEvents testNoExceptionBusinessAgreementWithParticipantCompletionParticipantEngine;
+ private ParticipantCompletionParticipantInboundEvents testFaultedExceptionBusinessAgreementWithParticipantCompletionParticipantEngine;
+
+ private final BusinessAgreementWithCoordinatorCompletionParticipant testSystemExceptionBusinessAgreementWithCoordinatorCompletionParticipant = new TestSystemExceptionBusinessAgreementWithCoordinatorCompletionParticipant();
+ private final BusinessAgreementWithCoordinatorCompletionParticipant testWrongStateExceptionBusinessAgreementWithCoordinatorCompletionParticipant = new TestWrongStateExceptionBusinessAgreementWithCoordinatorCompletionParticipant();
+ private final BusinessAgreementWithCoordinatorCompletionParticipant testNoExceptionBusinessAgreementWithCoordinatorCompletionParticipant = new TestNoExceptionBusinessAgreementWithCoordinatorCompletionParticipant();
+ private final BusinessAgreementWithCoordinatorCompletionParticipant testFaultedExceptionBusinessAgreementWithCoordinatorCompletionParticipant = new TestFaultedExceptionBusinessAgreementWithCoordinatorCompletionParticipant();
+
+ private CoordinatorCompletionParticipantInboundEvents testSystemExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine;
+ private CoordinatorCompletionParticipantInboundEvents testWrongStateExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine;
+ private CoordinatorCompletionParticipantInboundEvents testNoExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine;
+ private CoordinatorCompletionParticipantInboundEvents testFaultedExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine;
+
+ private final BAParticipantManager testNoExceptionBAPMParticipant = new TestNoExceptionBAPMParticipant();
+ private final BAParticipantManager testWrongStateExceptionBAPMParticipant = new TestWrongStateExceptionBAPMParticipant();
+ private final BAParticipantManager testSystemExceptionBAPMParticipant = new TestSystemExceptionBAPMParticipant();
+
+ private final BusinessActivityTerminator testNoExceptionBusinessActivityTerminator = new TestNoExceptionBusinessActivityTerminator(getTerminationParticipantEndpoint(TestUtil.NOEXCEPTION_PARTICIPANT_IDENTIFIER));
+ private final BusinessActivityTerminator testUnknownTransactionExceptionBusinessActivityTerminator = new TestUnknownTransactionExceptionBusinessActivityTerminator(getTerminationParticipantEndpoint(TestUtil.UNKNOWNTRANSACTIONEXCEPTION_TRANSACTION_IDENTIFIER));
+ private final BusinessActivityTerminator testTransactionRolledBackExceptionBusinessActivityTerminator = new TestTransactionRolledBackExceptionBusinessActivityTerminator(getTerminationParticipantEndpoint(TestUtil.TRANSACTIONROLLEDBACKEXCEPTION_PARTICIPANT_IDENTIFIER));
+ private final BusinessActivityTerminator testSystemExceptionBusinessActivityTerminator = new TestSystemExceptionBusinessActivityTerminator(getTerminationParticipantEndpoint(TestUtil.SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER));
+ /**
+ * * Notification that the web application initialization
+ * * process is starting.
+ * * All ServletContextListeners are notified of context
+ * * initialization before any filter or servlet in the web
+ * * application is initialized.
+ */
+
+public void contextInitialized(ServletContextEvent sce) {
+ final CompletionCoordinatorProcessor completionCoordinatorProcessor = CompletionCoordinatorProcessor.getProcessor() ;
+ completionCoordinatorProcessor.activateParticipant(testNoExceptionCompletionCoordinatorParticipant, TestUtil.NOEXCEPTION_TRANSACTION_IDENTIFIER);
+ completionCoordinatorProcessor.activateParticipant(testTransactionRolledExceptionCompletionCoordinatorParticipant, TestUtil.TRANSACTIONROLLEDBACKEXCEPTION_TRANSACTION_IDENTIFIER);
+ completionCoordinatorProcessor.activateParticipant(testUnknownTransactionExceptionCompletionCoordinatorParticipant, TestUtil.UNKNOWNTRANSACTIONEXCEPTION_TRANSACTION_IDENTIFIER);
+ completionCoordinatorProcessor.activateParticipant(testSystemExceptionCompletionCoordinatorParticipant, TestUtil.SYSTEMEXCEPTION_TRANSACTION_IDENTIFIER);
+
+ final ParticipantProcessor participantProcessor = ParticipantProcessor.getProcessor() ;
+
+ testPreparedVoteParticipantEngine = new ParticipantEngine(testPreparedVoteParticipant, TestUtil.PREPAREDVOTE_PARTICIPANT_IDENTIFIER, getCoordinatorEndpoint(TestUtil.PREPAREDVOTE_PARTICIPANT_IDENTIFIER));
+ testAbortedVoteParticipantEngine = new ParticipantEngine(testAbortedVoteParticipant, TestUtil.ABORTEDVOTE_PARTICIPANT_IDENTIFIER, getCoordinatorEndpoint(TestUtil.ABORTEDVOTE_PARTICIPANT_IDENTIFIER));
+ testReadOnlyParticipantEngine = new ParticipantEngine(testReadOnlyParticipant, TestUtil.READONLYVOTE_PARTICIPANT_IDENTIFIER, getCoordinatorEndpoint(TestUtil.READONLYVOTE_PARTICIPANT_IDENTIFIER));
+ testNoExceptionParticipantEngine = new ParticipantEngine(testNoExceptionParticipant, TestUtil.NOEXCEPTION_PARTICIPANT_IDENTIFIER, getCoordinatorEndpoint(TestUtil.NOEXCEPTION_PARTICIPANT_IDENTIFIER));
+ testTransactionRolledBackExceptionParticipantEngine = new ParticipantEngine(testTransactionRolledBackExceptionParticipant, TestUtil.TRANSACTIONROLLEDBACKEXCEPTION_PARTICIPANT_IDENTIFIER, getCoordinatorEndpoint(TestUtil.TRANSACTIONROLLEDBACKEXCEPTION_PARTICIPANT_IDENTIFIER));
+ testWrongStateExceptionParticipantEngine = new ParticipantEngine(testWrongStateExceptionParticipant, TestUtil.WRONGSTATEEXCEPTION_PARTICIPANT_IDENTIFIER, getCoordinatorEndpoint(TestUtil.WRONGSTATEEXCEPTION_PARTICIPANT_IDENTIFIER));
+ testSystemExceptionParticipantEngine = new ParticipantEngine(testSystemExceptionParticipant, TestUtil.SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER, getCoordinatorEndpoint(TestUtil.SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER));
+
+ participantProcessor.activateParticipant(testPreparedVoteParticipantEngine, TestUtil.PREPAREDVOTE_PARTICIPANT_IDENTIFIER);
+ participantProcessor.activateParticipant(testAbortedVoteParticipantEngine, TestUtil.ABORTEDVOTE_PARTICIPANT_IDENTIFIER);
+ participantProcessor.activateParticipant(testReadOnlyParticipantEngine, TestUtil.READONLYVOTE_PARTICIPANT_IDENTIFIER);
+ participantProcessor.activateParticipant(testNoExceptionParticipantEngine, TestUtil.NOEXCEPTION_PARTICIPANT_IDENTIFIER);
+ participantProcessor.activateParticipant(testTransactionRolledBackExceptionParticipantEngine, TestUtil.TRANSACTIONROLLEDBACKEXCEPTION_PARTICIPANT_IDENTIFIER);
+ participantProcessor.activateParticipant(testWrongStateExceptionParticipantEngine, TestUtil.WRONGSTATEEXCEPTION_PARTICIPANT_IDENTIFIER);
+ participantProcessor.activateParticipant(testSystemExceptionParticipantEngine, TestUtil.SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER);
+
+ final ParticipantCompletionParticipantProcessor participantCompletionParticipantProcessor = ParticipantCompletionParticipantProcessor.getProcessor() ;
+
+ testSystemExceptionBusinessAgreementWithParticipantCompletionParticipantEngine = new ParticipantCompletionParticipantEngine(TestUtil.SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER, getParticipantCompletionCoordinatorEndpoint(TestUtil.SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER), testSystemExceptionBusinessAgreementWithParticipantCompletionParticipant);
+ testWrongStateExceptionBusinessAgreementWithParticipantCompletionParticipantEngine = new ParticipantCompletionParticipantEngine(TestUtil.WRONGSTATEEXCEPTION_PARTICIPANT_IDENTIFIER, getParticipantCompletionCoordinatorEndpoint(TestUtil.WRONGSTATEEXCEPTION_PARTICIPANT_IDENTIFIER), testWrongStateExceptionBusinessAgreementWithParticipantCompletionParticipant);
+ testNoExceptionBusinessAgreementWithParticipantCompletionParticipantEngine = new ParticipantCompletionParticipantEngine(TestUtil.NOEXCEPTION_PARTICIPANT_IDENTIFIER, getParticipantCompletionCoordinatorEndpoint(TestUtil.NOEXCEPTION_PARTICIPANT_IDENTIFIER), testNoExceptionBusinessAgreementWithParticipantCompletionParticipant);
+ testFaultedExceptionBusinessAgreementWithParticipantCompletionParticipantEngine = new ParticipantCompletionParticipantEngine(TestUtil.FAULTEDEXCEPTION_PARTICIPANT_IDENTIFIER, getParticipantCompletionCoordinatorEndpoint(TestUtil.FAULTEDEXCEPTION_PARTICIPANT_IDENTIFIER), testFaultedExceptionBusinessAgreementWithParticipantCompletionParticipant);
+
+ participantCompletionParticipantProcessor.activateParticipant(testSystemExceptionBusinessAgreementWithParticipantCompletionParticipantEngine, TestUtil.SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER);
+ participantCompletionParticipantProcessor.activateParticipant(testWrongStateExceptionBusinessAgreementWithParticipantCompletionParticipantEngine, TestUtil.WRONGSTATEEXCEPTION_PARTICIPANT_IDENTIFIER);
+ participantCompletionParticipantProcessor.activateParticipant(testNoExceptionBusinessAgreementWithParticipantCompletionParticipantEngine, TestUtil.NOEXCEPTION_PARTICIPANT_IDENTIFIER);
+ participantCompletionParticipantProcessor.activateParticipant(testFaultedExceptionBusinessAgreementWithParticipantCompletionParticipantEngine, TestUtil.FAULTEDEXCEPTION_PARTICIPANT_IDENTIFIER);
+
+ final CoordinatorCompletionParticipantProcessor coordinatorCompletionParticipantProcessor = CoordinatorCompletionParticipantProcessor.getProcessor() ;
+
+ testSystemExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine = new CoordinatorCompletionParticipantEngine(TestUtil.SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER, getCoordinatorCompletionCoordinatorEndpoint(TestUtil.SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER), testSystemExceptionBusinessAgreementWithCoordinatorCompletionParticipant);
+ testWrongStateExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine = new CoordinatorCompletionParticipantEngine(TestUtil.WRONGSTATEEXCEPTION_PARTICIPANT_IDENTIFIER, getCoordinatorCompletionCoordinatorEndpoint(TestUtil.WRONGSTATEEXCEPTION_PARTICIPANT_IDENTIFIER), testWrongStateExceptionBusinessAgreementWithCoordinatorCompletionParticipant);
+ testNoExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine = new CoordinatorCompletionParticipantEngine(TestUtil.NOEXCEPTION_PARTICIPANT_IDENTIFIER, getCoordinatorCompletionCoordinatorEndpoint(TestUtil.NOEXCEPTION_PARTICIPANT_IDENTIFIER), testNoExceptionBusinessAgreementWithCoordinatorCompletionParticipant);
+ testFaultedExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine = new CoordinatorCompletionParticipantEngine(TestUtil.FAULTEDEXCEPTION_PARTICIPANT_IDENTIFIER, getCoordinatorCompletionCoordinatorEndpoint(TestUtil.FAULTEDEXCEPTION_PARTICIPANT_IDENTIFIER), testFaultedExceptionBusinessAgreementWithCoordinatorCompletionParticipant);
+
+
+ coordinatorCompletionParticipantProcessor.activateParticipant(testSystemExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine, TestUtil.SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER);
+ coordinatorCompletionParticipantProcessor.activateParticipant(testWrongStateExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine, TestUtil.WRONGSTATEEXCEPTION_PARTICIPANT_IDENTIFIER);
+ coordinatorCompletionParticipantProcessor.activateParticipant(testNoExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine, TestUtil.NOEXCEPTION_PARTICIPANT_IDENTIFIER);
+ coordinatorCompletionParticipantProcessor.activateParticipant(testFaultedExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine, TestUtil.FAULTEDEXCEPTION_PARTICIPANT_IDENTIFIER);
+
+ // final ParticipantManagerParticipantProcessor participantManagerParticipantProcessor = ParticipantManagerParticipantProcessor.getParticipant() ;
+ // participantManagerParticipantProcessor.activateParticipant(testNoExceptionBAPMParticipant, TestUtil.NOEXCEPTION_PARTICIPANT_IDENTIFIER);
+ // participantManagerParticipantProcessor.activateParticipant(testWrongStateExceptionBAPMParticipant, TestUtil.WRONGSTATEEXCEPTION_PARTICIPANT_IDENTIFIER);
+ // participantManagerParticipantProcessor.activateParticipant(testSystemExceptionBAPMParticipant, TestUtil.SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER);
+
+ final TerminationCoordinatorProcessor terminatorParticipantProcessor = TerminationCoordinatorProcessor.getProcessor() ;
+ terminatorParticipantProcessor.activateParticipant(testNoExceptionBusinessActivityTerminator, TestUtil.NOEXCEPTION_PARTICIPANT_IDENTIFIER);
+ terminatorParticipantProcessor.activateParticipant(testTransactionRolledBackExceptionBusinessActivityTerminator, TestUtil.TRANSACTIONROLLEDBACKEXCEPTION_TRANSACTION_IDENTIFIER);
+ terminatorParticipantProcessor.activateParticipant(testUnknownTransactionExceptionBusinessActivityTerminator, TestUtil.UNKNOWNTRANSACTIONEXCEPTION_TRANSACTION_IDENTIFIER);
+ terminatorParticipantProcessor.activateParticipant(testSystemExceptionBusinessActivityTerminator, TestUtil.SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER);
+ }
+
+ /**
+ * * Notification that the servlet context is about to be shut down.
+ * * All servlets and filters have been destroy()ed before any
+ * * ServletContextListeners are notified of context
+ * * destruction.
+ */
+public void contextDestroyed(ServletContextEvent sce) {
+ final CompletionCoordinatorProcessor completionCoordinatorProcessor = CompletionCoordinatorProcessor.getProcessor() ;
+ completionCoordinatorProcessor.deactivateParticipant(testNoExceptionCompletionCoordinatorParticipant);
+ completionCoordinatorProcessor.deactivateParticipant(testTransactionRolledExceptionCompletionCoordinatorParticipant);
+ completionCoordinatorProcessor.deactivateParticipant(testUnknownTransactionExceptionCompletionCoordinatorParticipant);
+ completionCoordinatorProcessor.deactivateParticipant(testSystemExceptionCompletionCoordinatorParticipant);
+
+ final ParticipantProcessor participantProcessor = ParticipantProcessor.getProcessor() ;
+ participantProcessor.deactivateParticipant(testPreparedVoteParticipantEngine);
+ participantProcessor.deactivateParticipant(testAbortedVoteParticipantEngine);
+ participantProcessor.deactivateParticipant(testReadOnlyParticipantEngine);
+ participantProcessor.deactivateParticipant(testNoExceptionParticipantEngine);
+ participantProcessor.deactivateParticipant(testTransactionRolledBackExceptionParticipantEngine);
+ participantProcessor.deactivateParticipant(testWrongStateExceptionParticipantEngine);
+ participantProcessor.deactivateParticipant(testSystemExceptionParticipantEngine);
+
+ final ParticipantCompletionParticipantProcessor participantCompletionParticipantProcessor = ParticipantCompletionParticipantProcessor.getProcessor() ;
+ participantCompletionParticipantProcessor.deactivateParticipant(testSystemExceptionBusinessAgreementWithParticipantCompletionParticipantEngine);
+ participantCompletionParticipantProcessor.deactivateParticipant(testWrongStateExceptionBusinessAgreementWithParticipantCompletionParticipantEngine);
+ participantCompletionParticipantProcessor.deactivateParticipant(testNoExceptionBusinessAgreementWithParticipantCompletionParticipantEngine);
+ participantCompletionParticipantProcessor.deactivateParticipant(testFaultedExceptionBusinessAgreementWithParticipantCompletionParticipantEngine);
+
+ final CoordinatorCompletionParticipantProcessor coordinatorCompletionParticipantProcessor = CoordinatorCompletionParticipantProcessor.getProcessor() ;
+ coordinatorCompletionParticipantProcessor.deactivateParticipant(testSystemExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine);
+ coordinatorCompletionParticipantProcessor.deactivateParticipant(testWrongStateExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine);
+ coordinatorCompletionParticipantProcessor.deactivateParticipant(testNoExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine);
+ coordinatorCompletionParticipantProcessor.deactivateParticipant(testFaultedExceptionBusinessAgreementWithCoordinatorCompletionParticipantEngine);
+
+ // final ParticipantManagerParticipantProcessor participantManagerParticipantProcessor = ParticipantManagerParticipantProcessor.getParticipant() ;
+ // participantManagerParticipantProcessor.deactivateParticipant(testNoExceptionBAPMParticipant);
+ // participantManagerParticipantProcessor.deactivateParticipant(testWrongStateExceptionBAPMParticipant);
+ // participantManagerParticipantProcessor.deactivateParticipant(testSystemExceptionBAPMParticipant);
+
+ final TerminationCoordinatorProcessor terminatorParticipantProcessor = TerminationCoordinatorProcessor.getProcessor() ;
+ terminatorParticipantProcessor.deactivateParticipant(testNoExceptionBusinessActivityTerminator);
+ terminatorParticipantProcessor.deactivateParticipant(testTransactionRolledBackExceptionBusinessActivityTerminator);
+ terminatorParticipantProcessor.deactivateParticipant(testUnknownTransactionExceptionBusinessActivityTerminator);
+ terminatorParticipantProcessor.deactivateParticipant(testSystemExceptionBusinessActivityTerminator);
+ }
+
+ private static W3CEndpointReference getCoordinatorCompletionParticipantEndpoint(String id)
+ {
+ try {
+ W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+ final QName serviceName = BusinessActivityConstants.COORDINATOR_COMPLETION_PARTICIPANT_SERVICE_QNAME;
+ final QName endpointName = BusinessActivityConstants.COORDINATOR_COMPLETION_PARTICIPANT_PORT_QNAME;
+ final String address = ServiceRegistry.getRegistry().getServiceURI(BusinessActivityConstants.COORDINATOR_COMPLETION_PARTICIPANT_SERVICE_NAME);
+ builder.serviceName(serviceName);
+ builder.endpointName(endpointName);
+ builder.address(address);
+ InstanceIdentifier.setEndpointInstanceIdentifier(builder, id);
+ return builder.build();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ private static W3CEndpointReference getTerminationParticipantEndpoint(String id)
+ {
+ try {
+ W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+ final QName serviceName = ArjunaTX11Constants.TERMINATION_PARTICIPANT_SERVICE_QNAME;
+ final QName endpointName = ArjunaTX11Constants.TERMINATION_PARTICIPANT_PORT_QNAME;
+ final String address = ServiceRegistry.getRegistry().getServiceURI(ArjunaTX11Constants.TERMINATION_PARTICIPANT_SERVICE_NAME);
+ builder.serviceName(serviceName);
+ builder.endpointName(endpointName);
+ builder.address(address);
+ InstanceIdentifier.setEndpointInstanceIdentifier(builder, id);
+ return builder.build();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ private static W3CEndpointReference getCoordinatorEndpoint(String id)
+ {
+ try {
+ W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+ final QName serviceName = AtomicTransactionConstants.COORDINATOR_SERVICE_QNAME;
+ final QName endpointName = AtomicTransactionConstants.COORDINATOR_PORT_QNAME;
+ final String address = ServiceRegistry.getRegistry().getServiceURI(AtomicTransactionConstants.COORDINATOR_SERVICE_NAME);
+ builder.serviceName(serviceName);
+ builder.endpointName(endpointName);
+ builder.address(address);
+ InstanceIdentifier.setEndpointInstanceIdentifier(builder, id);
+ return builder.build();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ private static W3CEndpointReference getParticipantCompletionCoordinatorEndpoint(String id)
+ {
+ try {
+ W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+ final QName serviceName = BusinessActivityConstants.PARTICIPANT_COMPLETION_COORDINATOR_SERVICE_QNAME;
+ final QName endpointName = BusinessActivityConstants.PARTICIPANT_COMPLETION_COORDINATOR_PORT_QNAME;
+ final String address = ServiceRegistry.getRegistry().getServiceURI(BusinessActivityConstants.PARTICIPANT_COMPLETION_COORDINATOR_SERVICE_NAME);
+ builder.serviceName(serviceName);
+ builder.endpointName(endpointName);
+ builder.address(address);
+ InstanceIdentifier.setEndpointInstanceIdentifier(builder, id);
+ return builder.build();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ private static W3CEndpointReference getCoordinatorCompletionCoordinatorEndpoint(String id)
+ {
+ try {
+ W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+ final QName serviceName = BusinessActivityConstants.COORDINATOR_COMPLETION_COORDINATOR_SERVICE_QNAME;
+ final QName endpointName = BusinessActivityConstants.COORDINATOR_COMPLETION_COORDINATOR_PORT_QNAME;
+ final String address = ServiceRegistry.getRegistry().getServiceURI(BusinessActivityConstants.COORDINATOR_COMPLETION_COORDINATOR_SERVICE_NAME);
+ builder.serviceName(serviceName);
+ builder.endpointName(endpointName);
+ builder.address(address);
+ InstanceIdentifier.setEndpointInstanceIdentifier(builder, id);
+ return builder.build();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestNoExceptionBAPMParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestNoExceptionBAPMParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestNoExceptionBAPMParticipant.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,72 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * $Id: TestNoExceptionBAPMParticipant.java,v 1.5.8.1 2005/11/22 10:37:37 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests;
+
+import com.arjuna.wst11.BAParticipantManager;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import javax.xml.namespace.QName;
+
+public class TestNoExceptionBAPMParticipant implements BAParticipantManager
+{
+
+ public void completed ()
+ throws WrongStateException, SystemException
+ {
+ }
+
+ /**
+ * Cannot complete.
+ */
+
+ public void cannotComplete() throws WrongStateException, UnknownTransactionException, SystemException {
+ }
+
+ /**
+ * Fault.
+ */
+
+ public void fail(QName exceptionIdentifier) throws SystemException {
+ }
+
+ public void exit ()
+ throws WrongStateException, SystemException
+ {
+ }
+
+ public void unknown ()
+ throws SystemException
+ {
+ }
+
+ public void error ()
+ throws SystemException
+ {
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestNoExceptionBusinessActivityTerminator.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestNoExceptionBusinessActivityTerminator.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestNoExceptionBusinessActivityTerminator.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,63 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * $Id: TestNoExceptionBusinessActivityTerminator.java,v 1.3.20.1 2005/11/22 10:37:37 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests;
+
+import com.arjuna.wst11.BusinessActivityTerminator;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+public class TestNoExceptionBusinessActivityTerminator implements BusinessActivityTerminator
+{
+ public TestNoExceptionBusinessActivityTerminator(W3CEndpointReference endpointReference)
+ {
+ this.endpointReference = endpointReference;
+ }
+
+ public void close ()
+ throws TransactionRolledBackException, UnknownTransactionException, SystemException
+ {
+ }
+
+ public void cancel ()
+ throws UnknownTransactionException, SystemException
+ {
+ }
+
+ public void complete ()
+ throws UnknownTransactionException, SystemException
+ {
+ }
+
+ public W3CEndpointReference getEndpoint() {
+ return endpointReference;
+ }
+
+ private W3CEndpointReference endpointReference;
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestNoExceptionCompletionCoordinatorParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestNoExceptionCompletionCoordinatorParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestNoExceptionCompletionCoordinatorParticipant.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,58 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * TestNoExceptionCompletionCoordinatorParticipant.java
+ */
+
+package com.arjuna.wst11.tests;
+
+import com.arjuna.wst11.CompletionCoordinatorParticipant;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+public class TestNoExceptionCompletionCoordinatorParticipant implements CompletionCoordinatorParticipant
+{
+ public TestNoExceptionCompletionCoordinatorParticipant(W3CEndpointReference endpointReference)
+ {
+ this.endpointReference = endpointReference;
+ }
+
+ public void commit()
+ throws TransactionRolledBackException, UnknownTransactionException, SystemException
+ {
+ }
+
+ public void rollback()
+ throws UnknownTransactionException, SystemException
+ {
+ }
+
+ public W3CEndpointReference getParticipant() {
+ return endpointReference;
+ }
+
+ private W3CEndpointReference endpointReference;
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestSystemExceptionBAPMParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestSystemExceptionBAPMParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestSystemExceptionBAPMParticipant.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,77 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * $Id: TestSystemExceptionBAPMParticipant.java,v 1.5.8.1 2005/11/22 10:37:36 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests;
+
+import com.arjuna.wst11.BAParticipantManager;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import javax.xml.namespace.QName;
+
+public class TestSystemExceptionBAPMParticipant implements BAParticipantManager
+{
+ public void completed ()
+ throws WrongStateException, SystemException
+ {
+ throw new SystemException();
+ }
+
+ /**
+ * Cannot complete.
+ */
+
+ public void cannotComplete() throws WrongStateException, UnknownTransactionException, SystemException {
+ throw new SystemException();
+ }
+
+ /**
+ * Fault.
+ */
+
+ public void fail(QName exceptionIdentifier) throws SystemException {
+ throw new SystemException();
+ }
+
+ public void exit ()
+ throws WrongStateException, SystemException
+ {
+ throw new SystemException();
+ }
+
+ public void unknown ()
+ throws SystemException
+ {
+ throw new SystemException();
+ }
+
+ public void error ()
+ throws SystemException
+ {
+ throw new SystemException();
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestSystemExceptionBusinessActivityTerminator.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestSystemExceptionBusinessActivityTerminator.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestSystemExceptionBusinessActivityTerminator.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,66 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * $Id: TestSystemExceptionBusinessActivityTerminator.java,v 1.3.20.1 2005/11/22 10:37:40 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests;
+
+import com.arjuna.wst11.BusinessActivityTerminator;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+public class TestSystemExceptionBusinessActivityTerminator implements BusinessActivityTerminator
+{
+ public TestSystemExceptionBusinessActivityTerminator(W3CEndpointReference endpointReference)
+ {
+ this.endpointReference = endpointReference;
+ }
+
+ public void close ()
+ throws TransactionRolledBackException, UnknownTransactionException, SystemException
+ {
+ throw new SystemException();
+ }
+
+ public void cancel ()
+ throws UnknownTransactionException, SystemException
+ {
+ throw new SystemException();
+ }
+
+ public void complete ()
+ throws UnknownTransactionException, SystemException
+ {
+ throw new SystemException();
+ }
+
+ public W3CEndpointReference getEndpoint() {
+ return endpointReference;
+ }
+
+ private W3CEndpointReference endpointReference;
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestSystemExceptionCompletionCoordinatorParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestSystemExceptionCompletionCoordinatorParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestSystemExceptionCompletionCoordinatorParticipant.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,60 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * TestSystemExceptionCompletionCoordinatorParticipant.java
+ */
+
+package com.arjuna.wst11.tests;
+
+import com.arjuna.wst11.CompletionCoordinatorParticipant;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+public class TestSystemExceptionCompletionCoordinatorParticipant implements CompletionCoordinatorParticipant
+{
+ public TestSystemExceptionCompletionCoordinatorParticipant(W3CEndpointReference endpointReference)
+ {
+ this.endpointReference = endpointReference;
+ }
+
+ public void commit()
+ throws TransactionRolledBackException, UnknownTransactionException, SystemException
+ {
+ throw new SystemException();
+ }
+
+ public void rollback()
+ throws UnknownTransactionException, SystemException
+ {
+ throw new SystemException();
+ }
+
+ public W3CEndpointReference getParticipant() {
+ return endpointReference;
+ }
+
+ private W3CEndpointReference endpointReference;
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestTransactionRolledBackExceptionBusinessActivityTerminator.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestTransactionRolledBackExceptionBusinessActivityTerminator.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestTransactionRolledBackExceptionBusinessActivityTerminator.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,66 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * $Id: TestTransactionRolledBackExceptionBusinessActivityTerminator.java,v 1.3.20.1 2005/11/22 10:37:37 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests;
+
+import com.arjuna.wst11.BusinessActivityTerminator;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+public class TestTransactionRolledBackExceptionBusinessActivityTerminator implements BusinessActivityTerminator
+{
+ public TestTransactionRolledBackExceptionBusinessActivityTerminator(W3CEndpointReference endpointReference)
+ {
+ this.endpointReference = endpointReference;
+ }
+
+ public void close ()
+ throws TransactionRolledBackException, UnknownTransactionException, SystemException
+ {
+ throw new TransactionRolledBackException();
+ }
+
+ public void cancel ()
+ throws UnknownTransactionException, SystemException
+ {
+ throw new UnknownTransactionException();
+ }
+
+ public void complete ()
+ throws UnknownTransactionException, SystemException
+ {
+ throw new UnknownTransactionException();
+ }
+
+ public W3CEndpointReference getEndpoint() {
+ return endpointReference;
+ }
+
+ private W3CEndpointReference endpointReference;
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestTransactionRolledBackExceptionCompletionCoordinatorParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestTransactionRolledBackExceptionCompletionCoordinatorParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestTransactionRolledBackExceptionCompletionCoordinatorParticipant.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,60 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * TestTransactionRolledBackExceptionCompletionCoordinatorParticipant.java
+ */
+
+package com.arjuna.wst11.tests;
+
+import com.arjuna.wst11.CompletionCoordinatorParticipant;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+public class TestTransactionRolledBackExceptionCompletionCoordinatorParticipant implements CompletionCoordinatorParticipant
+{
+ public TestTransactionRolledBackExceptionCompletionCoordinatorParticipant(W3CEndpointReference endpointReference)
+ {
+ this.endpointReference = endpointReference;
+ }
+
+ public void commit()
+ throws TransactionRolledBackException, UnknownTransactionException, SystemException
+ {
+ throw new TransactionRolledBackException();
+ }
+
+ public void rollback()
+ throws UnknownTransactionException, SystemException
+ {
+ throw new SystemException();
+ }
+
+ public W3CEndpointReference getParticipant() {
+ return endpointReference;
+ }
+
+ private W3CEndpointReference endpointReference;
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestUnknownTransactionExceptionBusinessActivityTerminator.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestUnknownTransactionExceptionBusinessActivityTerminator.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestUnknownTransactionExceptionBusinessActivityTerminator.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,66 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * $Id: TestUnknownTransactionExceptionBusinessActivityTerminator.java,v 1.3.20.1 2005/11/22 10:37:41 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests;
+
+import com.arjuna.wst11.BusinessActivityTerminator;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+public class TestUnknownTransactionExceptionBusinessActivityTerminator implements BusinessActivityTerminator
+{
+ public TestUnknownTransactionExceptionBusinessActivityTerminator(W3CEndpointReference endpointReference)
+ {
+ this.endpointReference = endpointReference;
+ }
+
+ public void close ()
+ throws TransactionRolledBackException, UnknownTransactionException, SystemException
+ {
+ throw new UnknownTransactionException();
+ }
+
+ public void cancel ()
+ throws UnknownTransactionException, SystemException
+ {
+ throw new UnknownTransactionException();
+ }
+
+ public void complete ()
+ throws UnknownTransactionException, SystemException
+ {
+ throw new UnknownTransactionException();
+ }
+
+ public W3CEndpointReference getEndpoint() {
+ return endpointReference;
+ }
+
+ private W3CEndpointReference endpointReference;
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestUnknownTransactionExceptionCompletionCoordinatorParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestUnknownTransactionExceptionCompletionCoordinatorParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestUnknownTransactionExceptionCompletionCoordinatorParticipant.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,60 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * TestUnknownTransactionExceptionCompletionCoordinatorParticipant.java
+ */
+
+package com.arjuna.wst11.tests;
+
+import com.arjuna.wst11.CompletionCoordinatorParticipant;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+public class TestUnknownTransactionExceptionCompletionCoordinatorParticipant implements CompletionCoordinatorParticipant
+{
+ public TestUnknownTransactionExceptionCompletionCoordinatorParticipant(W3CEndpointReference endpointReference)
+ {
+ this.endpointReference = endpointReference;
+ }
+
+ public void commit()
+ throws TransactionRolledBackException, UnknownTransactionException, SystemException
+ {
+ throw new UnknownTransactionException();
+ }
+
+ public void rollback()
+ throws UnknownTransactionException, SystemException
+ {
+ throw new UnknownTransactionException();
+ }
+
+ public W3CEndpointReference getParticipant() {
+ return endpointReference;
+ }
+
+ private W3CEndpointReference endpointReference;
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestUtil.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestUtil.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestUtil.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,183 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * TestUtil.java
+ */
+
+package com.arjuna.wst11.tests;
+
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.namespace.QName;
+import java.net.URISyntaxException;
+
+public class TestUtil
+{
+ public static final String NOEXCEPTION_TRANSACTION_IDENTIFIER = "NE123456TI";
+ public static final String TRANSACTIONROLLEDBACKEXCEPTION_TRANSACTION_IDENTIFIER = "TRBE123456TI";
+ public static final String UNKNOWNTRANSACTIONEXCEPTION_TRANSACTION_IDENTIFIER = "UTE123456TI";
+ public static final String SYSTEMEXCEPTION_TRANSACTION_IDENTIFIER = "SE123456TI";
+
+ public static final String NONEXISTENT_TRANSACTION_IDENTIFIER = "NONE123456TI";
+
+ public static final String PREPAREDVOTE_PARTICIPANT_IDENTIFIER = "PV123456PI";
+ public static final String ABORTEDVOTE_PARTICIPANT_IDENTIFIER = "AV123456PI";
+ public static final String READONLYVOTE_PARTICIPANT_IDENTIFIER = "ROV123456PI";
+
+ public static final String NOEXCEPTION_PARTICIPANT_IDENTIFIER = "NE123456PI";
+
+ public static final String FAULTEDEXCEPTION_PARTICIPANT_IDENTIFIER = "FE123456PI";
+
+ public static final String TRANSACTIONROLLEDBACKEXCEPTION_PARTICIPANT_IDENTIFIER = "TRBE123456PI";
+ public static final String WRONGSTATEEXCEPTION_PARTICIPANT_IDENTIFIER = "WSE123456PI";
+ public static final String SYSTEMEXCEPTION_PARTICIPANT_IDENTIFIER = "SE123456PI";
+
+ public static final String NONEXISTENT_PARTICIPANT_IDENTIFIER = "NONE123456PI";
+
+ public static String participantServiceURI = "http://localhost:8080/ws-t11/ParticipantService";
+ public static String coordinatorServiceURI = "http://localhost:8080/ws-t11/CoordinatorService";
+ public static String completionInitiatorServiceURI = "http://localhost:8080/ws-t11/CompletionInitiatorService";
+ public static String completionCoordinatorServiceURI = "http://localhost:8080/ws-t11/CompletionCoordinatorService";
+ private static AttributedURI atomicTransactionFaultAction = null;
+ private static AttributedURI businessActivityFaultAction = null;
+
+ public static String participantCompletionParticipantServiceURI = "http://localhost:8080/ws-t11/BusinessAgreementWithParticipantCompletionParticipantService";
+ public static String participantCompletionCoordinatorServiceURI = "http://localhost:8080/ws-t11/BusinessAgreementWithParticipantCompletionCoordinatorService";
+ public static String coordinatorCompletionParticipantServiceURI = "http://localhost:8080/ws-t11/BusinessAgreementWithCoordinatorCompletionParticipantService";
+ public static String coordinatorCompletionCoordinatorServiceURI = "http://localhost:8080/ws-t11/BusinessAgreementWithCoordinatorCompletionCoordinatorService";
+
+ public static synchronized AttributedURI getAtomicTransactionFaultAction()
+ {
+ if (atomicTransactionFaultAction == null) {
+ AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+ try {
+ atomicTransactionFaultAction = builder.newURI("http://docs.oasis-open.org/ws-tx/wsat/2006/06/fault");
+ } catch (URISyntaxException use) {
+ // not going to happen
+ }
+ }
+
+ return atomicTransactionFaultAction;
+ }
+
+ public static synchronized AttributedURI getBusinessActivityFaultAction()
+ {
+ if (businessActivityFaultAction == null) {
+ AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+ try {
+ businessActivityFaultAction = builder.newURI("http://docs.oasis-open.org/ws-tx/wscoor/2006/06/fault");
+ } catch (URISyntaxException use) {
+ // not going to happen
+ }
+ }
+
+ return businessActivityFaultAction;
+ }
+
+ public static W3CEndpointReference getParticipantEndpoint(String id)
+ {
+ return getEndpoint(AtomicTransactionConstants.PARTICIPANT_SERVICE_QNAME,
+ AtomicTransactionConstants.PARTICIPANT_SERVICE_QNAME,
+ participantServiceURI,
+ id);
+ }
+
+ public static W3CEndpointReference getCoordinatorEndpoint(String id)
+ {
+ return getEndpoint(AtomicTransactionConstants.COORDINATOR_SERVICE_QNAME,
+ AtomicTransactionConstants.COORDINATOR_PORT_QNAME,
+ coordinatorServiceURI,
+ id);
+ }
+
+ public static W3CEndpointReference getCompletionInitiatorEndpoint(String id)
+ {
+ return getEndpoint(AtomicTransactionConstants.COMPLETION_INITIATOR_SERVICE_QNAME,
+ AtomicTransactionConstants.COMPLETION_INITIATOR_SERVICE_QNAME,
+ completionInitiatorServiceURI,
+ id);
+ }
+
+ public static W3CEndpointReference getCompletionCoordinatorEndpoint(String id)
+ {
+ return getEndpoint(AtomicTransactionConstants.COMPLETION_COORDINATOR_SERVICE_QNAME,
+ AtomicTransactionConstants.COMPLETION_COORDINATOR_PORT_QNAME,
+ completionCoordinatorServiceURI,
+ id);
+ }
+
+ public static W3CEndpointReference getParticipantCompletionParticipantEndpoint(String id)
+ {
+ return getEndpoint(BusinessActivityConstants.PARTICIPANT_COMPLETION_PARTICIPANT_SERVICE_QNAME,
+ BusinessActivityConstants.PARTICIPANT_COMPLETION_PARTICIPANT_PORT_QNAME,
+ participantCompletionParticipantServiceURI,
+ id);
+ }
+
+ public static W3CEndpointReference getParticipantCompletionCoordinatorEndpoint(String id)
+ {
+ return getEndpoint(BusinessActivityConstants.PARTICIPANT_COMPLETION_COORDINATOR_SERVICE_QNAME,
+ BusinessActivityConstants.PARTICIPANT_COMPLETION_COORDINATOR_PORT_QNAME,
+ participantCompletionCoordinatorServiceURI,
+ id);
+ }
+
+ public static W3CEndpointReference getCoordinatorCompletionParticipantEndpoint(String id)
+ {
+ return getEndpoint(BusinessActivityConstants.COORDINATOR_COMPLETION_PARTICIPANT_SERVICE_QNAME,
+ BusinessActivityConstants.COORDINATOR_COMPLETION_PARTICIPANT_PORT_QNAME,
+ coordinatorCompletionParticipantServiceURI,
+ id);
+ }
+
+ public static W3CEndpointReference getCoordinatorCompletionCoordinatorEndpoint(String id)
+ {
+ return getEndpoint(BusinessActivityConstants.COORDINATOR_COMPLETION_COORDINATOR_SERVICE_QNAME,
+ BusinessActivityConstants.COORDINATOR_COMPLETION_COORDINATOR_PORT_QNAME,
+ coordinatorCompletionCoordinatorServiceURI,
+ id);
+ }
+
+ private static W3CEndpointReference getEndpoint(QName service, QName port, String address, String id)
+ {
+ try {
+ W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+ builder.serviceName(service);
+ builder.endpointName(port);
+ builder.address(address);
+ if (id != null) {
+ InstanceIdentifier.setEndpointInstanceIdentifier(builder, id);
+ }
+ return builder.build();
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestWrongStateExceptionBAPMParticipant.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestWrongStateExceptionBAPMParticipant.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/TestWrongStateExceptionBAPMParticipant.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,72 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * $Id: TestWrongStateExceptionBAPMParticipant.java,v 1.5.8.1 2005/11/22 10:37:38 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests;
+
+import com.arjuna.wst11.BAParticipantManager;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.WrongStateException;
+
+import javax.xml.namespace.QName;
+
+public class TestWrongStateExceptionBAPMParticipant implements BAParticipantManager
+{
+ public void completed ()
+ throws WrongStateException, SystemException
+ {
+ throw new WrongStateException();
+ }
+
+ public void exit ()
+ throws WrongStateException, SystemException
+ {
+ throw new WrongStateException();
+ }
+
+ public void cannotComplete ()
+ throws WrongStateException, SystemException
+ {
+ throw new WrongStateException();
+ }
+
+ public void unknown ()
+ throws SystemException
+ {
+ throw new SystemException();
+ }
+
+ public void fail (QName exceptionIdentifier)
+ throws SystemException
+ {
+ throw new SystemException();
+ }
+
+ public void error ()
+ throws SystemException
+ {
+ throw new SystemException();
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithCoordinatorCompletionCoordinatorTestCase.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithCoordinatorCompletionCoordinatorTestCase.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithCoordinatorCompletionCoordinatorTestCase.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,285 @@
+/*
+ * 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) 2004, Arjuna Technologies Limited.
+ *
+ * $Id: BusinessAgreementWithCoordinatorCompletionCoordinatorTestCase.java,v 1.1.2.1 2004/05/26 10:04:55 nmcl Exp $
+ */
+
+package com.arjuna.wst11.tests.junit;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.addressing.AddressingProperties;
+
+import junit.framework.TestCase;
+
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsba.State;
+import com.arjuna.webservices11.wsba.client.CoordinatorCompletionParticipantClient;
+import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionParticipantProcessor;
+import com.arjuna.wst11.tests.junit.TestCoordinatorCompletionParticipantProcessor.CoordinatorCompletionParticipantDetails;
+import com.arjuna.wst11.tests.junit.TestCoordinatorCompletionParticipantProcessor;
+import com.arjuna.wst11.tests.TestUtil;
+
+public class BusinessAgreementWithCoordinatorCompletionCoordinatorTestCase extends TestCase
+{
+ private CoordinatorCompletionParticipantProcessor origCoordinatorCompletionParticipantProcessor ;
+ private TestCoordinatorCompletionParticipantProcessor testCoordinatorCompletionParticipantProcessor = new TestCoordinatorCompletionParticipantProcessor() ;
+
+ protected void setUp()
+ throws Exception
+ {
+ origCoordinatorCompletionParticipantProcessor = CoordinatorCompletionParticipantProcessor.setProcessor(testCoordinatorCompletionParticipantProcessor) ;
+ }
+
+ public void testSendClose()
+ throws Exception
+ {
+ final String messageId = "testSendClose" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("1") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId) ;
+
+ CoordinatorCompletionParticipantClient.getClient().sendClose(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasClose()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendCancel()
+ throws Exception
+ {
+ final String messageId = "testSendCancel" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("2") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId) ;
+
+ CoordinatorCompletionParticipantClient.getClient().sendCancel(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCancel()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendCompensate()
+ throws Exception
+ {
+ final String messageId = "testSendCompensate" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("3") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId) ;
+
+ CoordinatorCompletionParticipantClient.getClient().sendCompensate(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCompensate()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendFaulted()
+ throws Exception
+ {
+ final String messageId = "testSendFaulted" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("4") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId) ;
+
+ CoordinatorCompletionParticipantClient.getClient().sendFailed(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasFailed()) ;
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendExited()
+ throws Exception
+ {
+ final String messageId = "testSendExited" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("5") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId) ;
+
+ CoordinatorCompletionParticipantClient.getClient().sendExited(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasExited()) ;
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendStatus()
+ throws Exception
+ {
+ final String messageId = "testSendStatus" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("6") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId) ;
+
+ final State state = State.STATE_ACTIVE ;
+
+ CoordinatorCompletionParticipantClient.getClient().sendStatus(endpoint, addressingProperties, new InstanceIdentifier("sender"), state.getValue()) ;
+
+ final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000) ;
+
+ assertNotNull(details.hasStatus()) ;
+ assertEquals(details.hasStatus().getState(), state.getValue()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendComplete()
+ throws Exception
+ {
+ final String messageId = "testSendComplete" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("7") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId) ;
+
+ CoordinatorCompletionParticipantClient.getClient().sendComplete(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasComplete()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendGetStatus()
+ throws Exception
+ {
+ final String messageId = "testSendGetStatus" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("8") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId) ;
+
+ CoordinatorCompletionParticipantClient.getClient().sendGetStatus(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasGetStatus()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendError()
+ throws Exception
+ {
+ final String messageId = "testSendError" ;
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId) ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("9") ;
+ final String reason = "testSendErrorReason" ;
+ final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER ;
+ final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME ;
+ final SoapFault11 soapFault = new SoapFault11(soapFaultType, subcode, reason) ;
+
+ // this would be a better test if we could set the identifier as a reference parameter here
+ AddressingHelper.installNoneReplyTo(addressingProperties);
+ SoapFaultClient.sendSoapFault(soapFault, addressingProperties, TestUtil.getBusinessActivityFaultAction()) ;
+
+ final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000) ;
+
+ assertNotNull(details.hasSoapFault()) ;
+ assertEquals(details.hasSoapFault().getSoapFaultType(), soapFaultType) ;
+ assertEquals(details.hasSoapFault().getReason(), reason) ;
+ assertEquals(details.hasSoapFault().getSubcode(), subcode) ;
+
+ checkDetails(details, false, false, messageId, null);
+ }
+
+ public void testSendNotCompleted()
+ throws Exception
+ {
+ final String messageId = "testSendNotCompleted" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("10") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionParticipantServiceURI, messageId) ;
+
+ CoordinatorCompletionParticipantClient.getClient().sendNotCompleted(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final CoordinatorCompletionParticipantDetails details = testCoordinatorCompletionParticipantProcessor.getCoordinatorCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasNotCompleted()) ;
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ protected void tearDown()
+ throws Exception
+ {
+ CoordinatorCompletionParticipantProcessor.setProcessor(origCoordinatorCompletionParticipantProcessor) ;
+ }
+
+ /**
+ * check the message details to see that they have the correct to and from address and message id, a null
+ * reply to address and an arjuna context containing the correct instannce identifier
+ * @param details
+ * @param messageId
+ * @param instanceIdentifier
+ */
+
+ private void checkDetails(CoordinatorCompletionParticipantDetails details, boolean hasFrom, boolean hasFaultTo, String messageId, InstanceIdentifier instanceIdentifier)
+ {
+ AddressingProperties inAddressingProperties = details.getAddressingProperties();
+ ArjunaContext inArjunaContext = details.getArjunaContext();
+
+ assertEquals(inAddressingProperties.getTo().getURI().toString(), TestUtil.coordinatorCompletionParticipantServiceURI);
+ assertNotNull(inAddressingProperties.getReplyTo());
+ assertTrue(AddressingHelper.isNoneReplyTo(inAddressingProperties));
+ if (hasFrom) {
+ assertNotNull(inAddressingProperties.getFrom());
+ assertEquals(inAddressingProperties.getFrom().getAddress().getURI().toString(), TestUtil.coordinatorCompletionCoordinatorServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ if (hasFaultTo) {
+ assertNotNull(inAddressingProperties.getFaultTo());
+ assertEquals(inAddressingProperties.getFaultTo().getAddress().getURI().toString(), TestUtil.coordinatorCompletionCoordinatorServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ assertNotNull(inAddressingProperties.getMessageID());
+ assertEquals(inAddressingProperties.getMessageID().getURI().toString(), messageId);
+
+ if (instanceIdentifier == null) {
+ assertNull(inArjunaContext);
+ } else {
+ assertNotNull(inArjunaContext) ;
+ assertEquals(instanceIdentifier.getInstanceIdentifier(), inArjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithCoordinatorCompletionParticipantTestCase.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithCoordinatorCompletionParticipantTestCase.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithCoordinatorCompletionParticipantTestCase.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,274 @@
+/*
+ * 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) 2004, Arjuna Technologies Limited.
+ *
+ * $Id: BusinessAgreementWithCoordinatorCompletionParticipantTestCase.java,v 1.1.2.1 2004/05/26 10:04:55 nmcl Exp $
+ */
+
+package com.arjuna.wst11.tests.junit;
+
+import junit.framework.TestCase;
+
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
+import com.arjuna.webservices11.wsba.State;
+import com.arjuna.webservices11.wsba.client.CoordinatorCompletionCoordinatorClient;
+import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionCoordinatorProcessor;
+import com.arjuna.wst11.tests.junit.TestCoordinatorCompletionCoordinatorProcessor.CoordinatorCompletionCoordinatorDetails;
+import com.arjuna.wst11.tests.junit.TestCoordinatorCompletionCoordinatorProcessor;
+import com.arjuna.wst11.tests.TestUtil;
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.namespace.QName;
+
+public class BusinessAgreementWithCoordinatorCompletionParticipantTestCase extends TestCase
+{
+ private CoordinatorCompletionCoordinatorProcessor origCoordinatorCompletionCoordinatorProcessor ;
+ private TestCoordinatorCompletionCoordinatorProcessor testCoordinatorCompletionCoordinatorProcessor = new TestCoordinatorCompletionCoordinatorProcessor() ;
+
+ protected void setUp()
+ throws Exception
+ {
+ origCoordinatorCompletionCoordinatorProcessor = CoordinatorCompletionCoordinatorProcessor.setProcessor(testCoordinatorCompletionCoordinatorProcessor) ;
+ }
+
+ public void testSendClosed()
+ throws Exception
+ {
+ final String messageId = "testSendClosed" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("1") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;
+
+ CoordinatorCompletionCoordinatorClient.getClient().sendClosed(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasClosed());
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendCancelled()
+ throws Exception
+ {
+ final String messageId = "testSendCancelled" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("2") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;
+
+ CoordinatorCompletionCoordinatorClient.getClient().sendCancelled(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCancelled());
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendCompensated()
+ throws Exception
+ {
+ final String messageId = "testSendCompensated" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("3") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;
+
+ CoordinatorCompletionCoordinatorClient.getClient().sendCompensated(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCompensated());
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendFault()
+ throws Exception
+ {
+ final String messageId = "testSendFault" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("4") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;
+
+ final State state = State.STATE_FAILING_COMPENSATING ;
+
+ CoordinatorCompletionCoordinatorClient.getClient().sendFail(endpoint, addressingProperties, new InstanceIdentifier("sender"), state.getValue()) ;
+
+ CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertNotNull(details.hasFail());
+ assertEquals(details.hasFail().getExceptionIdentifier(), state.getValue());
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendCompleted()
+ throws Exception
+ {
+ final String messageId = "testSendCompleted" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("5") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;
+
+ CoordinatorCompletionCoordinatorClient.getClient().sendCompleted(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCompleted());
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendStatus()
+ throws Exception
+ {
+ final String messageId = "testSendStatus" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("6") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;
+
+ final State state = State.STATE_COMPENSATING;
+
+ CoordinatorCompletionCoordinatorClient.getClient().sendStatus(endpoint, addressingProperties, new InstanceIdentifier("sender"), state.getValue()) ;
+
+ CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertNotNull(details.hasStatus());
+ assertEquals(details.hasStatus().getState(), state.getValue());
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendError()
+ throws Exception
+ {
+ final String messageId = "testSendError" ;
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("7") ;
+ final String reason = "testSendErrorReason" ;
+ final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER ;
+ final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME ;
+ final SoapFault11 soapFault = new SoapFault11(soapFaultType, subcode, reason) ;
+
+ // this would be a better test if we could set the identifier as a reference parameter here
+ AddressingHelper.installNoneReplyTo(addressingProperties);
+ SoapFaultClient.sendSoapFault(soapFault, addressingProperties, TestUtil.getBusinessActivityFaultAction()) ;
+
+ final CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertNotNull(details.hasSoapFault()) ;
+ assertEquals(details.hasSoapFault().getSoapFaultType(), soapFaultType) ;
+ assertEquals(details.hasSoapFault().getReason(), reason) ;
+ assertEquals(details.hasSoapFault().getSubcode(), subcode) ;
+
+ checkDetails(details, false, false, messageId, null);
+ }
+
+ public void testSendExit()
+ throws Exception
+ {
+ final String messageId = "testSendExit" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("8") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;
+
+ CoordinatorCompletionCoordinatorClient.getClient().sendExit(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasExit()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendGetStatus()
+ throws Exception
+ {
+ final String messageId = "testSendGetStatus" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("9") ;
+ W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId) ;
+
+ CoordinatorCompletionCoordinatorClient.getClient().sendGetStatus(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasGetStatus()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ protected void tearDown()
+ throws Exception
+ {
+ CoordinatorCompletionCoordinatorProcessor.setProcessor(origCoordinatorCompletionCoordinatorProcessor) ;
+ }
+ /**
+ * check the message details to see that they have the correct to and from address and message id, a null
+ * reply to address and an arjuna context containing the correct instannce identifier
+ * @param details
+ * @param hasFrom
+ * @param hasFaultTo
+ * @param messageId
+ * @param instanceIdentifier
+ */
+
+ private void checkDetails(CoordinatorCompletionCoordinatorDetails details, boolean hasFrom, boolean hasFaultTo, String messageId, InstanceIdentifier instanceIdentifier)
+ {
+ AddressingProperties inAddressingProperties = details.getAddressingProperties();
+ ArjunaContext inArjunaContext = details.getArjunaContext();
+
+ assertEquals(inAddressingProperties.getTo().getURI().toString(), TestUtil.coordinatorCompletionCoordinatorServiceURI);
+ assertNotNull(inAddressingProperties.getReplyTo());
+ assertTrue(AddressingHelper.isNoneReplyTo(inAddressingProperties));
+ if (hasFrom) {
+ assertNotNull(inAddressingProperties.getFrom());
+ assertEquals(inAddressingProperties.getFrom().getAddress().getURI().toString(), TestUtil.coordinatorCompletionParticipantServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ if (hasFaultTo) {
+ assertNotNull(inAddressingProperties.getFaultTo());
+ assertEquals(inAddressingProperties.getFaultTo().getAddress().getURI().toString(), TestUtil.coordinatorCompletionParticipantServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ assertNotNull(inAddressingProperties.getMessageID());
+ assertEquals(inAddressingProperties.getMessageID().getURI().toString(), messageId);
+
+ if (instanceIdentifier == null) {
+ assertNull(inArjunaContext);
+ } else {
+ assertNotNull(inArjunaContext) ;
+ assertEquals(instanceIdentifier.getInstanceIdentifier(), inArjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithParticipantCompletionCoordinatorTestCase.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithParticipantCompletionCoordinatorTestCase.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithParticipantCompletionCoordinatorTestCase.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,272 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * $Id: BusinessAgreementWithParticipantCompletionCoordinatorTestCase.java,v 1.1.2.1 2004/05/26 10:04:55 nmcl Exp $
+ */
+
+package com.arjuna.wst11.tests.junit;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.addressing.AddressingProperties;
+
+import junit.framework.TestCase;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
+import com.arjuna.webservices11.wsba.State;
+import com.arjuna.webservices11.wsba.client.ParticipantCompletionParticipantClient;
+import com.arjuna.webservices11.wsba.processors.ParticipantCompletionParticipantProcessor;
+import com.arjuna.wst11.tests.junit.TestParticipantCompletionParticipantProcessor.ParticipantCompletionParticipantDetails;
+import com.arjuna.wst11.tests.junit.TestParticipantCompletionParticipantProcessor;
+import com.arjuna.wst11.tests.TestUtil;
+
+public class BusinessAgreementWithParticipantCompletionCoordinatorTestCase extends TestCase
+{
+ private ParticipantCompletionParticipantProcessor origParticipantCompletionParticipantProcessor ;
+ private TestParticipantCompletionParticipantProcessor testParticipantCompletionParticipantProcessor = new TestParticipantCompletionParticipantProcessor() ;
+
+ protected void setUp()
+ throws Exception
+ {
+ origParticipantCompletionParticipantProcessor = ParticipantCompletionParticipantProcessor.setProcessor(testParticipantCompletionParticipantProcessor) ;
+ final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry() ;
+ }
+
+ public void testSendClose()
+ throws Exception
+ {
+ final String messageId = "testSendClose" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("1") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId) ;
+
+ ParticipantCompletionParticipantClient.getClient().sendClose(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantCompletionParticipantDetails details = testParticipantCompletionParticipantProcessor.getParticipantCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasClose()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendCancel()
+ throws Exception
+ {
+ final String messageId = "testSendCancel" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("2") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId) ;
+
+ ParticipantCompletionParticipantClient.getClient().sendCancel(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantCompletionParticipantDetails details = testParticipantCompletionParticipantProcessor.getParticipantCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCancel()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendCompensate()
+ throws Exception
+ {
+ final String messageId = "testSendCompensate" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("3") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId) ;
+
+ ParticipantCompletionParticipantClient.getClient().sendCompensate(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantCompletionParticipantDetails details = testParticipantCompletionParticipantProcessor.getParticipantCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCompensate()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendFaulted()
+ throws Exception
+ {
+ final String messageId = "testSendFaulted" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("4") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId) ;
+
+ ParticipantCompletionParticipantClient.getClient().sendFailed(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantCompletionParticipantDetails details = testParticipantCompletionParticipantProcessor.getParticipantCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasFaulted()) ;
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendExited()
+ throws Exception
+ {
+ final String messageId = "testSendExited" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("5") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId) ;
+
+ ParticipantCompletionParticipantClient.getClient().sendExited(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantCompletionParticipantDetails details = testParticipantCompletionParticipantProcessor.getParticipantCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasExited()) ;
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendStatus()
+ throws Exception
+ {
+ final String messageId = "testSendStatus" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("6") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId) ;
+
+ final State state = State.STATE_ACTIVE ;
+
+ ParticipantCompletionParticipantClient.getClient().sendStatus(endpoint, addressingProperties, new InstanceIdentifier("sender"), state.getValue()) ;
+
+ final ParticipantCompletionParticipantDetails details = testParticipantCompletionParticipantProcessor.getParticipantCompletionParticipantDetails(messageId, 10000) ;
+
+ assertNotNull(details.hasStatus()); ;
+ assertEquals(details.hasStatus().getState(), state.getValue());
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendGetStatus()
+ throws Exception
+ {
+ final String messageId = "testSendGetStatus" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("7") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId) ;
+
+ ParticipantCompletionParticipantClient.getClient().sendGetStatus(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantCompletionParticipantDetails details = testParticipantCompletionParticipantProcessor.getParticipantCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasGetStatus()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendError()
+ throws Exception
+ {
+ final String messageId = "testSendGetStatus" ;
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId) ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("8") ;
+ final String reason = "testSendErrorReason" ;
+ final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER ;
+ final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME ;
+ final SoapFault11 soapFault = new SoapFault11(soapFaultType, subcode, reason) ;
+
+ AddressingHelper.installNoneReplyTo(addressingProperties);
+ SoapFaultClient.sendSoapFault(soapFault, addressingProperties, TestUtil.getBusinessActivityFaultAction()) ;
+
+ final ParticipantCompletionParticipantDetails details = testParticipantCompletionParticipantProcessor.getParticipantCompletionParticipantDetails(messageId, 10000) ;
+
+ assertNotNull(details.getSoapFault());
+ assertEquals(details.getSoapFault().getSoapFaultType(), soapFault.getSoapFaultType()) ;
+ assertEquals(details.getSoapFault().getReason(), soapFault.getReason()) ;
+ assertEquals(details.getSoapFault().getSubcode(), soapFault.getSubcode()) ;
+
+ checkDetails(details, false, false, messageId, null);
+ }
+
+ public void testSendNotCompleted()
+ throws Exception
+ {
+ final String messageId = "testSendNotCompleted" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("9") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId) ;
+
+ ParticipantCompletionParticipantClient.getClient().sendNotCompleted(endpoint, addressingProperties, new InstanceIdentifier("sender")); ;
+
+ final ParticipantCompletionParticipantDetails details = testParticipantCompletionParticipantProcessor.getParticipantCompletionParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasNotCompleted()) ;
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+ protected void tearDown()
+ throws Exception
+ {
+ ParticipantCompletionParticipantProcessor.setProcessor(origParticipantCompletionParticipantProcessor) ;
+ }
+
+ /**
+ * check the message details to see that they have the correct to and from address and message id, a null
+ * reply to address and an arjuna context containing the correct instannce identifier
+ * @param details
+ * @param hasFrom
+ * @param hasFaultTo
+ * @param messageId
+ * @param instanceIdentifier
+ */
+
+ private void checkDetails(ParticipantCompletionParticipantDetails details, boolean hasFrom, boolean hasFaultTo, String messageId, InstanceIdentifier instanceIdentifier)
+ {
+ AddressingProperties inAddressingProperties = details.getAddressingProperties();
+ ArjunaContext inArjunaContext = details.getArjunaContext();
+
+ assertEquals(inAddressingProperties.getTo().getURI().toString(), TestUtil.participantCompletionParticipantServiceURI);
+ assertNotNull(inAddressingProperties.getReplyTo());
+ assertTrue(AddressingHelper.isNoneReplyTo(inAddressingProperties));
+ if (hasFrom) {
+ assertNotNull(inAddressingProperties.getFrom());
+ assertEquals(inAddressingProperties.getFrom().getAddress().getURI().toString(), TestUtil.participantCompletionCoordinatorServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ if (hasFaultTo) {
+ assertNotNull(inAddressingProperties.getFaultTo());
+ assertEquals(inAddressingProperties.getFaultTo().getAddress().getURI().toString(), TestUtil.participantCompletionCoordinatorServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ assertNotNull(inAddressingProperties.getMessageID());
+ assertEquals(inAddressingProperties.getMessageID().getURI().toString(), messageId);
+
+ if (instanceIdentifier == null) {
+ assertNull(inArjunaContext);
+ } else {
+ assertNotNull(inArjunaContext) ;
+ assertEquals(instanceIdentifier.getInstanceIdentifier(), inArjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithParticipantCompletionParticipantTestCase.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithParticipantCompletionParticipantTestCase.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/BusinessAgreementWithParticipantCompletionParticipantTestCase.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,292 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * $Id: BusinessAgreementWithParticipantCompletionParticipantTestCase.java,v 1.1.2.1 2004/05/26 10:04:56 nmcl Exp $
+ */
+
+package com.arjuna.wst11.tests.junit;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.addressing.AddressingProperties;
+
+import junit.framework.TestCase;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
+import com.arjuna.webservices11.wsba.State;
+import com.arjuna.webservices11.wsba.client.ParticipantCompletionCoordinatorClient;
+import com.arjuna.webservices11.wsba.processors.ParticipantCompletionCoordinatorProcessor;
+import com.arjuna.wst11.tests.junit.TestParticipantCompletionCoordinatorProcessor.ParticipantCompletionCoordinatorDetails;
+import com.arjuna.wst11.tests.junit.TestParticipantCompletionCoordinatorProcessor;
+import com.arjuna.wst11.tests.TestUtil;
+
+public class BusinessAgreementWithParticipantCompletionParticipantTestCase extends TestCase
+{
+ private ParticipantCompletionCoordinatorProcessor origParticipantCompletionCoordinatorProcessor ;
+ private TestParticipantCompletionCoordinatorProcessor testParticipantCompletionCoordinatorProcessor = new TestParticipantCompletionCoordinatorProcessor() ;
+
+ protected void setUp()
+ throws Exception
+ {
+ origParticipantCompletionCoordinatorProcessor = ParticipantCompletionCoordinatorProcessor.setProcessor(testParticipantCompletionCoordinatorProcessor) ;
+ }
+
+ public void testSendClosed()
+ throws Exception
+ {
+ final String messageId = "testSendClosed" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("1") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionCoordinatorServiceURI, messageId) ;
+
+ ParticipantCompletionCoordinatorClient.getClient().sendClosed(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantCompletionCoordinatorDetails details = testParticipantCompletionCoordinatorProcessor.getParticipantCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasClosed()) ;
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendCancelled()
+ throws Exception
+ {
+ final String messageId = "testSendCancelled" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("2") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionCoordinatorServiceURI, messageId) ;
+
+ ParticipantCompletionCoordinatorClient.getClient().sendCancelled(endpoint, addressingProperties, new InstanceIdentifier("sender")); ;
+
+ final ParticipantCompletionCoordinatorDetails details = testParticipantCompletionCoordinatorProcessor.getParticipantCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCancelled()) ;
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendCompensated()
+ throws Exception
+ {
+ final String messageId = "testSendCompensated" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("3") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionCoordinatorServiceURI, messageId) ;
+
+ ParticipantCompletionCoordinatorClient.getClient().sendCompensated(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantCompletionCoordinatorDetails details = testParticipantCompletionCoordinatorProcessor.getParticipantCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCompensated()) ;
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendCompleted()
+ throws Exception
+ {
+ final String messageId = "testSendCompleted" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("4") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionCoordinatorServiceURI, messageId) ;
+
+ ParticipantCompletionCoordinatorClient.getClient().sendCompleted(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantCompletionCoordinatorDetails details = testParticipantCompletionCoordinatorProcessor.getParticipantCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCompleted()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendStatus()
+ throws Exception
+ {
+ final String messageId = "testSendStatus" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("5") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionCoordinatorServiceURI, messageId) ;
+
+ final State state = State.STATE_ENDED ;
+
+ ParticipantCompletionCoordinatorClient.getClient().sendStatus(endpoint, addressingProperties, new InstanceIdentifier("sender"), state.getValue()) ;
+
+ final ParticipantCompletionCoordinatorDetails details = testParticipantCompletionCoordinatorProcessor.getParticipantCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertNotNull(details.hasStatus()); ;
+ assertEquals(details.hasStatus().getState(), state.getValue()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendError()
+ throws Exception
+ {
+ final String messageId = "testSendError" ;
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionCoordinatorServiceURI, messageId) ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("6") ;
+ final String reason = "testSendErrorReason" ;
+ final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER ;
+ final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME ;
+ final SoapFault11 soapFault = new SoapFault11(soapFaultType, subcode, reason) ;
+
+ AddressingHelper.installNoneReplyTo(addressingProperties);
+ SoapFaultClient.sendSoapFault(soapFault, addressingProperties, TestUtil.getBusinessActivityFaultAction()) ;
+
+ final ParticipantCompletionCoordinatorDetails details = testParticipantCompletionCoordinatorProcessor.getParticipantCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertNotNull(details.hasSoapFault()) ;
+ assertEquals(details.hasSoapFault().getSoapFaultType(), soapFault.getSoapFaultType()) ;
+ assertEquals(details.hasSoapFault().getSubcode(), soapFault.getSubcode()) ;
+ assertEquals(details.hasSoapFault().getReason(), soapFault.getReason()) ;
+
+ checkDetails(details, false, false, messageId, null);
+ }
+
+ public void testSendExit()
+ throws Exception
+ {
+ final String messageId = "testSendExit" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("7") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionCoordinatorServiceURI, messageId) ;
+
+ ParticipantCompletionCoordinatorClient.getClient().sendExit(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantCompletionCoordinatorDetails details = testParticipantCompletionCoordinatorProcessor.getParticipantCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasExit()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendFault()
+ throws Exception
+ {
+ final String messageId = "testSendFault" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("8") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionCoordinatorServiceURI, messageId) ;
+
+ final State state = State.STATE_FAILING_ACTIVE;
+
+ ParticipantCompletionCoordinatorClient.getClient().sendFail(endpoint, addressingProperties, new InstanceIdentifier("sender"), state.getValue()); ;
+
+ final ParticipantCompletionCoordinatorDetails details = testParticipantCompletionCoordinatorProcessor.getParticipantCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertNotNull(details.hasFault());
+ assertEquals(details.hasFault().getExceptionIdentifier(), state.getValue()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendGetStatus()
+ throws Exception
+ {
+ final String messageId = "testSendGetStatus" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("9") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionCoordinatorServiceURI, messageId) ;
+
+ ParticipantCompletionCoordinatorClient.getClient().sendGetStatus(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantCompletionCoordinatorDetails details = testParticipantCompletionCoordinatorProcessor.getParticipantCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasGetStatus()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendCannotComplete()
+ throws Exception
+ {
+ final String messageId = "testSendCannotComplete" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("10") ;
+ W3CEndpointReference endpoint = TestUtil.getParticipantCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantCompletionCoordinatorServiceURI, messageId) ;
+
+ ParticipantCompletionCoordinatorClient.getClient().sendCannotComplete(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantCompletionCoordinatorDetails details = testParticipantCompletionCoordinatorProcessor.getParticipantCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCannotComplete()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ protected void tearDown()
+ throws Exception
+ {
+ ParticipantCompletionCoordinatorProcessor.setProcessor(origParticipantCompletionCoordinatorProcessor) ;
+ }
+
+ /**
+ * check the message details to see that they have the correct to and from address and message id, a null
+ * reply to address and an arjuna context containing the correct instannce identifier
+ * @param details
+ * @param hasFrom
+ * @param hasFaultTo
+ * @param messageId
+ * @param instanceIdentifier
+ */
+
+ private void checkDetails(ParticipantCompletionCoordinatorDetails details, boolean hasFrom, boolean hasFaultTo, String messageId, InstanceIdentifier instanceIdentifier)
+ {
+ AddressingProperties inAddressingProperties = details.getAddressingProperties();
+ ArjunaContext inArjunaContext = details.getArjunaContext();
+
+ assertEquals(inAddressingProperties.getTo().getURI().toString(), TestUtil.participantCompletionCoordinatorServiceURI);
+ assertNotNull(inAddressingProperties.getReplyTo());
+ assertTrue(AddressingHelper.isNoneReplyTo(inAddressingProperties));
+ if (hasFrom) {
+ assertNotNull(inAddressingProperties.getFrom());
+ assertEquals(inAddressingProperties.getFrom().getAddress().getURI().toString(), TestUtil.participantCompletionParticipantServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ if (hasFaultTo) {
+ assertNotNull(inAddressingProperties.getFaultTo());
+ assertEquals(inAddressingProperties.getFaultTo().getAddress().getURI().toString(), TestUtil.participantCompletionParticipantServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ assertNotNull(inAddressingProperties.getMessageID());
+ assertEquals(inAddressingProperties.getMessageID().getURI().toString(), messageId);
+
+ if (instanceIdentifier == null) {
+ assertNull(inArjunaContext);
+ } else {
+ assertNotNull(inArjunaContext) ;
+ assertEquals(instanceIdentifier.getInstanceIdentifier(), inArjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/CompletionCoordinatorTestCase.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/CompletionCoordinatorTestCase.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/CompletionCoordinatorTestCase.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,190 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * CompletionCoordinatorTestCase.java
+ */
+
+package com.arjuna.wst11.tests.junit;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.addressing.AddressingProperties;
+
+import junit.framework.TestCase;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsat.client.CompletionInitiatorClient;
+import com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor;
+import com.arjuna.wst11.tests.junit.TestCompletionInitiatorCallback;
+import com.arjuna.wst11.tests.TestUtil;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
+
+public class CompletionCoordinatorTestCase extends TestCase
+{
+ protected void setUp()
+ throws Exception
+ {
+ }
+
+ public void testSendCommitted()
+ throws Exception
+ {
+ final String messageId = "123456" ;
+ final String instanceIdentifier = "testSendCommitted" ;
+ final W3CEndpointReference completionInitiatorEndpoint = TestUtil.getCompletionInitiatorEndpoint(instanceIdentifier);
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.completionInitiatorServiceURI, messageId) ;
+
+ final TestCompletionInitiatorCallback callback = new TestCompletionInitiatorCallback() {
+ public void committed(final Notification committed, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
+ {
+ assertEquals(addressingProperties.getTo().getURI().toString(), TestUtil.completionInitiatorServiceURI);
+ assertNull(addressingProperties.getFrom());
+ assertNotNull(addressingProperties.getFaultTo());
+ assertEquals(addressingProperties.getFaultTo().getAddress().getURI().toString(), TestUtil.completionCoordinatorServiceURI);
+ assertNotNull(addressingProperties.getReplyTo());
+ assertTrue(AddressingHelper.isNoneReplyTo(addressingProperties));
+ assertEquals(addressingProperties.getMessageID().getURI().toString(), messageId);
+
+ assertNotNull(arjunaContext) ;
+ assertEquals(instanceIdentifier, arjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;
+ }
+ };
+ final CompletionInitiatorProcessor initiator = CompletionInitiatorProcessor.getProcessor() ;
+ initiator.registerCallback(instanceIdentifier, callback) ;
+
+ try
+ {
+ CompletionInitiatorClient.getClient().sendCommitted(completionInitiatorEndpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+ callback.waitUntilTriggered() ;
+ }
+ finally
+ {
+ initiator.removeCallback(instanceIdentifier) ;
+ }
+
+ assertTrue(callback.hasTriggered()) ;
+ assertFalse(callback.hasFailed()) ;
+ }
+
+ public void testSendAborted()
+ throws Exception
+ {
+ final String messageId = "123456" ;
+ final String instanceIdentifier = "testSendAborted" ;
+ final W3CEndpointReference completionInitiatorEndpoint = TestUtil.getCompletionInitiatorEndpoint(instanceIdentifier);
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.completionInitiatorServiceURI, messageId) ;
+
+ final TestCompletionInitiatorCallback callback = new TestCompletionInitiatorCallback() {
+ public void aborted(final Notification aborted, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
+ {
+ assertEquals(addressingProperties.getTo().getURI().toString(), TestUtil.completionInitiatorServiceURI);
+ assertNull(addressingProperties.getFrom());
+ assertNotNull(addressingProperties.getFaultTo());
+ assertEquals(addressingProperties.getFaultTo().getAddress().getURI().toString(), TestUtil.completionCoordinatorServiceURI);
+ assertNotNull(addressingProperties.getReplyTo());
+ assertTrue(AddressingHelper.isNoneReplyTo(addressingProperties));
+ assertNotNull(addressingProperties.getMessageID());
+ assertEquals(addressingProperties.getMessageID().getURI().toString(), messageId);
+
+ assertNotNull(arjunaContext) ;
+ assertEquals(instanceIdentifier, arjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;
+ }
+ };
+ final CompletionInitiatorProcessor initiator = CompletionInitiatorProcessor.getProcessor() ;
+ initiator.registerCallback(instanceIdentifier, callback) ;
+
+ try
+ {
+ CompletionInitiatorClient.getClient().sendAborted(completionInitiatorEndpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+ callback.waitUntilTriggered() ;
+ }
+ finally
+ {
+ initiator.removeCallback(instanceIdentifier) ;
+ }
+
+ assertTrue(callback.hasTriggered()) ;
+ assertFalse(callback.hasFailed()) ;
+ }
+
+ public void testSendError()
+ throws Exception
+ {
+ final String messageId = "123456" ;
+ final String reason = "testSendErrorReason" ;
+ final String instanceIdentifier = "testSendError" ;
+ final W3CEndpointReference completionInitiatorEndpoint = TestUtil.getCompletionInitiatorEndpoint(instanceIdentifier);
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.completionInitiatorServiceURI, messageId) ;
+
+ final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER ;
+ final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME ;
+ final SoapFault soapFault = new SoapFault11(soapFaultType, subcode, reason) ;
+
+ final TestCompletionInitiatorCallback callback = new TestCompletionInitiatorCallback() {
+ public void soapFault(final SoapFault soapFault, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
+ {
+ assertEquals(addressingProperties.getTo().getURI().toString(), TestUtil.completionInitiatorServiceURI);
+ assertNull(addressingProperties.getFrom());
+ assertNull(addressingProperties.getFaultTo());
+ assertNotNull(addressingProperties.getReplyTo());
+ assertTrue(AddressingHelper.isNoneReplyTo(addressingProperties));
+ assertNotNull(addressingProperties.getMessageID());
+ assertEquals(addressingProperties.getMessageID().getURI().toString(), messageId);
+
+ assertNotNull(arjunaContext) ;
+ assertEquals(instanceIdentifier, arjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;
+
+ assertNotNull(soapFault) ;
+ assertEquals(soapFaultType, soapFault.getSoapFaultType()) ;
+ assertEquals(subcode, soapFault.getSubcode()) ;
+ assertEquals(reason, soapFault.getReason()) ;
+ }
+ };
+ final CompletionInitiatorProcessor initiator = CompletionInitiatorProcessor.getProcessor() ;
+ initiator.registerCallback(instanceIdentifier, callback) ;
+
+ try
+ {
+ CompletionInitiatorClient.getClient().sendSoapFault(completionInitiatorEndpoint, addressingProperties, soapFault, new InstanceIdentifier("sender")) ;
+ callback.waitUntilTriggered() ;
+ }
+ finally
+ {
+ initiator.removeCallback(instanceIdentifier) ;
+ }
+
+ assertTrue(callback.hasTriggered()) ;
+ assertFalse(callback.hasFailed()) ;
+ }
+
+ protected void tearDown()
+ throws Exception
+ {
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/CompletionParticipantTestCase.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/CompletionParticipantTestCase.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/CompletionParticipantTestCase.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,125 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * CompletionParticipantTestCase.java
+ */
+
+package com.arjuna.wst11.tests.junit;
+
+import junit.framework.TestCase;
+
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsat.client.CompletionCoordinatorClient;
+import com.arjuna.webservices11.wsat.processors.CompletionCoordinatorProcessor;
+import com.arjuna.wst11.tests.junit.TestCompletionCoordinatorProcessor.CompletionCoordinatorDetails;
+import com.arjuna.wst11.tests.junit.TestCompletionCoordinatorProcessor;
+import com.arjuna.wst11.tests.TestUtil;
+
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+public class CompletionParticipantTestCase extends TestCase
+{
+ private CompletionCoordinatorProcessor origCompletionCoordinatorProcessor ;
+
+ private TestCompletionCoordinatorProcessor testCompletionCoordinatorProcessor = new TestCompletionCoordinatorProcessor() ;
+
+ protected void setUp()
+ throws Exception
+ {
+ origCompletionCoordinatorProcessor = CompletionCoordinatorProcessor.setProcessor(testCompletionCoordinatorProcessor) ;
+ }
+
+ public void testSendCommit()
+ throws Exception
+ {
+ final String messageId = "testSendCommit" ;
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.completionCoordinatorServiceURI, messageId) ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("1") ;
+ final W3CEndpointReference endpoint = TestUtil.getCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+
+ CompletionCoordinatorClient.getClient().sendCommit(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final CompletionCoordinatorDetails details = testCompletionCoordinatorProcessor.getCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCommit()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendRollback()
+ throws Exception
+ {
+ final String messageId = "testSendRollback" ;
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.completionCoordinatorServiceURI, messageId) ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("2") ;
+ final W3CEndpointReference endpoint = TestUtil.getCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+
+ CompletionCoordinatorClient.getClient().sendRollback(endpoint, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final CompletionCoordinatorDetails details = testCompletionCoordinatorProcessor.getCompletionCoordinatorDetails(messageId, 10000) ;
+
+ assertTrue(details.hasRollback()) ;
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ protected void tearDown()
+ throws Exception
+ {
+ CompletionCoordinatorProcessor.setProcessor(origCompletionCoordinatorProcessor) ;
+ }
+
+ private void checkDetails(CompletionCoordinatorDetails details, boolean hasFrom, boolean hasFaultTo, String messageId, InstanceIdentifier instanceIdentifier)
+ {
+ AddressingProperties inAddressingProperties = details.getAddressingProperties();
+ ArjunaContext inArjunaContext = details.getArjunaContext();
+
+ assertEquals(inAddressingProperties.getTo().getURI().toString(), TestUtil.completionCoordinatorServiceURI);
+ assertNotNull(inAddressingProperties.getReplyTo());
+ assertTrue(AddressingHelper.isNoneReplyTo(inAddressingProperties));
+ if (hasFrom) {
+ assertNotNull(inAddressingProperties.getFrom());
+ assertEquals(inAddressingProperties.getFrom().getAddress().getURI().toString(), TestUtil.completionInitiatorServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ if (hasFaultTo) {
+ assertNotNull(inAddressingProperties.getFaultTo());
+ assertEquals(inAddressingProperties.getFaultTo().getAddress().getURI().toString(), TestUtil.completionInitiatorServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ assertNotNull(inAddressingProperties.getMessageID());
+ assertEquals(inAddressingProperties.getMessageID().getURI().toString(), messageId);
+
+ if (instanceIdentifier == null) {
+ assertNull(inArjunaContext);
+ } else {
+ assertNotNull(inArjunaContext);
+ assertEquals(instanceIdentifier.getInstanceIdentifier(), inArjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCompletionCoordinatorProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCompletionCoordinatorProcessor.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCompletionCoordinatorProcessor.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,166 @@
+/*
+ * 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.
+ */
+package com.arjuna.wst11.tests.junit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsat.processors.CompletionCoordinatorProcessor;
+import com.arjuna.wst11.CompletionCoordinatorParticipant;
+import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
+
+import javax.xml.ws.addressing.AddressingProperties;
+
+public class TestCompletionCoordinatorProcessor extends CompletionCoordinatorProcessor
+{
+ private Map messageIdMap = new HashMap() ;
+
+ public CompletionCoordinatorDetails getCompletionCoordinatorDetails(final String messageId, final long timeout)
+ {
+ final long endTime = System.currentTimeMillis() + timeout ;
+ synchronized(messageIdMap)
+ {
+ long now = System.currentTimeMillis() ;
+ while(now < endTime)
+ {
+ final CompletionCoordinatorDetails details = (CompletionCoordinatorDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ try
+ {
+ messageIdMap.wait(endTime - now) ;
+ }
+ catch (final InterruptedException ie) {} // ignore
+ now = System.currentTimeMillis() ;
+ }
+ final CompletionCoordinatorDetails details = (CompletionCoordinatorDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ }
+ throw new NullPointerException("Timeout occurred waiting for id: " + messageId) ;
+ }
+
+ /**
+ * Commit.
+ * @param commit The commit notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void commit(final Notification commit, final AddressingProperties addressingProperties,
+ final ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString();
+ final CompletionCoordinatorDetails details = new CompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setCommit(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Rollback.
+ * @param rollback The rollback notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void rollback(final Notification rollback, final AddressingProperties addressingProperties,
+ final ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CompletionCoordinatorDetails details = new CompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setRollback(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Activate the participant.
+ * @param participant The participant.
+ * @param identifier The identifier.
+ */
+ public void activateParticipant(final CompletionCoordinatorParticipant participant, final String identifier)
+ {
+ }
+
+ /**
+ * Deactivate the participant.
+ * @param participant The participant.
+ */
+ public void deactivateParticipant(final CompletionCoordinatorParticipant participant)
+ {
+ }
+
+ public static class CompletionCoordinatorDetails
+ {
+ private final AddressingProperties addressingProperties ;
+ private final ArjunaContext arjunaContext ;
+ private boolean commit ;
+ private boolean rollback ;
+
+ CompletionCoordinatorDetails(final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
+ {
+ this.addressingProperties = addressingProperties ;
+ this.arjunaContext = arjunaContext ;
+ }
+
+ public AddressingProperties getAddressingProperties()
+ {
+ return addressingProperties ;
+ }
+
+ public ArjunaContext getArjunaContext()
+ {
+ return arjunaContext ;
+ }
+
+ public boolean hasCommit()
+ {
+ return commit ;
+ }
+
+ void setCommit(final boolean commit)
+ {
+ this.commit = commit ;
+ }
+
+ public boolean hasRollback()
+ {
+ return rollback ;
+ }
+
+ void setRollback(final boolean rollback)
+ {
+ this.rollback = rollback ;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCompletionInitiatorCallback.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCompletionInitiatorCallback.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCompletionInitiatorCallback.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+package com.arjuna.wst11.tests.junit;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsat.processors.CompletionInitiatorCallback;
+import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
+
+import javax.xml.ws.addressing.AddressingProperties;
+
+/**
+ * Base callback class for tests.
+ * @author kevin
+ */
+public class TestCompletionInitiatorCallback extends CompletionInitiatorCallback
+{
+ /**
+ * An aborted response.
+ * @param aborted The aborted notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void aborted(final Notification aborted, final AddressingProperties addressingProperties,
+ final ArjunaContext arjunaContext)
+ {
+ throw new RuntimeException("Unexpected aborted response") ;
+ }
+
+ /**
+ * A committed response.
+ * @param committed The committed notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void committed(final Notification committed, final AddressingProperties addressingProperties,
+ final ArjunaContext arjunaContext)
+ {
+ throw new RuntimeException("Unexpected committed response") ;
+ }
+
+ /**
+ * A SOAP fault response.
+ * @param soapFault The SOAP fault.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void soapFault(final SoapFault soapFault, final AddressingProperties addressingProperties,
+ final ArjunaContext arjunaContext)
+ {
+ throw new RuntimeException("Unexpected SOAP fault response") ;
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCoordinatorCompletionCoordinatorProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCoordinatorCompletionCoordinatorProcessor.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCoordinatorCompletionCoordinatorProcessor.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,372 @@
+/*
+ * 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.
+ */
+package com.arjuna.wst11.tests.junit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsba.CoordinatorCompletionCoordinatorInboundEvents;
+import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionCoordinatorProcessor;
+import com.arjuna.webservices.SoapFault;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
+
+import javax.xml.ws.addressing.AddressingProperties;
+
+
+public class TestCoordinatorCompletionCoordinatorProcessor extends CoordinatorCompletionCoordinatorProcessor
+{
+ private Map messageIdMap = new HashMap() ;
+
+ public CoordinatorCompletionCoordinatorDetails getCoordinatorCompletionCoordinatorDetails(final String messageId, final long timeout)
+ {
+ final long endTime = System.currentTimeMillis() + timeout ;
+ synchronized(messageIdMap)
+ {
+ long now = System.currentTimeMillis() ;
+ while(now < endTime)
+ {
+ final CoordinatorCompletionCoordinatorDetails details = (CoordinatorCompletionCoordinatorDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ try
+ {
+ messageIdMap.wait(endTime - now) ;
+ }
+ catch (final InterruptedException ie) {} // ignore
+ now = System.currentTimeMillis() ;
+ }
+ final CoordinatorCompletionCoordinatorDetails details = (CoordinatorCompletionCoordinatorDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ }
+ throw new NullPointerException("Timeout occurred waiting for id: " + messageId) ;
+ }
+
+ /**
+ * Activate the coordinator.
+ *
+ * @param coordinator The coordinator.
+ * @param identifier The identifier.
+ */
+ public void activateCoordinator(CoordinatorCompletionCoordinatorInboundEvents coordinator, String identifier) {
+ }
+
+ /**
+ * Deactivate the coordinator.
+ *
+ * @param coordinator The coordinator.
+ */
+ public void deactivateCoordinator(CoordinatorCompletionCoordinatorInboundEvents coordinator) {
+ }
+
+ /**
+ * Cancelled.
+ *
+ * @param cancelled The cancelled notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void cancelled(NotificationType cancelled, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionCoordinatorDetails details = new CoordinatorCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setCancelled(true); ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Closed.
+ *
+ * @param closed The closed notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void closed(NotificationType closed, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionCoordinatorDetails details = new CoordinatorCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setClosed(true); ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Compensated.
+ *
+ * @param compensated The compensated notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void compensated(NotificationType compensated, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionCoordinatorDetails details = new CoordinatorCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setCompensated(true); ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Completed.
+ *
+ * @param completed The completed notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void completed(NotificationType completed, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionCoordinatorDetails details = new CoordinatorCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setCompleted(true); ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void exit(NotificationType exit, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionCoordinatorDetails details = new CoordinatorCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setExit(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Cannot complete.
+ *
+ * @param cannotComplete The cannot complete notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void cannotComplete(NotificationType cannotComplete, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ /**
+ * Fault.
+ *
+ * @param fault The fault exception.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void fail(ExceptionType fault, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionCoordinatorDetails details = new CoordinatorCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setFail(fault); ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void getStatus(NotificationType getStatus, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionCoordinatorDetails details = new CoordinatorCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setGetStatus(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Status.
+ *
+ * @param status The status.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void status(StatusType status, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionCoordinatorDetails details = new CoordinatorCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setStatus(status); ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * SOAP fault.
+ *
+ * @param soapFault The SOAP fault.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void soapFault(SoapFault soapFault, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionCoordinatorDetails details = new CoordinatorCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setSoapFault(soapFault); ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public static class CoordinatorCompletionCoordinatorDetails
+ {
+ private final AddressingProperties addressingProperties ;
+ private final ArjunaContext arjunaContext ;
+ private boolean closed ;
+ private boolean cancelled ;
+ private boolean compensated ;
+ private ExceptionType fail;
+ private boolean completed ;
+ private boolean cannotComplete ;
+ private StatusType status ;
+ private SoapFault soapFault ;
+ private boolean exit ;
+ private boolean getStatus ;
+
+ CoordinatorCompletionCoordinatorDetails(final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
+ {
+ this.addressingProperties = addressingProperties ;
+ this.arjunaContext = arjunaContext ;
+ }
+
+ public AddressingProperties getAddressingProperties()
+ {
+ return addressingProperties ;
+ }
+
+ public ArjunaContext getArjunaContext()
+ {
+ return arjunaContext ;
+ }
+
+ public boolean hasExit()
+ {
+ return exit ;
+ }
+
+ void setExit(final boolean exit)
+ {
+ this.exit = exit ;
+ }
+
+ public boolean hasGetStatus()
+ {
+ return getStatus ;
+ }
+
+ void setGetStatus(final boolean getStatus)
+ {
+ this.getStatus = getStatus ;
+ }
+ public boolean hasClosed() {
+ return closed;
+ }
+
+ public void setClosed(boolean closed) {
+ this.closed = closed;
+ }
+
+ public boolean hasCancelled() {
+ return cancelled;
+ }
+
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+
+ public boolean hasCompensated() {
+ return compensated;
+ }
+
+ public void setCompensated(boolean compensated) {
+ this.compensated = compensated;
+ }
+
+ public ExceptionType hasFail() {
+ return fail;
+ }
+
+ public void setFail(ExceptionType fail) {
+ this.fail = fail;
+ }
+
+ public boolean hasCompleted() {
+ return completed;
+ }
+
+ public void setCompleted(boolean completed) {
+ this.completed = completed;
+ }
+
+ public boolean hasCAnnotComplete() {
+ return cannotComplete;
+ }
+
+ public void setCannotComplete(boolean cannotComplete) {
+ this.cannotComplete = cannotComplete;
+ }
+
+ public StatusType hasStatus() {
+ return status;
+ }
+
+ public void setStatus(StatusType status) {
+ this.status = status;
+ }
+
+ public SoapFault hasSoapFault() {
+ return soapFault;
+ }
+
+ public void setSoapFault(SoapFault soapFault) {
+ this.soapFault = soapFault;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCoordinatorCompletionParticipantProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCoordinatorCompletionParticipantProcessor.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCoordinatorCompletionParticipantProcessor.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,375 @@
+/*
+ * 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.
+ */
+package com.arjuna.wst11.tests.junit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents;
+import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionParticipantProcessor;
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
+
+import javax.xml.ws.addressing.AddressingProperties;
+
+
+public class TestCoordinatorCompletionParticipantProcessor extends CoordinatorCompletionParticipantProcessor
+{
+ private Map messageIdMap = new HashMap() ;
+
+ public CoordinatorCompletionParticipantDetails getCoordinatorCompletionParticipantDetails(final String messageId, final long timeout)
+ {
+ final long endTime = System.currentTimeMillis() + timeout ;
+ synchronized(messageIdMap)
+ {
+ long now = System.currentTimeMillis() ;
+ while(now < endTime)
+ {
+ final CoordinatorCompletionParticipantDetails details = (CoordinatorCompletionParticipantDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ try
+ {
+ messageIdMap.wait(endTime - now) ;
+ }
+ catch (final InterruptedException ie) {} // ignore
+ now = System.currentTimeMillis() ;
+ }
+ final CoordinatorCompletionParticipantDetails details = (CoordinatorCompletionParticipantDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ }
+ throw new NullPointerException("Timeout occurred waiting for id: " + messageId) ;
+ }
+
+ /**
+ * Activate the participant.
+ *
+ * @param participant The participant.
+ * @param identifier The identifier.
+ */
+ public void activateParticipant(CoordinatorCompletionParticipantInboundEvents participant, String identifier) {
+ }
+
+ /**
+ * Deactivate the participant.
+ *
+ * @param participant The participant.
+ */
+ public void deactivateParticipant(CoordinatorCompletionParticipantInboundEvents participant) {
+ }
+
+ public void cancel(NotificationType cancel, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionParticipantDetails details = new CoordinatorCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setCancel(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void close(NotificationType close, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionParticipantDetails details = new CoordinatorCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setClose(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void compensate(NotificationType compensate, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionParticipantDetails details = new CoordinatorCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setCompensate(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void complete(NotificationType complete, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionParticipantDetails details = new CoordinatorCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setComplete(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Exited.
+ *
+ * @param exited The exited notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void exited(NotificationType exited, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionParticipantDetails details = new CoordinatorCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setExited(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Not Completed.
+ *
+ * @param notCompleted The not completed notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void notCompleted(NotificationType notCompleted, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionParticipantDetails details = new CoordinatorCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setNotCompleted(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Faulted.
+ *
+ * @param failed The failed notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void failed(NotificationType failed, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionParticipantDetails details = new CoordinatorCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setFailed(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void getStatus(NotificationType getStatus, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionParticipantDetails details = new CoordinatorCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setGetStatus(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Status.
+ *
+ * @param status The status.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void status(StatusType status, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionParticipantDetails details = new CoordinatorCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setStatus(status) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * SOAP fault.
+ *
+ * @param soapFault The SOAP fault.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void soapFault(SoapFault soapFault, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorCompletionParticipantDetails details = new CoordinatorCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setSoapFault(soapFault) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void activateParticipant(BusinessAgreementWithCoordinatorCompletionParticipant participant, String identifier)
+ {
+ }
+
+ public void deactivateParticipant(BusinessAgreementWithCoordinatorCompletionParticipant participant)
+ {
+ }
+
+ public static class CoordinatorCompletionParticipantDetails
+ {
+ private final AddressingProperties addressingProperties ;
+ private final ArjunaContext arjunaContext ;
+ private boolean cancel ;
+ private boolean close ;
+ private boolean compensate ;
+ private boolean complete ;
+ private boolean failed;
+ private boolean exited ;
+ private boolean notCompleted ;
+ private StatusType status ;
+ private boolean getStatus ;
+ private SoapFault soapFault ;
+
+ CoordinatorCompletionParticipantDetails(final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
+ {
+ this.addressingProperties = addressingProperties ;
+ this.arjunaContext = arjunaContext ;
+ }
+
+ public AddressingProperties getAddressingProperties()
+ {
+ return addressingProperties ;
+ }
+
+ public ArjunaContext getArjunaContext()
+ {
+ return arjunaContext ;
+ }
+
+ public boolean hasCancel()
+ {
+ return cancel ;
+ }
+
+ void setCancel(final boolean cancel)
+ {
+ this.cancel = cancel ;
+ }
+
+ public boolean hasClose()
+ {
+ return close ;
+ }
+
+ void setClose(final boolean close)
+ {
+ this.close = close ;
+ }
+
+ public boolean hasCompensate()
+ {
+ return compensate ;
+ }
+
+ void setCompensate(final boolean compensate)
+ {
+ this.compensate = compensate ;
+ }
+
+ public boolean hasComplete()
+ {
+ return complete ;
+ }
+
+ void setComplete(final boolean complete)
+ {
+ this.complete = complete ;
+ }
+
+ public boolean hasGetStatus()
+ {
+ return getStatus ;
+ }
+
+ void setGetStatus(final boolean getStatus)
+ {
+ this.getStatus = getStatus ;
+ }
+ public boolean hasFailed() {
+ return failed;
+ }
+
+ public void setFailed(boolean failed) {
+ this.failed = failed;
+ }
+
+ public boolean hasExited() {
+ return exited;
+ }
+
+ public void setExited(boolean exited) {
+ this.exited = exited;
+ }
+
+ public boolean hasNotCompleted() {
+ return notCompleted;
+ }
+
+ public void setNotCompleted(boolean notCompleted) {
+ this.notCompleted = notCompleted;
+ }
+
+ public StatusType hasStatus() {
+ return status;
+ }
+
+ public void setStatus(StatusType status) {
+ this.status = status;
+ }
+
+ public SoapFault hasSoapFault() {
+ return soapFault;
+ }
+
+ public void setSoapFault(SoapFault soapFault) {
+ this.soapFault = soapFault;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCoordinatorProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCoordinatorProcessor.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestCoordinatorProcessor.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,255 @@
+/*
+ * 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.
+ */
+package com.arjuna.wst11.tests.junit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsat.ParticipantInboundEvents;
+import com.arjuna.webservices11.wsat.CoordinatorInboundEvents;
+import com.arjuna.webservices11.wsat.processors.ParticipantProcessor;
+import com.arjuna.webservices11.wsat.processors.CoordinatorProcessor;
+
+import javax.xml.ws.addressing.AddressingProperties;
+
+import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
+
+public class TestCoordinatorProcessor extends CoordinatorProcessor
+{
+ private Map messageIdMap = new HashMap() ;
+
+ public CoordinatorDetails getCoordinatorDetails(final String messageId, final long timeout)
+ {
+ final long endTime = System.currentTimeMillis() + timeout ;
+ synchronized(messageIdMap)
+ {
+ long now = System.currentTimeMillis() ;
+ while(now < endTime)
+ {
+ final CoordinatorDetails details = (CoordinatorDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ try
+ {
+ messageIdMap.wait(endTime - now) ;
+ }
+ catch (final InterruptedException ie) {} // ignore
+ now = System.currentTimeMillis() ;
+ }
+ final CoordinatorDetails details = (CoordinatorDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ }
+ throw new NullPointerException("Timeout occurred waiting for id: " + messageId) ;
+ }
+
+ /**
+ * Activate the participant.
+ *
+ * @param coordinator The participant.
+ * @param identifier The identifier.
+ */
+ public void activateCoordinator(CoordinatorInboundEvents coordinator, String identifier) {
+ }
+
+ /**
+ * Deactivate the participant.
+ *
+ * @param coordinator The participant.
+ */
+ public void deactivateCoordinator(CoordinatorInboundEvents coordinator) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void aborted(Notification aborted,
+ AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorDetails details = new CoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setAborted(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void committed(Notification committed,
+ AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorDetails details = new CoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setCommitted(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void prepared(Notification prepared,
+ AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorDetails details = new CoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setPrepared(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void readOnly(Notification readOnly,
+ AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorDetails details = new CoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setReadOnly(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void replay(Notification replay,
+ AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorDetails details = new CoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setReplay(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void soapFault(SoapFault soapFault, AddressingProperties addressingProperties,
+ ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final CoordinatorDetails details = new CoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setSoapFault(soapFault) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public static class CoordinatorDetails
+ {
+ private final AddressingProperties addressingProperties ;
+ private final ArjunaContext arjunaContext ;
+ private boolean aborted ;
+ private boolean committed ;
+ private boolean prepared ;
+ private boolean readOnly ;
+ private boolean replay ;
+ private SoapFault soapFault ;
+
+ CoordinatorDetails(final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
+ {
+ this.addressingProperties = addressingProperties ;
+ this.arjunaContext = arjunaContext ;
+ }
+
+ public AddressingProperties getAddressingProperties()
+ {
+ return addressingProperties ;
+ }
+
+ public ArjunaContext getArjunaContext()
+ {
+ return arjunaContext ;
+ }
+
+ public boolean hasAborted()
+ {
+ return aborted ;
+ }
+
+ void setAborted(final boolean aborted)
+ {
+ this.aborted = aborted ;
+ }
+
+ public boolean hasCommitted()
+ {
+ return committed ;
+ }
+
+ void setCommitted(final boolean committed)
+ {
+ this.committed = committed ;
+ }
+
+ public boolean hasPrepared()
+ {
+ return prepared ;
+ }
+
+ void setPrepared(final boolean prepared)
+ {
+ this.prepared = prepared ;
+ }
+
+ public boolean hasReadOnly() {
+ return readOnly;
+ }
+
+ public void setReadOnly(boolean readOnly) {
+ this.readOnly = readOnly;
+ }
+
+ public boolean hasReplay() {
+ return replay;
+ }
+
+ public void setReplay(boolean replay) {
+ this.replay = replay;
+ }
+
+ public SoapFault hasSoapFault()
+ {
+ return soapFault ;
+ }
+
+ void setSoapFault(final SoapFault soapFault)
+ {
+ this.soapFault = soapFault ;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestParticipantCompletionCoordinatorProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestParticipantCompletionCoordinatorProcessor.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestParticipantCompletionCoordinatorProcessor.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,389 @@
+/*
+ * 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.
+ */
+package com.arjuna.wst11.tests.junit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsba.ParticipantCompletionCoordinatorInboundEvents;
+import com.arjuna.webservices11.wsba.processors.ParticipantCompletionCoordinatorProcessor;
+import com.arjuna.webservices.SoapFault;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
+
+import javax.xml.ws.addressing.AddressingProperties;
+
+
+public class TestParticipantCompletionCoordinatorProcessor extends ParticipantCompletionCoordinatorProcessor
+{
+ private Map messageIdMap = new HashMap() ;
+
+ public ParticipantCompletionCoordinatorDetails getParticipantCompletionCoordinatorDetails(final String messageId, final long timeout)
+ {
+ final long endTime = System.currentTimeMillis() + timeout ;
+ synchronized(messageIdMap)
+ {
+ long now = System.currentTimeMillis() ;
+ while(now < endTime)
+ {
+ final ParticipantCompletionCoordinatorDetails details = (ParticipantCompletionCoordinatorDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ try
+ {
+ messageIdMap.wait(endTime - now) ;
+ }
+ catch (final InterruptedException ie) {} // ignore
+ now = System.currentTimeMillis() ;
+ }
+ final ParticipantCompletionCoordinatorDetails details = (ParticipantCompletionCoordinatorDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ }
+ throw new NullPointerException("Timeout occurred waiting for id: " + messageId) ;
+ }
+
+ /**
+ * Activate the coordinator.
+ *
+ * @param coordinator The coordinator.
+ * @param identifier The identifier.
+ */
+ public void activateCoordinator(ParticipantCompletionCoordinatorInboundEvents coordinator, String identifier) {
+ }
+
+ /**
+ * Deactivate the coordinator.
+ *
+ * @param coordinator The coordinator.
+ */
+ public void deactivateCoordinator(ParticipantCompletionCoordinatorInboundEvents coordinator) {
+ }
+
+ /**
+ * Cancelled.
+ *
+ * @param cancelled The cancelled notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void cancelled(NotificationType cancelled, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionCoordinatorDetails details = new ParticipantCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setCancelled(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Closed.
+ *
+ * @param closed The closed notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void closed(NotificationType closed, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionCoordinatorDetails details = new ParticipantCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setClosed(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Compensated.
+ *
+ * @param compensated The compensated notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void compensated(NotificationType compensated, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionCoordinatorDetails details = new ParticipantCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setCompensated(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Completed.
+ *
+ * @param completed The completed notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void completed(NotificationType completed, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionCoordinatorDetails details = new ParticipantCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setCompleted(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * CannotComplete.
+ *
+ * @param cannotComplete The cannot complete notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void cannotComplete(NotificationType cannotComplete, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionCoordinatorDetails details = new ParticipantCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setCannotComplete(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * exit
+ * @param exit The exit notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void exit(NotificationType exit, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionCoordinatorDetails details = new ParticipantCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setExit(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Fault.
+ *
+ * @param fault The fault exception.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void fail(ExceptionType fault, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionCoordinatorDetails details = new ParticipantCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setFault(fault) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void getStatus(NotificationType getStatus, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionCoordinatorDetails details = new ParticipantCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setGetStatus(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Status.
+ *
+ * @param status The status.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void status(StatusType status, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionCoordinatorDetails details = new ParticipantCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setStatus(status) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * SOAP fault.
+ *
+ * @param soapFault The SOAP fault.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void soapFault(SoapFault soapFault, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionCoordinatorDetails details = new ParticipantCompletionCoordinatorDetails(addressingProperties, arjunaContext) ;
+ details.setSoapFault(soapFault) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public static class ParticipantCompletionCoordinatorDetails
+ {
+ private final AddressingProperties addressingProperties ;
+ private final ArjunaContext arjunaContext ;
+ private boolean exit ;
+ private boolean getStatus ;
+ private boolean cancelled;
+ private boolean closed;
+ private boolean compensated;
+ private boolean completed;
+ private boolean cannotComplete;
+ private ExceptionType fault;
+ private StatusType status;
+ private SoapFault soapFault;
+
+ ParticipantCompletionCoordinatorDetails(final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
+ {
+ this.addressingProperties = addressingProperties ;
+ this.arjunaContext = arjunaContext ;
+ }
+
+ public AddressingProperties getAddressingProperties()
+ {
+ return addressingProperties ;
+ }
+
+ public ArjunaContext getArjunaContext()
+ {
+ return arjunaContext ;
+ }
+
+ public boolean hasCannotComplete()
+ {
+ return cannotComplete ;
+ }
+
+ void setCannotComplete(final boolean cannotComplete)
+ {
+ this.cannotComplete = cannotComplete ;
+ }
+
+ public boolean hasExit()
+ {
+ return exit ;
+ }
+
+ void setExit(final boolean exit)
+ {
+ this.exit = exit ;
+ }
+
+ public boolean hasGetStatus()
+ {
+ return getStatus ;
+ }
+
+ void setGetStatus(final boolean getStatus)
+ {
+ this.getStatus = getStatus ;
+ }
+
+ public boolean hasCancelled() {
+ return cancelled;
+ }
+
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+
+ public boolean hasClosed() {
+ return closed;
+ }
+
+ public void setClosed(boolean closed) {
+ this.closed = closed;
+ }
+
+ public boolean hasCompensated() {
+ return compensated;
+ }
+
+ public void setCompensated(boolean compensated) {
+ this.compensated = compensated;
+ }
+
+ public boolean hasCompleted() {
+ return completed;
+ }
+
+ public void setCompleted(boolean completed) {
+ this.completed = completed;
+ }
+
+ public ExceptionType hasFault() {
+ return fault;
+ }
+
+ public void setFault(ExceptionType fault) {
+ this.fault = fault;
+ }
+
+ public StatusType hasStatus() {
+ return status;
+ }
+
+ public void setStatus(StatusType status) {
+ this.status = status;
+ }
+
+ public SoapFault hasSoapFault() {
+ return soapFault;
+ }
+
+ public void setSoapFault(SoapFault soapFault) {
+ this.soapFault = soapFault;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestParticipantCompletionParticipantProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestParticipantCompletionParticipantProcessor.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestParticipantCompletionParticipantProcessor.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,344 @@
+/*
+ * 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.
+ */
+package com.arjuna.wst11.tests.junit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsba.ParticipantCompletionParticipantInboundEvents;
+import com.arjuna.webservices11.wsba.processors.ParticipantCompletionParticipantProcessor;
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
+
+import javax.xml.ws.addressing.AddressingProperties;
+
+
+public class TestParticipantCompletionParticipantProcessor extends ParticipantCompletionParticipantProcessor
+{
+ private Map messageIdMap = new HashMap() ;
+
+ public ParticipantCompletionParticipantDetails getParticipantCompletionParticipantDetails(final String messageId, final long timeout)
+ {
+ final long endTime = System.currentTimeMillis() + timeout ;
+ synchronized(messageIdMap)
+ {
+ long now = System.currentTimeMillis() ;
+ while(now < endTime)
+ {
+ final ParticipantCompletionParticipantDetails details = (ParticipantCompletionParticipantDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ try
+ {
+ messageIdMap.wait(endTime - now) ;
+ }
+ catch (final InterruptedException ie) {} // ignore
+ now = System.currentTimeMillis() ;
+ }
+ final ParticipantCompletionParticipantDetails details = (ParticipantCompletionParticipantDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ }
+ throw new NullPointerException("Timeout occurred waiting for id: " + messageId) ;
+ }
+
+ /**
+ * Activate the participant.
+ *
+ * @param participant The participant.
+ * @param identifier The identifier.
+ */
+ public void activateParticipant(ParticipantCompletionParticipantInboundEvents participant, String identifier) {
+ }
+
+ /**
+ * Deactivate the participant.
+ *
+ * @param participant The participant.
+ */
+ public void deactivateParticipant(ParticipantCompletionParticipantInboundEvents participant) {
+ }
+
+ public void cancel(NotificationType cancel, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionParticipantDetails details = new ParticipantCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setCancel(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void close(NotificationType close, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionParticipantDetails details = new ParticipantCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setClose(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void compensate(NotificationType compensate, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionParticipantDetails details = new ParticipantCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setCompensate(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Exited.
+ *
+ * @param exited The exited notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void exited(NotificationType exited, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionParticipantDetails details = new ParticipantCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setExited(true); ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Not Completed.
+ *
+ * @param notCompleted The not completed notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void notCompleted(NotificationType notCompleted, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionParticipantDetails details = new ParticipantCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setNotCompleted(true); ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Faulted.
+ *
+ * @param faulted The faulted notification.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void failed(NotificationType faulted, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionParticipantDetails details = new ParticipantCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setFaulted(true); ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void getStatus(NotificationType getStatus, AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionParticipantDetails details = new ParticipantCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setGetStatus(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * Status.
+ *
+ * @param status The status.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void status(StatusType status, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionParticipantDetails details = new ParticipantCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setStatus(status); ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ /**
+ * SOAP fault.
+ *
+ * @param soapFault The SOAP fault.
+ * @param addressingProperties The addressing context.
+ * @param arjunaContext The arjuna context.
+ */
+ public void soapFault(SoapFault soapFault, AddressingProperties addressingProperties, ArjunaContext arjunaContext) {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantCompletionParticipantDetails details = new ParticipantCompletionParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setSoapFault(soapFault) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ details.setSoapFault(soapFault);
+ }
+
+ public static class ParticipantCompletionParticipantDetails
+ {
+ private final AddressingProperties addressingProperties ;
+ private final ArjunaContext arjunaContext ;
+ private boolean cancel ;
+ private boolean close ;
+ private boolean compensate ;
+ private boolean getStatus ;
+ private boolean faulted;
+ private boolean exited;
+ private boolean notCompleted;
+ private StatusType status;
+ private SoapFault soapFault;
+
+ ParticipantCompletionParticipantDetails(final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
+ {
+ this.addressingProperties = addressingProperties ;
+ this.arjunaContext = arjunaContext ;
+ }
+
+ public AddressingProperties getAddressingProperties()
+ {
+ return addressingProperties ;
+ }
+
+ public ArjunaContext getArjunaContext()
+ {
+ return arjunaContext ;
+ }
+
+ public boolean hasCancel()
+ {
+ return cancel ;
+ }
+
+ void setCancel(final boolean cancel)
+ {
+ this.cancel = cancel ;
+ }
+
+ public boolean hasClose()
+ {
+ return close ;
+ }
+
+ void setClose(final boolean close)
+ {
+ this.close = close ;
+ }
+
+ public boolean hasCompensate()
+ {
+ return compensate ;
+ }
+
+ void setCompensate(final boolean compensate)
+ {
+ this.compensate = compensate ;
+ }
+
+ public boolean hasGetStatus()
+ {
+ return getStatus ;
+ }
+
+ void setGetStatus(final boolean getStatus)
+ {
+ this.getStatus = getStatus ;
+ }
+
+ public boolean hasFaulted() {
+ return faulted;
+ }
+
+ public void setFaulted(boolean faulted) {
+ this.faulted = faulted;
+ }
+
+ public boolean hasExited() {
+ return exited;
+ }
+
+ public void setExited(boolean exited) {
+ this.exited = exited;
+ }
+
+ public boolean hasNotCompleted() {
+ return notCompleted;
+ }
+
+ public void setNotCompleted(boolean notCompleted) {
+ this.notCompleted = notCompleted;
+ }
+
+ public StatusType hasStatus() {
+ return status;
+ }
+ public void setStatus(StatusType status) {
+ this.status = status;
+ }
+
+ public SoapFault getSoapFault() {
+ return soapFault;
+ }
+
+ public void setSoapFault(SoapFault soapFault) {
+ this.soapFault = soapFault;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestParticipantProcessor.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestParticipantProcessor.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestParticipantProcessor.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,207 @@
+/*
+ * 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.
+ */
+package com.arjuna.wst11.tests.junit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsat.ParticipantInboundEvents;
+import com.arjuna.webservices11.wsat.processors.ParticipantProcessor;
+import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
+
+import javax.xml.ws.addressing.AddressingProperties;
+
+public class TestParticipantProcessor extends ParticipantProcessor
+{
+ private Map messageIdMap = new HashMap() ;
+
+ public ParticipantDetails getParticipantDetails(final String messageId, final long timeout)
+ {
+ final long endTime = System.currentTimeMillis() + timeout ;
+ synchronized(messageIdMap)
+ {
+ long now = System.currentTimeMillis() ;
+ while(now < endTime)
+ {
+ final ParticipantDetails details = (ParticipantDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ try
+ {
+ messageIdMap.wait(endTime - now) ;
+ }
+ catch (final InterruptedException ie) {} // ignore
+ now = System.currentTimeMillis() ;
+ }
+ final ParticipantDetails details = (ParticipantDetails)messageIdMap.remove(messageId) ;
+ if (details != null)
+ {
+ return details ;
+ }
+ }
+ throw new NullPointerException("Timeout occurred waiting for id: " + messageId) ;
+ }
+
+ /**
+ * Activate the participant.
+ *
+ * @param participant The participant.
+ * @param identifier The identifier.
+ */
+ public void activateParticipant(ParticipantInboundEvents participant, String identifier) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ /**
+ * Deactivate the participant.
+ *
+ * @param participant The participant.
+ */
+ public void deactivateParticipant(ParticipantInboundEvents participant) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void commit(Notification commit,
+ AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantDetails details = new ParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setCommit(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void prepare(Notification prepare,
+ AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantDetails details = new ParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setPrepare(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void rollback(Notification rollback,
+ AddressingProperties addressingProperties, ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantDetails details = new ParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setRollback(true) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public void soapFault(SoapFault soapFault, AddressingProperties addressingProperties,
+ ArjunaContext arjunaContext)
+ {
+ final String messageId = addressingProperties.getMessageID().getURI().toString() ;
+ final ParticipantDetails details = new ParticipantDetails(addressingProperties, arjunaContext) ;
+ details.setSoapFault(soapFault) ;
+
+ synchronized(messageIdMap)
+ {
+ messageIdMap.put(messageId, details) ;
+ messageIdMap.notifyAll() ;
+ }
+ }
+
+ public static class ParticipantDetails
+ {
+ private final AddressingProperties addressingProperties ;
+ private final ArjunaContext arjunaContext ;
+ private boolean commit ;
+ private boolean prepare ;
+ private boolean rollback ;
+ private SoapFault soapFault ;
+
+ ParticipantDetails(final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
+ {
+ this.addressingProperties = addressingProperties ;
+ this.arjunaContext = arjunaContext ;
+ }
+
+ public AddressingProperties getAddressingProperties()
+ {
+ return addressingProperties ;
+ }
+
+ public ArjunaContext getArjunaContext()
+ {
+ return arjunaContext ;
+ }
+
+ public boolean hasCommit()
+ {
+ return commit ;
+ }
+
+ void setCommit(final boolean commit)
+ {
+ this.commit = commit ;
+ }
+
+ public boolean hasPrepare()
+ {
+ return prepare ;
+ }
+
+ void setPrepare(final boolean prepare)
+ {
+ this.prepare = prepare ;
+ }
+
+ public boolean hasRollback()
+ {
+ return rollback ;
+ }
+
+ void setRollback(final boolean rollback)
+ {
+ this.rollback = rollback ;
+ }
+
+ public SoapFault getSoapFault()
+ {
+ return soapFault ;
+ }
+
+ void setSoapFault(final SoapFault soapFault)
+ {
+ this.soapFault = soapFault ;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestSuite.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestSuite.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TestSuite.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,55 @@
+/*
+ * 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) 2003, Arjuna Technologies Limited.
+ *
+ * TestSuite.java
+ */
+
+package com.arjuna.wst11.tests.junit;
+
+import com.arjuna.wst11.tests.junit.*;
+
+public class TestSuite extends junit.framework.TestSuite
+{
+ public TestSuite()
+ {
+ // the service tests are no longer working
+ addTest(new junit.framework.TestSuite(CompletionParticipantTestCase.class));
+ addTest(new junit.framework.TestSuite(CompletionCoordinatorTestCase.class));
+ addTest(new junit.framework.TestSuite(TwoPCParticipantTestCase.class));
+ addTest(new junit.framework.TestSuite(TwoPCCoordinatorTestCase.class));
+ //addTest(new junit.framework.TestSuite(CompletionServiceTestCase.class));
+ //addTest(new junit.framework.TestSuite(TwoPCServiceTestCase.class));
+ //addTest(new junit.framework.TestSuite(BusinessAgreementWithParticipantCompletionServiceTestCase.class));
+ addTest(new junit.framework.TestSuite(BusinessAgreementWithParticipantCompletionParticipantTestCase.class));
+ addTest(new junit.framework.TestSuite(BusinessAgreementWithParticipantCompletionCoordinatorTestCase.class));
+ //addTest(new junit.framework.TestSuite(BusinessAgreementWithCoordinatorCompletionServiceTestCase.class));
+ addTest(new junit.framework.TestSuite(BusinessAgreementWithCoordinatorCompletionParticipantTestCase.class));
+ addTest(new junit.framework.TestSuite(BusinessAgreementWithCoordinatorCompletionCoordinatorTestCase.class));
+ // these tests refer to a sercie which no longer exists
+ //addTest(new junit.framework.TestSuite(BAParticipantManagerServiceTestCase.class));
+ //addTest(new junit.framework.TestSuite(BAParticipantManagerParticipantTestCase.class));
+ //addTest(new junit.framework.TestSuite(BAParticipantManagerCoordinatorTestCase.class));
+ //addTest(new junit.framework.TestSuite(BusinessActivityTerminatorServiceTestCase.class));
+ }
+
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TwoPCCoordinatorTestCase.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TwoPCCoordinatorTestCase.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TwoPCCoordinatorTestCase.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,183 @@
+/*
+ * 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) 2003, 2004,
+ *
+ * Arjuna Technologies Limited.
+ *
+ * $Id: TwoPCCoordinatorTestCase.java,v 1.6.2.1 2005/11/22 10:37:45 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests.junit;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.addressing.AddressingProperties;
+
+import junit.framework.TestCase;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsat.client.ParticipantClient;
+import com.arjuna.webservices11.wsat.processors.ParticipantProcessor;
+import com.arjuna.wst11.tests.junit.TestParticipantProcessor.ParticipantDetails;
+import com.arjuna.wst11.tests.junit.TestParticipantProcessor;
+import com.arjuna.wst11.tests.TestUtil;
+
+public class TwoPCCoordinatorTestCase extends TestCase
+{
+ private ParticipantProcessor origParticipantProcessor ;
+
+ private TestParticipantProcessor testParticipantProcessor = new TestParticipantProcessor() ;
+
+ protected void setUp()
+ throws Exception
+ {
+ origParticipantProcessor = ParticipantProcessor.setProcessor(testParticipantProcessor) ;
+ }
+
+ public void testSendPrepare()
+ throws Exception
+ {
+ final String messageId = "testSendPrepare" ;
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantServiceURI, messageId) ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("1") ;
+ final W3CEndpointReference participantEndpointReference = TestUtil.getParticipantEndpoint(null);
+
+ ParticipantClient.getClient().sendPrepare(participantEndpointReference, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantDetails details = testParticipantProcessor.getParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasPrepare()) ;
+
+ checkDetails(details, true, true, messageId, null);
+ }
+
+ public void testSendCommit()
+ throws Exception
+ {
+ final String messageId = "testSendCommit" ;
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantServiceURI, messageId) ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("2") ;
+ final W3CEndpointReference participantEndpointReference = TestUtil.getParticipantEndpoint(null);
+
+ ParticipantClient.getClient().sendCommit(participantEndpointReference, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantDetails details = testParticipantProcessor.getParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasCommit()) ;
+
+ checkDetails(details, true, true, messageId, null);
+ }
+
+ public void testSendRollback()
+ throws Exception
+ {
+ final String messageId = "testSendRollback" ;
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantServiceURI, messageId) ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("3") ;
+ final W3CEndpointReference participantEndpointReference = TestUtil.getParticipantEndpoint(null);
+
+ ParticipantClient.getClient().sendRollback(participantEndpointReference, addressingProperties, new InstanceIdentifier("sender")) ;
+
+ final ParticipantDetails details = testParticipantProcessor.getParticipantDetails(messageId, 10000) ;
+
+ assertTrue(details.hasRollback()) ;
+
+ checkDetails(details, true, true, messageId, null);
+ }
+
+ public void testSendError()
+ throws Exception
+ {
+ final String messageId = "testSendError" ;
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.participantServiceURI, messageId) ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("4") ;
+
+ final String reason = "testSendErrorReason" ;
+ final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER ;
+ final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME ;
+ final SoapFault soapFault = new SoapFault11(soapFaultType, subcode, reason) ;
+
+ ParticipantClient.getClient().sendSoapFault(addressingProperties, soapFault, new InstanceIdentifier("sender")) ;
+
+ final ParticipantDetails details = testParticipantProcessor.getParticipantDetails(messageId, 10000) ;
+ final SoapFault receivedSoapFault = details.getSoapFault() ;
+
+ assertNotNull(receivedSoapFault) ;
+ assertEquals(soapFaultType, receivedSoapFault.getSoapFaultType()) ;
+ assertEquals(subcode, receivedSoapFault.getSubcode()) ;
+ assertEquals(reason, receivedSoapFault.getReason()) ;
+
+ checkDetails(details, false, false, messageId, null);
+ }
+
+ protected void tearDown()
+ throws Exception
+ {
+ ParticipantProcessor.setProcessor(origParticipantProcessor) ;
+ }
+ /**
+ * check the message details to see that they have the correct to, from and faultto address and message id, a
+ * none reply to address and an arjuna context containing the correct instannce identifier
+ * @param details
+ * @param hasFrom
+ * @param hasFaultTo
+ * @param messageId
+ * @param instanceIdentifier
+ */
+
+ private void checkDetails(ParticipantDetails details, boolean hasFrom, boolean hasFaultTo, String messageId, InstanceIdentifier instanceIdentifier)
+ {
+ AddressingProperties inAddressingProperties = details.getAddressingProperties();
+ ArjunaContext inArjunaContext = details.getArjunaContext();
+
+ assertEquals(inAddressingProperties.getTo().getURI().toString(), TestUtil.participantServiceURI);
+ assertNotNull(inAddressingProperties.getReplyTo());
+ assertTrue(AddressingHelper.isNoneReplyTo(inAddressingProperties));
+ if (hasFrom) {
+ assertNotNull(inAddressingProperties.getFrom());
+ assertEquals(inAddressingProperties.getFrom().getAddress().getURI().toString(), TestUtil.coordinatorServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ if (hasFaultTo) {
+ assertNotNull(inAddressingProperties.getFaultTo());
+ assertEquals(inAddressingProperties.getFaultTo().getAddress().getURI().toString(), TestUtil.coordinatorServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ assertNotNull(inAddressingProperties.getMessageID());
+ assertEquals(inAddressingProperties.getMessageID().getURI().toString(), messageId);
+
+ if (instanceIdentifier == null) {
+ assertNull(inArjunaContext);
+ } else {
+ assertNotNull(inArjunaContext) ;
+ assertEquals(instanceIdentifier.getInstanceIdentifier(), inArjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;
+ }
+ }
+}
\ No newline at end of file
Added: labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TwoPCParticipantTestCase.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TwoPCParticipantTestCase.java (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/tests/src/com/arjuna/wst11/tests/junit/TwoPCParticipantTestCase.java 2008-05-23 14:26:48 UTC (rev 20137)
@@ -0,0 +1,198 @@
+/*
+ * 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) 2003, 2004,
+ *
+ * Arjuna Technologies Limited.
+ *
+ * $Id: TwoPCParticipantTestCase.java,v 1.6.2.1 2005/11/22 10:37:46 kconner Exp $
+ */
+
+package com.arjuna.wst11.tests.junit;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.AttributedURI;
+
+import junit.framework.TestCase;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.wsat.client.CoordinatorClient;
+import com.arjuna.webservices11.wsat.processors.CoordinatorProcessor;
+import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
+import com.arjuna.wst11.tests.junit.TestCoordinatorProcessor.CoordinatorDetails;
+import com.arjuna.wst11.tests.junit.TestCoordinatorProcessor;
+import com.arjuna.wst11.tests.TestUtil;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
+
+public class TwoPCParticipantTestCase extends TestCase
+{
+ private CoordinatorProcessor origCoordinatorProcessor ;
+ private TestCoordinatorProcessor testCoordinatorProcessor = new TestCoordinatorProcessor();
+
+ protected void setUp()
+ throws Exception
+ {
+ origCoordinatorProcessor = CoordinatorProcessor.getProcessor();
+ CoordinatorProcessor.setProcessor(testCoordinatorProcessor);
+ }
+
+ public void testSendPrepared()
+ throws Exception
+ {
+ final String messageId = "testSendPrepared" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("1") ;
+ W3CEndpointReference coordinatorEndpoint = TestUtil.getCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorServiceURI, messageId) ;
+
+ CoordinatorClient.getClient().sendPrepared(coordinatorEndpoint, addressingProperties, new InstanceIdentifier("sender"));
+
+ CoordinatorDetails details = testCoordinatorProcessor.getCoordinatorDetails(messageId, 10000);
+ assertTrue(details.hasPrepared());
+
+ checkDetails(details, true, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendAborted()
+ throws Exception
+ {
+ final String messageId = "testSendAborted" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("2") ;
+ W3CEndpointReference coordinatorEndpoint = TestUtil.getCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorServiceURI, messageId) ;
+
+ CoordinatorClient.getClient().sendAborted(coordinatorEndpoint, addressingProperties, new InstanceIdentifier("sender"));
+
+ CoordinatorDetails details = testCoordinatorProcessor.getCoordinatorDetails(messageId, 10000);
+ assertTrue(details.hasAborted());
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendReadOnly()
+ throws Exception
+ {
+ final String messageId = "testSendReadOnly" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("3") ;
+ W3CEndpointReference coordinatorEndpoint = TestUtil.getCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorServiceURI, messageId) ;
+
+ CoordinatorClient.getClient().sendReadOnly(coordinatorEndpoint, addressingProperties, new InstanceIdentifier("sender"));
+
+ CoordinatorDetails details = testCoordinatorProcessor.getCoordinatorDetails(messageId, 10000);
+ assertTrue(details.hasReadOnly());
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendCommitted()
+ throws Exception
+ {
+ final String messageId = "testSendCommitted" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("4") ;
+ W3CEndpointReference coordinatorEndpoint = TestUtil.getCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorServiceURI, messageId) ;
+
+ CoordinatorClient.getClient().sendCommitted(coordinatorEndpoint, addressingProperties, new InstanceIdentifier("sender"));
+
+ CoordinatorDetails details = testCoordinatorProcessor.getCoordinatorDetails(messageId, 10000);
+ assertTrue(details.hasCommitted());
+
+ checkDetails(details, false, true, messageId, instanceIdentifier);
+ }
+
+ public void testSendError()
+ throws Exception
+ {
+ final String messageId = "testSendError" ;
+ final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("5");
+ W3CEndpointReference coordinatorEndpoint = TestUtil.getCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
+ final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.coordinatorServiceURI, messageId);
+ final String reason = "testSendErrorReason" ;
+ final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER ;
+ final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME ;
+ final SoapFault11 soapFault = new SoapFault11(soapFaultType, subcode, reason) ;
+
+ CoordinatorClient.getClient().sendSoapFault(coordinatorEndpoint, addressingProperties, soapFault, new InstanceIdentifier("sender"));
+
+ CoordinatorDetails details = testCoordinatorProcessor.getCoordinatorDetails(messageId, 10000);
+ assertNotNull(details.hasSoapFault());
+ assertEquals(details.hasSoapFault().getSoapFaultType(), soapFault.getSoapFaultType());
+ assertEquals(details.hasSoapFault().getReason(), soapFault.getReason());
+ assertEquals(details.hasSoapFault().getSubcode(), soapFault.getSubcode());
+
+ checkDetails(details, false, false, messageId, instanceIdentifier);
+ }
+
+ protected void tearDown()
+ throws Exception
+ {
+ CoordinatorProcessor.setProcessor(origCoordinatorProcessor);
+ }
+
+ /**
+ * check the message details to see that they have the correct to, from and faultto address and message id, a
+ * none reply to address and an arjuna context containing the correct instannce identifier
+ * @param details
+ * @param hasFrom
+ * @param hasFaultTo
+ * @param messageId
+ * @param instanceIdentifier
+ */
+
+ private void checkDetails(CoordinatorDetails details, boolean hasFrom, boolean hasFaultTo, String messageId, InstanceIdentifier instanceIdentifier)
+ {
+ AddressingProperties inAddressingProperties = details.getAddressingProperties();
+ ArjunaContext inArjunaContext = details.getArjunaContext();
+
+ assertEquals(inAddressingProperties.getTo().getURI().toString(), TestUtil.coordinatorServiceURI);
+ assertNotNull(inAddressingProperties.getReplyTo());
+ assertTrue(AddressingHelper.isNoneReplyTo(inAddressingProperties));
+ if (hasFrom) {
+ assertNotNull(inAddressingProperties.getFrom());
+ assertEquals(inAddressingProperties.getFrom().getAddress().getURI().toString(), TestUtil.participantServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ if (hasFaultTo) {
+ assertNotNull(inAddressingProperties.getFaultTo());
+ assertEquals(inAddressingProperties.getFaultTo().getAddress().getURI().toString(), TestUtil.participantServiceURI);
+ } else {
+ assertNull(inAddressingProperties.getFrom());
+ }
+ assertNotNull(inAddressingProperties.getMessageID());
+ assertEquals(inAddressingProperties.getMessageID().getURI().toString(), messageId);
+
+ if (instanceIdentifier == null) {
+ assertNull(inArjunaContext);
+ } else {
+ assertNotNull(inArjunaContext) ;
+ assertEquals(instanceIdentifier.getInstanceIdentifier(), inArjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;
+ }
+ }
+}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list