@Test public void testParseRoles() { assertEquals(Collections.singletonList("some_role"), ACLConfigurationParser.parseRoles(" some_role ")); assertEquals(Arrays.asList("a","b","C"), ACLConfigurationParser.parseRoles("a,b,C")); assertEquals(Collections.emptyList(), ACLConfigurationParser.parseRoles("# test comment")); }
public static List<String> parseRoles(String roleStr) { int hashIdx = roleStr.indexOf('#'); if (hashIdx >= 0) { roleStr = roleStr.substring(0, hashIdx); } List<String> roles = new ArrayList<>(); for (String role : roleStr.split("[,]")) { String trimmed = role.trim(); if (trimmed.length() > 0) { roles.add(trimmed); } } return roles; }
ACLConfigurationParser { public static List<String> parseRoles(String roleStr) { int hashIdx = roleStr.indexOf('#'); if (hashIdx >= 0) { roleStr = roleStr.substring(0, hashIdx); } List<String> roles = new ArrayList<>(); for (String role : roleStr.split("[,]")) { String trimmed = role.trim(); if (trimmed.length() > 0) { roles.add(trimmed); } } return roles; } }
ACLConfigurationParser { public static List<String> parseRoles(String roleStr) { int hashIdx = roleStr.indexOf('#'); if (hashIdx >= 0) { roleStr = roleStr.substring(0, hashIdx); } List<String> roles = new ArrayList<>(); for (String role : roleStr.split("[,]")) { String trimmed = role.trim(); if (trimmed.length() > 0) { roles.add(trimmed); } } return roles; }  }
ACLConfigurationParser { public static List<String> parseRoles(String roleStr) { int hashIdx = roleStr.indexOf('#'); if (hashIdx >= 0) { roleStr = roleStr.substring(0, hashIdx); } List<String> roles = new ArrayList<>(); for (String role : roleStr.split("[,]")) { String trimmed = role.trim(); if (trimmed.length() > 0) { roles.add(trimmed); } } return roles; }  static Specificity getRolesForInvocation(String methodName, Object[] params, String[] signature,
                                                    Dictionary<String, Object> config, List<String> addToRoles); static Specificity getRolesForInvocationForAlias(String methodName, Object[] params, String[] signature,
                                                    Dictionary<String, Object> config, List<String> addToRoles); static void getCompulsoryRoles(List<String> roles); static List<String> parseRoles(String roleStr); }
ACLConfigurationParser { public static List<String> parseRoles(String roleStr) { int hashIdx = roleStr.indexOf('#'); if (hashIdx >= 0) { roleStr = roleStr.substring(0, hashIdx); } List<String> roles = new ArrayList<>(); for (String role : roleStr.split("[,]")) { String trimmed = role.trim(); if (trimmed.length() > 0) { roles.add(trimmed); } } return roles; }  static Specificity getRolesForInvocation(String methodName, Object[] params, String[] signature,
                                                    Dictionary<String, Object> config, List<String> addToRoles); static Specificity getRolesForInvocationForAlias(String methodName, Object[] params, String[] signature,
                                                    Dictionary<String, Object> config, List<String> addToRoles); static void getCompulsoryRoles(List<String> roles); static List<String> parseRoles(String roleStr);  }