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");
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class ResourceInfoTest method testGetMultiple.
@Test
public void testGetMultiple() throws ExecutionException, InterruptedException {
ApplicationHandler handler = getApplication();
ContainerResponse response = handler.apply(RequestContextBuilder.from("/resource", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("get", response.getEntity());
assertResponseHeaders(response, "MyResource", "get");
response = handler.apply(RequestContextBuilder.from("/resource/get-child", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("get-child", response.getEntity());
assertResponseHeaders(response, "MyResource", "getChild");
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class ResourceInfoTest method testGetChild.
@Test
public void testGetChild() throws ExecutionException, InterruptedException {
ApplicationHandler handler = getApplication();
final ContainerResponse response = handler.apply(RequestContextBuilder.from("/resource/get-child", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("get-child", response.getEntity());
final String className = "MyResource";
final String methodName = "getChild";
assertResponseHeaders(response, className, methodName);
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class ResourceInfoTest method testInfoGet.
@Test
public void testInfoGet() throws ExecutionException, InterruptedException {
ApplicationHandler handler = getApplication();
final ContainerResponse response = handler.apply(RequestContextBuilder.from("/info", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("get-info", response.getEntity());
assertResponseHeaders(response, "ResourceTestingInfo", "getInfo");
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class ParamConverterInternalTest method testLazyConverter.
@Test
public void testLazyConverter() throws Exception {
final ApplicationHandler application = new ApplicationHandler(new ResourceConfig(MyLazyParamProvider.class, Resource.class));
final ContainerResponse response = application.apply(RequestContextBuilder.from("/resource", "GET").build()).get();
assertEquals(400, response.getStatus());
}
Aggregations