Search in sources :

Example 31 with BBoxDBConnection

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

Example 32 with BBoxDBConnection

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

the class TestTupleListFuture method testRejectedExeption.

@Test(expected = RejectedException.class)
public void testRejectedExeption() throws InterruptedException, RejectedException {
    final TupleListFutureStore tupleListFutureStore = new TupleListFutureStore();
    tupleListFutureStore.shutdown();
    final BBoxDBConnection connection = Mockito.mock(BBoxDBConnection.class);
    final Supplier<NetworkRequestPackage> supplier = () -> (null);
    final NetworkOperationFuture networkOperationFuture = new NetworkOperationFuture(connection, supplier);
    tupleListFutureStore.put(new TupleListFuture(networkOperationFuture, new DoNothingDuplicateResolver(), ""));
}
Also used : NetworkRequestPackage(org.bboxdb.network.packages.NetworkRequestPackage) TupleListFuture(org.bboxdb.network.client.future.TupleListFuture) NetworkOperationFuture(org.bboxdb.network.client.future.NetworkOperationFuture) DoNothingDuplicateResolver(org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) TupleListFutureStore(org.bboxdb.network.client.tools.TupleListFutureStore) Test(org.junit.Test)

Example 33 with BBoxDBConnection

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

the class TestClient method testSettleRequests2.

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

Example 34 with BBoxDBConnection

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

the class TestClient method testMisc.

/**
 * Test misc methods
 */
@Test(timeout = 10000)
public void testMisc() {
    final BBoxDBConnection bBoxDBConnection = new BBoxDBConnection();
    bBoxDBConnection.setMaxInFlightCalls((short) 1000);
    Assert.assertEquals(1000, bBoxDBConnection.getMaxInFlightCalls());
}
Also used : BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) Test(org.junit.Test)

Example 35 with BBoxDBConnection

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

the class DistributedRecoveryService method handleOutdatedRegions.

/**
 * Handle the outdated distribution regions
 * @param distributionGroupName
 * @param outdatedRegions
 */
protected void handleOutdatedRegions(final String distributionGroupName, final List<OutdatedDistributionRegion> outdatedRegions) {
    for (final OutdatedDistributionRegion outdatedDistributionRegion : outdatedRegions) {
        final BBoxDBConnection connection = MembershipConnectionService.getInstance().getConnectionForInstance(outdatedDistributionRegion.getNewestInstance());
        final long regionId = outdatedDistributionRegion.getDistributedRegion().getRegionId();
        final List<TupleStoreName> allTables = TupleStoreUtil.getAllTablesForDistributionGroupAndRegionId(storageRegistry, distributionGroupName, regionId);
        for (final TupleStoreName ssTableName : allTables) {
            try {
                runRecoveryForTable(ssTableName, outdatedDistributionRegion, connection.getBboxDBClient());
            } catch (RejectedException | StorageManagerException | ExecutionException e) {
                logger.error("Got an exception while performing recovery for table: " + ssTableName.getFullname());
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                logger.error("Got an exception while performing recovery for table: " + ssTableName.getFullname());
            }
        }
    }
}
Also used : RejectedException(org.bboxdb.commons.RejectedException) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) StorageManagerException(org.bboxdb.storage.StorageManagerException) ExecutionException(java.util.concurrent.ExecutionException)

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