Search in sources :

Example 1 with LocalTupleSink

use of org.bboxdb.distribution.partitioner.regionsplit.tuplesink.LocalTupleSink in project bboxdb by jnidzwetzki.

the class TestTupleSink method testTupleSink.

/**
 * Test the tuple sinks
 * @throws StorageManagerException
 * @throws BBoxDBException
 * @throws ZookeeperException
 * @throws InterruptedException
 */
@Test(timeout = 60000)
public void testTupleSink() throws StorageManagerException, BBoxDBException, ZookeeperException, InterruptedException {
    final DistributionRegion distributionRegion = SpacePartitionerCache.getInstance().getSpacePartitionerForGroupName(TEST_GROUP).getRootNode();
    tupleStoreAdapter.deleteTable(TABLENAME);
    tupleStoreAdapter.writeTuplestoreConfiguration(TABLENAME, new TupleStoreConfiguration());
    final List<BBoxDBInstance> systems = Arrays.asList(new BBoxDBInstance("10.0.0.1:10000"), new BBoxDBInstance("10.0.0.2:10000"), ZookeeperClientFactory.getLocalInstanceName());
    distributionRegion.setSystems(systems);
    final TupleRedistributor tupleRedistributor = createTupleRedistributor();
    tupleRedistributor.registerRegion(distributionRegion);
    final Map<DistributionRegion, List<AbstractTupleSink>> map = tupleRedistributor.getRegionMap();
    Assert.assertEquals(1, map.size());
    final long networkSinks = map.values().stream().flatMap(e -> e.stream()).filter(s -> s instanceof NetworkTupleSink).count();
    Assert.assertEquals(2, networkSinks);
    final long localSinks = map.values().stream().flatMap(e -> e.stream()).filter(s -> s instanceof LocalTupleSink).count();
    Assert.assertEquals(1, localSinks);
}
Also used : TupleRedistributor(org.bboxdb.distribution.partitioner.regionsplit.tuplesink.TupleRedistributor) Arrays(java.util.Arrays) BeforeClass(org.junit.BeforeClass) TupleStoreAdapter(org.bboxdb.distribution.zookeeper.TupleStoreAdapter) LocalTupleSink(org.bboxdb.distribution.partitioner.regionsplit.tuplesink.LocalTupleSink) Tuple(org.bboxdb.storage.entity.Tuple) BoundingBox(org.bboxdb.commons.math.BoundingBox) ArrayList(java.util.ArrayList) ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) Map(java.util.Map) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) StorageManagerException(org.bboxdb.storage.StorageManagerException) DistributionGroupConfiguration(org.bboxdb.storage.entity.DistributionGroupConfiguration) BBoxDBInstance(org.bboxdb.distribution.membership.BBoxDBInstance) ZookeeperClientFactory(org.bboxdb.distribution.zookeeper.ZookeeperClientFactory) NetworkTupleSink(org.bboxdb.distribution.partitioner.regionsplit.tuplesink.NetworkTupleSink) DistributionGroupConfigurationBuilder(org.bboxdb.storage.entity.DistributionGroupConfigurationBuilder) Test(org.junit.Test) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) Mockito(org.mockito.Mockito) List(java.util.List) AbstractTupleSink(org.bboxdb.distribution.partitioner.regionsplit.tuplesink.AbstractTupleSink) BBoxDBException(org.bboxdb.misc.BBoxDBException) TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) DistributionGroupAdapter(org.bboxdb.distribution.zookeeper.DistributionGroupAdapter) SpacePartitionerCache(org.bboxdb.distribution.partitioner.SpacePartitionerCache) TupleRedistributor(org.bboxdb.distribution.partitioner.regionsplit.tuplesink.TupleRedistributor) Assert(org.junit.Assert) DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) LocalTupleSink(org.bboxdb.distribution.partitioner.regionsplit.tuplesink.LocalTupleSink) NetworkTupleSink(org.bboxdb.distribution.partitioner.regionsplit.tuplesink.NetworkTupleSink) ArrayList(java.util.ArrayList) List(java.util.List) BBoxDBInstance(org.bboxdb.distribution.membership.BBoxDBInstance) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Map (java.util.Map)1 BoundingBox (org.bboxdb.commons.math.BoundingBox)1 BBoxDBInstance (org.bboxdb.distribution.membership.BBoxDBInstance)1 SpacePartitionerCache (org.bboxdb.distribution.partitioner.SpacePartitionerCache)1 AbstractTupleSink (org.bboxdb.distribution.partitioner.regionsplit.tuplesink.AbstractTupleSink)1 LocalTupleSink (org.bboxdb.distribution.partitioner.regionsplit.tuplesink.LocalTupleSink)1 NetworkTupleSink (org.bboxdb.distribution.partitioner.regionsplit.tuplesink.NetworkTupleSink)1 TupleRedistributor (org.bboxdb.distribution.partitioner.regionsplit.tuplesink.TupleRedistributor)1 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)1 DistributionGroupAdapter (org.bboxdb.distribution.zookeeper.DistributionGroupAdapter)1 TupleStoreAdapter (org.bboxdb.distribution.zookeeper.TupleStoreAdapter)1 ZookeeperClientFactory (org.bboxdb.distribution.zookeeper.ZookeeperClientFactory)1 ZookeeperException (org.bboxdb.distribution.zookeeper.ZookeeperException)1 BBoxDBException (org.bboxdb.misc.BBoxDBException)1 StorageManagerException (org.bboxdb.storage.StorageManagerException)1 DeletedTuple (org.bboxdb.storage.entity.DeletedTuple)1 DistributionGroupConfiguration (org.bboxdb.storage.entity.DistributionGroupConfiguration)1