Showing posts with label CXF. Show all posts
Showing posts with label CXF. Show all posts

Friday, January 14, 2011

Test Your CXF REST Service by Examining Application Object State

While I've previously described using CXF to unit test a REST service, it's a limited technique since the object returned from the HTTP request is a response string - and any assertions you could make against that string are going to be brittle, since it relies on the decisions around how the encoding (XML or JSON) is done. What we really want is a more object-oriented mechanism for testing against application object state...which means you need a REST client that calls the service and can then look at the returned application object, as opposed to a Response object.

Thursday, January 6, 2011

Versioning XML and JSON Models in a CXF REST Service

Following up on my previous post around how simple it was to add JSON support to my CXF-based REST service...now I'll add versioning support to my XML-annotated model and see what happens.

Tuesday, January 4, 2011

Add JSON Support to your REST Service

Continuing from my previous post about a standalone unit-test mechanism for your RESTful service, now I'll add JSON support to that service, which already gives you XML. This turns out to be a pretty simple thing - all we need is:

  1. Tell the RESTful service to produce both XML and JSON
  2. Add the runtime dependency you'll need 
  3. Add some tests to confirm things

Unit Test Your REST Service

Here's an approach for unit-testing your RESTful service.