Search in sources :

Example 21 with MAP

use of org.jboss.ws.api.addressing.MAP in project narayana by jbosstm.

the class CompletionCoordinatorTest method testSendAborted.

@Test
public void testSendAborted() throws Exception {
    final String messageId = "123456";
    final String instanceIdentifier = "testSendAborted";
    final W3CEndpointReference completionInitiatorEndpoint = TestUtil.getCompletionInitiatorEndpoint(instanceIdentifier);
    final MAP map = AddressingHelper.createRequestContext(TestUtil.completionInitiatorServiceURI, messageId);
    final TestCompletionInitiatorCallback callback = new TestCompletionInitiatorCallback() {

        public void aborted(final Notification aborted, final MAP map, final ArjunaContext arjunaContext) {
            assertEquals(map.getTo(), TestUtil.completionInitiatorServiceURI);
            assertNull(map.getFrom());
            assertNotNull(map.getFaultTo());
            assertEquals(map.getFaultTo().getAddress(), TestUtil.completionCoordinatorServiceURI);
            assertNotNull(map.getReplyTo());
            assertTrue(AddressingHelper.isNoneReplyTo(map));
            assertNotNull(map.getMessageID());
            assertEquals(map.getMessageID(), messageId);
            assertNotNull(arjunaContext);
            assertEquals(instanceIdentifier, arjunaContext.getInstanceIdentifier().getInstanceIdentifier());
        }
    };
    final CompletionInitiatorProcessor initiator = CompletionInitiatorProcessor.getProcessor();
    initiator.registerCallback(instanceIdentifier, callback);
    try {
        CompletionInitiatorClient.getClient().sendAborted(completionInitiatorEndpoint, map, new InstanceIdentifier("sender"));
        callback.waitUntilTriggered();
    } finally {
        initiator.removeCallback(instanceIdentifier);
    }
    assertTrue(callback.hasTriggered());
    assertFalse(callback.hasFailed());
}
Also used : W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) CompletionInitiatorProcessor(com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) ArjunaContext(com.arjuna.webservices11.wsarj.ArjunaContext) MAP(org.jboss.ws.api.addressing.MAP) Notification(org.oasis_open.docs.ws_tx.wsat._2006._06.Notification) Test(org.junit.Test)

Example 22 with MAP

use of org.jboss.ws.api.addressing.MAP in project narayana by jbosstm.

the class CompletionCoordinatorTest method testSendCommitted.

@Test
public void testSendCommitted() throws Exception {
    final String messageId = "123456";
    final String instanceIdentifier = "testSendCommitted";
    final W3CEndpointReference completionInitiatorEndpoint = TestUtil.getCompletionInitiatorEndpoint(instanceIdentifier);
    final MAP map = AddressingHelper.createRequestContext(TestUtil.completionInitiatorServiceURI, messageId);
    final TestCompletionInitiatorCallback callback = new TestCompletionInitiatorCallback() {

        public void committed(final Notification committed, final MAP map, final ArjunaContext arjunaContext) {
            assertEquals(map.getTo(), TestUtil.completionInitiatorServiceURI);
            assertNull(map.getFrom());
            assertNotNull(map.getFaultTo());
            assertEquals(map.getFaultTo().getAddress(), TestUtil.completionCoordinatorServiceURI);
            assertNotNull(map.getReplyTo());
            assertTrue(AddressingHelper.isNoneReplyTo(map));
            assertEquals(map.getMessageID(), messageId);
            assertNotNull(arjunaContext);
            assertEquals(instanceIdentifier, arjunaContext.getInstanceIdentifier().getInstanceIdentifier());
        }
    };
    final CompletionInitiatorProcessor initiator = CompletionInitiatorProcessor.getProcessor();
    initiator.registerCallback(instanceIdentifier, callback);
    try {
        CompletionInitiatorClient.getClient().sendCommitted(completionInitiatorEndpoint, map, new InstanceIdentifier("sender"));
        callback.waitUntilTriggered();
    } finally {
        initiator.removeCallback(instanceIdentifier);
    }
    assertTrue(callback.hasTriggered());
    assertFalse(callback.hasFailed());
}
Also used : W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) CompletionInitiatorProcessor(com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) ArjunaContext(com.arjuna.webservices11.wsarj.ArjunaContext) MAP(org.jboss.ws.api.addressing.MAP) Notification(org.oasis_open.docs.ws_tx.wsat._2006._06.Notification) Test(org.junit.Test)

Example 23 with MAP

use of org.jboss.ws.api.addressing.MAP in project narayana by jbosstm.

the class TwoPCCoordinatorTest method testSendError.

@Test
public void testSendError() throws Exception {
    final String messageId = "testSendError";
    final MAP map = 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(map, 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);
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) SoapFaultType(com.arjuna.webservices.SoapFaultType) QName(javax.xml.namespace.QName) ParticipantDetails(com.arjuna.wst.tests.arq.TestParticipantProcessor.ParticipantDetails) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) MAP(org.jboss.ws.api.addressing.MAP) Test(org.junit.Test)

Example 24 with MAP

use of org.jboss.ws.api.addressing.MAP in project narayana by jbosstm.

the class TwoPCCoordinatorTest method testSendRollback.

@Test
public void testSendRollback() throws Exception {
    final String messageId = "testSendRollback";
    final MAP map = AddressingHelper.createRequestContext(TestUtil.participantServiceURI, messageId);
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("3");
    final W3CEndpointReference participantEndpointReference = TestUtil.getParticipantEndpoint(null);
    ParticipantClient.getClient().sendRollback(participantEndpointReference, map, new InstanceIdentifier("sender"));
    final ParticipantDetails details = testParticipantProcessor.getParticipantDetails(messageId, 10000);
    assertTrue(details.hasRollback());
    checkDetails(details, true, true, messageId, null);
}
Also used : W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) ParticipantDetails(com.arjuna.wst.tests.arq.TestParticipantProcessor.ParticipantDetails) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) MAP(org.jboss.ws.api.addressing.MAP) Test(org.junit.Test)

Example 25 with MAP

use of org.jboss.ws.api.addressing.MAP in project narayana by jbosstm.

the class TwoPCCoordinatorTest method testSendCommit.

@Test
public void testSendCommit() throws Exception {
    final String messageId = "testSendCommit";
    final MAP map = AddressingHelper.createRequestContext(TestUtil.participantServiceURI, messageId);
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("2");
    final W3CEndpointReference participantEndpointReference = TestUtil.getParticipantEndpoint(null);
    ParticipantClient.getClient().sendCommit(participantEndpointReference, map, new InstanceIdentifier("sender"));
    final ParticipantDetails details = testParticipantProcessor.getParticipantDetails(messageId, 10000);
    assertTrue(details.hasCommit());
    checkDetails(details, true, true, messageId, null);
}
Also used : W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) ParticipantDetails(com.arjuna.wst.tests.arq.TestParticipantProcessor.ParticipantDetails) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) MAP(org.jboss.ws.api.addressing.MAP) Test(org.junit.Test)

Aggregations

MAP (org.jboss.ws.api.addressing.MAP)322 MessageContext (javax.xml.ws.handler.MessageContext)119 Action (javax.xml.ws.Action)104 ArjunaContext (com.arjuna.webservices11.wsarj.ArjunaContext)81 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)75 SoapFault11 (com.arjuna.webservices11.SoapFault11)65 Task (com.arjuna.services.framework.task.Task)62 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)53 Test (org.junit.Test)51 RequestWrapper (javax.xml.ws.RequestWrapper)41 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)40 NotificationType (org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType)29 SoapFault (com.arjuna.webservices.SoapFault)24 ATInitiatorProcessor (com.jboss.transaction.txinterop.webservices.atinterop.processors.ATInitiatorProcessor)15 InitiatorProcessor (com.jboss.transaction.wstf.webservices.sc007.processors.InitiatorProcessor)15 Notification (org.oasis_open.docs.ws_tx.wsat._2006._06.Notification)15 QName (javax.xml.namespace.QName)13 BAInitiatorProcessor (com.jboss.transaction.txinterop.webservices.bainterop.processors.BAInitiatorProcessor)12 SystemException (com.arjuna.wst.SystemException)11 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)11