use of org.bboxdb.network.client.future.EmptyResultFuture in project bboxdb by jnidzwetzki.
the class TestBBoxDBCluster method testInsertAndBoundingBoxContinousQuery.
/**
* Insert some tuples and start a bounding box query afterwards
* @throws ExecutionException
* @throws InterruptedException
* @throws BBoxDBException
*/
@Test(timeout = 60000)
public void testInsertAndBoundingBoxContinousQuery() throws InterruptedException, ExecutionException, BBoxDBException {
final BBoxDB bboxDBClient = connectToServer();
final String table = DISTRIBUTION_GROUP + "_relation9991";
// Create table
final EmptyResultFuture resultCreateTable = bboxDBClient.createTable(table, new TupleStoreConfiguration());
resultCreateTable.waitForAll();
Assert.assertFalse(resultCreateTable.isFailed());
// Execute query
final TupleListFuture result = bboxDBClient.queryBoundingBoxContinuous(table, new BoundingBox(-1d, 2d, -1d, 2d));
Assert.assertFalse(result.isFailed());
disconnect(bboxDBClient);
}
use of org.bboxdb.network.client.future.EmptyResultFuture in project bboxdb by jnidzwetzki.
the class TestHelper method recreateDistributionGroup.
/**
* Recreate the given distribution group
* @param client
* @param DISTRIBUTION_GROUP
* @throws InterruptedException
* @throws BBoxDBException
*/
public static void recreateDistributionGroup(final BBoxDB client, final String DISTRIBUTION_GROUP) throws InterruptedException, BBoxDBException {
// Delete distribution group
final EmptyResultFuture resultDelete = client.deleteDistributionGroup(DISTRIBUTION_GROUP);
resultDelete.waitForAll();
Assert.assertFalse(resultDelete.isFailed());
// Create distribution group
final DistributionGroupConfiguration configuration = DistributionGroupConfigurationBuilder.create(2).withReplicationFactor((short) 1).build();
final EmptyResultFuture resultCreate = client.createDistributionGroup(DISTRIBUTION_GROUP, configuration);
resultCreate.waitForAll();
Assert.assertFalse(resultCreate.isFailed());
}
use of org.bboxdb.network.client.future.EmptyResultFuture in project bboxdb by jnidzwetzki.
the class DistributedSelftest method recreateDistributionGroup.
/**
* Recreate the distribution group
* @param bboxdbCluster
* @throws BBoxDBException
* @throws InterruptedException
* @throws ExecutionException
*/
private static void recreateDistributionGroup(final BBoxDBCluster bboxdbCluster) throws BBoxDBException, InterruptedException, ExecutionException {
logger.info("Delete old distribution group: " + DISTRIBUTION_GROUP);
final EmptyResultFuture deleteFuture = bboxdbCluster.deleteDistributionGroup(DISTRIBUTION_GROUP);
deleteFuture.waitForAll();
if (deleteFuture.isFailed()) {
logger.error("Unable to delete distribution group: " + DISTRIBUTION_GROUP);
logger.error(deleteFuture.getAllMessages());
System.exit(-1);
}
// Wait for distribution group to settle
Thread.sleep(5000);
logger.info("Create new distribution group: " + DISTRIBUTION_GROUP);
final DistributionGroupConfiguration configuration = DistributionGroupConfigurationBuilder.create(2).withReplicationFactor((short) 2).build();
final EmptyResultFuture createFuture = bboxdbCluster.createDistributionGroup(DISTRIBUTION_GROUP, configuration);
createFuture.waitForAll();
if (createFuture.isFailed()) {
logger.error("Unable to create distribution group: " + DISTRIBUTION_GROUP);
logger.error(createFuture.getAllMessages());
System.exit(-1);
}
// Wait for distribution group to appear
Thread.sleep(5000);
}
use of org.bboxdb.network.client.future.EmptyResultFuture in project bboxdb by jnidzwetzki.
the class DistributedSelftest method deleteTuples.
/**
* Delete the stored tuples
* @param bboxdbClient
* @throws InterruptedException
* @throws BBoxDBException
* @throws ExecutionException
*/
private static void deleteTuples(final BBoxDBCluster bboxdbClient) throws InterruptedException, BBoxDBException, ExecutionException {
logger.info("Deleting tuples");
for (int i = 0; i < NUMBER_OF_OPERATIONS; i++) {
final String key = Integer.toString(i);
final EmptyResultFuture deletionResult = bboxdbClient.deleteTuple(TABLE, key);
deletionResult.waitForAll();
if (deletionResult.isFailed()) {
logger.error("Got an error while deleting: {} ", key);
logger.error(deletionResult.getAllMessages());
System.exit(-1);
}
}
}
use of org.bboxdb.network.client.future.EmptyResultFuture in project bboxdb by jnidzwetzki.
the class DistributedSelftest method insertNewTuples.
/**
* Insert new tuples
* @param bboxdbClient
* @throws InterruptedException
* @throws ExecutionException
* @throws BBoxDBException
*/
private static void insertNewTuples(final BBoxDBCluster bboxdbClient) throws InterruptedException, ExecutionException, BBoxDBException {
logger.info("Inserting new tuples");
for (int i = 0; i < NUMBER_OF_OPERATIONS; i++) {
final String key = Integer.toString(i);
final Tuple myTuple = new Tuple(key, new BoundingBox(1.0d, 2.0d, 1.0d, 2.0d), "test".getBytes());
final EmptyResultFuture insertResult = bboxdbClient.insertTuple(TABLE, myTuple);
insertResult.waitForAll();
if (insertResult.isFailed()) {
logger.error("Got an error during tuple insert: ", insertResult.getAllMessages());
System.exit(-1);
}
}
}
Aggregations