##### Coverage Report - com.ctrip.framework.apollo.portal.util.RoleUtils

Classes in this File | Line Coverage | Branch Coverage | Complexity
RoleUtils |
0% | 0/11
N/A | N/A
| 1.0;1

1 |  |
     package com.ctrip.framework.apollo.portal.util;
2 |  |
3 |  |
     import com.google.common.base.Joiner;
4 |  |
5 |  |
     import com.ctrip.framework.apollo.core.ConfigConsts;
6 |  |
     import com.ctrip.framework.apollo.portal.constant.RoleType;
7 |  |
8 | 0 |
     public class RoleUtils {
9 |  |
10 | 0 |
       private static final Joiner STRING_JOINER = Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR);
11 |  |
12 |  |
       public static String buildAppMasterRoleName(String appId){
13 | 0 |
         return STRING_JOINER.join(RoleType.MASTER, appId);
14 |  |
       }
15 |  |
16 |  |
       public static String buildAppRoleName(String appId, String roleType){
17 | 0 |
         return STRING_JOINER.join(roleType, appId);
18 |  |
       }
19 |  |
       public static String buildModifyNamespaceRoleName(String appId, String namespaceName){
20 | 0 |
         return STRING_JOINER.join(RoleType.MODIFY_NAMESPACE, appId, namespaceName);
21 |  |
       }
22 |  |
23 |  |
       public static String buildModifyDefaultNamespaceRoleName(String appId){
24 | 0 |
         return STRING_JOINER.join(RoleType.MODIFY_NAMESPACE, appId, ConfigConsts.NAMESPACE_APPLICATION);
25 |  |
       }
26 |  |
27 |  |
       public static String buildReleaseNamespaceRoleName(String appId, String namespaceName){
28 | 0 |
         return STRING_JOINER.join(RoleType.RELEASE_NAMESPACE, appId, namespaceName);
29 |  |
       }
30 |  |
31 |  |
       public static String buildNamespaceRoleName(String appId, String namespaceName, String roleType){
32 | 0 |
         return STRING_JOINER.join(roleType, appId, namespaceName);
33 |  |
       }
34 |  |
35 |  |
       public static String buildReleaseDefaultNamespaceRoleName(String appId){
36 | 0 |
         return STRING_JOINER.join(RoleType.RELEASE_NAMESPACE, appId, ConfigConsts.NAMESPACE_APPLICATION);
37 |  |
       }
38 |  |
39 |  |
       public static String buildNamespaceTargetId(String appId, String namespaceName){
40 | 0 |
         return STRING_JOINER.join(appId, namespaceName);
41 |  |
       }
42 |  |
43 |  |
       public static String buildDefaultNamespaceTargetId(String appId){
44 | 0 |
         return STRING_JOINER.join(appId, ConfigConsts.NAMESPACE_APPLICATION);
45 |  |
       }
46 |  |
47 |  |
48 |  |
     }