@Test public void testGetDescendantObjectsEmpty() { ApplicationGroup ag = new ApplicationGroup("group"); assertThat( ag.getDescendantObjects(ImmutableMap.of(), ImmutableMap.of(), new HashSet<>()), equalTo(ImmutableSet.of())); }
@VisibleForTesting Set<Application> getDescendantObjects( Map<String, Application> applications, Map<String, ApplicationGroup> applicationGroups, Set<String> alreadyTraversedGroups) { if (alreadyTraversedGroups.contains(_name)) { return ImmutableSet.of(); } alreadyTraversedGroups.add(_name); Set<Application> descendantObjects = new HashSet<>(); for (String member : _members) { if (applications.containsKey(member)) { descendantObjects.add(applications.get(member)); } else if (applicationGroups.containsKey(member)) { descendantObjects.addAll( applicationGroups .get(member) .getDescendantObjects(applications, applicationGroups, alreadyTraversedGroups)); } else if (ApplicationBuiltIn.getBuiltInApplication(member).isPresent()) { descendantObjects.add(ApplicationBuiltIn.getBuiltInApplication(member).get()); } } return descendantObjects; }
ApplicationGroup implements Serializable { @VisibleForTesting Set<Application> getDescendantObjects( Map<String, Application> applications, Map<String, ApplicationGroup> applicationGroups, Set<String> alreadyTraversedGroups) { if (alreadyTraversedGroups.contains(_name)) { return ImmutableSet.of(); } alreadyTraversedGroups.add(_name); Set<Application> descendantObjects = new HashSet<>(); for (String member : _members) { if (applications.containsKey(member)) { descendantObjects.add(applications.get(member)); } else if (applicationGroups.containsKey(member)) { descendantObjects.addAll( applicationGroups .get(member) .getDescendantObjects(applications, applicationGroups, alreadyTraversedGroups)); } else if (ApplicationBuiltIn.getBuiltInApplication(member).isPresent()) { descendantObjects.add(ApplicationBuiltIn.getBuiltInApplication(member).get()); } } return descendantObjects; } }
ApplicationGroup implements Serializable { @VisibleForTesting Set<Application> getDescendantObjects( Map<String, Application> applications, Map<String, ApplicationGroup> applicationGroups, Set<String> alreadyTraversedGroups) { if (alreadyTraversedGroups.contains(_name)) { return ImmutableSet.of(); } alreadyTraversedGroups.add(_name); Set<Application> descendantObjects = new HashSet<>(); for (String member : _members) { if (applications.containsKey(member)) { descendantObjects.add(applications.get(member)); } else if (applicationGroups.containsKey(member)) { descendantObjects.addAll( applicationGroups .get(member) .getDescendantObjects(applications, applicationGroups, alreadyTraversedGroups)); } else if (ApplicationBuiltIn.getBuiltInApplication(member).isPresent()) { descendantObjects.add(ApplicationBuiltIn.getBuiltInApplication(member).get()); } } return descendantObjects; } ApplicationGroup(String name); }
ApplicationGroup implements Serializable { @VisibleForTesting Set<Application> getDescendantObjects( Map<String, Application> applications, Map<String, ApplicationGroup> applicationGroups, Set<String> alreadyTraversedGroups) { if (alreadyTraversedGroups.contains(_name)) { return ImmutableSet.of(); } alreadyTraversedGroups.add(_name); Set<Application> descendantObjects = new HashSet<>(); for (String member : _members) { if (applications.containsKey(member)) { descendantObjects.add(applications.get(member)); } else if (applicationGroups.containsKey(member)) { descendantObjects.addAll( applicationGroups .get(member) .getDescendantObjects(applications, applicationGroups, alreadyTraversedGroups)); } else if (ApplicationBuiltIn.getBuiltInApplication(member).isPresent()) { descendantObjects.add(ApplicationBuiltIn.getBuiltInApplication(member).get()); } } return descendantObjects; } ApplicationGroup(String name); Set<Application> getDescendantObjects(
      Map<String, Application> applications, Map<String, ApplicationGroup> applicationGroups); Set<String> getMembers(); String getName(); }
ApplicationGroup implements Serializable { @VisibleForTesting Set<Application> getDescendantObjects( Map<String, Application> applications, Map<String, ApplicationGroup> applicationGroups, Set<String> alreadyTraversedGroups) { if (alreadyTraversedGroups.contains(_name)) { return ImmutableSet.of(); } alreadyTraversedGroups.add(_name); Set<Application> descendantObjects = new HashSet<>(); for (String member : _members) { if (applications.containsKey(member)) { descendantObjects.add(applications.get(member)); } else if (applicationGroups.containsKey(member)) { descendantObjects.addAll( applicationGroups .get(member) .getDescendantObjects(applications, applicationGroups, alreadyTraversedGroups)); } else if (ApplicationBuiltIn.getBuiltInApplication(member).isPresent()) { descendantObjects.add(ApplicationBuiltIn.getBuiltInApplication(member).get()); } } return descendantObjects; } ApplicationGroup(String name); Set<Application> getDescendantObjects(
      Map<String, Application> applications, Map<String, ApplicationGroup> applicationGroups); Set<String> getMembers(); String getName();  }