Search in sources :

Example 11 with BBoxDBConnection

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

the class TestNetworkCommunication method testSendDisconnectPackage.

/**
 * Integration test for the disconnect package
 */
@Test(timeout = 60000)
public void testSendDisconnectPackage() {
    System.out.println("=== Running testSendDisconnectPackage");
    final BBoxDBConnection bboxdbConnection = connectToServer();
    final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
    Assert.assertTrue(bboxDBClient.isConnected());
    disconnect(bboxDBClient);
    Assert.assertFalse(bboxDBClient.isConnected());
    disconnect(bboxDBClient);
    System.out.println("=== End testSendDisconnectPackage");
}
Also used : BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) Test(org.junit.Test)

Example 12 with BBoxDBConnection

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

the class TestNetworkCommunication method testEmptyBoundingBoxQuery.

/**
 * Start a bounding box query without inserted tuples
 * @throws ExecutionException
 * @throws InterruptedException
 * @throws BBoxDBException
 */
@Test(timeout = 60000)
public void testEmptyBoundingBoxQuery() throws InterruptedException, ExecutionException, BBoxDBException {
    final BBoxDBConnection bboxdbConnection = connectToServer();
    final BBoxDBClient bboxDBClient = bboxdbConnection.getBboxDBClient();
    NetworkQueryHelper.testBoundingBoxQuery(bboxDBClient, DISTRIBUTION_GROUP, false);
    disconnect(bboxDBClient);
}
Also used : BBoxDBClient(org.bboxdb.network.client.BBoxDBClient) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) Test(org.junit.Test)

Example 13 with BBoxDBConnection

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

the class TestClient method testSettleRequests1.

/**
 * Test the settle requests method
 */
@Test(timeout = 10000)
public void testSettleRequests1() {
    final BBoxDBConnection client = Mockito.spy(BBoxDBConnection.class);
    client.settlePendingCalls(1000);
    Mockito.verify(client, Mockito.atLeast(1)).getInFlightCalls();
}
Also used : BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) Test(org.junit.Test)

Example 14 with BBoxDBConnection

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

the class TestTupleListFuture method getFuture.

/**
 * @return
 */
private static NetworkOperationFuture getFuture() {
    final BBoxDBConnection connection = Mockito.mock(BBoxDBConnection.class);
    final Supplier<NetworkRequestPackage> supplier = () -> (null);
    final NetworkOperationFuture networkOperationFuture = new NetworkOperationFuture(connection, supplier);
    return networkOperationFuture;
}
Also used : NetworkRequestPackage(org.bboxdb.network.packages.NetworkRequestPackage) NetworkOperationFuture(org.bboxdb.network.client.future.NetworkOperationFuture) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection)

Example 15 with BBoxDBConnection

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

the class TupleRedistributor method registerRegion.

/**
 * Register a new region for distribution
 * @param distributionRegion
 * @throws StorageManagerException
 * @throws ZookeeperException
 */
public void registerRegion(final DistributionRegion distributionRegion) throws StorageManagerException {
    final ArrayList<AbstractTupleSink> sinks = new ArrayList<>();
    final Collection<BBoxDBInstance> instances = distributionRegion.getSystems();
    final MembershipConnectionService membershipConnectionService = MembershipConnectionService.getInstance();
    final BBoxDBInstance localInstance = ZookeeperClientFactory.getLocalInstanceName();
    for (final BBoxDBInstance instance : instances) {
        if (instance.socketAddressEquals(localInstance)) {
            final TupleStoreName localTableName = tupleStoreName.cloneWithDifferntRegionId(distributionRegion.getRegionId());
            final TupleStoreAdapter tupleStoreAdapter = ZookeeperClientFactory.getZookeeperClient().getTupleStoreAdapter();
            final TupleStoreConfiguration config = readTuplestoreConfig(localTableName, tupleStoreAdapter);
            final TupleStoreManager storageManager = tupleStoreManagerRegistry.createTableIfNotExist(localTableName, config);
            final LocalTupleSink tupleSink = new LocalTupleSink(tupleStoreName, storageManager);
            sinks.add(tupleSink);
            logger.info("Redistributing data to local table {}", localTableName.getFullname());
        } else {
            final BBoxDBConnection connection = membershipConnectionService.getConnectionForInstance(instance);
            final NetworkTupleSink tupleSink = new NetworkTupleSink(tupleStoreName, connection);
            sinks.add(tupleSink);
            logger.info("Redistributing data to remote system {}", instance.getInetSocketAddress());
        }
    }
    registerRegion(distributionRegion, sinks);
}
Also used : TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) ArrayList(java.util.ArrayList) MembershipConnectionService(org.bboxdb.distribution.membership.MembershipConnectionService) TupleStoreAdapter(org.bboxdb.distribution.zookeeper.TupleStoreAdapter) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) BBoxDBInstance(org.bboxdb.distribution.membership.BBoxDBInstance) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) TupleStoreManager(org.bboxdb.storage.tuplestore.manager.TupleStoreManager)

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