@Test public void getRootNodesReturnsExpectedNodes() { var rootNodeDn = "root-dn"; var staffNodeDn = "user-dn"; var rootNode = new LdapUserNode() .setDn(rootNodeDn) .setManagerDn(rootNodeDn); var staffNode = new LdapUserNode() .setDn(staffNodeDn) .setManagerDn(rootNodeDn); var actualRootNodes = userUpdater.getRootNodes(List.of(rootNode, staffNode)); assertThat(actualRootNodes).containsExactly(rootNode); }
Set<LdapUserNode> getRootNodes(@NonNull Collection<LdapUserNode> nodes) { return nodes.stream() .filter(ldapUserNode -> ldapUserNode.getDn().equals(ldapUserNode.getManagerDn())) .collect(Collectors.toSet()); }
UserUpdater { Set<LdapUserNode> getRootNodes(@NonNull Collection<LdapUserNode> nodes) { return nodes.stream() .filter(ldapUserNode -> ldapUserNode.getDn().equals(ldapUserNode.getManagerDn())) .collect(Collectors.toSet()); } }
UserUpdater { Set<LdapUserNode> getRootNodes(@NonNull Collection<LdapUserNode> nodes) { return nodes.stream() .filter(ldapUserNode -> ldapUserNode.getDn().equals(ldapUserNode.getManagerDn())) .collect(Collectors.toSet()); } UserUpdater(HierarchyTreeNodeRepository hierarchyTreeNodeRepo,
                       RepositoryUserService repoUserService,
                       UserDataRepository userDataRepo,
                       LdapAdapter ldapAdapter,
                       List<Normalizer<UserData>> normalizers); }
UserUpdater { Set<LdapUserNode> getRootNodes(@NonNull Collection<LdapUserNode> nodes) { return nodes.stream() .filter(ldapUserNode -> ldapUserNode.getDn().equals(ldapUserNode.getManagerDn())) .collect(Collectors.toSet()); } UserUpdater(HierarchyTreeNodeRepository hierarchyTreeNodeRepo,
                       RepositoryUserService repoUserService,
                       UserDataRepository userDataRepo,
                       LdapAdapter ldapAdapter,
                       List<Normalizer<UserData>> normalizers); void updateHierarchyAndUserData(); }
UserUpdater { Set<LdapUserNode> getRootNodes(@NonNull Collection<LdapUserNode> nodes) { return nodes.stream() .filter(ldapUserNode -> ldapUserNode.getDn().equals(ldapUserNode.getManagerDn())) .collect(Collectors.toSet()); } UserUpdater(HierarchyTreeNodeRepository hierarchyTreeNodeRepo,
                       RepositoryUserService repoUserService,
                       UserDataRepository userDataRepo,
                       LdapAdapter ldapAdapter,
                       List<Normalizer<UserData>> normalizers); void updateHierarchyAndUserData();  }