use of org.bboxdb.storage.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.
the class TestSSTableMetadataBuilder method testDumpAndReadFromYamlString1.
/**
* Dump the index to yaml and reread the data
*/
@Test(timeout = 60000)
public void testDumpAndReadFromYamlString1() {
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 TupleStoreMetaData metaData = ssTableIndexBuilder.getMetaData();
final String yamlData = metaData.exportToYaml();
final TupleStoreMetaData metaDataRead = TupleStoreMetaData.importFromYaml(yamlData);
Assert.assertEquals(metaData, metaDataRead);
Assert.assertEquals(2, metaData.getDimensions());
Assert.assertTrue(metaData.toString().length() > 10);
Assert.assertEquals(metaData.hashCode(), metaDataRead.hashCode());
}
use of org.bboxdb.storage.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.
the class TestSSTableMetadataBuilder method testDumpAndReadFromYamlFile2.
/**
* Dump the index to yaml file and reread the data - two tuple
* @throws IOException
*/
@Test(timeout = 60000)
public void testDumpAndReadFromYamlFile2() throws IOException {
final SSTableMetadataBuilder ssTableIndexBuilder = new SSTableMetadataBuilder();
addTwoTuples(ssTableIndexBuilder);
final File tmpFile = File.createTempFile("test", ".tmp");
final TupleStoreMetaData metaData = ssTableIndexBuilder.getMetaData();
metaData.exportToYamlFile(tmpFile);
final TupleStoreMetaData metaDataRead = TupleStoreMetaData.importFromYamlFile(tmpFile);
Assert.assertEquals(metaData, metaDataRead);
tmpFile.delete();
}
use of org.bboxdb.storage.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.
the class TestSSTableMetadataBuilder method testSSTableIndexBuilder5.
/**
* Build index with two tuples
*/
@Test(timeout = 60000)
public void testSSTableIndexBuilder5() {
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, 1.1d);
final Tuple tuple2 = new Tuple("def", boundingBox2, "".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());
}
use of org.bboxdb.storage.sstable.SSTableMetadataBuilder in project bboxdb by jnidzwetzki.
the class TestSSTableMetadataBuilder method testDumpAndReadFromYamlFile1.
/**
* Dump the index to yaml file and reread the data - zero tuples
* @throws IOException
*/
@Test(timeout = 60000)
public void testDumpAndReadFromYamlFile1() throws IOException {
final SSTableMetadataBuilder ssTableIndexBuilder = new SSTableMetadataBuilder();
final File tmpFile = File.createTempFile("test", ".tmp");
final TupleStoreMetaData metaData = ssTableIndexBuilder.getMetaData();
metaData.exportToYamlFile(tmpFile);
final TupleStoreMetaData metaDataRead = TupleStoreMetaData.importFromYamlFile(tmpFile);
Assert.assertEquals(metaData, metaDataRead);
tmpFile.delete();
}
Aggregations