##### Coverage Report - com.ctrip.framework.apollo.biz.datasource.TitanCondition

Classes in this File | Line Coverage | Branch Coverage | Complexity
TitanCondition |
62% | 5/8
50% | 3/6
| 7.0;7

1 |  |
     package com.ctrip.framework.apollo.biz.datasource;
2 |  |
3 |  |
     import org.springframework.context.annotation.Condition;
4 |  |
     import org.springframework.context.annotation.ConditionContext;
5 |  |
     import org.springframework.core.type.AnnotatedTypeMetadata;
6 |  |
7 |  |
     import com.ctrip.framework.apollo.core.utils.StringUtils;
8 |  |
9 | 2 |
     public class TitanCondition implements Condition {
10 |  |
11 |  |
       @Override
12 |  |
       public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
13 | 2 |
         if (!StringUtils.isEmpty(context.getEnvironment().getProperty("fat.titan.url"))) {
14 | 0 |
           return true;
15 | 2 |
         } else if (!StringUtils.isEmpty(context.getEnvironment().getProperty("uat.titan.url"))) {
16 | 0 |
           return true;
17 | 2 |
         } else if (!StringUtils.isEmpty(context.getEnvironment().getProperty("pro.titan.url"))) {
18 | 0 |
           return true;
19 |  |
         }
20 | 2 |
         return false;
21 |  |
       }
22 |  |
23 |  |
     }