use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class PreOrderDiffWalkTest method testLeafBucketSimple.
@Test
public void testLeafBucketSimple() {
final int rightsize = 1 + RevTree.NORMALIZED_SIZE_LIMIT;
RevTree left = createFeaturesTree(leftSource, "f", 1).build();
RevTree right = createFeaturesTree(rightSource, "f", rightsize).build();
PreOrderDiffWalk visitor = new PreOrderDiffWalk(left, right, leftSource, rightSource);
// consume all
when(consumer.tree(any(Node.class), any(Node.class))).thenReturn(true);
when(consumer.bucket(anyInt(), anyInt(), any(Bucket.class), any(Bucket.class))).thenReturn(true);
visitor.walk(consumer);
// there's only the root tree
verify(consumer, times(1)).tree(any(Node.class), any(Node.class));
// there's only one feature on the right tree, so all right trees features fall on a single
// bucket
final int leftBucketCount = right.buckets().get().size();
final int expectedBucketCalls = leftBucketCount - 1;
verify(consumer, times(expectedBucketCalls)).bucket(anyInt(), eq(0), any(Bucket.class), any(Bucket.class));
verify(consumer, times(rightsize - 1)).feature((Node) isNull(), any(Node.class));
verify(consumer, times(expectedBucketCalls)).endBucket(anyInt(), eq(0), any(Bucket.class), any(Bucket.class));
verify(consumer, times(1)).endTree(any(Node.class), any(Node.class));
verifyNoMoreInteractions(consumer);
}
use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class DepthSearchTest method setUp.
@Before
public void setUp() throws IOException {
File envHome = tempFolder.getRoot();
Platform testPlatform = new TestPlatform(envHome);
Context injector = Guice.createInjector(Modules.override(new GeogigModule()).with(new MemoryModule(testPlatform))).getInstance(Context.class);
fakeGeogig = new GeoGIG(injector);
Repository fakeRepo = fakeGeogig.getOrCreateRepository();
odb = fakeRepo.objectDatabase();
search = new DepthSearch(odb);
RevTreeBuilder root = new RevTreeBuilder(odb);
root = addTree(root, "path/to/tree1", "node11", "node12", "node13");
root = addTree(root, "path/to/tree2", "node21", "node22", "node23");
root = addTree(root, "tree3", "node31", "node32", "node33");
RevTree rootTree = root.build();
odb.put(rootTree);
rootTreeId = rootTree.getId();
}
use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class PreOrderDiffWalkTest method testBucketLeafSeveral.
@Test
public void testBucketLeafSeveral() {
final int leftsize = 1 + RevTree.NORMALIZED_SIZE_LIMIT;
RevTree left = createFeaturesTree(leftSource, "f", leftsize).build();
RevTree right = createFeaturesTree(rightSource, "f", 1).build();
PreOrderDiffWalk visitor = new PreOrderDiffWalk(left, right, leftSource, rightSource);
// consume all
when(consumer.tree(any(Node.class), any(Node.class))).thenReturn(true);
when(consumer.bucket(anyInt(), anyInt(), any(Bucket.class), any(Bucket.class))).thenReturn(true);
visitor.walk(consumer);
// there's only the root tree
verify(consumer, times(1)).tree(any(Node.class), any(Node.class));
// there's only one feature on the right tree, so all right trees features fall on a single
// bucket
final int leftBucketCount = left.buckets().get().size();
final int expectedBucketCalls = leftBucketCount - 1;
verify(consumer, times(expectedBucketCalls)).bucket(anyInt(), eq(0), any(Bucket.class), any(Bucket.class));
verify(consumer, times(leftsize - 1)).feature(any(Node.class), (Node) isNull());
verify(consumer, times(expectedBucketCalls)).endBucket(anyInt(), eq(0), any(Bucket.class), any(Bucket.class));
verify(consumer, times(1)).endTree(any(Node.class), any(Node.class));
verifyNoMoreInteractions(consumer);
}
use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class PreOrderDiffWalkTest method testLeafBucketOneLevelDepth.
@Test
public void testLeafBucketOneLevelDepth() {
final int leftsize = RevTree.NORMALIZED_SIZE_LIMIT;
final int rightsize = 2 * RevTree.NORMALIZED_SIZE_LIMIT;
final int overlapCount = 100;
RevTree right = createFeaturesTree(rightSource, "f", rightsize).build();
assertDepth(right, rightSource, 1);
testLeafBucketDeeper(leftsize, right, overlapCount);
}
use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class PreOrderDiffWalkTest method testSameRootTree.
@Test
public void testSameRootTree() {
RevTree left = createFeaturesTree(leftSource, "f", 10).build();
RevTree right = left;
PreOrderDiffWalk visitor = new PreOrderDiffWalk(left, right, leftSource, rightSource);
visitor.walk(consumer);
verifyNoMoreInteractions(consumer);
}
Aggregations