use of org.jboss.netty.channel.Channel in project opentsdb by OpenTSDB.
the class TestHttpQuery method getQueryString.
@Test
public void getQueryString() {
final Channel channelMock = NettyMocks.fakeChannel();
final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/api/v1/put?param=value¶m2=value2");
final HttpQuery query = new HttpQuery(tsdb, req, channelMock);
Map<String, List<String>> params = query.getQueryString();
assertNotNull(params);
assertEquals("value", params.get("param").get(0));
assertEquals("value2", params.get("param2").get(0));
}
use of org.jboss.netty.channel.Channel in project opentsdb by OpenTSDB.
the class TestHttpQuery method getCharsetSupplied.
@Test
public void getCharsetSupplied() {
final Channel channelMock = NettyMocks.fakeChannel();
final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/");
req.headers().add("Content-Type", "text/plain; charset=UTF-16");
final HttpQuery query = new HttpQuery(tsdb, req, channelMock);
assertEquals(Charset.forName("UTF-16"), query.getCharset());
}
use of org.jboss.netty.channel.Channel in project opentsdb by OpenTSDB.
the class TestHttpQuery method setSerializerDummyCT.
@Test
public void setSerializerDummyCT() throws Exception {
PluginLoader.loadJAR("plugin_test.jar");
HttpQuery.initializeSerializerMaps(null);
final Channel channelMock = NettyMocks.fakeChannel();
final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/");
req.headers().add("Content-Type", "application/tsdbdummy");
final HttpQuery query = new HttpQuery(tsdb, req, channelMock);
query.setSerializer();
assertEquals("net.opentsdb.tsd.DummyHttpSerializer", query.serializer().getClass().getCanonicalName());
}
use of org.jboss.netty.channel.Channel in project opentsdb by OpenTSDB.
the class TestHttpQuery method getAPIMethodDelete.
@Test
public void getAPIMethodDelete() {
final Channel channelMock = NettyMocks.fakeChannel();
final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.DELETE, "/");
HttpQuery query = new HttpQuery(tsdb, req, channelMock);
assertEquals(HttpMethod.DELETE, query.getAPIMethod());
}
use of org.jboss.netty.channel.Channel in project opentsdb by OpenTSDB.
the class TestHttpQuery method setSerializerCT.
@Test
public void setSerializerCT() throws Exception {
HttpQuery.initializeSerializerMaps(null);
final Channel channelMock = NettyMocks.fakeChannel();
final HttpRequest req = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/");
req.headers().add("Content-Type", "application/json");
final HttpQuery query = new HttpQuery(tsdb, req, channelMock);
query.setSerializer();
assertEquals(HttpJsonSerializer.class.getCanonicalName(), query.serializer().getClass().getCanonicalName());
}
Aggregations