Not sure if this is what you're looking for but I know that we put in some
code into one of our actual DAO classes that is invoked by the methods
annotated like this...
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ContactList getContactList(@PathParam("CompanyID") String
companyId, @QueryParam("searchName") String searchName) throws
RESTServiceException {
// implementation code here... call to DAO made here
// if the *searchName *parameter is some "obscure" test value
that we have defined already (kind of like an Easter Egg), then it returns
a ContactList object graph populated with
// 10 "records" of "mock data" loaded only from a static{} block
in the DAO class
// Doing it this way, all the code that serializes out the
object graph (made up of JAXB annotated Java classes) is untouched and
behaves the same... just without doing all the actual DB connection stuff
yet still allows the expected JSON response to be obtained just like any
other "live" call from the client code
}
HTH
Mark
On Tue, Feb 7, 2012 at 12:16 PM, Ganesan, Chandru <[email protected]>wrote:
> Hi
>
> Is there a way to configure a mock server that accepts a HTTP request from
> the WebClient and returns a JSON response. I'd like to integrate this mock
> server as part of the unit test running under Apache CXF. Could you provide
> some pointers?
>
> Appreciate the help
>
>
> Thanks
> Chandru
>
*
*