use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class WriteBackTest method testPreserveMetadataId.
@Test
public void testPreserveMetadataId() {
RevTreeBuilder oldRoot = new RevTreeBuilder(odb);
RevTree tree = new RevTreeBuilder(odb).put(blob("blob")).build();
final ObjectId treeMetadataId = ObjectId.forString("fakeMdId");
ObjectId newRootId = writeBack.setAncestor(oldRoot).setChildPath("level1/level2").setTree(tree).setMetadataId(treeMetadataId).call();
Optional<NodeRef> ref;
DepthSearch depthSearch = new DepthSearch(odb);
ref = depthSearch.find(newRootId, "level1/level2");
assertTrue(ref.isPresent());
assertTrue(ref.get().getNode().getMetadataId().isPresent());
assertFalse(ref.get().getNode().getMetadataId().get().isNull());
assertEquals(treeMetadataId, ref.get().getNode().getMetadataId().get());
}
use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class WriteTree2Test method forceTreeId.
private RevTree forceTreeId(RevTreeBuilder b, ObjectId treeId) {
RevTree tree = b.build();
RevTree fakenId = RevTreeImpl.create(treeId, tree.size(), tree);
return fakenId;
}
use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class DiffCountConsumerTest method depth.
private int depth(RevTree deepTree, int currDepth) {
if (!deepTree.buckets().isPresent()) {
return currDepth;
}
int depth = currDepth;
for (Bucket bucket : deepTree.buckets().get().values()) {
RevTree bucketTree = odb.get(bucket.id(), RevTree.class);
int d = depth(bucketTree, currDepth + 1);
depth = Math.max(depth, d);
}
return depth;
}
use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class WriteBackTest method testSiblingsNested.
@Test
public void testSiblingsNested() {
RevTreeBuilder oldRoot = new RevTreeBuilder(odb);
RevTree tree1 = new RevTreeBuilder(odb).put(blob("blob")).build();
RevTree tree2 = new RevTreeBuilder(odb).put(blob("blob")).build();
ObjectId newRootId1 = writeBack.setAncestor(oldRoot).setChildPath("subtree1/level2").setTree(tree1).call();
ObjectId newRootId2 = writeBack.setAncestor(odb.getTree(newRootId1).builder(odb)).setChildPath("subtree2/level2/level3").setTree(tree2).call();
// created the intermediate tree node?
DepthSearch depthSearch = new DepthSearch(odb);
assertTrue(depthSearch.find(newRootId2, "subtree1").isPresent());
assertTrue(depthSearch.find(newRootId2, "subtree1/level2").isPresent());
assertTrue(depthSearch.find(newRootId2, "subtree1/level2/blob").isPresent());
assertTrue(depthSearch.find(newRootId2, "subtree2").isPresent());
assertTrue(depthSearch.find(newRootId2, "subtree2/level2").isPresent());
assertTrue(depthSearch.find(newRootId2, "subtree2/level2/level3").isPresent());
assertTrue(depthSearch.find(newRootId2, "subtree2/level2/level3/blob").isPresent());
}
use of org.locationtech.geogig.api.RevTree in project GeoGig by boundlessgeo.
the class DiffCountConsumerTest method testChildrenChildrenNestedTrees.
@Test
public void testChildrenChildrenNestedTrees() {
RevTreeBuilder rootBuilder = new RevTreeBuilder(odb, childrenFeatureTypesTree);
childTree1.put(featureRef("tree1", 1000));
createFeatureTypesTree(rootBuilder, "tree1", childTree1);
RevTree newRoot = rootBuilder.build();
assertEquals(1, count(childrenFeatureTypesTree, newRoot).featureCount());
childTree2.remove("tree2/2");
createFeatureTypesTree(rootBuilder, "tree2", childTree2);
newRoot = rootBuilder.build();
assertEquals(2, count(childrenFeatureTypesTree, newRoot).featureCount());
childTree2.put(Node.create("tree2/1", FAKE_FEATURE_ID_CHANGED, ObjectId.NULL, TYPE.FEATURE, null));
createFeatureTypesTree(rootBuilder, "tree2", childTree2);
newRoot = rootBuilder.build();
assertEquals(3, count(childrenFeatureTypesTree, newRoot).featureCount());
}
Aggregations