Coverage Report - com.ctrip.framework.apollo.portal.api.API
 
Classes in this File Line Coverage Branch Coverage Complexity
API
100%
4/4
N/A
1
 
 1  
 package com.ctrip.framework.apollo.portal.api;
 2  
 
 3  
 import javax.annotation.PostConstruct;
 4  
 
 5  
 import org.springframework.beans.factory.annotation.Autowired;
 6  
 import org.springframework.web.client.RestTemplate;
 7  
 
 8  
 import com.ctrip.framework.apollo.common.auth.RestTemplateFactory;
 9  
 import com.ctrip.framework.apollo.core.enums.Env;
 10  
 import com.ctrip.framework.apollo.portal.service.ServiceLocator;
 11  
 
 12  6
 public class API {
 13  
 
 14  
   @Autowired
 15  
   protected ServiceLocator serviceLocator;
 16  
 
 17  
   @Autowired
 18  
   private RestTemplateFactory restTemplateFactory;
 19  
 
 20  
   protected RestTemplate restTemplate;
 21  
 
 22  
   @PostConstruct
 23  
   private void postConstruct() {
 24  6
     restTemplate = restTemplateFactory.getObject();
 25  6
   }
 26  
 
 27  
   public String getAdminServiceHost(Env env) {
 28  12
     return serviceLocator.getServiceAddress(env).getHomepageUrl();
 29  
   }
 30  
 }