Search in sources :

Example 16 with NoSuchUniqueId

use of net.opentsdb.uid.NoSuchUniqueId 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();
}
Also used : TSQuery(net.opentsdb.core.TSQuery) MockDataPoints(net.opentsdb.storage.MockDataPoints) NoSuchUniqueId(net.opentsdb.uid.NoSuchUniqueId) ArrayList(java.util.ArrayList) DataPoints(net.opentsdb.core.DataPoints) MockDataPoints(net.opentsdb.storage.MockDataPoints) Matchers.anyString(org.mockito.Matchers.anyString) Annotation(net.opentsdb.meta.Annotation) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 17 with NoSuchUniqueId

use of net.opentsdb.uid.NoSuchUniqueId 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();
}
Also used : TSQuery(net.opentsdb.core.TSQuery) MockDataPoints(net.opentsdb.storage.MockDataPoints) NoSuchUniqueId(net.opentsdb.uid.NoSuchUniqueId) ArrayList(java.util.ArrayList) DataPoints(net.opentsdb.core.DataPoints) MockDataPoints(net.opentsdb.storage.MockDataPoints) Matchers.anyString(org.mockito.Matchers.anyString) Annotation(net.opentsdb.meta.Annotation) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

NoSuchUniqueId (net.opentsdb.uid.NoSuchUniqueId)17 Test (org.junit.Test)8 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)8 Deferred (com.stumbleupon.async.Deferred)6 ArrayList (java.util.ArrayList)6 Map (java.util.Map)5 HashMap (java.util.HashMap)4 NoSuchUniqueName (net.opentsdb.uid.NoSuchUniqueName)4 DataPoints (net.opentsdb.core.DataPoints)3 TSQuery (net.opentsdb.core.TSQuery)3 Annotation (net.opentsdb.meta.Annotation)3 MockDataPoints (net.opentsdb.storage.MockDataPoints)3 InvocationOnMock (org.mockito.invocation.InvocationOnMock)3 Callback (com.stumbleupon.async.Callback)2 List (java.util.List)2 Matchers.anyString (org.mockito.Matchers.anyString)2 DeferredGroupException (com.stumbleupon.async.DeferredGroupException)1 IOException (java.io.IOException)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Pattern (java.util.regex.Pattern)1