use of org.bboxdb.storage.entity.TupleStoreConfiguration 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.TupleStoreConfiguration 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.TupleStoreConfiguration 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));
}
use of org.bboxdb.storage.entity.TupleStoreConfiguration in project bboxdb by jnidzwetzki.
the class TestTupleStoreAdapter method testTupleStoreConfig2.
/**
* Test configuration 2
* @throws ZookeeperException
*/
@Test(timeout = 60000)
public void testTupleStoreConfig2() throws ZookeeperException {
final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().allowDuplicates(true).withTTL(10000, TimeUnit.MILLISECONDS).withVersions(100).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.TupleStoreConfiguration in project bboxdb by jnidzwetzki.
the class TestStorageManager method testTTLDuplicates.
/**
* Test the storage manager with duplicates - ttl version
* @throws StorageManagerException
* @throws RejectedException
* @throws InterruptedException
*/
@Test(timeout = 60000)
public void testTTLDuplicates() throws StorageManagerException, RejectedException, InterruptedException {
// The TTL
final int TTL_IN_MS = 5000;
// Delete the old table
storageRegistry.deleteTable(TEST_RELATION, true);
// Create a new table
final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().allowDuplicates(true).withTTL(TTL_IN_MS, TimeUnit.MILLISECONDS).build();
storageRegistry.createTable(TEST_RELATION, tupleStoreConfiguration);
// Assure table is created successfully
storageManager = storageRegistry.getTupleStoreManager(TEST_RELATION);
Assert.assertTrue(storageManager.getServiceState().isInRunningState());
final Tuple tuple1 = new Tuple("abc", BoundingBox.FULL_SPACE, "abc1".getBytes());
storageManager.put(tuple1);
final Tuple tuple2 = new Tuple("abc", BoundingBox.FULL_SPACE, "abc2".getBytes());
storageManager.put(tuple2);
final Tuple tuple3 = new Tuple("abc", BoundingBox.FULL_SPACE, "abc3".getBytes());
storageManager.put(tuple3);
final Tuple tuple4 = new Tuple("abc", BoundingBox.FULL_SPACE, "abc4".getBytes());
storageManager.put(tuple4);
final Tuple tuple5 = new Tuple("abc", BoundingBox.FULL_SPACE, "abc5".getBytes());
storageManager.put(tuple5);
final List<Tuple> readTuples = storageManager.get("abc");
Assert.assertFalse(readTuples.isEmpty());
// Sleep longer than TTL
Thread.sleep(TTL_IN_MS * 2);
final List<Tuple> readTuples2 = storageManager.get("abc");
Assert.assertTrue(readTuples2.isEmpty());
}
Aggregations