Search in sources :

Example 1 with MutableDataPoint

use of net.opentsdb.core.MutableDataPoint in project opentsdb by OpenTSDB.

the class TestPostAggregatedDataPoints method before.

@Before
public void before() throws Exception {
    base_data_points = PowerMockito.mock(DataPoints.class);
    points = new MutableDataPoint[NUM_POINTS];
    long ts = BASE_TIME;
    for (int i = 0; i < NUM_POINTS; i++) {
        MutableDataPoint mdp = new MutableDataPoint();
        mdp.reset(ts, i);
        points[i] = mdp;
        ts += TIME_INTERVAL;
    }
    tags = new HashMap<String, String>(1);
    tags.put("colo", "lga");
    agg_tags = new ArrayList<String>(1);
    agg_tags.add("host");
    tsuids = new ArrayList<String>(1);
    // just 1 byte UIDs for kicks
    tsuids.add("0101010202");
    annotations = new ArrayList<Annotation>(1);
    annotations.add(PowerMockito.mock(Annotation.class));
    tag_uids = new ByteMap<byte[]>();
    tag_uids.put(new byte[] { 1 }, new byte[] { 1 });
    when(base_data_points.metricName()).thenReturn(METRIC_NAME);
    when(base_data_points.metricNameAsync()).thenReturn(Deferred.fromResult(METRIC_NAME));
    when(base_data_points.getTags()).thenReturn(tags);
    when(base_data_points.getTagsAsync()).thenReturn(Deferred.fromResult(tags));
    when(base_data_points.getAggregatedTags()).thenReturn(agg_tags);
    when(base_data_points.getAggregatedTagsAsync()).thenReturn(Deferred.fromResult(agg_tags));
    when(base_data_points.getTSUIDs()).thenReturn(tsuids);
    when(base_data_points.getAnnotations()).thenReturn(annotations);
    when(base_data_points.getTagUids()).thenReturn(tag_uids);
    when(base_data_points.getQueryIndex()).thenReturn(42);
}
Also used : MutableDataPoint(net.opentsdb.core.MutableDataPoint) DataPoints(net.opentsdb.core.DataPoints) MutableDataPoint(net.opentsdb.core.MutableDataPoint) DataPoint(net.opentsdb.core.DataPoint) Annotation(net.opentsdb.meta.Annotation) Before(org.junit.Before)

Aggregations

DataPoint (net.opentsdb.core.DataPoint)1 DataPoints (net.opentsdb.core.DataPoints)1 MutableDataPoint (net.opentsdb.core.MutableDataPoint)1 Annotation (net.opentsdb.meta.Annotation)1 Before (org.junit.Before)1