use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.
the class ServiceImplTest method testNonSpecificGetPort.
@Test
public void testNonSpecificGetPort() throws Exception {
SOAPService service = new SOAPService();
Greeter proxy = service.getPort(Greeter.class);
Client client = ClientProxy.getClient(proxy);
boolean boolA = client.getEndpoint().getEndpointInfo().getName().equals(SOAP_PORT);
boolean boolB = client.getEndpoint().getEndpointInfo().getName().equals(SOAP_PORT1);
assertTrue(boolA || boolB);
assertNotNull("expected ConduitSelector", client.getConduitSelector());
}
use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.
the class ServiceImplTest method testServiceImpl.
@Test
public void testServiceImpl() throws Exception {
SOAPService service = new SOAPService();
Greeter proxy = service.getSoapPort();
Client client = ClientProxy.getClient(proxy);
assertEquals("bar", client.getEndpoint().get("foo"));
assertNotNull("expected ConduitSelector", client.getConduitSelector());
assertTrue("unexpected ConduitSelector", client.getConduitSelector() instanceof NullConduitSelector);
}
use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.
the class ConfiguredEndpointTest method doTestConfiguredClientEndpoint.
private void doTestConfiguredClientEndpoint() {
javax.xml.ws.Service service = new SOAPService();
Greeter greeter = service.getPort(PORT_NAME, Greeter.class);
JaxWsClientProxy eih = (JaxWsClientProxy) Proxy.getInvocationHandler(greeter);
Client client = eih.getClient();
JaxWsEndpointImpl endpoint = (JaxWsEndpointImpl) client.getEndpoint();
org.apache.cxf.service.ServiceImpl svc = (org.apache.cxf.service.ServiceImpl) endpoint.getService();
assertEquals("Unexpected bean name.", SERVICE_NAME.toString(), svc.getBeanName());
List<Interceptor<? extends Message>> interceptors = svc.getInInterceptors();
assertEquals("Unexpected number of interceptors: " + interceptors, 1, interceptors.size());
assertEquals("Unexpected interceptor id.", "service-in", findTestInterceptor(interceptors).getId());
interceptors = svc.getOutInterceptors();
assertEquals("Unexpected number of interceptors: " + interceptors, 1, interceptors.size());
assertEquals("Unexpected interceptor id.", "service-out", findTestInterceptor(interceptors).getId());
interceptors = svc.getInFaultInterceptors();
assertEquals("Unexpected number of interceptors: " + interceptors, 1, interceptors.size());
assertEquals("Unexpected interceptor id.", "service-in-fault", findTestInterceptor(interceptors).getId());
interceptors = svc.getOutFaultInterceptors();
assertEquals("Unexpected number of interceptors: " + interceptors, 1, interceptors.size());
assertEquals("Unexpected interceptor id.", "service-out-fault", findTestInterceptor(interceptors).getId());
}
use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.
the class ConfiguredEndpointTest method doTestDefaultClientEndpoint.
private void doTestDefaultClientEndpoint() {
javax.xml.ws.Service service = new SOAPService();
Greeter greeter = service.getPort(PORT_NAME, Greeter.class);
JaxWsClientProxy eih = (JaxWsClientProxy) Proxy.getInvocationHandler(greeter);
Client client = eih.getClient();
JaxWsEndpointImpl endpoint = (JaxWsEndpointImpl) client.getEndpoint();
assertEquals("Unexpected bean name", PORT_NAME.toString() + ".endpoint", endpoint.getBeanName());
assertFalse("Unexpected value for property validating", Boolean.TRUE.equals(endpoint.get(Message.SCHEMA_VALIDATION_ENABLED)));
// System.out.println("endpoint interceptors");
List<Interceptor<? extends Message>> interceptors = endpoint.getInInterceptors();
printInterceptors("in", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
interceptors = endpoint.getOutInterceptors();
printInterceptors("out", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
interceptors = endpoint.getInFaultInterceptors();
printInterceptors("inFault", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
interceptors = endpoint.getOutFaultInterceptors();
printInterceptors("outFault", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
// System.out.println("service interceptors");
org.apache.cxf.service.ServiceImpl svc = (org.apache.cxf.service.ServiceImpl) endpoint.getService();
assertEquals("Unexpected bean name", SERVICE_NAME.toString(), svc.getBeanName());
interceptors = svc.getInInterceptors();
printInterceptors("in", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
interceptors = svc.getOutInterceptors();
printInterceptors("out", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
interceptors = svc.getInFaultInterceptors();
printInterceptors("inFault", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
interceptors = svc.getOutFaultInterceptors();
printInterceptors("outFault", interceptors);
assertNull("Unexpected test interceptor", findTestInterceptor(interceptors));
}
use of org.apache.hello_world_soap_http.SOAPService in project cxf by apache.
the class ClientServerTest method testAsyncSynchronousPolling.
@Test
public void testAsyncSynchronousPolling() throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
SOAPService service = new SOAPService(wsdl, serviceName);
assertNotNull(service);
final String expectedString = new String("Hello, finally!");
class Poller extends Thread {
Response<GreetMeLaterResponse> response;
int tid;
Poller(Response<GreetMeLaterResponse> r, int t) {
response = r;
tid = t;
}
public void run() {
if (tid % 2 > 0) {
while (!response.isDone()) {
try {
Thread.sleep(100);
} catch (InterruptedException ex) {
// ignore
}
}
}
GreetMeLaterResponse reply = null;
try {
reply = response.get();
} catch (Exception ex) {
fail("Poller " + tid + " failed with " + ex);
}
assertNotNull("Poller " + tid + ": no response received from service", reply);
String s = reply.getResponseType();
assertEquals(expectedString, s);
}
}
Greeter greeter = service.getPort(portName, Greeter.class);
updateAddressPort(greeter, PORT);
long before = System.currentTimeMillis();
long delay = 3000;
Response<GreetMeLaterResponse> response = greeter.greetMeLaterAsync(delay);
long after = System.currentTimeMillis();
assertTrue("Duration of calls exceeded " + delay + " ms", after - before < delay);
// first time round, responses should not be available yet
assertFalse("Response already available.", response.isDone());
Poller[] pollers = new Poller[4];
for (int i = 0; i < pollers.length; i++) {
pollers[i] = new Poller(response, i);
}
for (Poller p : pollers) {
p.start();
}
for (Poller p : pollers) {
p.join();
}
}
Aggregations