On 03/02/12 03:02, Jeff Wang wrote:
I'm having two difficulties with testing. One practical, one theoretical.
practical:
If I have any @Context annotations, I can't actually call the service
via a client proxy. I need to code the call separately (and
manually.)
I updated the proxies to simply ignore explicit Context parameters, they
are only populated on the server side...You'd need to pass 'null' if you
have explicit Context params, in meantime try injecting Contexts into
fields...
theoretical:
Using the same JSON compile unit on the service and the test seems to
defeat the purpose. If I have a webpage hitting my JAX-RS server, and
I change the name of a field, I'd like to have my test point that out,
so that when I fix my test, I can let my web team know. But if I use
the same compile unit, whatever I change, even accidentally, will
marshall and unmarshall correctly, the actual user of the API may then
run into issues.
I'm not sure I understand completely, but just in case, it's possible to
adapt the in/out JSON sequences to the expected ones with the help of
TransformFeature, but only if the default JSONProvider is used
Sergey
Jeff
On Thu, Feb 2, 2012 at 1:49 PM, Glen Mazza<[email protected]> wrote:
I recently converted the Jersey "helloworld" sample to using CXF, its JUnit
test case structure might be something you can leverage:
https://github.com/gmazza/jersey-samples-on-cxf/tree/master/helloworld/src/test/java/com/sun/jersey/samples/helloworld
HTH,
Glen
On 02/01/2012 02:41 PM, cganesan wrote:
Hi
Is there a way to invoke the URLs for a JAX-RS end point services as part
of
JUnit test - triggered from MAven build? Does Apache CXF support something
like an embedded container towards this?
Thanks
Chandru
--
View this message in context:
http://cxf.547215.n5.nabble.com/Unit-testing-JAX-RS-services-tp5448539p5448539.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com