@Test public void testFindAscendantsOfATest() { ldapGroupNode = new LdapGroupNode(a); ldapLdapGroupUtils = new LdapGroupUtils(); Set<LdapGroup> visited = ldapLdapGroupUtils.findAscendantsForLdapGroupNode(ldapGroupNode, groups(a, b, b1, b2, c, c1, c2)); assertThat("Ascendants of A should be", visited, everyItem(isIn(groups(c2, c)))); }
public Set<LdapGroup> findAscendantsForLdapGroupNode(LdapGroupNode targetNode, Set<LdapGroup> ldapGroups) { Set<LdapGroupNode> allNodes = ldapGroups.stream() .map(LdapGroupNode::new) .collect(Collectors.toSet()); return allNodes.stream() .flatMap(node -> findAscendantsStream(targetNode, node)) .map(LdapGroupNode::getLdapGroup) .collect(Collectors.toSet()); }
LdapGroupUtils { public Set<LdapGroup> findAscendantsForLdapGroupNode(LdapGroupNode targetNode, Set<LdapGroup> ldapGroups) { Set<LdapGroupNode> allNodes = ldapGroups.stream() .map(LdapGroupNode::new) .collect(Collectors.toSet()); return allNodes.stream() .flatMap(node -> findAscendantsStream(targetNode, node)) .map(LdapGroupNode::getLdapGroup) .collect(Collectors.toSet()); } }
LdapGroupUtils { public Set<LdapGroup> findAscendantsForLdapGroupNode(LdapGroupNode targetNode, Set<LdapGroup> ldapGroups) { Set<LdapGroupNode> allNodes = ldapGroups.stream() .map(LdapGroupNode::new) .collect(Collectors.toSet()); return allNodes.stream() .flatMap(node -> findAscendantsStream(targetNode, node)) .map(LdapGroupNode::getLdapGroup) .collect(Collectors.toSet()); }  }
LdapGroupUtils { public Set<LdapGroup> findAscendantsForLdapGroupNode(LdapGroupNode targetNode, Set<LdapGroup> ldapGroups) { Set<LdapGroupNode> allNodes = ldapGroups.stream() .map(LdapGroupNode::new) .collect(Collectors.toSet()); return allNodes.stream() .flatMap(node -> findAscendantsStream(targetNode, node)) .map(LdapGroupNode::getLdapGroup) .collect(Collectors.toSet()); }  Set<LdapGroup> findDescendantsForLdapGroupNode(LdapGroupNode startNode); Set<LdapGroup> findAscendantsForLdapGroupNode(LdapGroupNode targetNode, Set<LdapGroup> ldapGroups); }
LdapGroupUtils { public Set<LdapGroup> findAscendantsForLdapGroupNode(LdapGroupNode targetNode, Set<LdapGroup> ldapGroups) { Set<LdapGroupNode> allNodes = ldapGroups.stream() .map(LdapGroupNode::new) .collect(Collectors.toSet()); return allNodes.stream() .flatMap(node -> findAscendantsStream(targetNode, node)) .map(LdapGroupNode::getLdapGroup) .collect(Collectors.toSet()); }  Set<LdapGroup> findDescendantsForLdapGroupNode(LdapGroupNode startNode); Set<LdapGroup> findAscendantsForLdapGroupNode(LdapGroupNode targetNode, Set<LdapGroup> ldapGroups);  }