use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class DiffCountConsumerTest method testBucketChildrenDeeperBuckets.
@Test
public void testBucketChildrenDeeperBuckets() {
final RevTree deepTree = createFeaturesTree("", 20000 + RevTree.NORMALIZED_SIZE_LIMIT).build();
// sanity check
assertTrue(deepTree.buckets().isPresent());
{
// sanity check to ensure we're testing with a tree with depth > 1 (i.e. at least two
// levels of buckets)
final int maxDepth = depth(deepTree, 0);
assertTrue(maxDepth > 1);
}
RevTreeBuilder builder = new RevTreeBuilder(odb, deepTree);
{
final int count = (int) (deepTree.size() - RevTree.NORMALIZED_SIZE_LIMIT);
for (int i = 0; i < count; i++) {
String path = String.valueOf(i);
builder.remove(path);
}
}
RevTree changed = builder.build();
assertEquals(RevTree.NORMALIZED_SIZE_LIMIT, changed.size());
// sanity check
assertTrue(changed.features().isPresent());
assertFalse(changed.buckets().isPresent());
final long expected = deepTree.size() - changed.size();
assertEquals(expected, count(deepTree, changed).featureCount());
assertEquals(expected, count(changed, deepTree).featureCount());
}
use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class DiffCountConsumerTest method testBucketChildren.
@Test
public void testBucketChildren() {
RevTreeBuilder builder = new RevTreeBuilder(odb, bucketsFeatureTree);
RevTree changed;
for (int i = 0; i < RevTree.NORMALIZED_SIZE_LIMIT; i++) {
builder.remove(String.valueOf(i));
}
changed = builder.build();
assertEquals(RevTree.NORMALIZED_SIZE_LIMIT, changed.size());
assertFalse(changed.buckets().isPresent());
assertEquals(RevTree.NORMALIZED_SIZE_LIMIT, count(bucketsFeatureTree, changed).featureCount());
assertEquals(RevTree.NORMALIZED_SIZE_LIMIT, count(changed, bucketsFeatureTree).featureCount());
}
use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class DepthTreeIteratorTest method testRecursiveTreesOnly.
@Test
public void testRecursiveTreesOnly() {
assertEquals(0, list(emptyTree, Strategy.RECURSIVE_TREES_ONLY).size());
assertEquals(0, list(featuresLeafTree, Strategy.RECURSIVE_TREES_ONLY).size());
assertEquals(treesLeafTree.numTrees(), list(treesLeafTree, Strategy.RECURSIVE_TREES_ONLY).size());
assertEquals(mixedLeafTree.numTrees(), list(mixedLeafTree, Strategy.RECURSIVE_TREES_ONLY).size());
assertEquals(0, list(featuresBucketsTree, Strategy.RECURSIVE_TREES_ONLY).size());
int numSubTrees = RevTree.NORMALIZED_SIZE_LIMIT + 1;
int featuresPerTree = RevTree.NORMALIZED_SIZE_LIMIT + 1;
RevTreeBuilder builder = createTreesTree(source, numSubTrees, featuresPerTree, metadataId);
for (int i = 0; i < 25000; i++) {
builder.put(featureNode("f", i));
}
RevTree mixedBucketsTree = builder.build();
Stopwatch sw = Stopwatch.createStarted();
assertEquals(numSubTrees, list(mixedBucketsTree, Strategy.RECURSIVE_TREES_ONLY).size());
sw.stop();
System.err.println(sw);
}
use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class DepthTreeIteratorTest method testTrees.
@Test
public void testTrees() {
assertEquals(0, list(emptyTree, Strategy.TREES_ONLY).size());
assertEquals(0, list(featuresLeafTree, Strategy.TREES_ONLY).size());
assertEquals(100, list(treesLeafTree, Strategy.TREES_ONLY).size());
assertEquals(10, list(mixedLeafTree, Strategy.TREES_ONLY).size());
assertEquals(0, list(featuresBucketsTree, Strategy.TREES_ONLY).size());
int numSubTrees = RevTree.NORMALIZED_SIZE_LIMIT + 1;
int featuresPerTree = RevTree.NORMALIZED_SIZE_LIMIT + 1;
RevTreeBuilder builder = createTreesTree(source, numSubTrees, featuresPerTree, metadataId);
for (int i = 0; i < 25000; i++) {
builder.put(featureNode("f", i));
}
RevTree mixedBucketsTree = builder.build();
assertEquals(numSubTrees, list(mixedBucketsTree, Strategy.TREES_ONLY).size());
}
use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class PostOrderDiffWalkTest method testSameRootTree.
@Test
public void testSameRootTree() {
RevTree left = createFeaturesTree(leftSource, "f", 10).build();
RevTree right = left;
PostOrderDiffWalk visitor = new PostOrderDiffWalk(left, right, leftSource, rightSource);
Consumer consumer = mock(Consumer.class);
visitor.walk(consumer);
verifyNoMoreInteractions(consumer);
}
Aggregations