use of org.bboxdb.distribution.region.DistributionRegionIdMapper in project bboxdb by jnidzwetzki.
the class TestRegionIdMapper method testGetTableNames1.
/**
* Test the tablename result
*/
@Test(timeout = 60000)
public void testGetTableNames1() {
final DistributionRegionIdMapper regionIdMapper = new DistributionRegionIdMapper(DISTRIBUTION_REGION_NAME);
regionIdMapper.addMapping(1, new BoundingBox(1d, 2d, 1d, 2d));
regionIdMapper.addMapping(2, new BoundingBox(10d, 20d, 10d, 20d));
regionIdMapper.addMapping(3, new BoundingBox(15d, 18d, 15d, 18d));
final Collection<TupleStoreName> mappingResult = regionIdMapper.getLocalTablesForRegion(new BoundingBox(1.5d, 55d, 1.5d, 55d), DEFAULT_SSTABLE_NAME);
Assert.assertTrue(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_1")));
Assert.assertTrue(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_2")));
Assert.assertTrue(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_3")));
Assert.assertFalse(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_4")));
}
use of org.bboxdb.distribution.region.DistributionRegionIdMapper in project bboxdb by jnidzwetzki.
the class TestRegionIdMapper method testMappingAppears2.
/**
* Wait until mapping appears
* @throws InterruptedException
* @throws TimeoutException
*/
@Test(timeout = 10000, expected = TimeoutException.class)
public void testMappingAppears2() throws TimeoutException, InterruptedException {
final DistributionRegionIdMapper regionIdMapper = new DistributionRegionIdMapper(DISTRIBUTION_REGION_NAME);
regionIdMapper.waitUntilMappingAppears(3, 5, TimeUnit.SECONDS);
}
use of org.bboxdb.distribution.region.DistributionRegionIdMapper in project bboxdb by jnidzwetzki.
the class TestRegionIdMapper method testThreeMapping.
/**
* Test the mapping with three entries
*/
@Test(timeout = 60000)
public void testThreeMapping() {
final DistributionRegionIdMapper regionIdMapper = new DistributionRegionIdMapper(DISTRIBUTION_REGION_NAME);
regionIdMapper.addMapping(1, new BoundingBox(1d, 2d, 1d, 2d));
regionIdMapper.addMapping(2, new BoundingBox(10d, 20d, 10d, 20d));
regionIdMapper.addMapping(3, new BoundingBox(15d, 18d, 15d, 18d));
Assert.assertEquals(3, regionIdMapper.getLocalTablesForRegion(new BoundingBox(1.5d, 55d, 1.5d, 55d), DEFAULT_SSTABLE_NAME).size());
}
use of org.bboxdb.distribution.region.DistributionRegionIdMapper in project bboxdb by jnidzwetzki.
the class TestRegionIdMapper method testGetTableNames2.
/**
* Test the tablename result
*/
@Test(timeout = 60000)
public void testGetTableNames2() {
final DistributionRegionIdMapper regionIdMapper = new DistributionRegionIdMapper(DISTRIBUTION_REGION_NAME);
regionIdMapper.addMapping(1, new BoundingBox(1d, 2d, 1d, 2d));
regionIdMapper.addMapping(2, new BoundingBox(10d, 20d, 10d, 20d));
regionIdMapper.addMapping(3, new BoundingBox(15d, 18d, 15d, 18d));
final Collection<TupleStoreName> mappingResult = regionIdMapper.getLocalTablesForRegion(new BoundingBox(1.5d, 1.5d, 1.5d, 1.5d), DEFAULT_SSTABLE_NAME);
Assert.assertTrue(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_1")));
Assert.assertFalse(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_2")));
Assert.assertFalse(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_3")));
Assert.assertFalse(mappingResult.contains(new TupleStoreName(DEFAULT_TABLE_NAME + "_4")));
}
use of org.bboxdb.distribution.region.DistributionRegionIdMapper in project bboxdb by jnidzwetzki.
the class TestRegionIdMapper method testTwoMapping.
/**
* Test the mapping with two entries
*/
@Test(timeout = 60000)
public void testTwoMapping() {
final DistributionRegionIdMapper regionIdMapper = new DistributionRegionIdMapper(DISTRIBUTION_REGION_NAME);
regionIdMapper.addMapping(1, new BoundingBox(1d, 2d, 1d, 2d));
regionIdMapper.addMapping(2, new BoundingBox(10d, 20d, 10d, 20d));
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());
Assert.assertEquals(2, regionIdMapper.getLocalTablesForRegion(new BoundingBox(1.5d, 55d, 1.5d, 55d), 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());
}
Aggregations