@Test public void testGetRoleArnsForUsers() { assertThat(getValidator().getRoleArnsForUsers(Collections.emptyList(), Collections.emptyMap())).isEqualTo(Collections.emptySortedSet()); List<String> users = Arrays.asList("user1", "user2", "user3"); assertThat(getValidator().getRoleArnsForUsers(users, Collections.emptyMap())).isEqualTo(Collections.emptySortedSet()); Map<String, String> userMappings = new TreeMap<>(); userMappings.put("user1", "role1"); userMappings.put("user2", "role1"); userMappings.put("user3", "role2"); List<String> allUsers = new ArrayList<>(userMappings.keySet()); SortedSet<String> expectedRoles = new TreeSet<>(userMappings.values()); assertThat(getValidator().getRoleArnsForUsers(allUsers, userMappings)) .isEqualTo(expectedRoles); List<String> oneUser = Collections.singletonList("user1"); SortedSet<String> expectedOneRole = new TreeSet<>(); expectedOneRole.add("role1"); assertThat(getValidator().getRoleArnsForUsers(oneUser, userMappings)) .isEqualTo(expectedOneRole); }
SortedSet<String> getRoleArnsForUsers(Collection<String> users, Map<String, String> userMappings) { LOGGER.debug("Filter out specific users: {} from userMappings: {}", users, userMappings); return userMappings.entrySet().stream() .filter(m -> users.contains(m.getKey())) .map(Entry::getValue).collect(Collectors.toCollection(TreeSet::new)); }
AwsIDBrokerMappedRolePermissionValidator { SortedSet<String> getRoleArnsForUsers(Collection<String> users, Map<String, String> userMappings) { LOGGER.debug("Filter out specific users: {} from userMappings: {}", users, userMappings); return userMappings.entrySet().stream() .filter(m -> users.contains(m.getKey())) .map(Entry::getValue).collect(Collectors.toCollection(TreeSet::new)); } }
AwsIDBrokerMappedRolePermissionValidator { SortedSet<String> getRoleArnsForUsers(Collection<String> users, Map<String, String> userMappings) { LOGGER.debug("Filter out specific users: {} from userMappings: {}", users, userMappings); return userMappings.entrySet().stream() .filter(m -> users.contains(m.getKey())) .map(Entry::getValue).collect(Collectors.toCollection(TreeSet::new)); }  }
AwsIDBrokerMappedRolePermissionValidator { SortedSet<String> getRoleArnsForUsers(Collection<String> users, Map<String, String> userMappings) { LOGGER.debug("Filter out specific users: {} from userMappings: {}", users, userMappings); return userMappings.entrySet().stream() .filter(m -> users.contains(m.getKey())) .map(Entry::getValue).collect(Collectors.toCollection(TreeSet::new)); }  void validate(AmazonIdentityManagement iam, CloudS3View cloudFileSystem,
            ValidationResultBuilder validationResultBuilder); }
AwsIDBrokerMappedRolePermissionValidator { SortedSet<String> getRoleArnsForUsers(Collection<String> users, Map<String, String> userMappings) { LOGGER.debug("Filter out specific users: {} from userMappings: {}", users, userMappings); return userMappings.entrySet().stream() .filter(m -> users.contains(m.getKey())) .map(Entry::getValue).collect(Collectors.toCollection(TreeSet::new)); }  void validate(AmazonIdentityManagement iam, CloudS3View cloudFileSystem,
            ValidationResultBuilder validationResultBuilder);  }