PolicyTestUtils.setPolicyConstants(bus,
PolicyConstants.NAMESPACE_W3_200607);
BusFactory.setDefaultBus(bus);
OutMessageRecorder outRecorder = new OutMessageRecorder();
bus.getOutInterceptors().add(outRecorder);
InMessageRecorder inRecorder = new InMessageRecorder();
bus.getInInterceptors().add(inRecorder);
ReliableGreeterService gs = new ReliableGreeterService();
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());
}
MessageRecorder mr = new MessageRecorder(outRecorder, inRecorder);
mr.awaitMessages(5, 9, 5000);
MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages());
mf.verifyMessages(5, true);
String[] expectedActions = new String[] {RMConstants.getCreateSequenceAction(),
GREETMEONEWAY_ACTION,