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_matchWhen() {
          Invocation invocation = new RpcInvocation();
  
          Router router = new ConditionRouterFactory().getRouter(getRouteUrl(" => host = 1.2.3.4"));
          boolean matchWhen = ((ConditionRouter) router).matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"),
                  invocation);
          Assert.assertEquals(true, matchWhen);
  
          router = new ConditionRouterFactory()
                  .getRouter(getRouteUrl("host = 2.2.2.2,1.1.1.1,3.3.3.3 => host = 1.2.3.4"));
          matchWhen = ((ConditionRouter) router).matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"),
                  invocation);
          Assert.assertEquals(true, matchWhen);
  
          router = new ConditionRouterFactory()
                  .getRouter(getRouteUrl("host = 2.2.2.2,1.1.1.1,3.3.3.3 & host !=1.1.1.1 => host = 1.2.3.4"));
          matchWhen = ((ConditionRouter) router).matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"),
                  invocation);
          Assert.assertEquals(false, matchWhen);
  
          router = new ConditionRouterFactory()
                  .getRouter(getRouteUrl("host !=4.4.4.4 & host = 2.2.2.2,1.1.1.1,3.3.3.3 => host = 1.2.3.4"));
          matchWhen = ((ConditionRouter) router).matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"),
                  invocation);
          Assert.assertEquals(true, matchWhen);
  
          router = new ConditionRouterFactory()
                  .getRouter(getRouteUrl("host !=4.4.4.* & host = 2.2.2.2,1.1.1.1,3.3.3.3 => host = 1.2.3.4"));
          matchWhen = ((ConditionRouter) router).matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"),
                  invocation);
          Assert.assertEquals(true, matchWhen);
  
          router = new ConditionRouterFactory()
                  .getRouter(getRouteUrl("host = 2.2.2.2,1.1.1.*,3.3.3.3 & host != 1.1.1.1 => host = 1.2.3.4"));
          matchWhen = ((ConditionRouter) router).matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"),
                  invocation);
          Assert.assertEquals(false, matchWhen);
  
          router = new ConditionRouterFactory()
                  .getRouter(getRouteUrl("host = 2.2.2.2,1.1.1.*,3.3.3.3 & host != 1.1.1.2 => host = 1.2.3.4"));
          matchWhen = ((ConditionRouter) router).matchWhen(URL.valueOf("consumer://1.1.1.1/com.foo.BarService"),
                  invocation);
          Assert.assertEquals(true, matchWhen);
      }
test_case.class_method_signature: ConditionRouterTest.testRoute_matchWhen()
test_case.full_signature: @Test public void testRoute_matchWhen()
test_case.identifier: testRoute_matchWhen
test_case.invocations: getRouter getRouteUrl matchWhen valueOf assertEquals getRouter getRouteUrl matchWhen valueOf assertEquals getRouter getRouteUrl matchWhen valueOf assertEquals getRouter getRouteUrl matchWhen valueOf assertEquals getRouter getRouteUrl matchWhen valueOf assertEquals getRouter getRouteUrl matchWhen valueOf assertEquals getRouter getRouteUrl matchWhen valueOf assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRoute_matchWhen()
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: boolean matchWhen(URL url, Invocation invocation) {
          return whenCondition == null || whenCondition.isEmpty() || matchCondition(whenCondition, url, null, invocation);
      }
focal_method.class_method_signature: ConditionRouter.matchWhen(URL url, Invocation invocation)
focal_method.full_signature:  boolean matchWhen(URL url, Invocation invocation)
focal_method.identifier: matchWhen
focal_method.invocations: isEmpty matchCondition
focal_method.parameters: (URL url, Invocation invocation)
focal_method.return: boolean
focal_method.signature: boolean matchWhen(URL url, Invocation invocation)