@Test public void testExtractAppIdFromRoleName() throws Exception { assertEquals("someApp", RoleUtils.extractAppIdFromRoleName("Master+someApp")); assertEquals("someApp", RoleUtils.extractAppIdFromRoleName("ModifyNamespace+someApp+xx")); assertEquals("app1", RoleUtils.extractAppIdFromRoleName("ReleaseNamespace+app1+application")); }
public static String extractAppIdFromRoleName(String roleName) { Iterator<String> parts = STRING_SPLITTER.split(roleName).iterator(); if (parts.hasNext()) { String roleType = parts.next(); if (RoleType.isValidRoleType(roleType) && parts.hasNext()) { return parts.next(); } } return null; }
RoleUtils { public static String extractAppIdFromRoleName(String roleName) { Iterator<String> parts = STRING_SPLITTER.split(roleName).iterator(); if (parts.hasNext()) { String roleType = parts.next(); if (RoleType.isValidRoleType(roleType) && parts.hasNext()) { return parts.next(); } } return null; } }
RoleUtils { public static String extractAppIdFromRoleName(String roleName) { Iterator<String> parts = STRING_SPLITTER.split(roleName).iterator(); if (parts.hasNext()) { String roleType = parts.next(); if (RoleType.isValidRoleType(roleType) && parts.hasNext()) { return parts.next(); } } return null; }  }
RoleUtils { public static String extractAppIdFromRoleName(String roleName) { Iterator<String> parts = STRING_SPLITTER.split(roleName).iterator(); if (parts.hasNext()) { String roleType = parts.next(); if (RoleType.isValidRoleType(roleType) && parts.hasNext()) { return parts.next(); } } return null; }  static String buildAppMasterRoleName(String appId); static String extractAppIdFromMasterRoleName(String masterRoleName); static String extractAppIdFromRoleName(String roleName); static String buildAppRoleName(String appId, String roleType); static String buildModifyNamespaceRoleName(String appId, String namespaceName); static String buildModifyNamespaceRoleName(String appId, String namespaceName, String env); static String buildModifyDefaultNamespaceRoleName(String appId); static String buildReleaseNamespaceRoleName(String appId, String namespaceName); static String buildReleaseNamespaceRoleName(String appId, String namespaceName, String env); static String buildNamespaceRoleName(String appId, String namespaceName, String roleType); static String buildNamespaceRoleName(String appId, String namespaceName, String roleType, String env); static String buildReleaseDefaultNamespaceRoleName(String appId); static String buildNamespaceTargetId(String appId, String namespaceName); static String buildNamespaceTargetId(String appId, String namespaceName, String env); static String buildDefaultNamespaceTargetId(String appId); static String buildCreateApplicationRoleName(String permissionType, String permissionTargetId); }
RoleUtils { public static String extractAppIdFromRoleName(String roleName) { Iterator<String> parts = STRING_SPLITTER.split(roleName).iterator(); if (parts.hasNext()) { String roleType = parts.next(); if (RoleType.isValidRoleType(roleType) && parts.hasNext()) { return parts.next(); } } return null; }  static String buildAppMasterRoleName(String appId); static String extractAppIdFromMasterRoleName(String masterRoleName); static String extractAppIdFromRoleName(String roleName); static String buildAppRoleName(String appId, String roleType); static String buildModifyNamespaceRoleName(String appId, String namespaceName); static String buildModifyNamespaceRoleName(String appId, String namespaceName, String env); static String buildModifyDefaultNamespaceRoleName(String appId); static String buildReleaseNamespaceRoleName(String appId, String namespaceName); static String buildReleaseNamespaceRoleName(String appId, String namespaceName, String env); static String buildNamespaceRoleName(String appId, String namespaceName, String roleType); static String buildNamespaceRoleName(String appId, String namespaceName, String roleType, String env); static String buildReleaseDefaultNamespaceRoleName(String appId); static String buildNamespaceTargetId(String appId, String namespaceName); static String buildNamespaceTargetId(String appId, String namespaceName, String env); static String buildDefaultNamespaceTargetId(String appId); static String buildCreateApplicationRoleName(String permissionType, String permissionTargetId);  }