public void testRobustWithSomeFaults() throws Exception {
LOG.fine("Creating greeter client");
SpringBusFactory bf = new SpringBusFactory();
bus = bf.createBus("/org/apache/cxf/systest/ws/rm/seqlength1.xml");
// set the client retry interval much shorter than the slow processing delay
RMManager manager = bus.getExtension(RMManager.class);
AcknowledgementInterval ai
= new org.apache.cxf.ws.rmp.v200502.ObjectFactory()
.createRMAssertionAcknowledgementInterval();
ai.setMilliseconds(new Long(5000));
manager.getRMAssertion().setAcknowledgementInterval(ai);
BusFactory.setDefaultBus(bus);
GreeterService gs = new GreeterService();
greeter = gs.getGreeterPort();
updateAddressPort(greeter, PORT);
LOG.fine("Invoking greeter");
greeter.greetMeOneWay("one");
Thread.sleep(3000);
// invoked once
assertEquals("not invoked once", 1, serverGreeter.getCount());
assertTrue("still in retransmission", manager.getRetransmissionQueue().isEmpty());
LOG.fine("Invoking greeter and raising a fault");
serverGreeter.setThrowAlways(true);
greeter.greetMeOneWay("two");
Thread.sleep(3000);
// still invoked once
assertEquals("not invoked once", 1, serverGreeter.getCount());
assertTrue("still in retransmission", manager.getRetransmissionQueue().isEmpty());
LOG.fine("Invoking robust greeter and raising a fault");
robustSetter.setRobust(true);
greeter.greetMeOneWay("three");
Thread.sleep(3000);
// still invoked once
assertEquals("not invoked once", 1, serverGreeter.getCount());
assertFalse("no message in retransmission", manager.getRetransmissionQueue().isEmpty());
LOG.fine("Stop raising a fault and let the retransmission succeeds");
serverGreeter.setThrowAlways(false);
Thread.sleep(8000);
// invoked twice
assertEquals("not invoked twice", 2, serverGreeter.getCount());
assertTrue("still in retransmission", manager.getRetransmissionQueue().isEmpty());
}