Search in sources :

Example 26 with BBoxDBConnection

use of org.bboxdb.network.client.BBoxDBConnection 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)

Example 27 with BBoxDBConnection

use of org.bboxdb.network.client.BBoxDBConnection 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 28 with BBoxDBConnection

use of org.bboxdb.network.client.BBoxDBConnection 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 29 with BBoxDBConnection

use of org.bboxdb.network.client.BBoxDBConnection 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 30 with BBoxDBConnection

use of org.bboxdb.network.client.BBoxDBConnection 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)

Aggregations

BBoxDBConnection (org.bboxdb.network.client.BBoxDBConnection)37 BBoxDBClient (org.bboxdb.network.client.BBoxDBClient)26 Test (org.junit.Test)24 EmptyResultFuture (org.bboxdb.network.client.future.EmptyResultFuture)8 TupleListFuture (org.bboxdb.network.client.future.TupleListFuture)5 Tuple (org.bboxdb.storage.entity.Tuple)5 TupleStoreConfiguration (org.bboxdb.storage.entity.TupleStoreConfiguration)5 BoundingBox (org.bboxdb.commons.math.BoundingBox)4 InetSocketAddress (java.net.InetSocketAddress)3 BBoxDBInstance (org.bboxdb.distribution.membership.BBoxDBInstance)3 NetworkRequestPackage (org.bboxdb.network.packages.NetworkRequestPackage)3 TupleStoreName (org.bboxdb.storage.entity.TupleStoreName)3 ExecutionException (java.util.concurrent.ExecutionException)2 TupleStoreAdapter (org.bboxdb.distribution.zookeeper.TupleStoreAdapter)2 NetworkOperationFuture (org.bboxdb.network.client.future.NetworkOperationFuture)2 StorageManagerException (org.bboxdb.storage.StorageManagerException)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 TimeoutException (java.util.concurrent.TimeoutException)1 RejectedException (org.bboxdb.commons.RejectedException)1