use of com.icodici.universa.node2.Notification 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.icodici.universa.node2.Notification in project narayana by jbosstm.
the class CompletionCoordinatorRPCClient method sendCommit.
/**
* Send a commit request.
* @param map addressing context initialised with to and message ID.
* @param identifier The identifier of the initiator.
* @throws com.arjuna.webservices.SoapFault For any errors.
* @throws java.io.IOException for any transport errors.
*/
public boolean sendCommit(final W3CEndpointReference endpoint, final MAP map) throws SoapFault, IOException {
CompletionCoordinatorRPCPortType port = getPort(endpoint, map, commitAction);
Notification commit = new Notification();
try {
return port.commitOperation(commit);
} catch (SOAPFaultException sfe) {
throw SoapFault11.create(sfe);
}
}
use of com.icodici.universa.node2.Notification in project narayana by jbosstm.
the class CoordinatorClient method sendPrepared.
/**
* Send a prepared request.
* @param map addressing context initialised with to and message ID.
* @param identifier The identifier of the initiator.
* @throws com.arjuna.webservices.SoapFault For any SOAP errors.
* @throws java.io.IOException for any transport errors.
*/
public void sendPrepared(final W3CEndpointReference endpoint, final MAP map, final InstanceIdentifier identifier) throws SoapFault, IOException {
MAPEndpoint participant = getParticipant(endpoint, map);
AddressingHelper.installFromFaultTo(map, participant, identifier);
CoordinatorPortType port = getPort(endpoint, map, preparedAction);
Notification prepared = new Notification();
port.preparedOperation(prepared);
}
use of com.icodici.universa.node2.Notification in project narayana by jbosstm.
the class CoordinatorClient method sendAborted.
/**
* Send an aborted request.
* @param map addressing context initialised with to and message ID.
* @param identifier The identifier of the initiator.
* @throws com.arjuna.webservices.SoapFault For any SOAP errors.
* @throws java.io.IOException for any transport errors.
*/
public void sendAborted(final W3CEndpointReference endpoint, final MAP map, final InstanceIdentifier identifier) throws SoapFault, IOException {
MAPEndpoint participant = getParticipant(endpoint, map);
AddressingHelper.installFaultTo(map, participant, identifier);
CoordinatorPortType port = getPort(endpoint, map, abortedAction);
Notification aborted = new Notification();
port.abortedOperation(aborted);
}
use of com.icodici.universa.node2.Notification in project narayana by jbosstm.
the class CoordinatorClient method sendCommitted.
/**
* Send a committed request.
* @param map addressing context initialised with to and message ID.
* @param identifier The identifier of the initiator.
* @throws com.arjuna.webservices.SoapFault For any SOAP errors.
* @throws java.io.IOException for any transport errors.
*/
public void sendCommitted(final W3CEndpointReference endpoint, final MAP map, final InstanceIdentifier identifier) throws SoapFault, IOException {
MAPEndpoint participant = getParticipant(endpoint, map);
AddressingHelper.installFaultTo(map, participant, identifier);
CoordinatorPortType port = getPort(endpoint, map, committedAction);
Notification committed = new Notification();
port.committedOperation(committed);
}
Aggregations