use of org.bboxdb.distribution.partitioner.QuadtreeSpacePartitioner in project bboxdb by jnidzwetzki.
the class TestQuadtreeSpacePartitioner method testSplit0.
@Test(timeout = 60000)
public void testSplit0() throws ZookeeperException, ZookeeperNotFoundException, BBoxDBException, ResourceAllocationException {
final QuadtreeSpacePartitioner spacepartitionier = getSpacePartitioner();
final DistributionRegion rootNode = spacepartitionier.getRootNode();
Assert.assertEquals(0, rootNode.getDirectChildren().size());
spacepartitionier.splitRegion(rootNode, new HashSet<>());
Assert.assertEquals(4, rootNode.getDirectChildren().size());
}
use of org.bboxdb.distribution.partitioner.QuadtreeSpacePartitioner in project bboxdb by jnidzwetzki.
the class TestQuadtreeSpacePartitioner method testSplit1.
@Test(timeout = 60000)
public void testSplit1() throws ZookeeperException, ZookeeperNotFoundException, BBoxDBException, ResourceAllocationException {
final QuadtreeSpacePartitioner spacepartitionier = getSpacePartitioner();
final DistributionRegion rootNode = spacepartitionier.getRootNode();
Assert.assertEquals(0, rootNode.getDirectChildren().size());
spacepartitionier.splitRegion(rootNode, new HashSet<>());
Assert.assertEquals(4, rootNode.getDirectChildren().size());
final DistributionRegion child1 = rootNode.getChildNumber(1);
spacepartitionier.splitRegion(child1, new HashSet<>());
Assert.assertEquals(4, child1.getDirectChildren().size());
Assert.assertEquals(8, rootNode.getAllChildren().size());
}
use of org.bboxdb.distribution.partitioner.QuadtreeSpacePartitioner in project bboxdb by jnidzwetzki.
the class TestQuadtreeSpacePartitioner method testRestrictedSpace.
/**
* Test the restricted space
* @throws ZookeeperException
* @throws BBoxDBException
* @throws ZookeeperNotFoundException
*/
@Test(timeout = 60000)
public void testRestrictedSpace() throws ZookeeperException, BBoxDBException, ZookeeperNotFoundException {
final BoundingBox completeSpace = new BoundingBox(0d, 10d, 0d, 10d);
final DistributionGroupConfiguration configuration = DistributionGroupConfigurationBuilder.create(2).withSpacePartitioner("org.bboxdb.distribution.partitioner.QuadtreeSpacePartitioner", completeSpace.toCompactString()).withPlacementStrategy("org.bboxdb.distribution.placement.DummyResourcePlacementStrategy", "").build();
distributionGroupZookeeperAdapter.deleteDistributionGroup(TEST_GROUP);
distributionGroupZookeeperAdapter.createDistributionGroup(TEST_GROUP, configuration);
final QuadtreeSpacePartitioner spacepartitionier = getSpacePartitioner();
final DistributionRegion rootNode = spacepartitionier.getRootNode();
Assert.assertEquals(completeSpace, rootNode.getConveringBox());
spacepartitionier.splitRegion(rootNode, new HashSet<>());
Assert.assertEquals("[[0.0,5.0):[0.0,5.0)]", rootNode.getChildNumber(0).getConveringBox().toCompactString());
Assert.assertEquals("[[5.0,10.0]:[0.0,5.0)]", rootNode.getChildNumber(1).getConveringBox().toCompactString());
Assert.assertEquals("[[0.0,5.0):[5.0,10.0]]", rootNode.getChildNumber(2).getConveringBox().toCompactString());
Assert.assertEquals("[[5.0,10.0]:[5.0,10.0]]", rootNode.getChildNumber(3).getConveringBox().toCompactString());
}
Aggregations