use of com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter in project sidewinder by srotya.
the class TestDiskStorageEngine method testSeriesToDataPointConversion.
@Test
public void testSeriesToDataPointConversion() throws IOException {
List<DataPoint> points = new ArrayList<>();
long headerTimestamp = System.currentTimeMillis();
HashMap<String, String> map = new HashMap<>();
map.put("metadata.dir", "target/db1/mdq");
map.put("index.dir", "target/db1/index");
map.put("data.dir", "target/db1/data");
map.put(StorageEngine.PERSISTENCE_DISK, "true");
ByteBuffer buf = ByteBuffer.allocate(100);
Writer timeSeries = new ByzantineWriter();
timeSeries.configure(map, buf, true, 1, false);
timeSeries.setHeaderTimestamp(headerTimestamp);
timeSeries.addValue(headerTimestamp, 1L);
TimeSeries.seriesToDataPoints("value", Arrays.asList("test=1"), points, timeSeries, null, null, false);
assertEquals(1, points.size());
points.clear();
Predicate timepredicate = new BetweenPredicate(Long.MAX_VALUE, Long.MAX_VALUE);
TimeSeries.seriesToDataPoints("value", Arrays.asList("test=1"), points, timeSeries, timepredicate, null, false);
assertEquals(0, points.size());
}
use of com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter in project sidewinder by srotya.
the class TestMemStorageEngine method testSeriesToDataPointConversion.
@Test
public void testSeriesToDataPointConversion() throws IOException {
List<DataPoint> points = new ArrayList<>();
long headerTimestamp = System.currentTimeMillis();
ByteBuffer buf = ByteBuffer.allocate(1024);
Writer timeSeries = new ByzantineWriter();
timeSeries.configure(conf, buf, true, 1, false);
timeSeries.setHeaderTimestamp(headerTimestamp);
timeSeries.addValue(headerTimestamp, 1L);
TimeSeries.seriesToDataPoints("value", Arrays.asList("test=2"), points, timeSeries, null, null, false);
assertEquals(1, points.size());
points.clear();
Predicate timepredicate = new BetweenPredicate(Long.MAX_VALUE, Long.MAX_VALUE);
TimeSeries.seriesToDataPoints("value", Arrays.asList("test=2"), points, timeSeries, timepredicate, null, false);
assertEquals(0, points.size());
}
Aggregations