use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class BusinessAgreementWithParticipantCompletionCoordinatorTest method testSendCancel.
@Test
public void testSendCancel() throws Exception {
final String messageId = "testSendCancel";
final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("2");
W3CEndpointReference endpoint = TestUtil.getParticipantCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
final MAP map = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId);
ParticipantCompletionParticipantClient.getClient().sendCancel(endpoint, map, new InstanceIdentifier("sender"));
final ParticipantCompletionParticipantDetails details = testParticipantCompletionParticipantProcessor.getParticipantCompletionParticipantDetails(messageId, 10000);
assertTrue(details.hasCancel());
checkDetails(details, true, true, messageId, instanceIdentifier);
}
use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class BusinessAgreementWithParticipantCompletionCoordinatorTest method testSendStatus.
@Test
public void testSendStatus() throws Exception {
final String messageId = "testSendStatus";
final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("6");
W3CEndpointReference endpoint = TestUtil.getParticipantCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
final MAP map = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId);
final State state = State.STATE_ACTIVE;
ParticipantCompletionParticipantClient.getClient().sendStatus(endpoint, map, 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);
}
use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class BusinessAgreementWithParticipantCompletionCoordinatorTest method testSendError.
@Test
public void testSendError() throws Exception {
final String messageId = "testSendGetStatus";
final MAP map = 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);
ParticipantCompletionParticipantClient.getClient().sendSoapFault(soapFault, null, map, 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);
}
use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class BusinessAgreementWithParticipantCompletionCoordinatorTest method testSendCompensate.
@Test
public void testSendCompensate() throws Exception {
final String messageId = "testSendCompensate";
final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("3");
W3CEndpointReference endpoint = TestUtil.getParticipantCompletionParticipantEndpoint(instanceIdentifier.getInstanceIdentifier());
final MAP map = AddressingHelper.createRequestContext(TestUtil.participantCompletionParticipantServiceURI, messageId);
ParticipantCompletionParticipantClient.getClient().sendCompensate(endpoint, map, new InstanceIdentifier("sender"));
final ParticipantCompletionParticipantDetails details = testParticipantCompletionParticipantProcessor.getParticipantCompletionParticipantDetails(messageId, 10000);
assertTrue(details.hasCompensate());
checkDetails(details, true, true, messageId, instanceIdentifier);
}
use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class CompletionCoordinatorTest method testSendError.
@Test
public void testSendError() throws Exception {
final String messageId = "123456";
final String reason = "testSendErrorReason";
final String instanceIdentifier = "testSendError";
final W3CEndpointReference completionInitiatorEndpoint = TestUtil.getCompletionInitiatorEndpoint(instanceIdentifier);
final MAP map = 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 MAP map, final ArjunaContext arjunaContext) {
assertEquals(map.getTo(), TestUtil.completionInitiatorServiceURI);
assertNull(map.getFrom());
assertNull(map.getFaultTo());
assertNotNull(map.getReplyTo());
assertTrue(AddressingHelper.isNoneReplyTo(map));
assertNotNull(map.getMessageID());
assertEquals(map.getMessageID(), 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, map, soapFault, new InstanceIdentifier("sender"));
callback.waitUntilTriggered();
} finally {
initiator.removeCallback(instanceIdentifier);
}
assertTrue(callback.hasTriggered());
assertFalse(callback.hasFailed());
}
Aggregations