use of org.bboxdb.storage.sstable.duplicateresolver.TTLAndVersionTupleDuplicateResolver in project bboxdb by jnidzwetzki.
the class TestTupleHelper method testTupleDuplicateResolverTTLAndVersion1.
/**
* Test the tuple resolver
*/
@Test(timeout = 60000)
public void testTupleDuplicateResolverTTLAndVersion1() {
final Tuple tupleA = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 1);
final Tuple tupleB = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 2);
final Tuple tupleC = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 1);
final Tuple tupleD = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 4);
final Tuple tupleE = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 3);
final Tuple tupleF = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 1);
final List<Tuple> tupleList = new ArrayList<>(Arrays.asList(tupleA, tupleB, tupleC, tupleD, tupleE, tupleF));
// basetime = 6, ttl = 3 / tuple older than 2 are removed with 10 duplicates
final DuplicateResolver<Tuple> resolver = new TTLAndVersionTupleDuplicateResolver(4, TimeUnit.MICROSECONDS, 10, 6);
resolver.removeDuplicates(tupleList);
Assert.assertEquals(3, tupleList.size());
Assert.assertTrue(tupleList.contains(tupleD));
Assert.assertTrue(tupleList.contains(tupleE));
Assert.assertTrue(tupleList.contains(tupleB));
}
use of org.bboxdb.storage.sstable.duplicateresolver.TTLAndVersionTupleDuplicateResolver in project bboxdb by jnidzwetzki.
the class TestTupleHelper method testTupleDuplicateResolverTTLAndVersion2.
/**
* Test the tuple resolver
*/
@Test(timeout = 60000)
public void testTupleDuplicateResolverTTLAndVersion2() {
final Tuple tupleA = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 1);
final Tuple tupleB = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 2);
final Tuple tupleC = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 1);
final Tuple tupleD = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 4);
final Tuple tupleE = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 3);
final Tuple tupleF = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 1);
final List<Tuple> tupleList = new ArrayList<>(Arrays.asList(tupleA, tupleB, tupleC, tupleD, tupleE, tupleF));
// basetime = 6, ttl = 3 / tuple older than 2 are removed with 10 duplicates
final DuplicateResolver<Tuple> resolver = new TTLAndVersionTupleDuplicateResolver(4, TimeUnit.MICROSECONDS, 1, 6);
resolver.removeDuplicates(tupleList);
Assert.assertEquals(1, tupleList.size());
Assert.assertTrue(tupleList.contains(tupleD));
}
Aggregations