use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndTester method testServerOneWayReturnFalse2.
/*
*
* Have one of the server handlers return false during a
* one-way request. The handler chain caller should stop
* calling handlers and dispatch the message to the endpoint.
*
* Same as testServerInboundReturnFalse2 but with a different
* handler returning false.
*/
public void testServerOneWayReturnFalse2() throws Exception {
TestService_Service service = getService();
TestService testStub = getTestStub(service);
ReportService reportStub = getReportStub(service);
HandlerTracker tracker = HandlerTracker.getClientInstance();
reportStub.clearHandlerTracker();
for (int i = 0; i < numTotalServerHandlers; i++) {
reportStub.setInstruction(SERVER_PREFIX + i, HA_REGISTER_HANDLE_XYZ);
}
reportStub.setInstruction(SERVER_PREFIX + 1, HA_RETURN_FALSE);
tracker.clearAll();
testStub.testIntOneWay(0);
// handler 1 will not register
int[] calledNames = { 4, 2 };
List<String> calledHandlers = reportStub.getReport(REPORT_CALLED_HANDLERS);
assertEquals("did not get the right number of called handlers", calledNames.length, calledHandlers.size());
for (int i = 0; i < calledNames.length; i++) {
assertEquals("did not get expected handler name", SERVER_PREFIX + calledNames[i], calledHandlers.get(i));
}
}
use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndTester method testClientHandlers2.
/*
* Make sure the right number of client side handlers are
* in place for a one-way call.
*/
public void testClientHandlers2() throws Exception {
HandlerTracker tracker = HandlerTracker.getClientInstance();
TestService_Service service = getService();
TestService stub = getTestStub(service);
tracker.clearAll();
for (int i = 0; i < numTotalHandlers; i++) {
// just set them all
tracker.setHandlerAction(CLIENT_PREFIX + i, HA_REGISTER_HANDLE_XYZ);
}
stub.testIntOneWay(0);
List<String> calledHandlers = tracker.getCalledHandlers();
assertEquals("did not get the right number of called handlers", numTestHandlers, calledHandlers.size());
int[] calledNames = { 0, 1, 3, 4, 5, 7 };
for (int i = 0; i < calledNames.length; i++) {
assertEquals("did not get expected handler name", CLIENT_PREFIX + calledNames[i], calledHandlers.get(i));
}
}
use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndTester method testResponsePropertyDispatch.
/*
* Sets a property on the (client side) response handler context
* and verifies that the client sees it in the response context.
* This version uses a dispatch client rather than proxy.
*/
public void testResponsePropertyDispatch() throws Exception {
HandlerTracker tracker = HandlerTracker.getClientInstance();
Dispatch<Object> dispatch = getDispatchJAXB(testPortQName);
// tell the server handlers not to do anything
ReportService reportStub = getReportStub(getService());
reportStub.clearHandlerTracker();
// add handler
String myHandlerName = "MyDispatchHandler";
BaseSOAPHandler propAddingHandler = new BaseSOAPHandler();
propAddingHandler.setName(CLIENT_PREFIX + myHandlerName);
propAddingHandler.initTheHandler();
List<Handler> newHandlers = new ArrayList<Handler>();
newHandlers.add(propAddingHandler);
dispatch.getBinding().setHandlerChain(newHandlers);
// tell the client handlers what to do
tracker.clearAll();
tracker.setHandlerAction(CLIENT_PREFIX + myHandlerName, HA_ADD_USER_PROPERTY_INBOUND);
int x = 1;
TestInt request = new TestInt();
request.setIntin(x);
TestIntResponse response = (TestIntResponse) dispatch.invoke(request);
assertEquals("did not get proper response", x, response.getIntout());
Map context = dispatch.getResponseContext();
Object testValue = context.get(USER_HANDLER_PROPERTY_NAME);
assertNotNull("did not receive property in response context", testValue);
String testValueString = (String) testValue;
assertTrue("property value incorrect. expected ", testValueString.equals(USER_PROPERTY_HANDLER_SET));
}
use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndTester method testServerInboundReturnFalse1.
/*
* Have one of the server handlers return false and change
* the message contents to look like a reply.
*
* This is really a test of the handler util
* changeRequestToResponse() method used in client side tests.
*/
public void testServerInboundReturnFalse1() throws Exception {
TestService_Service service = getService();
TestService testStub = getTestStub(service);
ReportService reportStub = getReportStub(service);
HandlerTracker tracker = HandlerTracker.getClientInstance();
reportStub.clearHandlerTracker();
reportStub.setInstruction(SERVER_PREFIX + 2, HA_RETURN_FALSE_CHANGE_MESSAGE);
tracker.clearAll();
for (int i = 0; i < numTotalHandlers; i++) {
tracker.setHandlerAction(CLIENT_PREFIX + i, HA_REGISTER_HANDLE_XYZ);
}
int result = testStub.testInt(0);
assertEquals("did not get expected value back", 0, result);
}
use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndTester method testResponseProperty.
/*
* Sets a property on the (client side) response handler context
* and verifies that the client sees it in the response context.
*/
public void testResponseProperty() throws Exception {
HandlerTracker tracker = HandlerTracker.getClientInstance();
TestService stub = getTestStub(getService());
tracker.clearAll();
tracker.setHandlerAction(CLIENT_PREFIX + 5, HA_ADD_USER_PROPERTY_INBOUND);
stub.testInt(1);
Map context = ((BindingProvider) stub).getResponseContext();
Object testValue = context.get(USER_HANDLER_PROPERTY_NAME);
assertNotNull("did not receive property in response context", testValue);
String testValueString = (String) testValue;
assertTrue("property value incorrect. expected ", testValueString.equals(USER_PROPERTY_HANDLER_SET));
}
Aggregations