use of org.bboxdb.storage.entity.DeletedTuple in project bboxdb by jnidzwetzki.
the class TestMemtable method testNewestOldest.
/**
* Test newest and oldest timestamp
* @throws StorageManagerException
*/
@Test(timeout = 60000)
public void testNewestOldest() throws StorageManagerException {
final Tuple createdTuple1 = new Tuple("1", null, "abc".getBytes(), 60);
memtable.put(createdTuple1);
final Tuple createdTuple2 = new Tuple("2", null, "def".getBytes(), 1);
memtable.put(createdTuple2);
Assert.assertEquals(1, memtable.getOldestTupleVersionTimestamp());
Assert.assertEquals(60, memtable.getNewestTupleVersionTimestamp());
final DeletedTuple deletedTuple = new DeletedTuple("3", 500);
memtable.put(deletedTuple);
Assert.assertEquals(1, memtable.getOldestTupleVersionTimestamp());
Assert.assertEquals(500, memtable.getNewestTupleVersionTimestamp());
}
use of org.bboxdb.storage.entity.DeletedTuple in project bboxdb by jnidzwetzki.
the class TestMemtable method testTupleDelete.
/**
* Test the deletion of a tuple
* @throws Exception
*/
@Test(timeout = 60000)
public void testTupleDelete() throws Exception {
final Tuple createdTuple = new Tuple("1", null, "abc".getBytes());
memtable.put(createdTuple);
Assert.assertEquals(createdTuple, memtable.get("1").get(0));
memtable.delete("1", MicroSecondTimestampProvider.getNewTimestamp());
Assert.assertTrue(memtable.get("1").get(1) instanceof DeletedTuple);
}
use of org.bboxdb.storage.entity.DeletedTuple in project bboxdb by jnidzwetzki.
the class TestTupleSink method testTupleRedistribution2.
/**
* Test the tuple redistribution
* @throws Exception
*/
@Test(timeout = 60000)
public void testTupleRedistribution2() throws Exception {
final DistributionRegion distributionRegion1 = new DistributionRegion(TEST_GROUP, DistributionRegion.ROOT_NODE_ROOT_POINTER, new BoundingBox(0.0, 1.0, 0.0, 1.0, 0.0, 1.0), 1);
final DistributionRegion distributionRegion2 = new DistributionRegion(TEST_GROUP, DistributionRegion.ROOT_NODE_ROOT_POINTER, new BoundingBox(5.0, 6.0, 5.0, 6.0, 5.0, 6.0), 1);
final TupleRedistributor tupleRedistributor = createTupleRedistributor();
final AbstractTupleSink tupleSink1 = Mockito.mock(AbstractTupleSink.class);
tupleRedistributor.registerRegion(distributionRegion1, Arrays.asList(tupleSink1));
final AbstractTupleSink tupleSink2 = Mockito.mock(AbstractTupleSink.class);
tupleRedistributor.registerRegion(distributionRegion2, Arrays.asList(tupleSink2));
final Tuple tuple1 = new Tuple("abc", new BoundingBox(0.0, 1.0, 0.0, 1.0, 0.0, 1.0), "".getBytes());
tupleRedistributor.redistributeTuple(tuple1);
(Mockito.verify(tupleSink1, Mockito.times(1))).sinkTuple(Mockito.any(Tuple.class));
(Mockito.verify(tupleSink2, Mockito.never())).sinkTuple(Mockito.any(Tuple.class));
final Tuple tuple2 = new Tuple("abc", new BoundingBox(5.0, 6.0, 5.0, 6.0, 5.0, 6.0), "".getBytes());
tupleRedistributor.redistributeTuple(tuple2);
(Mockito.verify(tupleSink1, Mockito.times(1))).sinkTuple(Mockito.any(Tuple.class));
(Mockito.verify(tupleSink2, Mockito.times(1))).sinkTuple(Mockito.any(Tuple.class));
final Tuple tuple3 = new Tuple("abc", new BoundingBox(0.0, 6.0, 0.0, 6.0, 0.0, 6.0), "".getBytes());
tupleRedistributor.redistributeTuple(tuple3);
(Mockito.verify(tupleSink1, Mockito.atLeast(2))).sinkTuple(Mockito.any(Tuple.class));
(Mockito.verify(tupleSink2, Mockito.atLeast(2))).sinkTuple(Mockito.any(Tuple.class));
final Tuple tuple4 = new DeletedTuple("abc");
tupleRedistributor.redistributeTuple(tuple4);
(Mockito.verify(tupleSink1, Mockito.atLeast(3))).sinkTuple(Mockito.any(Tuple.class));
(Mockito.verify(tupleSink2, Mockito.atLeast(3))).sinkTuple(Mockito.any(Tuple.class));
System.out.println(tupleRedistributor.getStatistics());
}
use of org.bboxdb.storage.entity.DeletedTuple in project bboxdb by jnidzwetzki.
the class TestSSTableMetadataBuilder method testSSTableIndexBuilder8.
/**
* Build index with multiple tuples - check timestamps
*/
@Test(timeout = 60000)
public void testSSTableIndexBuilder8() {
final SSTableMetadataBuilder ssTableIndexBuilder = new SSTableMetadataBuilder();
final Tuple tuple1 = new Tuple("0", BoundingBox.FULL_SPACE, "".getBytes(), 6);
ssTableIndexBuilder.addTuple(tuple1);
Assert.assertEquals(6, ssTableIndexBuilder.getMetaData().getNewestTupleVersionTimestamp());
Assert.assertEquals(6, ssTableIndexBuilder.getMetaData().getOldestTupleVersionTimestamp());
Assert.assertEquals(tuple1.getReceivedTimestamp(), ssTableIndexBuilder.getMetaData().getNewestTupleInsertedTimstamp());
final Tuple tuple2 = new Tuple("0", BoundingBox.FULL_SPACE, "".getBytes(), 7);
ssTableIndexBuilder.addTuple(tuple2);
Assert.assertEquals(7, ssTableIndexBuilder.getMetaData().getNewestTupleVersionTimestamp());
Assert.assertEquals(6, ssTableIndexBuilder.getMetaData().getOldestTupleVersionTimestamp());
Assert.assertEquals(tuple2.getReceivedTimestamp(), ssTableIndexBuilder.getMetaData().getNewestTupleInsertedTimstamp());
final Tuple tuple3 = new Tuple("0", BoundingBox.FULL_SPACE, "".getBytes(), 2);
ssTableIndexBuilder.addTuple(tuple3);
Assert.assertEquals(7, ssTableIndexBuilder.getMetaData().getNewestTupleVersionTimestamp());
Assert.assertEquals(2, ssTableIndexBuilder.getMetaData().getOldestTupleVersionTimestamp());
Assert.assertEquals(tuple3.getReceivedTimestamp(), ssTableIndexBuilder.getMetaData().getNewestTupleInsertedTimstamp());
final Tuple tuple4 = new DeletedTuple("0", 22);
ssTableIndexBuilder.addTuple(tuple4);
Assert.assertEquals(22, ssTableIndexBuilder.getMetaData().getNewestTupleVersionTimestamp());
Assert.assertEquals(2, ssTableIndexBuilder.getMetaData().getOldestTupleVersionTimestamp());
Assert.assertEquals(tuple4.getReceivedTimestamp(), ssTableIndexBuilder.getMetaData().getNewestTupleInsertedTimstamp());
}
use of org.bboxdb.storage.entity.DeletedTuple in project bboxdb by jnidzwetzki.
the class TestStorageManager method testTupleDelete.
@Test(timeout = 60000)
public void testTupleDelete() throws Exception {
final Tuple createdTuple = new Tuple("1", BoundingBox.FULL_SPACE, "abc".getBytes());
storageManager.put(createdTuple);
Assert.assertEquals(createdTuple, storageManager.get("1").get(0));
storageManager.delete("1", MicroSecondTimestampProvider.getNewTimestamp());
Assert.assertTrue(storageManager.get("1").get(0) instanceof DeletedTuple);
}
Aggregations