Search in sources :

Example 21 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier 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 InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier 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 InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier 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 InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier 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 InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier 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

InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)130 MAP (org.jboss.ws.api.addressing.MAP)83 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)53 Test (org.junit.Test)51 SoapFault11 (com.arjuna.webservices11.SoapFault11)24 SoapFault (com.arjuna.webservices.SoapFault)20 ArjunaContext (com.arjuna.webservices11.wsarj.ArjunaContext)13 SystemException (com.arjuna.wst.SystemException)13 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)13 QName (javax.xml.namespace.QName)12 CoordinatorCompletionCoordinatorInboundEvents (com.arjuna.webservices11.wsba.CoordinatorCompletionCoordinatorInboundEvents)10 CoordinatorCompletionParticipantInboundEvents (com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)10 ParticipantCompletionCoordinatorInboundEvents (com.arjuna.webservices11.wsba.ParticipantCompletionCoordinatorInboundEvents)10 CoordinatorCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionParticipantProcessor.CoordinatorCompletionParticipantDetails)10 ParticipantCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionCoordinatorProcessor.ParticipantCompletionCoordinatorDetails)10 SoapFaultType (com.arjuna.webservices.SoapFaultType)9 ParticipantCompletionParticipantInboundEvents (com.arjuna.webservices11.wsba.ParticipantCompletionParticipantInboundEvents)9 CoordinatorCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionCoordinatorProcessor.CoordinatorCompletionCoordinatorDetails)9 ParticipantCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionParticipantProcessor.ParticipantCompletionParticipantDetails)9 ProtocolException (javax.xml.ws.ProtocolException)9