use of org.bboxdb.distribution.region.DistributionRegionIdMapper in project bboxdb by jnidzwetzki.
the class TestRegionIdMapper method testMappingDisappears2.
/**
* Wait until mapping disappears
* @throws InterruptedException
* @throws TimeoutException
*/
@Test(timeout = 15000, expected = TimeoutException.class)
public void testMappingDisappears2() throws TimeoutException, InterruptedException {
final DistributionRegionIdMapper regionIdMapper = new DistributionRegionIdMapper(DISTRIBUTION_REGION_NAME);
regionIdMapper.addMapping(3, new BoundingBox(15d, 18d, 15d, 18d));
regionIdMapper.waitUntilMappingDisappears(3, 5, TimeUnit.SECONDS);
}
use of org.bboxdb.distribution.region.DistributionRegionIdMapper in project bboxdb by jnidzwetzki.
the class TestRegionIdMapper method testZeroMapping.
/**
* Test the mapping with no entries
*/
@Test(timeout = 60000)
public void testZeroMapping() {
final DistributionRegionIdMapper regionIdMapper = new DistributionRegionIdMapper(DISTRIBUTION_REGION_NAME);
Assert.assertEquals(0, regionIdMapper.getLocalTablesForRegion(new BoundingBox(2.5d, 2.5d, 1.5d, 1.5d), DEFAULT_SSTABLE_NAME).size());
}
use of org.bboxdb.distribution.region.DistributionRegionIdMapper in project bboxdb by jnidzwetzki.
the class TestRegionIdMapper method testMappingAppears3.
/**
* Wait until mapping appears
* @throws InterruptedException
* @throws TimeoutException
*/
@Test(timeout = 15000)
public void testMappingAppears3() throws TimeoutException, InterruptedException {
final DistributionRegionIdMapper regionIdMapper = new DistributionRegionIdMapper(DISTRIBUTION_REGION_NAME);
final Runnable runable = new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
regionIdMapper.addMapping(3, new BoundingBox(15d, 18d, 15d, 18d));
}
};
final Thread thread = new Thread(runable);
thread.start();
regionIdMapper.waitUntilMappingAppears(3, 5, TimeUnit.SECONDS);
}
use of org.bboxdb.distribution.region.DistributionRegionIdMapper in project bboxdb by jnidzwetzki.
the class TestRegionIdMapper method testOneMapping.
/**
* Test the mapping with one entry
*/
@Test(timeout = 60000)
public void testOneMapping() {
final DistributionRegionIdMapper regionIdMapper = new DistributionRegionIdMapper(DISTRIBUTION_REGION_NAME);
regionIdMapper.addMapping(1, new BoundingBox(1d, 2d, 1d, 2d));
Assert.assertEquals(0, regionIdMapper.getLocalTablesForRegion(new BoundingBox(2.5d, 2.5d, 1.5d, 1.5d), DEFAULT_SSTABLE_NAME).size());
Assert.assertEquals(1, regionIdMapper.getLocalTablesForRegion(new BoundingBox(1.5d, 1.5d, 1.5d, 1.5d), DEFAULT_SSTABLE_NAME).size());
regionIdMapper.clear();
Assert.assertEquals(0, regionIdMapper.getLocalTablesForRegion(new BoundingBox(1.5d, 1.5d, 1.5d, 1.5d), DEFAULT_SSTABLE_NAME).size());
}
use of org.bboxdb.distribution.region.DistributionRegionIdMapper in project bboxdb by jnidzwetzki.
the class TestRegionSyncer method buildSyncer.
/**
* Build a new syncer
*/
private DistributionRegionSyncer buildSyncer() {
final Set<DistributionRegionCallback> callbacks = new CopyOnWriteArraySet<>();
final DistributionRegionIdMapper distributionRegionIdMapper = new DistributionRegionIdMapper(GROUP);
final SpacePartitionerContext spacePartitionerContext = new SpacePartitionerContext("", GROUP, ZookeeperClientFactory.getZookeeperClient(), callbacks, distributionRegionIdMapper);
return new DistributionRegionSyncer(spacePartitionerContext);
}
Aggregations