Search in sources :

Example 16 with BBoxDBClient

use of org.bboxdb.network.client.BBoxDBClient 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);
}
Also used : BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) Before(org.junit.Before)

Example 17 with BBoxDBClient

use of org.bboxdb.network.client.BBoxDBClient 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);
}
Also used : BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) EmptyResultFuture(org.bboxdb.network.client.future.EmptyResultFuture) Test(org.junit.Test)

Example 18 with BBoxDBClient

use of org.bboxdb.network.client.BBoxDBClient 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");
}
Also used : BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) Tuple(org.bboxdb.storage.entity.Tuple) EmptyResultFuture(org.bboxdb.network.client.future.EmptyResultFuture) Test(org.junit.Test)

Example 19 with BBoxDBClient

use of org.bboxdb.network.client.BBoxDBClient 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);
}
Also used : BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) Test(org.junit.Test)

Example 20 with BBoxDBClient

use of org.bboxdb.network.client.BBoxDBClient in project bboxdb by jnidzwetzki.

the class TestNetworkCommunication method testInsertAndBoundingBoxQuery.

/**
 * Insert some tuples and start a bounding box query afterwards
 * @throws ExecutionException
 * @throws InterruptedException
 * @throws BBoxDBException
 */
@Test(timeout = 60000)
public void testInsertAndBoundingBoxQuery() throws InterruptedException, ExecutionException, BBoxDBException {
    final BBoxDBConnection bboxdbConnection = connectToServer();
    final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
    NetworkQueryHelper.testBoundingBoxQuery(bboxDBClient, DISTRIBUTION_GROUP, true);
    disconnect(bboxDBClient);
}
Also used : BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) Test(org.junit.Test)

Aggregations

BBoxDBClient (org.bboxdb.network.client.BBoxDBClient)27 BBoxDBConnection (org.bboxdb.network.client.BBoxDBConnection)26 Test (org.junit.Test)20 EmptyResultFuture (org.bboxdb.network.client.future.EmptyResultFuture)8 Tuple (org.bboxdb.storage.entity.Tuple)5 BoundingBox (org.bboxdb.commons.math.BoundingBox)4 TupleListFuture (org.bboxdb.network.client.future.TupleListFuture)4 TupleStoreConfiguration (org.bboxdb.storage.entity.TupleStoreConfiguration)4 BBoxDBInstance (org.bboxdb.distribution.membership.BBoxDBInstance)2 List (java.util.List)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 TupleStoreAdapter (org.bboxdb.distribution.zookeeper.TupleStoreAdapter)1 ZookeeperClient (org.bboxdb.distribution.zookeeper.ZookeeperClient)1 NetworkRequestPackage (org.bboxdb.network.packages.NetworkRequestPackage)1 RoutingHeader (org.bboxdb.network.routing.RoutingHeader)1 StorageManagerException (org.bboxdb.storage.StorageManagerException)1 DistributionGroupConfiguration (org.bboxdb.storage.entity.DistributionGroupConfiguration)1 TupleStoreName (org.bboxdb.storage.entity.TupleStoreName)1 Before (org.junit.Before)1