Search in sources :

Example 26 with BBoxDBClient

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

the class TestNetworkCommunication method testMiscMethods.

/**
 * Test misc methods
 */
@Test(timeout = 60000)
public void testMiscMethods() {
    final BBoxDBClient bboxDBClient = connectToServer().getBboxDBClient();
    Assert.assertTrue(bboxDBClient.toString().length() > 10);
    Assert.assertTrue(bboxDBClient.getTuplesPerPage() >= -1);
    bboxDBClient.isPagingEnabled();
    disconnect(bboxDBClient);
}
Also used : BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) Test(org.junit.Test)

Example 27 with BBoxDBClient

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

the class RegionMerger method mergeDataByNetworkRead.

/**
 * Merge the region by a network read
 *
 * @param region
 * @param tupleStoreName
 * @param tupleRedistributor
 * @param childRegion
 * @throws InterruptedException
 * @throws StorageManagerException
 * @throws Exception
 */
private void mergeDataByNetworkRead(final DistributionRegion region, final TupleStoreName tupleStoreName, final TupleRedistributor tupleRedistributor, final DistributionRegion childRegion) throws InterruptedException, StorageManagerException {
    final List<BBoxDBInstance> systems = childRegion.getSystems();
    assert (!systems.isEmpty()) : "Systems can not be empty";
    final BBoxDBInstance firstSystem = systems.get(0);
    final BBoxDBConnection connection = MembershipConnectionService.getInstance().getConnectionForInstance(firstSystem);
    assert (connection != null) : "Connection can not be null: " + firstSystem.getStringValue();
    final BoundingBox bbox = childRegion.getConveringBox();
    final String fullname = tupleStoreName.getFullname();
    final BBoxDBClient bboxDBClient = connection.getBboxDBClient();
    final TupleListFuture result = bboxDBClient.queryBoundingBox(fullname, bbox);
    result.waitForAll();
    if (result.isFailed()) {
        throw new StorageManagerException("Exception while fetching tuples: " + result.getAllMessages());
    }
    for (final Tuple tuple : result) {
        tupleRedistributor.redistributeTuple(tuple);
    }
}
Also used : BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) BoundingBox(org.bboxdb.commons.math.BoundingBox) TupleListFuture(org.bboxdb.network.client.future.TupleListFuture) BBoxDBInstance(org.bboxdb.distribution.membership.BBoxDBInstance) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) StorageManagerException(org.bboxdb.storage.StorageManagerException) Tuple(org.bboxdb.storage.entity.Tuple)

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