use of net.opentsdb.core.DataPoints in project opentsdb by OpenTSDB.
the class TestDivideSeries method divideTooManyResultSets.
@Test(expected = IllegalArgumentException.class)
public void divideTooManyResultSets() throws Exception {
SeekableView view2 = SeekableViewsForTest.generator(START_TIME, INTERVAL, NUM_POINTS, true, 10, 1);
DataPoints dps2 = PowerMockito.mock(DataPoints.class);
when(dps2.iterator()).thenReturn(view2);
when(dps2.metricName()).thenReturn("sys.mem");
when(dps2.metricUID()).thenReturn(new byte[] { 0, 0, 2 });
group_bys = new DataPoints[] { dps2 };
query_results.add(group_bys);
// doesn't matter what they are
for (int i = 0; i < 100; i++) {
query_results.add(group_bys);
}
func.evaluate(data_query, query_results, params);
}
use of net.opentsdb.core.DataPoints in project opentsdb by OpenTSDB.
the class TestHighestCurrent method evaluateTopN1with2SeriesLong.
@Test
public void evaluateTopN1with2SeriesLong() throws Exception {
params.add("1");
SeekableView view2 = SeekableViewsForTest.generator(START_TIME, INTERVAL, NUM_POINTS, true, 10, 1);
DataPoints dps2 = PowerMockito.mock(DataPoints.class);
when(dps2.iterator()).thenReturn(view2);
when(dps2.metricNameAsync()).thenReturn(Deferred.fromResult("sys.mem"));
group_bys = new DataPoints[] { dps, dps2 };
query_results.clear();
query_results.add(group_bys);
final DataPoints[] results = func.evaluate(data_query, query_results, params);
assertEquals(1, results.length);
assertEquals("sys.mem", results[0].metricName());
long ts = START_TIME;
long v = 10;
for (DataPoint dp : results[0]) {
assertEquals(ts, dp.timestamp());
assertTrue(dp.isInteger());
assertEquals(v, dp.longValue());
ts += INTERVAL;
v += 1;
}
}
use of net.opentsdb.core.DataPoints in project opentsdb by OpenTSDB.
the class TestHighestCurrent method evaluateTopN100with2SeriesLong.
@Test
public void evaluateTopN100with2SeriesLong() throws Exception {
params.add("100");
SeekableView view2 = SeekableViewsForTest.generator(START_TIME, INTERVAL, NUM_POINTS, true, 10, 1);
DataPoints dps2 = PowerMockito.mock(DataPoints.class);
when(dps2.iterator()).thenReturn(view2);
when(dps2.metricNameAsync()).thenReturn(Deferred.fromResult("sys.mem"));
DataPoints[] group_bys2 = new DataPoints[] { dps2 };
query_results.add(group_bys2);
final DataPoints[] results = func.evaluate(data_query, query_results, params);
assertEquals(2, results.length);
assertEquals("sys.mem", results[0].metricName());
assertEquals(METRIC, results[1].metricName());
long ts = START_TIME;
long v = 10;
for (DataPoint dp : results[0]) {
assertEquals(ts, dp.timestamp());
assertTrue(dp.isInteger());
assertEquals(v, dp.longValue());
ts += INTERVAL;
v += 1;
}
ts = START_TIME;
v = 1;
for (DataPoint dp : results[1]) {
assertEquals(ts, dp.timestamp());
assertTrue(dp.isInteger());
assertEquals(v, dp.longValue());
ts += INTERVAL;
v += 1;
}
}
use of net.opentsdb.core.DataPoints in project opentsdb by OpenTSDB.
the class TestHighestCurrent method evaluateTopN100with2SubQuerySeriesLong.
@Test
public void evaluateTopN100with2SubQuerySeriesLong() throws Exception {
params.add("100");
SeekableView view2 = SeekableViewsForTest.generator(START_TIME, INTERVAL, NUM_POINTS, true, 10, 1);
DataPoints dps2 = PowerMockito.mock(DataPoints.class);
when(dps2.iterator()).thenReturn(view2);
when(dps2.metricNameAsync()).thenReturn(Deferred.fromResult("sys.mem"));
group_bys = new DataPoints[] { dps, dps2 };
query_results.clear();
query_results.add(group_bys);
final DataPoints[] results = func.evaluate(data_query, query_results, params);
assertEquals(2, results.length);
assertEquals("sys.mem", results[0].metricName());
assertEquals(METRIC, results[1].metricName());
long ts = START_TIME;
long v = 10;
for (DataPoint dp : results[0]) {
assertEquals(ts, dp.timestamp());
assertTrue(dp.isInteger());
assertEquals(v, dp.longValue());
ts += INTERVAL;
v += 1;
}
ts = START_TIME;
v = 1;
for (DataPoint dp : results[1]) {
assertEquals(ts, dp.timestamp());
assertTrue(dp.isInteger());
assertEquals(v, dp.longValue());
ts += INTERVAL;
v += 1;
}
}
use of net.opentsdb.core.DataPoints in project opentsdb by OpenTSDB.
the class TestHighestMax method evaluateTopN100with2SubQuerySeriesLong.
@Test
public void evaluateTopN100with2SubQuerySeriesLong() throws Exception {
params.add("100");
SeekableView view2 = SeekableViewsForTest.generator(START_TIME, INTERVAL, NUM_POINTS, true, 10, 1);
DataPoints dps2 = PowerMockito.mock(DataPoints.class);
when(dps2.iterator()).thenReturn(view2);
when(dps2.metricNameAsync()).thenReturn(Deferred.fromResult("sys.mem"));
group_bys = new DataPoints[] { dps, dps2 };
query_results.clear();
query_results.add(group_bys);
final DataPoints[] results = func.evaluate(data_query, query_results, params);
assertEquals(2, results.length);
assertEquals("sys.mem", results[0].metricName());
assertEquals(METRIC, results[1].metricName());
long ts = START_TIME;
long v = 10;
for (DataPoint dp : results[0]) {
assertEquals(ts, dp.timestamp());
assertTrue(dp.isInteger());
assertEquals(v, dp.longValue());
ts += INTERVAL;
v += 1;
}
ts = START_TIME;
v = 1;
for (DataPoint dp : results[1]) {
assertEquals(ts, dp.timestamp());
assertTrue(dp.isInteger());
assertEquals(v, dp.longValue());
ts += INTERVAL;
v += 1;
}
}
Aggregations