users@jersey.java.net

Re: [Jersey] 0.6 -> 0.7 problem with jetty

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 03 Jun 2008 17:52:15 +0200

I wonder if it is my fault. This is the rather embarrassing piece of code:

     public BaseRule(UriTemplate template) {
         assert template != template; <- !!!!!!!!!!!!

         this.template = template;
     }

Find bugs spotted it, but i did not spot that find bugs did until after
0.7 was released. However, it seemed to be benign and did not result in
any failures to unit tests or running the examples, otherwise i would
have noticed and fixed it immediately.

Paul.

Lars Tackmann wrote:
> On Tue, Jun 3, 2008 at 5:34 PM, Lars Tackmann <lars_at_randompage.org> wrote:
>> On Tue, Jun 3, 2008 at 4:46 PM, Jean Aurambault <aurambaj_at_yahoo-inc.com> wrote:
>>> Hi,
>>>
>>> I've the following error when running unit tests (I've just updated to
>>> jersey 0.7). I suppose there is a problem with jetty configuration but I
>>> don't know where to start... Any idea?
>> I will look into it tomorrow after work.
>
> Ok I couldn't wait that long. It is definitely a unit test
> instrumentation issue and properly related to the way TestNG runs it
> tests. If I rewrite the above code into the following Junit 3.X test
> (I have not yet tried JUnit 4.X) then it actually works:
>
> --
> package jetty;
>
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
>
> import junit.framework.TestCase;
>
> import org.mortbay.jetty.Server;
> import org.mortbay.jetty.servlet.Context;
> import org.mortbay.jetty.servlet.ServletHolder;
>
> import com.sun.ws.rest.api.client.Client;
> import com.sun.ws.rest.api.client.WebResource;
> import com.sun.ws.rest.spi.container.servlet.ServletContainer;
>
> public class JettyTest extends TestCase {
> private static Server server;
>
> @Path("/")
> public static class TestResource {
> @GET
> public String get() {
> return "GET";
> }
> }
>
> public void setUp() throws Exception {
> ServletHolder sh = new ServletHolder(ServletContainer.class);
>
> sh.setInitParameter(
> "com.sun.ws.rest.config.property.resourceConfigClass",
> "com.sun.ws.rest.api.core.PackagesResourceConfig");
> sh
> .setInitParameter("com.sun.ws.rest.config.property.packages",
> "jetty");
>
> server = new Server(9999);
> Context context = new Context(server, "/", Context.SESSIONS);
> context.addServlet(sh, "/*");
> server.start();
> }
>
> public void tearDown() throws Exception {
> if (server != null)
> server.stop();
> }
>
> public void simpleTest() {
> Client c = Client.create();
> WebResource r = c.resource("http://localhost:9999/");
> assert r.get(String.class).equals("GET");
> }
> }
> --
>
> will try to look into why testng do this.
>
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109