##### Coverage Report - com.ctrip.apollo.biz.datasource.TitanSettings

Classes in this File | Line Coverage | Branch Coverage | Complexity
TitanSettings |
15% | 2/13
0% | 0/8
| 9.0;9
TitanSettings$1 |
0% | 0/1
N/A | N/A
| 9.0;9

1 |  |
     package com.ctrip.apollo.biz.datasource;
2 |  |
3 |  |
     import org.springframework.beans.factory.annotation.Value;
4 |  |
     import org.springframework.stereotype.Component;
5 |  |
6 |  |
     import com.ctrip.apollo.core.enums.Env;
7 |  |
     import com.ctrip.apollo.core.enums.EnvUtils;
8 |  |
     import com.ctrip.framework.foundation.Foundation;
9 |  |
10 |  |
     @Component
11 | 1 |
     public class TitanSettings {
12 |  |
13 |  |
       @Value("${fat.titan.url:}")
14 |  |
       private String fatTitanUrl;
15 |  |
16 |  |
       @Value("${uat.titan.url:}")
17 |  |
       private String uatTitanUrl;
18 |  |
19 |  |
       @Value("${pro.titan.url:}")
20 |  |
       private String proTitanUrl;
21 |  |
22 |  |
       @Value("${fat.titan.dbname:}")
23 |  |
       private String fatTitanDbname;
24 |  |
25 |  |
       @Value("${uat.titan.dbname:}")
26 |  |
       private String uatTitanDbname;
27 |  |
28 |  |
       @Value("${pro.titan.dbname:}")
29 |  |
       private String proTitanDbname;
30 |  |
31 |  |
       public String getTitanUrl() {
32 | 0 |
         Env env = EnvUtils.transformEnv(Foundation.server().getEnvType());
33 | 0 |
         switch (env) {
34 |  |
           case FAT:
35 |  |
           case FWS:
36 | 0 |
             return fatTitanUrl;
37 |  |
           case UAT:
38 | 0 |
             return uatTitanUrl;
39 |  |
           case TOOLS:
40 |  |
           case PRO:
41 | 0 |
             return proTitanUrl;
42 |  |
           default:
43 | 1 |
             return "";
44 |  |
         }
45 |  |
       }
46 |  |
47 |  |
       public String getTitanDbname() {
48 | 0 |
         Env env = EnvUtils.transformEnv(Foundation.server().getEnvType());
49 | 0 |
         switch (env) {
50 |  |
           case FAT:
51 |  |
           case FWS:
52 | 0 |
             return fatTitanDbname;
53 |  |
           case UAT:
54 | 0 |
             return uatTitanDbname;
55 |  |
           case TOOLS:
56 |  |
           case PRO:
57 | 0 |
             return proTitanDbname;
58 |  |
           default:
59 | 0 |
             return "";
60 |  |
         }
61 |  |
       }
62 |  |
63 |  |
     }