Search in sources :

Example 1 with SSTableMetadataBuilder

use of org.bboxdb.storage.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.

the class TestSSTableMetadataBuilder method testSSTableIndexBuilder1.

/**
 * Build empty index
 */
@Test(timeout = 60000)
public void testSSTableIndexBuilder1() {
    final SSTableMetadataBuilder ssTableIndexBuilder = new SSTableMetadataBuilder();
    final TupleStoreMetaData metadata = ssTableIndexBuilder.getMetaData();
    Assert.assertArrayEquals(new double[] {}, metadata.getBoundingBoxData(), 0.001d);
    Assert.assertEquals(0, metadata.getTuples());
}
Also used : TupleStoreMetaData(org.bboxdb.storage.entity.TupleStoreMetaData) SSTableMetadataBuilder(org.bboxdb.storage.sstable.SSTableMetadataBuilder) Test(org.junit.Test)

Example 2 with SSTableMetadataBuilder

use of org.bboxdb.storage.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.

the class TestSSTableMetadataBuilder method testSSTableIndexBuilder2.

/**
 * Build index with one tuple
 */
@Test(timeout = 60000)
public void testSSTableIndexBuilder2() {
    final SSTableMetadataBuilder ssTableIndexBuilder = new SSTableMetadataBuilder();
    final BoundingBox boundingBox1 = new BoundingBox(1d, 2d);
    final Tuple tuple1 = new Tuple("abc", boundingBox1, "".getBytes());
    ssTableIndexBuilder.addTuple(tuple1);
    final TupleStoreMetaData metadata = ssTableIndexBuilder.getMetaData();
    Assert.assertArrayEquals(boundingBox1.toDoubleArray(), metadata.getBoundingBoxData(), 0.001d);
    Assert.assertEquals(metadata.getOldestTupleVersionTimestamp(), metadata.getNewestTupleVersionTimestamp());
    Assert.assertEquals(1, metadata.getTuples());
    Assert.assertEquals(tuple1.getReceivedTimestamp(), metadata.getNewestTupleInsertedTimstamp());
}
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 3 with SSTableMetadataBuilder

use of org.bboxdb.storage.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.

the class TestSSTableMetadataBuilder method testSSTableIndexBuilder3.

/**
 * Build index with two tuples
 */
@Test(timeout = 60000)
public void testSSTableIndexBuilder3() {
    final SSTableMetadataBuilder ssTableIndexBuilder = new SSTableMetadataBuilder();
    final BoundingBox boundingBox1 = new BoundingBox(1d, 2d);
    final Tuple tuple1 = new Tuple("abc", boundingBox1, "".getBytes());
    final Tuple tuple2 = new Tuple("def", boundingBox1, "".getBytes());
    ssTableIndexBuilder.addTuple(tuple1);
    ssTableIndexBuilder.addTuple(tuple2);
    final TupleStoreMetaData metadata = ssTableIndexBuilder.getMetaData();
    Assert.assertArrayEquals(boundingBox1.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 4 with SSTableMetadataBuilder

use of org.bboxdb.storage.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.

the class TestSSTableMetadataBuilder method testSSTableIndexBuilder7.

/**
 * Build index with two tuples - bounding boxes are differ in the dimension
 */
@Test(timeout = 60000)
public void testSSTableIndexBuilder7() {
    final SSTableMetadataBuilder ssTableIndexBuilder = new SSTableMetadataBuilder();
    addTwoTuples(ssTableIndexBuilder);
    final TupleStoreMetaData metadata = ssTableIndexBuilder.getMetaData();
    Assert.assertArrayEquals(new double[] { 1d, 2d, 1d, 5f }, metadata.getBoundingBoxData(), 0.001d);
    Assert.assertEquals(2, metadata.getTuples());
}
Also used : TupleStoreMetaData(org.bboxdb.storage.entity.TupleStoreMetaData) SSTableMetadataBuilder(org.bboxdb.storage.sstable.SSTableMetadataBuilder) Test(org.junit.Test)

Example 5 with SSTableMetadataBuilder

use of org.bboxdb.storage.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.

the class TestSSTableMetadataBuilder method testDumpAndReadFromYamlStrig2.

/**
 * Dump the index to yaml and reread the data
 */
@Test(timeout = 60000)
public void testDumpAndReadFromYamlStrig2() {
    final SSTableMetadataBuilder ssTableIndexBuilder = new SSTableMetadataBuilder();
    addTwoTuples(ssTableIndexBuilder);
    final TupleStoreMetaData metaData = ssTableIndexBuilder.getMetaData();
    final String yamlData = metaData.exportToYaml();
    final TupleStoreMetaData metaDataRead = TupleStoreMetaData.importFromYaml(yamlData);
    Assert.assertEquals(metaData, metaDataRead);
}
Also used : TupleStoreMetaData(org.bboxdb.storage.entity.TupleStoreMetaData) SSTableMetadataBuilder(org.bboxdb.storage.sstable.SSTableMetadataBuilder) 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