Search in sources :

Example 51 with Response

use of javax.ws.rs.core.Response in project druid by druid-io.

the class AbstractListenerHandlerTest method testHandleSimpleDELETE.

@Test
public void testHandleSimpleDELETE() throws Exception {
    final Response response = abstractListenerHandler.handleDELETE(valid_id);
    Assert.assertEquals(202, response.getStatus());
    Assert.assertEquals(obj, response.getEntity());
}
Also used : Response(javax.ws.rs.core.Response) Test(org.junit.Test)

Example 52 with Response

use of javax.ws.rs.core.Response in project druid by druid-io.

the class AbstractListenerHandlerTest method testMissingHandleAll.

@Test
public void testMissingHandleAll() throws Exception {
    returnEmpty.set(true);
    final Response response = abstractListenerHandler.handleGETAll();
    Assert.assertEquals(404, response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) Test(org.junit.Test)

Example 53 with Response

use of javax.ws.rs.core.Response in project druid by druid-io.

the class AbstractListenerHandlerTest method testError.

@Test
public void testError() throws Exception {
    final ByteArrayInputStream bais = new ByteArrayInputStream(StringUtils.toUtf8(mapper.writeValueAsString(new SomeBeanClass("a"))));
    failPost.set(true);
    final Response response = abstractListenerHandler.handlePOST(bais, mapper, good_id);
    Assert.assertEquals(500, response.getStatus());
    Assert.assertEquals(ImmutableMap.of("error", error_msg), response.getEntity());
}
Also used : Response(javax.ws.rs.core.Response) ByteArrayInputStream(java.io.ByteArrayInputStream) Test(org.junit.Test)

Example 54 with Response

use of javax.ws.rs.core.Response in project druid by druid-io.

the class AbstractListenerHandlerTest method testSimple.

@Test
public void testSimple() throws Exception {
    final SomeBeanClass val = new SomeBeanClass("a");
    final ByteArrayInputStream bais = new ByteArrayInputStream(StringUtils.toUtf8(mapper.writeValueAsString(val)));
    final Response response = abstractListenerHandler.handlePOST(bais, mapper, good_id);
    Assert.assertEquals(202, response.getStatus());
    Assert.assertEquals(ImmutableMap.of(good_id, val), response.getEntity());
}
Also used : Response(javax.ws.rs.core.Response) ByteArrayInputStream(java.io.ByteArrayInputStream) Test(org.junit.Test)

Example 55 with Response

use of javax.ws.rs.core.Response in project druid by druid-io.

the class AbstractListenerHandlerTest method testErrorAll.

@Test
public void testErrorAll() throws Exception {
    final Map<String, SomeBeanClass> val = ImmutableMap.of();
    final ByteArrayInputStream bais = new ByteArrayInputStream(StringUtils.toUtf8(mapper.writeValueAsString(val)));
    failPost.set(true);
    final Response response = abstractListenerHandler.handlePOSTAll(bais, mapper);
    Assert.assertEquals(500, response.getStatus());
    Assert.assertEquals(ImmutableMap.of("error", error_msg), response.getEntity());
}
Also used : Response(javax.ws.rs.core.Response) ByteArrayInputStream(java.io.ByteArrayInputStream) Test(org.junit.Test)

Aggregations

Response (javax.ws.rs.core.Response)3808 Test (org.junit.Test)2883 JerseyTest (org.glassfish.jersey.test.JerseyTest)849 Test (org.testng.annotations.Test)342 Builder (javax.ws.rs.client.Invocation.Builder)298 ResteasyClientBuilder (org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder)287 WebTarget (javax.ws.rs.client.WebTarget)278 BaseTest (org.xdi.oxauth.BaseTest)274 Parameters (org.testng.annotations.Parameters)271 DBUnitTest (org.orcid.test.DBUnitTest)270 JSONException (org.codehaus.jettison.json.JSONException)253 URI (java.net.URI)230 JSONObject (org.codehaus.jettison.json.JSONObject)181 Path (javax.ws.rs.Path)153 Matchers.containsString (org.hamcrest.Matchers.containsString)142 URISyntaxException (java.net.URISyntaxException)124 ResponseType (org.xdi.oxauth.model.common.ResponseType)120 Produces (javax.ws.rs.Produces)113 RelationshipRepresentationTest (org.neo4j.server.rest.repr.RelationshipRepresentationTest)105 GET (javax.ws.rs.GET)104