use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class OptionsTest method testNoHead.
@Test
public void testNoHead() throws ExecutionException, InterruptedException {
ApplicationHandler application = new ApplicationHandler(new ResourceConfig(ResourceWithoutGetMethod.class));
final ContainerResponse response = testOptions(MediaType.TEXT_PLAIN_TYPE, application, "/no-get");
Assert.assertFalse(((String) response.getEntity()).contains("HEAD"));
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class RMBuilderTest method testHelloWorld.
@Test
public void testHelloWorld() throws Exception {
ApplicationHandler app = createApplication(HelloWorldResource.class);
ContainerResponse response = app.apply(RequestContextBuilder.from("/helloworld", "GET").build()).get();
assertEquals("hello", response.getEntity());
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class ConsumeProduceSimpleTest method testImplicitProduces.
@Test
public void testImplicitProduces() throws Exception {
final ApplicationHandler application = createApplication(ImplicitProducesResource.class);
final ContainerResponse response = application.apply(RequestContextBuilder.from("/", "GET").accept(MediaType.TEXT_PLAIN_TYPE).build()).get();
assertEquals("text/plain", response.getEntity());
assertEquals("text-plain", response.getHeaderString("HEAD"));
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class DynamicFeatureTest method testSubResourceFeature.
@Test
public void testSubResourceFeature() throws Exception {
final ApplicationHandler application = createApplication(SubResourceDynamicFeature.class);
ContainerResponse response;
response = application.apply(RequestContextBuilder.from("/resource/sub", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("sub-get-filtered", response.getEntity());
response = application.apply(RequestContextBuilder.from("/resource", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("get", response.getEntity());
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class DynamicFeatureTest method testInjectedConfigurable.
@Test
public void testInjectedConfigurable() throws Exception {
final ResourceConfig resourceConfig = getTestResourceConfig(InjectConfigurableDynamicFeature.class);
resourceConfig.property("hello", "world");
final ApplicationHandler application = createApplication(resourceConfig);
assertNull(application.getConfiguration().getProperty("foo"));
final ContainerResponse response = application.apply(RequestContextBuilder.from("/resource", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("get", response.getEntity());
assertNull(application.getConfiguration().getProperty("foo"));
assertEquals("world", application.getConfiguration().getProperty("hello"));
}
Aggregations