use of net.opentsdb.core.DataPoints in project opentsdb by OpenTSDB.
the class TestHttpJsonSerializer method formatQueryAsyncV1EmptyDPs.
@Test
public void formatQueryAsyncV1EmptyDPs() throws Exception {
setupFormatQuery();
HttpQuery query = NettyMocks.getQuery(tsdb, "");
HttpJsonSerializer serdes = new HttpJsonSerializer(query);
final TSQuery data_query = getTestQuery(false);
validateTestQuery(data_query);
final List<DataPoints[]> results = new ArrayList<DataPoints[]>(1);
ChannelBuffer cb = serdes.formatQueryAsyncV1(data_query, results, Collections.<Annotation>emptyList()).joinUninterruptibly();
assertNotNull(cb);
final String json = cb.toString(Charset.forName("UTF-8"));
assertEquals("[]", json);
}
use of net.opentsdb.core.DataPoints in project opentsdb by OpenTSDB.
the class TestHttpJsonSerializer method formatQueryAsyncV1NoSuchAggTagId.
@Test(expected = DeferredGroupException.class)
public void formatQueryAsyncV1NoSuchAggTagId() throws Exception {
setupFormatQuery();
HttpQuery query = NettyMocks.getQuery(tsdb, "");
HttpJsonSerializer serdes = new HttpJsonSerializer(query);
final TSQuery data_query = getTestQuery(false);
validateTestQuery(data_query);
final DataPoints dps = new MockDataPoints().getMock();
final List<DataPoints[]> results = new ArrayList<DataPoints[]>(1);
results.add(new DataPoints[] { dps });
when(dps.getAggregatedTagsAsync()).thenReturn(Deferred.<List<String>>fromError(new NoSuchUniqueId("No such tagk", new byte[] { 0, 0, 1 })));
serdes.formatQueryAsyncV1(data_query, results, Collections.<Annotation>emptyList()).joinUninterruptibly();
}
Aggregations