use of org.apache.cxf.greeter_control.ControlService in project cxf by apache.
the class InterceptorFaultTest method setupGreeter.
private void setupGreeter(String cfgResource, boolean useDecoupledEndpoint) throws NumberFormatException, MalformedURLException {
SpringBusFactory bf = new SpringBusFactory();
controlBus = bf.createBus();
BusFactory.setDefaultBus(controlBus);
ControlService cs = new ControlService();
control = cs.getControlPort();
updateAddressPort(control, PORT);
assertTrue("Failed to start greeter", control.startGreeter(cfgResource));
greeterBus = bf.createBus(cfgResource);
BusFactory.setDefaultBus(greeterBus);
LOG.fine("Initialised greeter bus with configuration: " + cfgResource);
if (null == comparator) {
comparator = new PhaseComparator();
}
if (null == inPhases) {
inPhases = new ArrayList<>();
inPhases.addAll(greeterBus.getExtension(PhaseManager.class).getInPhases());
Collections.sort(inPhases, comparator);
}
if (null == postUnMarshalPhase) {
postUnMarshalPhase = getPhase(Phase.POST_UNMARSHAL);
}
GreeterService gs = new GreeterService();
greeter = gs.getGreeterPort();
updateAddressPort(greeter, PORT);
LOG.fine("Created greeter client.");
if (!useDecoupledEndpoint) {
return;
}
// programatically configure decoupled endpoint that is guaranteed to
// be unique across all test cases
decoupledEndpointPort++;
decoupledEndpoint = "http://localhost:" + allocatePort("decoupled-" + decoupledEndpointPort) + "/decoupled_endpoint";
Client c = ClientProxy.getClient(greeter);
HTTPConduit hc = (HTTPConduit) (c.getConduit());
HTTPClientPolicy cp = hc.getClient();
cp.setDecoupledEndpoint(decoupledEndpoint);
LOG.fine("Using decoupled endpoint: " + cp.getDecoupledEndpoint());
}
use of org.apache.cxf.greeter_control.ControlService in project cxf by apache.
the class FailoverAddressOverrideTest method startTarget.
protected void startTarget(String address) throws Exception {
ControlService cs = new ControlService();
control = cs.getControlPort();
updateAddressPort(control, PORT_0);
LOG.info("starting replicated target: " + address);
assertTrue("Failed to start greeter", control.startGreeter(address));
targets.add(address);
}
use of org.apache.cxf.greeter_control.ControlService in project cxf by apache.
the class SequenceTest method initControl.
private void initControl(SpringBusFactory bf, String cfgResource) {
controlBus = bf.createBus();
BusFactory.setDefaultBus(controlBus);
ControlService cs = new ControlService();
control = cs.getControlPort();
try {
updateAddressPort(control, PORT);
} catch (Exception ex) {
// ignore
}
assertTrue("Failed to start greeter", control.startGreeter(cfgResource));
}
use of org.apache.cxf.greeter_control.ControlService in project cxf by apache.
the class WSRM12ServerCycleTest method runTest.
public void runTest(String cfg, boolean faultOnRestart) throws Exception {
SpringBusFactory bf = new SpringBusFactory();
bus = bf.createBus();
BusFactory.setDefaultBus(bus);
ControlService cs = new ControlService();
Control control = cs.getControlPort();
ConnectionHelper.setKeepAliveConnection(control, false, true);
updateAddressPort(control, PORT);
assertTrue("Failed to start greeter", control.startGreeter(cfg));
System.setProperty("db.name", getPrefix() + "-recovery");
Bus greeterBus = new SpringBusFactory().createBus();
System.clearProperty("db.name");
BusFactory.setDefaultBus(greeterBus);
// avoid early client resends
greeterBus.getExtension(RMManager.class).getConfiguration().setBaseRetransmissionInterval(Long.valueOf(60000));
GreeterService gs = new GreeterService();
Greeter greeter = gs.getGreeterPort(new LoggingFeature(), new AddressingFeature(), wsrm());
updateAddressPort(greeter, PORT);
greeter.greetMe("one");
greeter.greetMe("two");
greeter.greetMe("three");
control.stopGreeter(cfg);
// make sure greeter is down
Thread.sleep(1000);
control.startGreeter(cfg);
// CXF-7392
if (faultOnRestart) {
try {
greeter.greetMe("four");
} catch (SOAPFaultException ex) {
assertTrue(ex.getMessage().contains("wsrm:Identifier"));
// expected, sequence identifier doesn't exist on other side
}
} else {
// this should work as the sequence should be recovered on the server side
greeter.greetMe("four");
}
((Closeable) greeter).close();
greeterBus.shutdown(true);
control.stopGreeter(cfg);
bus.shutdown(true);
}
use of org.apache.cxf.greeter_control.ControlService in project cxf by apache.
the class FailoverTest method startTarget.
protected void startTarget(String address) throws Exception {
ControlService cs = new ControlService();
control = cs.getControlPort();
updateAddressPort(control, PORT_0);
LOG.info("starting replicated target: " + address);
assertTrue("Failed to start greeter", control.startGreeter(address));
targets.add(address);
}
Aggregations