Search in sources :

Example 1 with QuadtreeSpacePartitioner

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());
}
Also used : DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) QuadtreeSpacePartitioner(org.bboxdb.distribution.partitioner.QuadtreeSpacePartitioner) Test(org.junit.Test)

Example 2 with QuadtreeSpacePartitioner

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());
}
Also used : DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) QuadtreeSpacePartitioner(org.bboxdb.distribution.partitioner.QuadtreeSpacePartitioner) Test(org.junit.Test)

Example 3 with QuadtreeSpacePartitioner

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());
}
Also used : DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) BoundingBox(org.bboxdb.commons.math.BoundingBox) DistributionGroupConfiguration(org.bboxdb.storage.entity.DistributionGroupConfiguration) QuadtreeSpacePartitioner(org.bboxdb.distribution.partitioner.QuadtreeSpacePartitioner) Test(org.junit.Test)

Aggregations

QuadtreeSpacePartitioner (org.bboxdb.distribution.partitioner.QuadtreeSpacePartitioner)3 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)3 Test (org.junit.Test)3 BoundingBox (org.bboxdb.commons.math.BoundingBox)1 DistributionGroupConfiguration (org.bboxdb.storage.entity.DistributionGroupConfiguration)1