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());
}
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());
}
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);
}
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);
}
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);
}
Aggregations