Search in sources :

Example 6 with SSTableMetadataBuilder

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);
}
Also used : SSTableMetadataBuilder(org.bboxdb.storage.sstable.SSTableMetadataBuilder) Test(org.junit.Test)

Example 7 with SSTableMetadataBuilder

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());
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) TupleStoreMetaData(org.bboxdb.storage.entity.TupleStoreMetaData) SSTableMetadataBuilder(org.bboxdb.storage.sstable.SSTableMetadataBuilder) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) Tuple(org.bboxdb.storage.entity.Tuple) Test(org.junit.Test)

Example 8 with SSTableMetadataBuilder

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());
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) TupleStoreMetaData(org.bboxdb.storage.entity.TupleStoreMetaData) SSTableMetadataBuilder(org.bboxdb.storage.sstable.SSTableMetadataBuilder) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) Tuple(org.bboxdb.storage.entity.Tuple) Test(org.junit.Test)

Example 9 with SSTableMetadataBuilder

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());
}
Also used : DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) SSTableMetadataBuilder(org.bboxdb.storage.sstable.SSTableMetadataBuilder) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) Tuple(org.bboxdb.storage.entity.Tuple) Test(org.junit.Test)

Example 10 with SSTableMetadataBuilder

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);
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) SSTableMetadataBuilder(org.bboxdb.storage.sstable.SSTableMetadataBuilder) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) Tuple(org.bboxdb.storage.entity.Tuple) Test(org.junit.Test)

Aggregations

SSTableMetadataBuilder (org.bboxdb.storage.sstable.SSTableMetadataBuilder)14 Test (org.junit.Test)14 TupleStoreMetaData (org.bboxdb.storage.entity.TupleStoreMetaData)11 DeletedTuple (org.bboxdb.storage.entity.DeletedTuple)8 Tuple (org.bboxdb.storage.entity.Tuple)8 BoundingBox (org.bboxdb.commons.math.BoundingBox)7 File (java.io.File)2