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");
}
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);
}
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();
}
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;
}
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);
}
Aggregations