On Nov 9, 2009, at 1:28 PM, tarjei wrote:
> Hi, I've spent some time working with the jersey test framework
> today. Since I've allready posted one bug that I then found a
> workaround to, I thought I'd see if posting to the maillinglist
> solved my other problems.
>
> The first one I want to report is that when I use
> com
> .sun.jersey.test.framework.spi.container.http.HTTPContainerFactory
> with multiple test methods, then it tries to create a new Container
> for each test, resulting in Address already in use exceptions.
>
The LW HTTP server is buggy when starting and stopping multiple times
from within the same process. Sometimes one can place a sleep
statement after stopping or before starting, which can help, but is
unreliable.
The behavior for JerseyTest is to start and stop the container for
each test. IIUC we could modify such that it is possible to override
this behavior by extending from JerseyTest such that the container can
be started and stopped once per class. This may not resolve the LW
HTTP server issue if multiple test classes are present.
> Also, the HTTPContainer does not support Spring for some reason.
>
The LW HTTP server does not support the Servlet API. And only the
LowLevelAppDescriptor is supported with the LW HTTP server test
container factory. So if you are using WebAppDescriptor you will see
an error like:
"The application descriptor must be an instance of
LowLevelAppDescriptor"
Paul.