Search in sources :

Example 21 with BBoxDBClient

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

the class TestNetworkCommunication method testJoin.

/**
 * Test the tuple join
 * @throws ExecutionException
 * @throws InterruptedException
 * @throws BBoxDBException
 */
@Test(timeout = 60000)
public void testJoin() throws InterruptedException, ExecutionException, BBoxDBException {
    System.out.println("=== Running network testJoin");
    final BBoxDBConnection bboxdbConnection = connectToServer();
    final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
    NetworkQueryHelper.executeJoinQuery(bboxDBClient, DISTRIBUTION_GROUP);
    System.out.println("=== End network testJoin");
    disconnect(bboxDBClient);
}
Also used : BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) Test(org.junit.Test)

Example 22 with BBoxDBClient

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

the class TestNetworkCommunication method testSendKeepAlivePackage.

/**
 * Send a keep alive package to the server
 * @throws InterruptedException
 * @throws ExecutionException
 */
@Test(timeout = 60000)
public void testSendKeepAlivePackage() throws InterruptedException, ExecutionException {
    System.out.println("=== Running sendKeepAlivePackage");
    final BBoxDBConnection bboxdbConnection = connectToServer();
    final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
    final EmptyResultFuture result = bboxDBClient.sendKeepAlivePackage();
    result.waitForAll();
    Assert.assertTrue(result.isDone());
    Assert.assertFalse(result.isFailed());
    Assert.assertTrue(bboxdbConnection.getConnectionState().isInRunningState());
    disconnect(bboxDBClient);
    Assert.assertFalse(bboxDBClient.isConnected());
    System.out.println("=== End sendKeepAlivePackage");
    disconnect(bboxDBClient);
}
Also used : BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) EmptyResultFuture(org.bboxdb.network.client.future.EmptyResultFuture) Test(org.junit.Test)

Example 23 with BBoxDBClient

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

the class TestNetworkCommunication method testDoubleDisconnect.

/**
 * Test the double disconnect call
 */
@Test(timeout = 60000)
public void testDoubleDisconnect() {
    final BBoxDBConnection bboxdbConnection = connectToServer();
    final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
    disconnect(bboxDBClient);
    disconnect(bboxDBClient);
}
Also used : BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) Test(org.junit.Test)

Example 24 with BBoxDBClient

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

Example 25 with BBoxDBClient

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

the class TestNetworkCommunication method testInsertedTimeQuery.

/**
 * Execute the version inserted query
 * @throws BBoxDBException
 * @throws InterruptedException
 */
@Test(timeout = 60000)
public void testInsertedTimeQuery() throws InterruptedException, BBoxDBException {
    final BBoxDBConnection bboxdbConnection = connectToServer();
    final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
    NetworkQueryHelper.testInsertedTimeQuery(bboxDBClient, DISTRIBUTION_GROUP);
    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