use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class LayeredFiltersTest method testResourceMethodOnClass.
@Test
@Ignore("JERSEY-2414 - not yet implemented")
public void testResourceMethodOnClass() throws ExecutionException, InterruptedException {
final ResourceConfig resourceConfig = new ResourceConfig(ResourceWithSubresourceLocatorOnClass.class).register(FilterOne.class).register(FilterTwo.class);
final ApplicationHandler application = new ApplicationHandler(resourceConfig);
final ContainerResponse response = application.apply(RequestContextBuilder.from("/sub", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("onetwo", response.getEntity());
List<Object> xTest = response.getHeaders().get("X-TEST");
assertEquals(2, xTest.size());
assertEquals("two", xTest.get(0));
assertEquals("one", xTest.get(1));
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class LayeredFiltersTest method testResourceSubresourceMethodOnClass.
@Test
@Ignore("JERSEY-2414 - not yet implemented")
public void testResourceSubresourceMethodOnClass() throws ExecutionException, InterruptedException {
final ResourceConfig resourceConfig = new ResourceConfig(ResourceWithSubresourceLocatorOnClass.class).register(FilterOne.class).register(FilterTwo.class);
final ApplicationHandler application = new ApplicationHandler(resourceConfig);
final ContainerResponse response = application.apply(RequestContextBuilder.from("/sub/submethod", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("onetwo", response.getEntity());
List<Object> xTest = response.getHeaders().get("X-TEST");
assertEquals(2, xTest.size());
assertEquals("two", xTest.get(0));
assertEquals("one", xTest.get(1));
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class LayeredFiltersTest method testResourceMethodMultiple.
@Test
public void testResourceMethodMultiple() throws ExecutionException, InterruptedException {
final ResourceConfig resourceConfig = new ResourceConfig(ResourceWithMethodMultiple.class).register(FilterOne.class).register(FilterTwo.class);
final ApplicationHandler application = new ApplicationHandler(resourceConfig);
final ContainerResponse response = application.apply(RequestContextBuilder.from("/", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("onetwo", response.getEntity());
List<Object> xTest = response.getHeaders().get("X-TEST");
assertEquals(2, xTest.size());
assertEquals("two", xTest.get(0));
assertEquals("one", xTest.get(1));
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class UriConnegFilterTest method testGetFoo.
@Test
public void testGetFoo() throws Exception {
ContainerResponse response = handler.apply(RequestContextBuilder.from("", "/resource.foo", "GET").build()).get();
assertEquals("foo", response.getEntity());
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class UriModificationFilterTest method testWithInstance.
@Test
public void testWithInstance() throws ExecutionException, InterruptedException {
final ResourceConfig resourceConfig = new ResourceConfig(Resource.class).register(UriModifyFilter.class);
final ApplicationHandler application = new ApplicationHandler(resourceConfig);
final ContainerResponse response = application.apply(RequestContextBuilder.from("/a/b/c", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("/a/b?filter=c", response.getEntity());
}
Aggregations