use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class TwoPCCoordinatorTest method checkDetails.
/**
* 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) {
MAP inMAP = details.getMAP();
ArjunaContext inArjunaContext = details.getArjunaContext();
assertEquals(inMAP.getTo(), TestUtil.participantServiceURI);
assertNotNull(inMAP.getReplyTo());
assertTrue(AddressingHelper.isNoneReplyTo(inMAP));
if (hasFrom) {
assertNotNull(inMAP.getFrom());
assertEquals(inMAP.getFrom().getAddress(), TestUtil.coordinatorServiceURI);
} else {
assertNull(inMAP.getFrom());
}
if (hasFaultTo) {
assertNotNull(inMAP.getFaultTo());
assertEquals(inMAP.getFaultTo().getAddress(), TestUtil.coordinatorServiceURI);
} else {
assertNull(inMAP.getFrom());
}
assertNotNull(inMAP.getMessageID());
assertEquals(inMAP.getMessageID(), messageId);
if (instanceIdentifier == null) {
assertNull(inArjunaContext);
} else {
assertNotNull(inArjunaContext);
assertEquals(instanceIdentifier.getInstanceIdentifier(), inArjunaContext.getInstanceIdentifier().getInstanceIdentifier());
}
}
use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class BusinessAgreementWithCoordinatorCompletionParticipantTest method testSendCompensated.
@Test
public void testSendCompensated() throws Exception {
final String messageId = "testSendCompensated";
final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("3");
W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
final MAP map = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId);
CoordinatorCompletionCoordinatorClient.getClient().sendCompensated(endpoint, map, new InstanceIdentifier("sender"));
CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000);
assertTrue(details.hasCompensated());
checkDetails(details, false, true, messageId, instanceIdentifier);
}
use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class BusinessAgreementWithCoordinatorCompletionParticipantTest method testSendError.
@Test
public void testSendError() throws Exception {
final String messageId = "testSendError";
final MAP map = 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
CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(soapFault, null, map, 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);
}
use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class BusinessAgreementWithCoordinatorCompletionParticipantTest method testSendCancelled.
public void testSendCancelled() throws Exception {
final String messageId = "testSendCancelled";
final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("2");
W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
final MAP map = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId);
CoordinatorCompletionCoordinatorClient.getClient().sendCancelled(endpoint, map, new InstanceIdentifier("sender"));
CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000);
assertTrue(details.hasCancelled());
checkDetails(details, false, true, messageId, instanceIdentifier);
}
use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class BusinessAgreementWithCoordinatorCompletionParticipantTest method testSendCompleted.
@Test
public void testSendCompleted() throws Exception {
final String messageId = "testSendCompleted";
final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("5");
W3CEndpointReference endpoint = TestUtil.getCoordinatorCompletionCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
final MAP map = AddressingHelper.createRequestContext(TestUtil.coordinatorCompletionCoordinatorServiceURI, messageId);
CoordinatorCompletionCoordinatorClient.getClient().sendCompleted(endpoint, map, new InstanceIdentifier("sender"));
CoordinatorCompletionCoordinatorDetails details = testCoordinatorCompletionCoordinatorProcessor.getCoordinatorCompletionCoordinatorDetails(messageId, 10000);
assertTrue(details.hasCompleted());
checkDetails(details, true, true, messageId, instanceIdentifier);
}
Aggregations