use of org.locationtech.geogig.api.plumbing.CreateTree in project GeoGig by boundlessgeo.
the class DepthSearchTest method addTree.
private RevTreeBuilder addTree(RevTreeBuilder root, final String treePath, String... singleNodeNames) {
Context mockInjector = mock(Context.class);
when(mockInjector.objectDatabase()).thenReturn(odb);
CreateTree op = new CreateTree().setIndex(false);
op.setContext(mockInjector);
RevTreeBuilder subTreeBuilder = op.call();
if (singleNodeNames != null) {
for (String singleNodeName : singleNodeNames) {
String nodePath = NodeRef.appendChild(treePath, singleNodeName);
ObjectId fakeFeatureOId = ObjectId.forString(nodePath);
// forString(treePath);
ObjectId fakeTypeOId = ObjectId.NULL;
subTreeBuilder.put(Node.create(singleNodeName, fakeFeatureOId, fakeTypeOId, TYPE.FEATURE, null));
}
}
RevTree subtree = subTreeBuilder.build();
WriteBack writeBack = fakeGeogig.command(WriteBack.class).setAncestor(root).setChildPath(treePath).setTree(subtree).setMetadataId(fakeTreeMetadataId);
ObjectId newRootId = writeBack.call();
return fakeGeogig.command(RevObjectParse.class).setObjectId(newRootId).call(RevTree.class).get().builder(odb);
}
Aggregations