вторник, 19 февраля 2013 г.

Apache CXF integration testing

Sometimes it is necessary to make the test of web-service client and service.
If you have an Apache CXF service and client then you can try to use local transport for your test.
So, here is an example.

The client you define like this:
 <jaxws:client id="client" serviceClass="IIdentificationService"  address="local://test"/>.

And here is how you test the integration:

IIdentificationServiceImpl impl = new IIdentificationServiceImpl();
Endpoint ep = Endpoint.publish("local://test", impl);
IIdentificationService client = (IIdentificationService) context.getBean("client");
Result res = client.call("123");
ep.stop();


What is important here is the address of endpoint and client. Both uses the prefix "local". This means that messages will transport inside the JVM.
For reference see http://cxf.apache.org/docs/local-transport.html.

Комментариев нет:

Отправить комментарий