use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class AmbiguousTemplateTest method testPathParamOnAmbiguousTemplate3.
@Test
public void testPathParamOnAmbiguousTemplate3() throws ExecutionException, InterruptedException {
final ApplicationHandler applicationHandler = new ApplicationHandler(new ResourceConfig(ResourceABC.class, ResourceXYZ.class));
final ContainerResponse response = applicationHandler.apply(RequestContextBuilder.from("/uuu", "GET").build()).get();
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("abc:uuu", response.getEntity());
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class AmbiguousTemplateTest method testPathParamOnAmbiguousTemplateTroughSubResourceLocator1.
@Test
public void testPathParamOnAmbiguousTemplateTroughSubResourceLocator1() throws ExecutionException, InterruptedException {
final ApplicationHandler applicationHandler = new ApplicationHandler(new ResourceConfig(SimpleLocator.class));
final ContainerResponse response = applicationHandler.apply(RequestContextBuilder.from("/locator/abc/uuu/a", "GET").build()).get();
Assert.assertEquals(404, response.getStatus());
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class AmbiguousTemplateTest method testGetOnChild.
@Test
public void testGetOnChild() throws ExecutionException, InterruptedException {
ResourceConfig resourceConfig = new ResourceConfig(ResourceA.class, ResourceB.class, ResourceQ.class);
ApplicationHandler app = new ApplicationHandler(resourceConfig);
final ContainerResponse containerResponse = app.apply(RequestContextBuilder.from("/resq/a", "GET").build()).get();
Assert.assertEquals(200, containerResponse.getStatus());
Assert.assertEquals("getA", containerResponse.getEntity());
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class AmbiguousTemplateTest method testOptionsOnRoot.
@Test
public void testOptionsOnRoot() throws ExecutionException, InterruptedException {
ResourceConfig resourceConfig = new ResourceConfig(ResourceA.class, ResourceB.class, ResourceQ.class);
ApplicationHandler app = new ApplicationHandler(resourceConfig);
final ContainerResponse containerResponse = app.apply(RequestContextBuilder.from("/aaa", "OPTIONS").accept(MediaType.TEXT_PLAIN).build()).get();
Assert.assertEquals(200, containerResponse.getStatus());
final List<String> methods = Arrays.asList(containerResponse.getEntity().toString().split(", "));
assertThat(methods, hasItems("POST", "GET", "OPTIONS", "HEAD"));
assertThat(methods.size(), is(4));
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class SpringDevProfileResourceTest method configure.
@Override
protected Application configure() {
System.setProperty("spring.profiles.active", "dev");
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext("org.glassfish.jersey.server.spring.profiles");
return new ResourceConfig().register(RequestContextFilter.class).register(LoggingFeature.class).packages("org.glassfish.jersey.server.spring.profiles").property("contextConfig", context);
}
Aggregations