use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.
the class MessageCallbackOnewayTest method testOnewayExactlyOnceInOrder.
private void testOnewayExactlyOnceInOrder(Executor executor) throws Exception {
init("org/apache/cxf/systest/ws/rm/exactlyonce-inorder.xml", executor);
greeterBus.getOutInterceptors().add(new MessageLossSimulator());
RMManager manager = greeterBus.getExtension(RMManager.class);
manager.getConfiguration().setBaseRetransmissionInterval(RETRANSMISSION_INTERVAL);
String[] callArgs = new String[] { "one", "two", "three", "four" };
for (int i = 0; i < callArgs.length; i++) {
greeter.greetMeOneWay(callArgs[i]);
}
callback.waitDone(8, 3000, 60000);
verifyCallbacks();
}
use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.
the class ProtocolVariationsTest method testTerminateSequenceRM11.
@Test
public void testTerminateSequenceRM11() throws Exception {
init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", false);
RMManager manager = greeterBus.getExtension(RMManager.class);
manager.getSourcePolicy().getSequenceTerminationPolicy().setMaxLength(1);
// WS-RM 1.1 and WS-A 1.0
Client client = ClientProxy.getClient(greeter);
client.getRequestContext().put(RMManager.WSRM_VERSION_PROPERTY, RM11Constants.NAMESPACE_URI);
client.getRequestContext().put(RMManager.WSRM_WSA_VERSION_PROPERTY, Names.WSA_NAMESPACE_NAME);
greeter.greetMeOneWay("one");
verifyTerminateSequence(Names.WSA_NAMESPACE_NAME, RM11Constants.INSTANCE);
}
use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.
the class RedeliveryTest method testAutomaticRedeliveryAfterError.
@Test
public void testAutomaticRedeliveryAfterError() throws Exception {
LOG.fine("Creating greeter client");
SpringBusFactory bf = new SpringBusFactory();
bus = bf.createBus("/org/apache/cxf/systest/ws/rm/rminterceptors.xml");
// set the client retry interval much shorter than the slow processing delay
RMManager manager = bus.getExtension(RMManager.class);
RMConfiguration cfg = manager.getConfiguration();
cfg.setBaseRetransmissionInterval(3000L);
BusFactory.setDefaultBus(bus);
GreeterService gs = new GreeterService();
greeter = gs.getGreeterPort();
updateAddressPort(greeter, PORT);
assertNull("last greeted by none", serverGreeter.getValue());
LOG.fine("Invoking greeter for one");
greeter.greetMeOneWay("one");
LOG.fine("Wait for 4 secs ...");
Thread.sleep(4000);
assertEquals("last greeted by one", "one", serverGreeter.getValue());
assertTrue("retransmission running", manager.getRetransmissionQueue().isEmpty());
LOG.fine("Activating the error trigger and invoking greeter for two");
serverGreeter.setThrowAlways(true);
greeter.greetMeOneWay("two");
LOG.fine("Wait for 4 secs ...");
Thread.sleep(4000);
RMManager serverManager = serverBus.getExtension(RMManager.class);
assertEquals("last greeted by one", "one", serverGreeter.getValue());
assertTrue("retransmission running", manager.getRetransmissionQueue().isEmpty());
assertFalse("redelivery not running", serverManager.getRedeliveryQueue().isEmpty());
LOG.fine("Deactivating the error trigger and wait for 9 secs ...");
serverGreeter.setThrowAlways(false);
Thread.sleep(9000);
assertEquals("last greeted by two", "two", serverGreeter.getValue());
assertTrue("redelivery running", serverManager.getRedeliveryQueue().isEmpty());
}
use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.
the class RetransmissionQueueTest method testDecoupleFaultHandling.
@Test
public void testDecoupleFaultHandling() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
bus = bf.createBus("/org/apache/cxf/systest/ws/rm/message-loss.xml");
BusFactory.setDefaultBus(bus);
LoggingInInterceptor in = new LoggingInInterceptor();
bus.getInInterceptors().add(in);
bus.getInFaultInterceptors().add(in);
LoggingOutInterceptor out = new LoggingOutInterceptor();
bus.getOutInterceptors().add(out);
bus.getExtension(RMManager.class).getConfiguration().setBaseRetransmissionInterval(new Long(4000));
// an interceptor to simulate a transmission error
MessageLossSimulator loser = new MessageLossSimulator();
bus.getOutInterceptors().add(loser);
bus.getOutFaultInterceptors().add(out);
GreeterService gs = new GreeterService();
final Greeter greeter = gs.getGreeterPort();
updateAddressPort(greeter, PORT);
LOG.fine("Created greeter client.");
ConnectionHelper.setKeepAliveConnection(greeter, true);
loser.setMode(-1);
loser.setThrowsException(true);
try {
greeter.greetMeOneWay("oneway");
} catch (Exception e) {
fail("fault thrown after queued for retransmission");
}
Thread.sleep(2000);
RMManager manager = bus.getExtension(RMManager.class);
boolean empty = manager.getRetransmissionQueue().isEmpty();
assertFalse("RetransmissionQueue is empty", empty);
loser.setMode(1);
Thread.sleep(6000);
empty = manager.getRetransmissionQueue().isEmpty();
assertTrue("RetransmissionQueue not cleared", empty);
}
use of org.apache.cxf.ws.rm.RMManager in project cxf by apache.
the class RobustServiceWithFaultTest method testRobustWithSomeFaults.
@Test
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);
manager.getConfiguration().setBaseRetransmissionInterval(new Long(5000));
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());
}
Aggregations