use of javax.ws.rs.core.Response in project jersey by jersey.
the class EventListenerTest method testExceptionProcessing.
@Test
public void testExceptionProcessing() {
final Response response = target().path("resource/locator/exception").request().get();
assertEquals(200, response.getStatus());
assertEquals("mapped", response.readEntity(String.class));
int i = 1;
System.out.println(response.getHeaders());
assertEquals("[" + i++ + "]", response.getHeaderString("R.MATCHED_LOCATOR.order"));
assertEquals("[" + i++ + "]", response.getHeaderString("R.MATCHED_SUB_RESOURCE.order"));
assertEquals("[" + i++ + "]", response.getHeaderString("R.REQ_FILTERS_START.order"));
assertEquals("[" + i++ + "]", response.getHeaderString("R.REQ_FILTERS_FINISHED.order"));
assertEquals("[" + i++ + "]", response.getHeaderString("R.RESOURCE_METHOD_START.order"));
assertEquals("[" + i++ + "]", response.getHeaderString("R.RESOURCE_METHOD_FINISHED.order"));
assertEquals("[" + i++ + "]", response.getHeaderString("R.EXCEPTION_MAPPER_FOUND.order"));
assertEquals("[" + i++ + "]", response.getHeaderString("R.RESP_FILTERS_START.order"));
assertEquals("[" + i + "]", response.getHeaderString("R.RESP_FILTERS_FINISHED.order"));
}
use of javax.ws.rs.core.Response in project jersey by jersey.
the class MonitoringStatisticsLocatorTest method testResourceClassStatisticsWadlOptions.
@Test
public void testResourceClassStatisticsWadlOptions() {
final Response response = target().path("resource/resourceClassStatisticsWadlOptionsTest").request().get();
assertEquals(200, response.getStatus());
assertEquals("OK", response.readEntity(String.class));
}
use of javax.ws.rs.core.Response in project jersey by jersey.
the class MonitoringStatisticsLocatorTest method testUriStatisticsAnotherHello.
@Test
public void testUriStatisticsAnotherHello() throws InterruptedException {
Response response = target().path("another/hello").request().get();
assertEquals(200, response.getStatus());
assertEquals("Hello, again.", response.readEntity(String.class));
Thread.sleep(600);
response = target().path("resource/uriStatisticsAnotherHelloTest").request().get();
assertEquals(200, response.getStatus());
assertEquals("OK", response.readEntity(String.class));
}
use of javax.ws.rs.core.Response in project jersey by jersey.
the class MonitoringStatisticsLocatorTest method test.
@Test
public void test() throws InterruptedException {
Response response = target().path("resource").request().get();
assertEquals(200, response.getStatus());
assertEquals("null", response.readEntity(String.class));
response = target().path("resource/resource-locator").request().get();
assertEquals(200, response.getStatus());
assertEquals("get", response.readEntity(String.class));
response = target().path("resource/resource-locator").request().get();
assertEquals(200, response.getStatus());
assertEquals("get", response.readEntity(String.class));
response = target().path("resource/resource-locator/sub").request().get();
assertEquals(200, response.getStatus());
assertEquals("get", response.readEntity(String.class));
response = target().path("resource/hello").request().get();
assertEquals(200, response.getStatus());
assertEquals("Hello!", response.readEntity(String.class));
response = target().path("another/hello").request().get();
assertEquals(200, response.getStatus());
assertEquals("Hello, again.", response.readEntity(String.class));
response = target().path("another/xml").request().get();
assertEquals(200, response.getStatus());
assertEquals("<?xml version=\"1.0\"?><hello>World!</hello>", response.readEntity(String.class));
Thread.sleep(600);
response = target().path("resource").request().get();
assertEquals(200, response.getStatus());
assertEquals("getFound", response.readEntity(String.class));
response = target().path("resource/uri").request().get();
assertEquals(200, response.getStatus());
assertEquals("getFound", response.readEntity(String.class));
}
use of javax.ws.rs.core.Response in project jersey by jersey.
the class MonitoringStatisticsLocatorTest method testResourceClassStatisticsGenericOptions.
@Test
public void testResourceClassStatisticsGenericOptions() {
final Response response = target().path("resource/resourceClassStatisticsGenericOptionsTest").request().get();
assertEquals(200, response.getStatus());
assertEquals("OK", response.readEntity(String.class));
}
Aggregations