[
https://issues.apache.org/jira/browse/CXF-3163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sergey Beryozkin resolved CXF-3163.
-----------------------------------
Resolution: Duplicate
Assignee: Sergey Beryozkin
Hi Rice - I'm closing it as Duplicate of CXF-4390:
https://issues.apache.org/jira/browse/CXF-4390
Thanks
> Support mock objects for easier testing on jaxrs
> ------------------------------------------------
>
> Key: CXF-3163
> URL: https://issues.apache.org/jira/browse/CXF-3163
> Project: CXF
> Issue Type: New Feature
> Components: JAX-RS
> Affects Versions: 2.3.1
> Reporter: Rice Yeh
> Assignee: Sergey Beryozkin
>
> I move my implementation of JAX-RS from RestEasy to CXF. One feature in
> RestEasy I like is that it provides a very simple way to test my resources.
> Its test code is like below:
> this.dispatcher = MockDispatcherFactory.createDispatcher();
> this.dispatcher.getRegistry().addResourceFactory(new
> POJOResourceFactory(organization.class), "hr");
> this.dispatcher.getRegistry().addResourceFactory(new
> POJOResourceFactory(bureaucracy.class), "hr");
> MockHttpRequest request = MockHttpRequest.get("/hr/bureaucracy/" +
> oid(b) + "/organization/" + oid(finance) +"/children");
> MockHttpResponse response = new MockHttpResponse();
> this.dispatcher.invoke(request, response);
> System.out.println(response.getContentAsString());
> assert response.getStatus() == 200;
> That is, I don't need to startup http (jetty) server. All (server and client)
> are done in memory and in one thread which makes makes inspection on
> exception stack track easy when things go wrong. For cxf, WebClient is
> totally coupled with http and local transport is not supported by its jaxrs
> implementation.
> Regards,
> Rice
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira