use of org.glassfish.jersey.server.ApplicationHandler 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.ApplicationHandler 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.ApplicationHandler in project jersey by jersey.
the class ResourceInfoTest method testInfoGetChild.
@Test
public void testInfoGetChild() throws ExecutionException, InterruptedException {
ApplicationHandler handler = getApplication();
final ContainerResponse response = handler.apply(RequestContextBuilder.from("/info/child", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("get-info-child", response.getEntity());
assertResponseHeaders(response, "ResourceTestingInfo", "getChildInfo");
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class ResourceInfoTest method test404.
@Test
public void test404() throws ExecutionException, InterruptedException {
ApplicationHandler handler = getApplication();
final ContainerResponse response = handler.apply(RequestContextBuilder.from("/NOT_FOUND", "GET").build()).get();
assertEquals(404, response.getStatus());
assertResponseHeaders(response, "<null>", "<null>");
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class ResourceInfoTest method testGetSubResource.
@Test
public void testGetSubResource() throws ExecutionException, InterruptedException {
ApplicationHandler handler = getApplication();
final ContainerResponse response = handler.apply(RequestContextBuilder.from("/resource/locator", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("get-sub-resource", response.getEntity());
assertResponseHeaders(response, "SubResource", "getFromSubResource");
}
Aggregations