users@jersey.java.net

[Jersey] Re: JerseyTest 2.4 and url-pattern

From: Eric Stein <steine_at_locustec.com>
Date: Tue, 15 Apr 2014 13:33:05 +0000

Hm, maybe I should be more clear. I've got a single .jar file containing two packages, .rest.view and .rest.data. Each of them is a separate API. In my web application, I have two servlets, each of which has the url-pattern set to recognize one of those packages. I have integration test suites for both packages. In the past, there wasn't an issue, because all the endpoints were distinct. Now I need the same endpoint in both APIs. That's causing JerseyTest to throw the following exception:

org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
[[FATAL] A resource model has ambiguous (sub-)resource method for HTTP method GET and input mime-types as defined by @Consumes and @Produces annotations at Java methods
    public Foo com.locustec.view.ViewAPIClass.getX(int,int)
and
    public Bar com.locustec. data.DataAPIClass.getY(int,int,java.lang.String)
at matching regular expression /([^/]+?). These two methods produces and consumes exactly the same mime-types and therefore their invocation as a resource methods will always fail.; source='org.glassfish.jersey.server.model.RuntimeResource_at_553abee1']

When I run the webapp, there's no problem getting to the correct resource, because I configured the servlets in web.xml to include the path /data or /view. How do I correctly set up JerseyTest to run the two APIs?

Thanks,
Eric

-----Original Message-----
From: Eric Stein
Sent: Tuesday, April 15, 2014 9:00 AM
To: users_at_jersey.java.net
Subject: JerseyTest 2.4 and url-pattern

How do I set the url-pattern for an instance of a JerseyTest? I'm running two APIs in the same project, and they share an endpoint. That's blowing up my JerseyTest suite because it doesn't recognize it should be configured as two applications.