use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndTester method testClientRequestAndResponseProperties.
/*
* Verifies that properties exist in request and response. Also
* combines some of the above request and response tests.
*/
public void testClientRequestAndResponseProperties() throws Exception {
HandlerTracker tracker = HandlerTracker.getClientInstance();
TestService stub = getTestStub(getService());
((BindingProvider) stub).getRequestContext().put(USER_CLIENT_PROPERTY_NAME, USER_PROPERTY_CLIENT_SET);
tracker.clearAll();
// handler looks for client prop in request
tracker.setHandlerAction(CLIENT_PREFIX + 5, HA_CHECK_FOR_USER_PROPERTY_OUTBOUND);
// handler adds another prop during request
tracker.setHandlerAction(CLIENT_PREFIX + 7, HA_ADD_USER_PROPERTY_OUTBOUND);
// handler checks for both props and adds third
tracker.setHandlerAction(CLIENT_PREFIX + 3, HA_ADD_AND_CHECK_PROPS_INBOUND);
stub.testInt(1);
Map context = ((BindingProvider) stub).getResponseContext();
Object testValue = context.get(USER_HANDLER_PROPERTY_NAME);
assertNotNull("did not receive first handler property in response context", testValue);
assertEquals("property value incorrect", USER_PROPERTY_HANDLER_SET, (String) testValue);
// this is the last property added
testValue = context.get(USER_HANDLER_PROPERTY_NAME + INBOUND);
assertNotNull("did not receive second handler property in response context", testValue);
assertEquals("property value incorrect", USER_PROPERTY_HANDLER_SET + INBOUND, (String) testValue);
}
use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndTester method testLogicalMessageContextInformation.
/*
* Check LogicalMessageContext in handlers
*/
public void testLogicalMessageContextInformation() throws Exception {
HandlerTracker tracker = HandlerTracker.getClientInstance();
TestService testStub = getTestStub(getService());
tracker.clearAll();
tracker.setHandlerAction(CLIENT_PREFIX + "0", HA_CHECK_LMC);
tracker.setHandlerAction(CLIENT_PREFIX + "1", HA_CHECK_LMC);
tracker.setHandlerAction(CLIENT_PREFIX + "3", HA_CHECK_LMC);
testStub.testInt(4);
}
use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndTester method testClientOutboundReturnFalse3.
/*
* Have one of the client handlers return false and change
* the message contents to look like a reply. Should get 0
* back as result and proper handlers were called and closed.
* Have first handler return false. Test for bug 6232834.
*/
public void testClientOutboundReturnFalse3() throws Exception {
TestService_Service service = getService();
TestService testStub = getTestStub(service);
ReportService reportStub = getReportStub(service);
HandlerTracker tracker = HandlerTracker.getClientInstance();
reportStub.clearHandlerTracker();
tracker.clearAll();
for (int i = 0; i < numTotalHandlers; i++) {
tracker.setHandlerAction(CLIENT_PREFIX + i, HA_REGISTER_HANDLE_XYZ);
}
tracker.setHandlerAction(CLIENT_PREFIX + 0, HA_RETURN_FALSE_CHANGE_MESSAGE);
int result = testStub.testInt(0);
assertEquals("did not get expected value back", 0, result);
// check called handlers
int[] called = { 0 };
int[] closed = { 0 };
List<String> calledHandlers = tracker.getCalledHandlers();
assertEquals("Did not get proper number of called handlers", called.length, calledHandlers.size());
for (int i = 0; i < called.length; i++) {
assertEquals("did not find expected handler", CLIENT_PREFIX + called[i], calledHandlers.get(i));
}
// check closed handlers
List<String> closedHandlers = tracker.getClosedHandlers();
assertEquals("Did not get proper number of closed handlers", closed.length, closedHandlers.size());
for (int i = 0; i < closed.length; i++) {
assertEquals("did not find expected handler", CLIENT_PREFIX + closed[i], closedHandlers.get(i));
}
}
use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndTester method testSOAPHeader1.
/*
* Test soap header. This test has a handler add header elements
* and another handler check for them. Test1 is two client side
* handlers.
*/
public void testSOAPHeader1() throws Exception {
HandlerTracker tracker = HandlerTracker.getClientInstance();
TestService testStub = getTestStub(getService());
tracker.clearAll();
tracker.setHandlerAction(CLIENT_PREFIX + 5, HA_ADD_HEADER_OUTBOUND);
tracker.setHandlerAction(CLIENT_PREFIX + 7, HA_CHECK_FOR_ADDED_HEADER_OUTBOUND);
testStub.testInt(123);
}
use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndTester method testServerOutboundReturnFalse1.
/*
* Have one of the server handlers return false and check
* that the proper handlers were called.
*/
public void testServerOutboundReturnFalse1() 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 + "0", HA_RETURN_FALSE_OUTBOUND);
tracker.clearAll();
int result = testStub.testInt(0);
assertEquals("did not get expected value back", 0, result);
// check called handlers on server side
List<String> calledHandlers = reportStub.getReport(REPORT_CALLED_HANDLERS);
// server0 called twice, the rest are skipped
int[] called = { 4, 2, 1, 0, 0 };
assertEquals("Did not get proper number of called handlers", called.length, calledHandlers.size());
for (int i = 0; i < called.length; i++) {
assertEquals("did not find expected handler", SERVER_PREFIX + called[i], calledHandlers.get(i));
}
}
Aggregations