use of org.apache.handlers.AddNumbers in project cxf by apache.
the class HandlerInvocationUsingAddNumbersTest method testAddHandlerByAnnotationClientSide.
@Test
public void testAddHandlerByAnnotationClientSide() throws Exception {
URL wsdl = getClass().getResource("/wsdl/addNumbers.wsdl");
AddNumbersServiceWithAnnotation service = new AddNumbersServiceWithAnnotation(wsdl, serviceName);
AddNumbers port = service.getPort(portName, AddNumbers.class);
setAddress(port, addNumbersAddress);
int result = port.addNumbers(10, 20);
assertEquals(200, result);
int result1 = port.addNumbers(5, 6);
assertEquals(11, result1);
}
use of org.apache.handlers.AddNumbers in project cxf by apache.
the class HandlerInvocationUsingAddNumbersTest method testHandlerInjectingResource.
@Test
public void testHandlerInjectingResource() throws Exception {
// When CXF is deployed in a servlet container, ServletContextResourceResolver is used to resolve
// Servlet context resources.
Bus bus = BusFactory.getDefaultBus();
ResourceManager resourceManager = bus.getExtension(ResourceManager.class);
assertNotNull(resourceManager);
resourceManager.addResourceResolver(new TestResourceResolver());
URL wsdl = getClass().getResource("/wsdl/addNumbers.wsdl");
AddNumbersServiceWithAnnotation service = new AddNumbersServiceWithAnnotation(wsdl, serviceName);
AddNumbers port = service.getPort(portName, AddNumbers.class);
setAddress(port, addNumbersAddress);
@SuppressWarnings("rawtypes") List<Handler> handlerChain = ((BindingProvider) port).getBinding().getHandlerChain();
SmallNumberHandler h = (SmallNumberHandler) handlerChain.get(0);
assertEquals("injectedValue", h.getInjectedString());
}
use of org.apache.handlers.AddNumbers in project cxf by apache.
the class SpringConfiguredAutoRewriteSoapAddressTest method testWsdlAddress.
@Test
public void testWsdlAddress() throws Exception {
AddNumbers addNumbers = getApplicationContext().getBean("cxfHandlerTestClientEndpoint", AddNumbers.class);
int r = addNumbers.addNumbers(10, 15);
assertEquals(1015, r);
List<String> serviceUrls = findAllServiceUrlsFromWsdl("localhost", port);
assertEquals(1, serviceUrls.size());
assertEquals("http://localhost:" + port + "/SpringEndpoint", serviceUrls.get(0));
String version = System.getProperty("java.version");
if (version.startsWith("1.8")) {
// Just skip the test as "127.0.0.1" doesn't work in JDK8
return;
}
serviceUrls = findAllServiceUrlsFromWsdl("127.0.0.1", port);
assertEquals(1, serviceUrls.size());
assertEquals("http://127.0.0.1:" + port + "/SpringEndpoint", serviceUrls.get(0));
}
Aggregations