use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestRegionIdMapper method testGetAll.
/**
* Get all known mappings
*/
@Test(timeout = 60000)
public void testGetAll() {
final DistributionRegionIdMapper regionIdMapper = new DistributionRegionIdMapper(DISTRIBUTION_REGION_NAME);
regionIdMapper.addMapping(1, new BoundingBox(1d, 2d, 1d, 2d));
regionIdMapper.addMapping(2, new BoundingBox(10d, 20d, 10d, 20d));
regionIdMapper.addMapping(3, new BoundingBox(15d, 18d, 15d, 18d));
final List<TupleStoreName> mappingResult = regionIdMapper.getAllLocalTables(DEFAULT_SSTABLE_NAME);
Assert.assertEquals(3, mappingResult.size());
}
use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestTupleSink method createTupleRedistributor.
/**
* Get the tuple redistributor
* @return
* @throws BBoxDBException
* @throws InterruptedException
*/
protected TupleRedistributor createTupleRedistributor() throws InterruptedException, BBoxDBException {
final TupleStoreName tupleStoreName = new TupleStoreName(TABLENAME.getFullname());
final TupleStoreManagerRegistry tupleStoreManagerRegistry = new TupleStoreManagerRegistry();
tupleStoreManagerRegistry.init();
return new TupleRedistributor(tupleStoreManagerRegistry, tupleStoreName);
}
use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestTupleStoreAdapter method testTupleStoreConfig1.
/**
* Test configuration 1
* @throws ZookeeperException
*/
@Test(timeout = 60000)
public void testTupleStoreConfig1() throws ZookeeperException {
final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().build();
final TupleStoreName tupleStoreName = new TupleStoreName("dg_table1");
tupleStoreAdapter.deleteTable(tupleStoreName);
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName));
tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName, tupleStoreConfiguration);
final TupleStoreConfiguration readConfig = tupleStoreAdapter.readTuplestoreConfiguration(tupleStoreName);
Assert.assertEquals(tupleStoreConfiguration, readConfig);
Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName));
}
use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestTupleStoreAdapter method testTupleStoreConfig3.
/**
* Test configuration 3
* @throws ZookeeperException
*/
@Test(timeout = 60000)
public void testTupleStoreConfig3() throws ZookeeperException {
final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().withSpatialIndexReader("reader").withSpatialIndexWriter("writer").build();
final TupleStoreName tupleStoreName = new TupleStoreName("dg_table1");
tupleStoreAdapter.deleteTable(tupleStoreName);
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName));
tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName, tupleStoreConfiguration);
final TupleStoreConfiguration readConfig = tupleStoreAdapter.readTuplestoreConfiguration(tupleStoreName);
Assert.assertEquals(tupleStoreConfiguration, readConfig);
Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName));
}
use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestNetworkClasses method encodeAndDecodeDeletedTuple1.
/**
* The the encoding and decoding of an insert tuple package
* @throws IOException
* @throws PackageEncodeException
*/
@Test(timeout = 60000)
public void encodeAndDecodeDeletedTuple1() throws IOException, PackageEncodeException {
final Tuple tuple = new DeletedTuple("key", 12);
final short sequenceNumber = sequenceNumberGenerator.getNextSequenceNummber();
final InsertTupleRequest insertPackage = new InsertTupleRequest(sequenceNumber, ROUTING_HEADER_UNROUTED, new TupleStoreName("test"), tuple);
byte[] encodedVersion = networkPackageToByte(insertPackage);
Assert.assertNotNull(encodedVersion);
final ByteBuffer bb = NetworkPackageDecoder.encapsulateBytes(encodedVersion);
final InsertTupleRequest decodedPackage = InsertTupleRequest.decodeTuple(bb);
Assert.assertEquals(insertPackage.getTuple(), decodedPackage.getTuple());
Assert.assertEquals(insertPackage.getTable(), decodedPackage.getTable());
Assert.assertEquals(insertPackage.getRoutingHeader(), new RoutingHeader(false));
Assert.assertEquals(insertPackage, decodedPackage);
Assert.assertEquals(insertPackage.hashCode(), decodedPackage.hashCode());
Assert.assertEquals(insertPackage.toString(), decodedPackage.toString());
Assert.assertTrue(TupleHelper.isDeletedTuple(decodedPackage.getTuple()));
}
Aggregations