use of org.apache.cxf.greeter_control.GreeterService 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.greeter_control.GreeterService 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.greeter_control.GreeterService 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());
}
use of org.apache.cxf.greeter_control.GreeterService in project cxf by apache.
the class SequenceTimeoutTest method initDispatch.
private Dispatch<DOMSource> initDispatch() {
GreeterService gs = new GreeterService();
Dispatch<DOMSource> dispatch = gs.createDispatch(GreeterService.GreeterPort, DOMSource.class, Service.Mode.MESSAGE);
try {
updateAddressPort(dispatch, PORT);
} catch (Exception e) {
// ignore
}
dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.FALSE);
dispatch.getRequestContext().put(MessageContext.WSDL_OPERATION, GREETME_NAME);
return dispatch;
}
use of org.apache.cxf.greeter_control.GreeterService in project cxf by apache.
the class SequenceTimeoutTest method initProxy.
private void initProxy(boolean useDecoupledEndpoint, Executor executor) {
GreeterService gs = new GreeterService();
if (null != executor) {
gs.setExecutor(executor);
}
greeter = gs.getGreeterPort();
try {
updateAddressPort(greeter, PORT);
} catch (Exception e) {
// ignore
}
ConnectionHelper.setKeepAliveConnection(greeter, true);
}
Aggregations