use of net.opentsdb.core.TSQuery in project opentsdb by OpenTSDB.
the class TestQueryStats method testEqualsSame.
@Test
public void testEqualsSame() throws Exception {
final TSQuery query = new TSQuery();
query.setStart("1h-ago");
final QueryStats stats = new QueryStats(remote, query, headers);
assertTrue(stats.equals(stats));
}
use of net.opentsdb.core.TSQuery in project opentsdb by OpenTSDB.
the class TestQueryStats method ctor.
@Test
public void ctor() throws Exception {
final TSQuery query = new TSQuery();
query.setStart("1h-ago");
final QueryStats stats = new QueryStats(remote, query, headers);
assertNotNull(stats);
final Map<String, Object> map = QueryStats.getRunningAndCompleteStats();
assertNotNull(map);
assertEquals(1, ((List<Object>) map.get("running")).size());
assertEquals(0, ((Collection<QueryStats>) map.get("completed")).size());
assertSame(headers, stats.getRequestHeaders());
}
use of net.opentsdb.core.TSQuery in project opentsdb by OpenTSDB.
the class TestQueryStats method getStatTime.
@Test
public void getStatTime() throws Exception {
final TSQuery query = new TSQuery();
query.setStart("1h-ago");
final QueryStats stats = new QueryStats(remote, query, headers);
stats.markSerializationSuccessful();
assertEquals(1000.0, stats.getTimeStat(QueryStat.PROCESSING_PRE_WRITE_TIME), 0.001);
assertEquals(Double.NaN, stats.getTimeStat(QueryStat.AVG_AGGREGATION_TIME), 0.001);
}
use of net.opentsdb.core.TSQuery in project opentsdb by OpenTSDB.
the class TestQueryStats method ctorNullRemote.
@Test(expected = IllegalArgumentException.class)
public void ctorNullRemote() throws Exception {
final TSQuery query = new TSQuery();
query.setStart("1h-ago");
new QueryStats(null, query, headers);
}
use of net.opentsdb.core.TSQuery in project opentsdb by OpenTSDB.
the class TestHttpJsonSerializer method formatQueryAsyncV1NoSuchTagId.
@Test(expected = DeferredGroupException.class)
public void formatQueryAsyncV1NoSuchTagId() 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.getTagsAsync()).thenReturn(Deferred.<Map<String, String>>fromError(new NoSuchUniqueId("No such tagv", new byte[] { 0, 0, 1 })));
serdes.formatQueryAsyncV1(data_query, results, Collections.<Annotation>emptyList()).joinUninterruptibly();
}
Aggregations