use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestNetworkCommunication method testSendDeletePackage.
/**
* Send a delete package to the server
* @throws InterruptedException
* @throws ExecutionException
* @throws ZookeeperException
* @throws BBoxDBException
*/
@Test(timeout = 60000)
public void testSendDeletePackage() throws InterruptedException, ExecutionException, ZookeeperException, BBoxDBException {
System.out.println("=== Running sendDeletePackage");
final BBoxDBConnection bboxdbConnection = connectToServer();
final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
final String tableName = DISTRIBUTION_GROUP + "_relation3";
final TupleStoreName tupleStoreName = new TupleStoreName(tableName);
final ZookeeperClient zookeeperClient = ZookeeperClientFactory.getZookeeperClient();
final TupleStoreAdapter tupleStoreAdapter = zookeeperClient.getTupleStoreAdapter();
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName));
// Create table
final TupleStoreConfiguration configuration = TupleStoreConfigurationBuilder.create().build();
final EmptyResultFuture createFuture = bboxDBClient.createTable(tableName, configuration);
createFuture.waitForAll();
Assert.assertTrue(createFuture.isDone());
Assert.assertFalse(createFuture.isFailed());
Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName));
// Delete table
final EmptyResultFuture deleteResult1 = bboxDBClient.deleteTable(tableName);
deleteResult1.waitForAll();
Assert.assertTrue(deleteResult1.isDone());
Assert.assertFalse(deleteResult1.isFailed());
Assert.assertTrue(bboxdbConnection.getConnectionState().isInRunningState());
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName));
// Second call
final EmptyResultFuture deleteResult2 = bboxDBClient.deleteTable(tableName);
deleteResult2.waitForAll();
Assert.assertTrue(deleteResult2.isDone());
Assert.assertFalse(deleteResult2.isFailed());
Assert.assertTrue(bboxdbConnection.getConnectionState().isInRunningState());
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName));
// Disconnect
disconnect(bboxDBClient);
Assert.assertFalse(bboxDBClient.isConnected());
System.out.println("=== End sendDeletePackage");
}
use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestRegionIdMapper method testGetTableNames1.
/**
* Test the tablename result
*/
@Test(timeout = 60000)
public void testGetTableNames1() {
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 Collection<TupleStoreName> mappingResult = regionIdMapper.getLocalTablesForRegion(new BoundingBox(1.5d, 55d, 1.5d, 55d), DEFAULT_SSTABLE_NAME);
Assert.assertTrue(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_1")));
Assert.assertTrue(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_2")));
Assert.assertTrue(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_3")));
Assert.assertFalse(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_4")));
}
use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestRegionIdMapper method testGetTableNames2.
/**
* Test the tablename result
*/
@Test(timeout = 60000)
public void testGetTableNames2() {
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 Collection<TupleStoreName> mappingResult = regionIdMapper.getLocalTablesForRegion(new BoundingBox(1.5d, 1.5d, 1.5d, 1.5d), DEFAULT_SSTABLE_NAME);
Assert.assertTrue(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_1")));
Assert.assertFalse(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_2")));
Assert.assertFalse(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_3")));
Assert.assertFalse(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_4")));
}
use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestTupleStoreAdapter method testDeleteDistributionGroup.
@Test(timeout = 60000)
public void testDeleteDistributionGroup() throws ZookeeperException {
final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().build();
final TupleStoreName tupleStoreName1 = new TupleStoreName("dg_table1");
final TupleStoreName tupleStoreName2 = new TupleStoreName("dg_table2");
tupleStoreAdapter.deleteTable(tupleStoreName1);
tupleStoreAdapter.deleteTable(tupleStoreName2);
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName1));
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName2));
tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName1, tupleStoreConfiguration);
tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName2, tupleStoreConfiguration);
Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName1));
Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName2));
}
use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestTupleStoreAdapter method deleteAndCreateTable.
/**
* Test the tuplestore creation and deletion
* @throws ZookeeperException
*/
@Test(timeout = 60000)
public void deleteAndCreateTable() throws ZookeeperException {
final TupleStoreName tupleStoreName1 = new TupleStoreName("dg_table1");
final TupleStoreName tupleStoreName2 = new TupleStoreName("dg_table2");
tupleStoreAdapter.deleteTable(tupleStoreName1);
tupleStoreAdapter.deleteTable(tupleStoreName2);
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName1));
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName2));
final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().build();
tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName1, tupleStoreConfiguration);
Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName1));
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName2));
tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName2, tupleStoreConfiguration);
Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName1));
Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName2));
tupleStoreAdapter.deleteTable(tupleStoreName1);
tupleStoreAdapter.deleteTable(tupleStoreName2);
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName1));
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName2));
}
Aggregations