use of org.bboxdb.storage.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.
the class TestSSTableMetadataBuilder method testDumpToYaml1.
/**
* Dump the index to yaml
*/
@Test(timeout = 60000)
public void testDumpToYaml1() {
final SSTableMetadataBuilder ssTableIndexBuilder = new SSTableMetadataBuilder();
final String yamlData = ssTableIndexBuilder.getMetaData().exportToYaml();
Assert.assertTrue(yamlData.length() > 10);
}
use of org.bboxdb.storage.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.
the class TestSSTableMetadataBuilder method testSSTableIndexBuilder6.
/**
* Build index with two tuples - bounding boxes are differ in the dimension
*/
@Test(expected = IllegalArgumentException.class)
public void testSSTableIndexBuilder6() {
final SSTableMetadataBuilder ssTableIndexBuilder = new SSTableMetadataBuilder();
final BoundingBox boundingBox1 = new BoundingBox(1d, 2d, 1d, 2d);
final Tuple tuple1 = new Tuple("abc", boundingBox1, "".getBytes());
final BoundingBox boundingBox2 = new BoundingBox(1d, 1.1d);
final Tuple tuple2 = new Tuple("def", boundingBox2, "".getBytes());
ssTableIndexBuilder.addTuple(tuple1);
ssTableIndexBuilder.addTuple(tuple2);
final TupleStoreMetaData metadata = ssTableIndexBuilder.getMetaData();
Assert.assertArrayEquals(new double[] {}, metadata.getBoundingBoxData(), 0.001d);
Assert.assertEquals(2, metadata.getTuples());
}
use of org.bboxdb.storage.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.
the class TestSSTableMetadataBuilder method testSSTableIndexBuilder4.
/**
* Build index with two tuples
*/
@Test(timeout = 60000)
public void testSSTableIndexBuilder4() {
final SSTableMetadataBuilder ssTableIndexBuilder = new SSTableMetadataBuilder();
final BoundingBox boundingBox1 = new BoundingBox(1d, 2d);
final Tuple tuple1 = new Tuple("abc", boundingBox1, "".getBytes());
final BoundingBox boundingBox2 = new BoundingBox(1d, 3d);
final Tuple tuple2 = new Tuple("def", boundingBox2, "".getBytes());
ssTableIndexBuilder.addTuple(tuple1);
ssTableIndexBuilder.addTuple(tuple2);
final TupleStoreMetaData metadata = ssTableIndexBuilder.getMetaData();
Assert.assertArrayEquals(boundingBox2.toDoubleArray(), metadata.getBoundingBoxData(), 0.001d);
Assert.assertEquals(2, metadata.getTuples());
}
use of org.bboxdb.storage.sstable.SSTableMetadataBuilder 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.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.
the class TestSSTableMetadataBuilder method testDumpToYaml2.
/**
* Dump the index to yaml
*/
@Test(timeout = 60000)
public void testDumpToYaml2() {
final SSTableMetadataBuilder ssTableIndexBuilder = new SSTableMetadataBuilder();
final BoundingBox boundingBox1 = new BoundingBox(1d, 2d, 1d, 2d);
final Tuple tuple1 = new Tuple("abc", boundingBox1, "".getBytes());
ssTableIndexBuilder.addTuple(tuple1);
final String yamlData = ssTableIndexBuilder.getMetaData().exportToYaml();
Assert.assertTrue(yamlData.length() > 10);
}
Aggregations