use of org.bboxdb.network.client.BBoxDBConnection in project bboxdb by jnidzwetzki.
the class TestNetworkCommunication method testCreateDistributionGroupTwoTimes.
/**
* Test create a distribution group two times
* @throws BBoxDBException
* @throws InterruptedException
*/
@Test(timeout = 60000)
public void testCreateDistributionGroupTwoTimes() throws BBoxDBException, InterruptedException {
final BBoxDBConnection bboxdbConnection = connectToServer();
final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
// Create distribution group
final DistributionGroupConfiguration configuration = DistributionGroupConfigurationBuilder.create(2).withReplicationFactor((short) 1).build();
final EmptyResultFuture resultCreate = bboxDBClient.createDistributionGroup(DISTRIBUTION_GROUP, configuration);
// Prevent retries
resultCreate.setRetryPolicy(FutureRetryPolicy.RETRY_POLICY_NONE);
resultCreate.waitForAll();
Assert.assertTrue(resultCreate.isFailed());
Assert.assertEquals(ErrorMessages.ERROR_DGROUP_EXISTS, resultCreate.getMessage(0));
Assert.assertTrue(bboxdbConnection.getConnectionState().isInRunningState());
disconnect(bboxDBClient);
}
use of org.bboxdb.network.client.BBoxDBConnection in project bboxdb by jnidzwetzki.
the class TestNetworkCommunication method before.
/**
* Re-create distribution group for each test
* @throws InterruptedException
* @throws BBoxDBException
*/
@Before
public void before() throws InterruptedException, BBoxDBException {
final BBoxDBConnection bboxdbConnection = connectToServer();
final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
TestHelper.recreateDistributionGroup(bboxDBClient, DISTRIBUTION_GROUP);
disconnect(bboxDBClient);
}
use of org.bboxdb.network.client.BBoxDBConnection in project bboxdb by jnidzwetzki.
the class TestNetworkCommunication method testCreateTableTwoTimes.
/**
* Test create a table two times
* @throws BBoxDBException
* @throws InterruptedException
*/
@Test(timeout = 60000)
public void testCreateTableTwoTimes() throws BBoxDBException, InterruptedException {
final BBoxDBConnection bboxdbConnection = connectToServer();
final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
final String table = DISTRIBUTION_GROUP + "_mytable";
final EmptyResultFuture resultCreateTable1 = bboxDBClient.createTable(table, new TupleStoreConfiguration());
resultCreateTable1.waitForAll();
Assert.assertFalse(resultCreateTable1.isFailed());
final EmptyResultFuture resultCreateTable2 = bboxDBClient.createTable(table, new TupleStoreConfiguration());
// Prevent retries
resultCreateTable2.setRetryPolicy(FutureRetryPolicy.RETRY_POLICY_NONE);
resultCreateTable2.waitForAll();
Assert.assertTrue(resultCreateTable2.isFailed());
Assert.assertEquals(ErrorMessages.ERROR_TABLE_EXISTS, resultCreateTable2.getMessage(0));
Assert.assertTrue(bboxdbConnection.getConnectionState().isInRunningState());
disconnect(bboxDBClient);
}
use of org.bboxdb.network.client.BBoxDBConnection in project bboxdb by jnidzwetzki.
the class TestNetworkCommunication method testInsertIntoNonExstingTable.
/**
* Test insert into non existing table
* @throws BBoxDBException
* @throws InterruptedException
*/
@Test(timeout = 60000)
public void testInsertIntoNonExstingTable() throws BBoxDBException, InterruptedException {
System.out.println("=== Running testInsertIntoNonExstingTable");
final BBoxDBConnection bboxdbConnection = connectToServer();
final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
final String table = DISTRIBUTION_GROUP + "_relationnonexsting";
final String key = "key12";
System.out.println("Insert tuple");
final Tuple tuple = new Tuple(key, BoundingBox.FULL_SPACE, "abc".getBytes());
final EmptyResultFuture insertResult = bboxDBClient.insertTuple(table, tuple);
// Prevent retries
insertResult.setRetryPolicy(FutureRetryPolicy.RETRY_POLICY_NONE);
insertResult.waitForAll();
Assert.assertTrue(insertResult.isFailed());
Assert.assertTrue(insertResult.isDone());
System.out.println(insertResult.getMessage(0));
bboxDBClient.disconnect();
System.out.println("=== End testInsertIntoNonExstingTable");
}
use of org.bboxdb.network.client.BBoxDBConnection in project bboxdb by jnidzwetzki.
the class TestNetworkCommunication method testInsertAndBoundingBoxTimeQuery.
/**
* Insert some tuples and start a bounding box query afterwards
* @throws ExecutionException
* @throws InterruptedException
* @throws BBoxDBException
*/
@Test(timeout = 60000)
public void testInsertAndBoundingBoxTimeQuery() throws InterruptedException, ExecutionException, BBoxDBException {
System.out.println("=== Running testInsertAndBoundingBoxTimeQuery");
final BBoxDBConnection bboxdbConnection = connectToServer();
final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
NetworkQueryHelper.executeBoudingboxAndTimeQuery(bboxDBClient, DISTRIBUTION_GROUP);
System.out.println("=== End testInsertAndBoundingBoxTimeQuery");
disconnect(bboxDBClient);
}
Aggregations