users@jersey.java.net

Re: [Jersey] mock a Jersey Service

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 14 Jan 2010 13:03:11 +0100

Hi Ronak,

We have a unit test framework where you can perform in memory tests to
JAX-RS resource classes.

In the client API it is possible to intercept at two levels:

1) You could write a ClientFilter that passes the ClientRequest to the
MockService and it returns a ClientResponse.

2) Write a new TerminatingClientHandler such that parsing and
serialization of the headers and entities is performed.

Essentially the in-memory test support implements 2) and uses a
special in-memory server-side container to dispatch requests to
resource classes.

I sure 1) or 2) is possible to dispatch to an in-memory to a mocked up
RESTlet service.

I can send more details if this sounds like the right direction you
want to take.

Paul.



On Jan 14, 2010, at 12:31 AM, Ronak Patel wrote:

> Hi everyone,
>
> I'm trying to test a client side REST SDK that I made for a RESTful
> Web Service using JAX-RS Jersey.
>
> I was wondering if there's any way to intercept or retrieve the HTTP/
> XML/JSON that the client SDK generates to manually provide that
> output to a Mock Service.
>
> My service under test is written using RESTlet while the client SDK
> is written in Jersey.
>
> Thanks,
>
> Ronak Patel
>
>
>
>