MCPcopy
hub / github.com/OpenTSDB/opentsdb / evaluateGroupByDouble

Method evaluateGroupByDouble

test/query/expression/TestAlias.java:134–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

132 }
133
134 @Test
135 public void evaluateGroupByDouble() throws Exception {
136 SeekableView view2 = SeekableViewsForTest.generator(START_TIME, INTERVAL,
137 NUM_POINTS, false, 10, 1);
138 DataPoints dps2 = PowerMockito.mock(DataPoints.class);
139 when(dps2.iterator()).thenReturn(view2);
140 when(dps2.metricName()).thenReturn("sys.mem");
141 group_bys = new DataPoints[] { dps, dps2 };
142 query_results.clear();
143 query_results.add(group_bys);
144 params.add("My Alias");
145
146 final DataPoints[] results = func.evaluate(data_query, query_results, params);
147
148 assertEquals(2, results.length);
149 assertEquals("My Alias", results[0].metricName());
150 assertEquals("My Alias", results[1].metricName());
151
152 long ts = START_TIME;
153 double v = 1;
154 for (DataPoint dp : results[0]) {
155 assertEquals(ts, dp.timestamp());
156 assertTrue(dp.isInteger());
157 assertEquals((long)v, dp.longValue());
158 ts += INTERVAL;
159 v += 1;
160 }
161 ts = START_TIME;
162 v = 10;
163 for (DataPoint dp : results[1]) {
164 assertEquals(ts, dp.timestamp());
165 assertFalse(dp.isInteger());
166 assertEquals(v, dp.doubleValue(), 0.001);
167 ts += INTERVAL;
168 v += 1;
169 }
170 }
171
172 @Test
173 public void evaluateSubQuerySeries() throws Exception {

Callers

nothing calls this directly

Calls 10

generatorMethod · 0.95
iteratorMethod · 0.95
metricNameMethod · 0.95
clearMethod · 0.80
evaluateMethod · 0.65
timestampMethod · 0.65
isIntegerMethod · 0.65
longValueMethod · 0.65
doubleValueMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected