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 AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
{
assertEquals(addressingProperties.getTo().getURI().toString(), TestUtil.completionInitiatorServiceURI);
assertNull(addressingProperties.getFrom());
assertNull(addressingProperties.getFaultTo());
assertNotNull(addressingProperties.getReplyTo());
assertTrue(AddressingHelper.isNoneReplyTo(addressingProperties));
assertNotNull(addressingProperties.getMessageID());
assertEquals(addressingProperties.getMessageID().getURI().toString(), 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, addressingProperties, soapFault, new InstanceIdentifier("sender")) ;
callback.waitUntilTriggered() ;
}
finally
{
initiator.removeCallback(instanceIdentifier) ;
}
assertTrue(callback.hasTriggered()) ;
assertFalse(callback.hasFailed()) ;
}