use of jakarta.xml.ws.BindingProvider in project metro-jax-ws by eclipse-ee4j.
the class BindingTester method testBindingInstances.
/*
* get the binding object on dispatch object
*/
// public void testDispatch1() throws Exception {
// Dispatch dispatch = createDispatchForSource(
// new QName("urn:test", "TestServicePort"));
// assertNotNull("dispatch object is null", dispatch);
// Binding binding = dispatch.getBinding();
// assertNotNull("binding object should not be null", binding);
// List handlers = binding.getHandlerChain();
// assertNotNull("handler list should not be null", handlers);
// assertTrue("There should be no handlers in list", handlers.size() == 0);
// }
/*
* Used for testing of handlers shared between bindings.
*/
public void testBindingInstances() throws Exception {
TestService_Service service = getService();
TestService stub1 = getTestStub(service);
TestService stub2 = getTestStub(service);
// make some calls
stub1.testInt(0);
stub2.testInt(0);
Binding b1 = ((BindingProvider) stub1).getBinding();
Binding b2 = ((BindingProvider) stub2).getBinding();
List<Handler> chain = b1.getHandlerChain();
// get a soap handler from the chain. doesn't matter which one
BaseSOAPHandler handler = null;
for (Handler h : chain) {
if (h instanceof BaseSOAPHandler) {
handler = (BaseSOAPHandler) h;
break;
}
}
assertTrue("handler should be in 'ready' state", handler.isAvailable());
b2.setHandlerChain(new ArrayList<Handler>());
assertTrue("handler should be in 'ready' state", handler.isAvailable());
}
use of jakarta.xml.ws.BindingProvider 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));
}
use of jakarta.xml.ws.BindingProvider 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 jakarta.xml.ws.BindingProvider in project metro-jax-ws by eclipse-ee4j.
the class HandlerChainTester method testHandlersOnTestPort2.
public void testHandlersOnTestPort2() {
TestService_Service service = getService();
TestService testStub = service.getPort(TestService.class);
Binding testBinding = ((BindingProvider) testStub).getBinding();
List<Handler> chain = testBinding.getHandlerChain();
// System.out.println(chain.size());
assertEquals(3, chain.size());
}
use of jakarta.xml.ws.BindingProvider in project metro-jax-ws by eclipse-ee4j.
the class HandlerChainTester method testHandlersOnTestPort3.
public void testHandlersOnTestPort3() {
Service service = Service.create(WSDL_LOCATION, TESTSERVICE);
TestService testStub = service.getPort(TESTSERVICEPORT, TestService.class);
Binding testBinding = ((BindingProvider) testStub).getBinding();
List<Handler> chain = testBinding.getHandlerChain();
// System.out.println(chain.size());
assertEquals(0, chain.size());
}
Aggregations