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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations