final String messageId = "123456" ;
final String instanceIdentifier = "testSendCommitted" ;
final W3CEndpointReference completionInitiatorEndpoint = TestUtil.getCompletionInitiatorEndpoint(instanceIdentifier);
final AddressingProperties addressingProperties = AddressingHelper.createRequestContext(TestUtil.completionInitiatorServiceURI, messageId) ;
final TestCompletionInitiatorCallback callback = new TestCompletionInitiatorCallback() {
public void committed(final Notification committed, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
{
assertEquals(addressingProperties.getTo().getURI().toString(), TestUtil.completionInitiatorServiceURI);
assertNull(addressingProperties.getFrom());
assertNotNull(addressingProperties.getFaultTo());
assertEquals(addressingProperties.getFaultTo().getAddress().getURI().toString(), TestUtil.completionCoordinatorServiceURI);
assertNotNull(addressingProperties.getReplyTo());
assertTrue(AddressingHelper.isNoneReplyTo(addressingProperties));
assertEquals(addressingProperties.getMessageID().getURI().toString(), messageId);
assertNotNull(arjunaContext) ;
assertEquals(instanceIdentifier, arjunaContext.getInstanceIdentifier().getInstanceIdentifier()) ;
}
};
final CompletionInitiatorProcessor initiator = CompletionInitiatorProcessor.getProcessor() ;
initiator.registerCallback(instanceIdentifier, callback) ;
try
{
CompletionInitiatorClient.getClient().sendCommitted(completionInitiatorEndpoint, addressingProperties, new InstanceIdentifier("sender")) ;
callback.waitUntilTriggered() ;
}
finally
{
initiator.removeCallback(instanceIdentifier) ;
}
assertTrue(callback.hasTriggered()) ;
assertFalse(callback.hasFailed()) ;
}