use of org.apache.cxf.frontend.ClientProxyFactoryBean in project camel by apache.
the class CxfConsumerResponseTest method testInvokingServiceFromCXFClient.
// END SNIPPET: example
@Test
public void testInvokingServiceFromCXFClient() throws Exception {
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(simpleEndpointAddress);
clientBean.setServiceClass(HelloService.class);
clientBean.setBus(BusFactory.getDefaultBus());
HelloService client = (HelloService) proxyFactory.create();
assertNotNull(client);
String result = client.echo(TEST_MESSAGE);
assertEquals("We should get the echo string result from router", result, "echo " + TEST_MESSAGE);
Boolean bool = client.echoBoolean(Boolean.TRUE);
assertNotNull("The result should not be null", bool);
assertEquals("We should get the echo boolean result from router ", bool.toString(), "true");
int beforeCallingPing = pingCounter;
client.ping();
int afterCallingPing = pingCounter;
assertTrue("The ping operation doesn't be called", afterCallingPing - beforeCallingPing == 1);
}
use of org.apache.cxf.frontend.ClientProxyFactoryBean in project camel by apache.
the class CxfConsumerTest method testInvokingServiceFromCXFClient.
// END SNIPPET: example
@Test
public void testInvokingServiceFromCXFClient() throws Exception {
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(SIMPLE_ENDPOINT_ADDRESS);
clientBean.setServiceClass(HelloService.class);
clientBean.setBus(BusFactory.newInstance().createBus());
HelloService client = (HelloService) proxyFactory.create();
String result = client.echo(TEST_MESSAGE);
assertEquals("We should get the echo string result from router", result, "echo " + TEST_MESSAGE);
Boolean bool = client.echoBoolean(Boolean.TRUE);
assertNotNull("The result should not be null", bool);
assertEquals("We should get the echo boolean result from router ", bool.toString(), "true");
}
Aggregations