Coverage Report - com.ctrip.framework.apollo.common.datasource.TitanSettings
 
Classes in this File Line Coverage Branch Coverage Complexity
TitanSettings
0%
0/17
0%
0/12
11
TitanSettings$1
0%
0/1
N/A
11
 
 1  
 package com.ctrip.framework.apollo.common.datasource;
 2  
 
 3  
 import org.springframework.beans.factory.annotation.Value;
 4  
 import org.springframework.stereotype.Component;
 5  
 
 6  
 import com.ctrip.framework.apollo.core.enums.Env;
 7  
 import com.ctrip.framework.apollo.core.enums.EnvUtils;
 8  
 import com.ctrip.framework.foundation.Foundation;
 9  
 
 10  
 @Component
 11  0
 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
     if (env == null) {
 34  0
       return "";
 35  
     }
 36  0
     switch (env) {
 37  
       case FAT:
 38  
       case FWS:
 39  0
         return fatTitanUrl;
 40  
       case UAT:
 41  0
         return uatTitanUrl;
 42  
       case TOOLS:
 43  
       case PRO:
 44  0
         return proTitanUrl;
 45  
       default:
 46  0
         return "";
 47  
     }
 48  
   }
 49  
 
 50  
   public String getTitanDbname() {
 51  0
     Env env = EnvUtils.transformEnv(Foundation.server().getEnvType());
 52  0
     if (env == null) {
 53  0
       return "";
 54  
     }
 55  0
     switch (env) {
 56  
       case FAT:
 57  
       case FWS:
 58  0
         return fatTitanDbname;
 59  
       case UAT:
 60  0
         return uatTitanDbname;
 61  
       case TOOLS:
 62  
       case PRO:
 63  0
         return proTitanDbname;
 64  
       default:
 65  0
         return "";
 66  
     }
 67  
   }
 68  
 
 69  
 }