test_class.declarator: SCRIPT_URL = URL.valueOf("condition://0.0.0.0/com.foo.BarService")
test_class.modifier: private
test_class.original_string: private URL SCRIPT_URL = URL.valueOf("condition://0.0.0.0/com.foo.BarService");
test_class.type: URL
test_class.var_name: SCRIPT_URL
test_class.file: dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/router/condition/ConditionRouterTest.java
test_class.identifier: ConditionRouterTest
test_case.body: @Test
      public void testRoute_NoForce() {
          Router router = new ConditionRouterFactory().getRouter(getRouteUrl("host = " + NetUtils.getLocalHost() + " => " + " host = 1.2.3.4"));
          List<Invoker<String>> invokers = new ArrayList<Invoker<String>>();
          Invoker<String> invoker1 = new MockInvoker<String>(URL.valueOf("dubbo://10.20.3.3:20880/com.foo.BarService"));
          Invoker<String> invoker2 = new MockInvoker<String>(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":20880/com.foo.BarService"));
          Invoker<String> invoker3 = new MockInvoker<String>(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":20880/com.foo.BarService"));
          invokers.add(invoker1);
          invokers.add(invoker2);
          invokers.add(invoker3);
          List<Invoker<String>> fileredInvokers = router.route(invokers, URL.valueOf("consumer://" + NetUtils.getLocalHost() + "/com.foo.BarService"), new RpcInvocation());
          Assert.assertEquals(invokers, fileredInvokers);
      }
test_case.class_method_signature: ConditionRouterTest.testRoute_NoForce()
test_case.full_signature: @Test public void testRoute_NoForce()
test_case.identifier: testRoute_NoForce
test_case.invocations: getRouter getRouteUrl getLocalHost valueOf valueOf getLocalHost valueOf getLocalHost add add add route valueOf getLocalHost assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRoute_NoForce()
focal_class.declarator: logger = LoggerFactory.getLogger(ConditionRouter.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(ConditionRouter.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: DEFAULT_PRIORITY = 2
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_PRIORITY = 2;
focal_class.type: int
focal_class.var_name: DEFAULT_PRIORITY
focal_class.declarator: ROUTE_PATTERN = Pattern.compile("([&!=,]*)\\s*([^&!=,\\s]+)")
focal_class.modifier: private static
focal_class.original_string: private static Pattern ROUTE_PATTERN = Pattern.compile("([&!=,]*)\\s*([^&!=,\\s]+)");
focal_class.type: Pattern
focal_class.var_name: ROUTE_PATTERN
focal_class.declarator: force
focal_class.modifier: private final
focal_class.original_string: private final boolean force;
focal_class.type: boolean
focal_class.var_name: force
focal_class.declarator: whenCondition
focal_class.modifier: private final
focal_class.original_string: private final Map<String, MatchPair> whenCondition;
focal_class.type: Map<String, MatchPair>
focal_class.var_name: whenCondition
focal_class.declarator: thenCondition
focal_class.modifier: private final
focal_class.original_string: private final Map<String, MatchPair> thenCondition;
focal_class.type: Map<String, MatchPair>
focal_class.var_name: thenCondition
focal_class.file: dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/condition/ConditionRouter.java
focal_class.identifier: ConditionRouter
focal_class.class_method_signature: ConditionRouter.ConditionRouter(URL url)
focal_class.full_signature: public  ConditionRouter(URL url)
focal_class.identifier: ConditionRouter
focal_class.modifiers: public
focal_class.parameters: (URL url)
focal_class.signature:  ConditionRouter(URL url)
focal_class.class_method_signature: ConditionRouter.parseRule(String rule)
focal_class.full_signature: private static Map<String, MatchPair> parseRule(String rule)
focal_class.identifier: parseRule
focal_class.modifiers: private static
focal_class.parameters: (String rule)
focal_class.return: Map<String, MatchPair>
focal_class.signature: Map<String, MatchPair> parseRule(String rule)
focal_class.class_method_signature: ConditionRouter.route(List<Invoker<T>> invokers, URL url, Invocation invocation)
focal_class.full_signature: @Override public List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation)
focal_class.identifier: route
focal_class.modifiers: @Override public
focal_class.parameters: (List<Invoker<T>> invokers, URL url, Invocation invocation)
focal_class.return: List<Invoker<T>>
focal_class.signature: List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation)
focal_class.class_method_signature: ConditionRouter.getUrl()
focal_class.full_signature: @Override public URL getUrl()
focal_class.identifier: getUrl
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: URL
focal_class.signature: URL getUrl()
focal_class.class_method_signature: ConditionRouter.compareTo(Router o)
focal_class.full_signature: @Override public int compareTo(Router o)
focal_class.identifier: compareTo
focal_class.modifiers: @Override public
focal_class.parameters: (Router o)
focal_class.return: int
focal_class.signature: int compareTo(Router o)
focal_class.class_method_signature: ConditionRouter.matchWhen(URL url, Invocation invocation)
focal_class.full_signature:  boolean matchWhen(URL url, Invocation invocation)
focal_class.identifier: matchWhen
focal_class.parameters: (URL url, Invocation invocation)
focal_class.return: boolean
focal_class.signature: boolean matchWhen(URL url, Invocation invocation)
focal_class.class_method_signature: ConditionRouter.matchThen(URL url, URL param)
focal_class.full_signature: private boolean matchThen(URL url, URL param)
focal_class.identifier: matchThen
focal_class.modifiers: private
focal_class.parameters: (URL url, URL param)
focal_class.return: boolean
focal_class.signature: boolean matchThen(URL url, URL param)
focal_class.class_method_signature: ConditionRouter.matchCondition(Map<String, MatchPair> condition, URL url, URL param, Invocation invocation)
focal_class.full_signature: private boolean matchCondition(Map<String, MatchPair> condition, URL url, URL param, Invocation invocation)
focal_class.identifier: matchCondition
focal_class.modifiers: private
focal_class.parameters: (Map<String, MatchPair> condition, URL url, URL param, Invocation invocation)
focal_class.return: boolean
focal_class.signature: boolean matchCondition(Map<String, MatchPair> condition, URL url, URL param, Invocation invocation)
focal_class.superclass: extends AbstractRouter
focal_method.body: @Override
      public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation)
              throws RpcException {
          if (invokers == null || invokers.isEmpty()) {
              return invokers;
          }
          try {
              if (!matchWhen(url, invocation)) {
                  return invokers;
              }
              List<Invoker<T>> result = new ArrayList<Invoker<T>>();
              if (thenCondition == null) {
                  logger.warn("The current consumer in the service blacklist. consumer: " + NetUtils.getLocalHost() + ", service: " + url.getServiceKey());
                  return result;
              }
              for (Invoker<T> invoker : invokers) {
                  if (matchThen(invoker.getUrl(), url)) {
                      result.add(invoker);
                  }
              }
              if (!result.isEmpty()) {
                  return result;
              } else if (force) {
                  logger.warn("The route result is empty and force execute. consumer: " + NetUtils.getLocalHost() + ", service: " + url.getServiceKey() + ", router: " + url.getParameterAndDecoded(Constants.RULE_KEY));
                  return result;
              }
          } catch (Throwable t) {
              logger.error("Failed to execute condition router rule: " + getUrl() + ", invokers: " + invokers + ", cause: " + t.getMessage(), t);
          }
          return invokers;
      }
focal_method.class_method_signature: ConditionRouter.route(List<Invoker<T>> invokers, URL url, Invocation invocation)
focal_method.full_signature: @Override public List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation)
focal_method.identifier: route
focal_method.invocations: isEmpty matchWhen warn getLocalHost getServiceKey matchThen getUrl add isEmpty warn getLocalHost getServiceKey getParameterAndDecoded error getUrl getMessage
focal_method.modifiers: @Override public
focal_method.parameters: (List<Invoker<T>> invokers, URL url, Invocation invocation)
focal_method.return: List<Invoker<T>>
focal_method.signature: List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation)