bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr-optional.xml");
Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr-optional.xml");
PolicyTestUtils.setPolicyConstants(bus,
PolicyConstants.NAMESPACE_W3_200607);
BusFactory.setDefaultBus(bus);
InMessageRecorder in = new InMessageRecorder();
bus.getInInterceptors().add(in);
OutMessageRecorder out = new OutMessageRecorder();
bus.getOutInterceptors().add(out);
BasicGreeterService gs = new BasicGreeterService();
final Greeter greeter = gs.getGreeterPort();
LOG.fine("Created greeter client.");
ConnectionHelper.setKeepAliveConnection(greeter, true);
// oneway
greeter.greetMeOneWay("CXF");
// two-way
assertEquals("CXF", greeter.greetMe("cxf"));
// exception
try {
greeter.pingMe();
} catch (PingMeFault ex) {
fail("First invocation should have succeeded.");
}
try {
greeter.pingMe();
fail("Expected PingMeFault not thrown.");
} catch (PingMeFault ex) {
assertEquals(2, (int)ex.getFaultInfo().getMajor());
assertEquals(1, (int)ex.getFaultInfo().getMinor());
}
MessageFlow mf = new MessageFlow(out.getOutboundMessages(), in.getInboundMessages());
for (int i = 0; i < 3; i++) {
mf.verifyHeader(RMUtils.getAddressingConstants().getMessageIDQName(), true, i);
mf.verifyHeader(RMUtils.getAddressingConstants().getMessageIDQName(), false, i);
}
}