/** * Implements {@link Supplier#get()} by deferring to {@link #call()} */ @Override public Iterator<NodeRef> get() { return call(); } }
/** * Implements {@link Supplier#get()} by deferring to {@link #call()} */ @Override public Iterator<NodeRef> get() { return call(); } }
private Map<String, NodeRef> getDeleteTrees(RevTree workTree) { Iterator<NodeRef> childTrees = command(LsTreeOp.class) .setStrategy(Strategy.DEPTHFIRST_ONLY_TREES) .setReference(workTree.getId().toString()).call(); ImmutableMap<String, NodeRef> treesByPath = Maps.uniqueIndex(childTrees, (ref) -> ref.path()); Set<String> requestedTrees = Sets.intersection(treesByPath.keySet(), new HashSet<>(pathsToRemove)); Predicate<String> keyPredicate = Predicates.in(requestedTrees); Map<String, NodeRef> requestedTreesMap = Maps.filterKeys(treesByPath, keyPredicate); return requestedTreesMap; }
private Iterator<Feature> transformFeatures(SimpleFeatureType featureType, String path) { String refspec = Ref.WORK_HEAD + ":" + path; Iterator<NodeRef> oldFeatures = command(LsTreeOp.class).setReference(refspec) .setStrategy(Strategy.FEATURES_ONLY).call(); RevFeatureType revFeatureType = RevFeatureTypeBuilder.build(featureType); Iterator<Feature> transformedIterator = transformIterator(oldFeatures, revFeatureType); return transformedIterator; }
private List<String> getTypeNames(String head) { Iterator<NodeRef> typeTrees = geogig.command(LsTreeOp.class) .setStrategy(Strategy.TREES_ONLY).setReference(head).call(); List<String> typeNames = Lists .newArrayList(Iterators.transform(typeTrees, (ref) -> ref.name())); return typeNames; }
private List<String> getTypeNames(String head) { Iterator<NodeRef> typeTrees = geogig.command(LsTreeOp.class) .setStrategy(Strategy.TREES_ONLY).setReference(head).call(); List<String> typeNames = Lists .newArrayList(Iterators.transform(typeTrees, (ref) -> ref.name())); return typeNames; }
public Map<String, NodeRef> getFeatureNodes(@NonNull String treeIsh) { Iterator<NodeRef> refs = getContext().command(LsTreeOp.class).setReference(treeIsh) .setStrategy(Strategy.DEPTHFIRST_ONLY_FEATURES).call(); return Maps.uniqueIndex(refs, n -> n.path()); }
private ImmutableMap<String, NodeRef> getTreeRefsByPath(ObjectId newRepoRoot) { Iterator<NodeRef> iterator = geogig.command(LsTreeOp.class) .setReference(newRepoRoot.toString()).setStrategy(Strategy.DEPTHFIRST_ONLY_TREES) .call(); ImmutableMap<String, NodeRef> refsByPath = Maps.uniqueIndex(iterator, (n) -> n.path()); return refsByPath; }
private ImmutableMap<String, NodeRef> getRefsByPath(ObjectId repoRoot, boolean includeFeatures) { Strategy strategy = includeFeatures ? Strategy.DEPTHFIRST : Strategy.DEPTHFIRST_ONLY_TREES; Iterator<NodeRef> iterator = geogig.command(LsTreeOp.class) .setReference(repoRoot.toString()).setStrategy(strategy).call(); ImmutableMap<String, NodeRef> refsByPath = Maps.uniqueIndex(iterator, (n) -> n.path()); return refsByPath; }
private ImmutableMap<String, NodeRef> getRefsByPath(ObjectId repoRoot, boolean includeFeatures) { Strategy strategy = includeFeatures ? Strategy.DEPTHFIRST : Strategy.DEPTHFIRST_ONLY_TREES; Iterator<NodeRef> iterator = geogig.command(LsTreeOp.class) .setReference(repoRoot.toString()).setStrategy(strategy).call(); ImmutableMap<String, NodeRef> refsByPath = Maps.uniqueIndex(iterator, (n) -> n.path()); return refsByPath; }
private ImmutableMap<String, NodeRef> getTreeRefsByPath(ObjectId newRepoRoot) { Iterator<NodeRef> iterator = geogig.command(LsTreeOp.class) .setReference(newRepoRoot.toString()).setStrategy(Strategy.DEPTHFIRST_ONLY_TREES) .call(); ImmutableMap<String, NodeRef> refsByPath = Maps.uniqueIndex(iterator, (n) -> n.path()); return refsByPath; }
@Test public void testRefAndPathListing() { Iterator<NodeRef> iter = geogig.command(LsTreeOp.class).setReference("HEAD:Points").call(); List<NodeRef> nodes = ImmutableList.copyOf(iter); assertEquals(3, nodes.size()); for (NodeRef ref : nodes) { ObjectId metadataId = ref.getMetadataId(); assertFalse(metadataId.isNull()); } }
@Test public void testPathListing() { Iterator<NodeRef> iter = geogig.command(LsTreeOp.class).setReference("Points").call(); List<NodeRef> nodes = ImmutableList.copyOf(iter); assertEquals(3, nodes.size()); for (NodeRef ref : nodes) { ObjectId metadataId = ref.getMetadataId(); assertFalse(metadataId.isNull()); } }
@Test public void testNonRecursiveRootListing() { Iterator<NodeRef> iter = geogig.command(LsTreeOp.class).call(); assertEquals(2, Iterators.size(iter)); }
@Test public void testRecursiveRootListing() { Iterator<NodeRef> iter = geogig.command(LsTreeOp.class) .setStrategy(Strategy.DEPTHFIRST_ONLY_FEATURES).call(); assertEquals(6, Iterators.size(iter)); }
@Test public void testUnexistentOriginListing() { try { geogig.command(LsTreeOp.class).setReference("WRONGORIGIN").call(); fail(); } catch (IllegalArgumentException e) { assertTrue(true); } }
@Test public void testNonRecursiveTreeListing() { Iterator<NodeRef> iter = geogig.command(LsTreeOp.class).setStrategy(Strategy.TREES_ONLY) .call(); assertEquals(2, Iterators.size(iter)); }
@Test public void testUnexistentPathListing() { try { geogig.command(LsTreeOp.class).setReference("WORK_HEAD:WRONGPATH").call(); fail(); } catch (IllegalArgumentException e) { assertTrue(true); } }
@Test public void testHEADNonRecursiveTreeListing() { Iterator<NodeRef> iter = geogig.command(LsTreeOp.class).setReference("HEAD") .setStrategy(Strategy.TREES_ONLY).call(); assertEquals(2, Iterators.size(iter)); }
@Test public void testListingWithJustAFeature() { Iterator<NodeRef> iter = geogig.command(LsTreeOp.class).setReference("Points/Points.1") .setStrategy(Strategy.TREES_ONLY).call(); assertEquals(2, Iterators.size(iter)); }