use of com.srotya.sidewinder.core.storage.SeriesOutput in project sidewinder by srotya.
the class TestWindowedFunctions method testWindowedLast.
@Test
public void testWindowedLast() throws Exception {
double[] values = { 1.1, 2.2, 3.3, 4.4 };
List<DataPoint> dps = new ArrayList<>();
long ts = 1486617103629L;
for (int i = 0; i < values.length; i++) {
double d = values[i];
ts = ts + (30_000);
dps.add(MiscUtils.buildDataPoint(ts, d));
}
WindowedAggregator rwa = new WindowedLast();
rwa.init(new Object[] { 70, "smean" });
SeriesOutput series = new SeriesOutput();
series.setDataPoints(dps);
series.setFp(true);
List<DataPoint> result = rwa.apply(series).getDataPoints();
assertEquals(2, result.size());
assertEquals(1.1, result.get(0).getValue(), 0);
assertEquals(4.4, result.get(1).getValue(), 0);
}
use of com.srotya.sidewinder.core.storage.SeriesOutput in project sidewinder by srotya.
the class TestTransformFunctions method testLog10.
@Test
public void testLog10() {
Function f = new Log10Function();
List<SeriesOutput> series = new ArrayList<>();
SeriesOutput s = new SeriesOutput(Arrays.asList(new DataPoint(1L, 100), new DataPoint(1L, 1000)));
series.add(s);
List<SeriesOutput> apply = f.apply(series);
assertEquals(2, apply.get(0).getDataPoints().size());
assertEquals(2, apply.get(0).getDataPoints().get(0).getLongValue(), 0.1);
assertEquals(3, apply.get(0).getDataPoints().get(1).getLongValue(), 0.1);
}
use of com.srotya.sidewinder.core.storage.SeriesOutput in project sidewinder by srotya.
the class TestTransformFunctions method testLog.
@Test
public void testLog() {
Function f = new LogFunction();
List<SeriesOutput> series = new ArrayList<>();
SeriesOutput s = new SeriesOutput(Arrays.asList(new DataPoint(1L, 100), new DataPoint(1L, 1000)));
series.add(s);
List<SeriesOutput> apply = f.apply(series);
assertEquals(2, apply.get(0).getDataPoints().size());
assertEquals(4.0, apply.get(0).getDataPoints().get(0).getLongValue(), 0.1);
assertEquals(6.0, apply.get(0).getDataPoints().get(1).getLongValue(), 0.1);
}
use of com.srotya.sidewinder.core.storage.SeriesOutput in project sidewinder by srotya.
the class TestTransformFunctions method testCeil.
@Test
public void testCeil() {
Function f = new CeilFunction();
List<SeriesOutput> series = new ArrayList<>();
SeriesOutput s = new SeriesOutput(Arrays.asList(new DataPoint(1L, 3.2), new DataPoint(1L, 4.7)));
series.add(s);
List<SeriesOutput> apply = f.apply(series);
assertEquals(2, apply.get(0).getDataPoints().size());
assertEquals(3.2, apply.get(0).getDataPoints().get(0).getValue(), 0.1);
assertEquals(4.7, apply.get(0).getDataPoints().get(1).getValue(), 0.1);
}
use of com.srotya.sidewinder.core.storage.SeriesOutput in project sidewinder by srotya.
the class TestTransformFunctions method testSquareRoot.
@Test
public void testSquareRoot() {
Function f = new SqrtFunction();
List<SeriesOutput> series = new ArrayList<>();
SeriesOutput s = new SeriesOutput(Arrays.asList(new DataPoint(1L, 9), new DataPoint(1L, 16)));
series.add(s);
List<SeriesOutput> apply = f.apply(series);
assertEquals(2, apply.get(0).getDataPoints().size());
assertEquals(3, apply.get(0).getDataPoints().get(0).getLongValue());
assertEquals(4, apply.get(0).getDataPoints().get(1).getLongValue());
}
Aggregations