target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testIsMatch4() { URL consumerUrl = URL.valueOf("dubbo: URL providerUrl = URL.valueOf("http: assertTrue(UrlUtils.isMatch(consumerUrl, providerUrl)); } | public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) return false; ... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... |
@Test public void testIsMatch5() { URL consumerUrl = URL.valueOf("dubbo: URL providerUrl = URL.valueOf("http: assertTrue(UrlUtils.isMatch(consumerUrl, providerUrl)); } | public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) return false; ... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... |
@Test public void test_sort() throws Exception { List<Integer> list = new ArrayList<Integer>(); list.add(100); list.add(10); list.add(20); List<Integer> expected = new ArrayList<Integer>(); expected.add(10); expected.add(20); expected.add(100); assertEquals(expected, CollectionUtils.sort(list)); } | @SuppressWarnings({"unchecked", "rawtypes"}) public static <T> List<T> sort(List<T> list) { if (list != null && list.size() > 0) { Collections.sort((List) list); } return list; } | CollectionUtils { @SuppressWarnings({"unchecked", "rawtypes"}) public static <T> List<T> sort(List<T> list) { if (list != null && list.size() > 0) { Collections.sort((List) list); } return list; } } | CollectionUtils { @SuppressWarnings({"unchecked", "rawtypes"}) public static <T> List<T> sort(List<T> list) { if (list != null && list.size() > 0) { Collections.sort((List) list); } return list; } private CollectionUtils(); } | CollectionUtils { @SuppressWarnings({"unchecked", "rawtypes"}) public static <T> List<T> sort(List<T> list) { if (list != null && list.size() > 0) { Collections.sort((List) list); } return list; } private CollectionUtils(); @SuppressWarnings({"unchecked", "rawtypes"}) static List<T> sort(List<T> list); static List<Str... | CollectionUtils { @SuppressWarnings({"unchecked", "rawtypes"}) public static <T> List<T> sort(List<T> list) { if (list != null && list.size() > 0) { Collections.sort((List) list); } return list; } private CollectionUtils(); @SuppressWarnings({"unchecked", "rawtypes"}) static List<T> sort(List<T> list); static List<Str... |
@Test public void testSelectAgainAndCheckAvailable() { LoadBalance lb = ExtensionLoader.getExtensionLoader(LoadBalance.class).getExtension(RoundRobinLoadBalance.NAME); initlistsize5(); { selectedInvokers.clear(); selectedInvokers.add(invoker1); selectedInvokers.add(invoker2); selectedInvokers.add(invoker3); selectedInv... | protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMethodName(); boolean sticky = invokers.get(0).ge... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... |
@Test public void test_sortSimpleName() throws Exception { List<String> list = new ArrayList<String>(); list.add("aaa.z"); list.add("b"); list.add(null); list.add("zzz.a"); list.add("c"); list.add(null); List<String> sorted = CollectionUtils.sortSimpleName(list); assertNull(sorted.get(0)); assertNull(sorted.get(1)); } | public static List<String> sortSimpleName(List<String> list) { if (list != null && list.size() > 0) { Collections.sort(list, SIMPLE_NAME_COMPARATOR); } return list; } | CollectionUtils { public static List<String> sortSimpleName(List<String> list) { if (list != null && list.size() > 0) { Collections.sort(list, SIMPLE_NAME_COMPARATOR); } return list; } } | CollectionUtils { public static List<String> sortSimpleName(List<String> list) { if (list != null && list.size() > 0) { Collections.sort(list, SIMPLE_NAME_COMPARATOR); } return list; } private CollectionUtils(); } | CollectionUtils { public static List<String> sortSimpleName(List<String> list) { if (list != null && list.size() > 0) { Collections.sort(list, SIMPLE_NAME_COMPARATOR); } return list; } private CollectionUtils(); @SuppressWarnings({"unchecked", "rawtypes"}) static List<T> sort(List<T> list); static List<String> sortSim... | CollectionUtils { public static List<String> sortSimpleName(List<String> list) { if (list != null && list.size() > 0) { Collections.sort(list, SIMPLE_NAME_COMPARATOR); } return list; } private CollectionUtils(); @SuppressWarnings({"unchecked", "rawtypes"}) static List<T> sort(List<T> list); static List<String> sortSim... |
@Test public void test_joinList() throws Exception { List<String> list = Arrays.asList(); assertEquals("", CollectionUtils.join(list, "/")); list = Arrays.asList("x"); assertEquals("x", CollectionUtils.join(list, "-")); list = Arrays.asList("a", "b"); assertEquals("a/b", CollectionUtils.join(list, "/")); } | public static List<String> join(Map<String, String> map, String separator) { if (map == null) { return null; } List<String> list = new ArrayList<String>(); if (map == null || map.size() == 0) { return list; } for (Map.Entry<String, String> entry : map.entrySet()) { String key = entry.getKey(); String value = entry.getV... | CollectionUtils { public static List<String> join(Map<String, String> map, String separator) { if (map == null) { return null; } List<String> list = new ArrayList<String>(); if (map == null || map.size() == 0) { return list; } for (Map.Entry<String, String> entry : map.entrySet()) { String key = entry.getKey(); String ... | CollectionUtils { public static List<String> join(Map<String, String> map, String separator) { if (map == null) { return null; } List<String> list = new ArrayList<String>(); if (map == null || map.size() == 0) { return list; } for (Map.Entry<String, String> entry : map.entrySet()) { String key = entry.getKey(); String ... | CollectionUtils { public static List<String> join(Map<String, String> map, String separator) { if (map == null) { return null; } List<String> list = new ArrayList<String>(); if (map == null || map.size() == 0) { return list; } for (Map.Entry<String, String> entry : map.entrySet()) { String key = entry.getKey(); String ... | CollectionUtils { public static List<String> join(Map<String, String> map, String separator) { if (map == null) { return null; } List<String> list = new ArrayList<String>(); if (map == null || map.size() == 0) { return list; } for (Map.Entry<String, String> entry : map.entrySet()) { String key = entry.getKey(); String ... |
@Test public void test_expandCondition() throws Exception { Map<String, RouteRule.MatchPair> condition = new HashMap<String, RouteRule.MatchPair>(); { Set<String> matches = new HashSet<String>(); matches.add("value1_1"); matches.add("value1_2"); matches.add("value1_3"); Set<String> unmatches = new HashSet<String>(); un... | public static <T extends Collection<String>> Map<String, RouteRule.MatchPair> expandCondition( Map<String, RouteRule.MatchPair> condition, String srcKeyName, String destKeyName, Map<String, T> expandName2Set) { if (null == condition || StringUtils.isEmpty(srcKeyName) || StringUtils.isEmpty(destKeyName)) { return condit... | RouteRuleUtils { public static <T extends Collection<String>> Map<String, RouteRule.MatchPair> expandCondition( Map<String, RouteRule.MatchPair> condition, String srcKeyName, String destKeyName, Map<String, T> expandName2Set) { if (null == condition || StringUtils.isEmpty(srcKeyName) || StringUtils.isEmpty(destKeyName)... | RouteRuleUtils { public static <T extends Collection<String>> Map<String, RouteRule.MatchPair> expandCondition( Map<String, RouteRule.MatchPair> condition, String srcKeyName, String destKeyName, Map<String, T> expandName2Set) { if (null == condition || StringUtils.isEmpty(srcKeyName) || StringUtils.isEmpty(destKeyName)... | RouteRuleUtils { public static <T extends Collection<String>> Map<String, RouteRule.MatchPair> expandCondition( Map<String, RouteRule.MatchPair> condition, String srcKeyName, String destKeyName, Map<String, T> expandName2Set) { if (null == condition || StringUtils.isEmpty(srcKeyName) || StringUtils.isEmpty(destKeyName)... | RouteRuleUtils { public static <T extends Collection<String>> Map<String, RouteRule.MatchPair> expandCondition( Map<String, RouteRule.MatchPair> condition, String srcKeyName, String destKeyName, Map<String, T> expandName2Set) { if (null == condition || StringUtils.isEmpty(srcKeyName) || StringUtils.isEmpty(destKeyName)... |
@Test public void test_filterServiceByRule() throws Exception { List<String> services = new ArrayList<String>(); services.add("com.alibaba.MemberService"); services.add("com.alibaba.ViewCacheService"); services.add("com.alibaba.PC2Service"); services.add("service2"); Route route = new Route(); route.setMatchRule("servi... | public static Set<String> filterServiceByRule(List<String> services, RouteRule rule) { if (null == services || services.isEmpty() || rule == null) { return new HashSet<String>(); } RouteRule.MatchPair p = rule.getWhenCondition().get("service"); if (p == null) { return new HashSet<String>(); } Set<String> filter = Parse... | RouteRuleUtils { public static Set<String> filterServiceByRule(List<String> services, RouteRule rule) { if (null == services || services.isEmpty() || rule == null) { return new HashSet<String>(); } RouteRule.MatchPair p = rule.getWhenCondition().get("service"); if (p == null) { return new HashSet<String>(); } Set<Strin... | RouteRuleUtils { public static Set<String> filterServiceByRule(List<String> services, RouteRule rule) { if (null == services || services.isEmpty() || rule == null) { return new HashSet<String>(); } RouteRule.MatchPair p = rule.getWhenCondition().get("service"); if (p == null) { return new HashSet<String>(); } Set<Strin... | RouteRuleUtils { public static Set<String> filterServiceByRule(List<String> services, RouteRule rule) { if (null == services || services.isEmpty() || rule == null) { return new HashSet<String>(); } RouteRule.MatchPair p = rule.getWhenCondition().get("service"); if (p == null) { return new HashSet<String>(); } Set<Strin... | RouteRuleUtils { public static Set<String> filterServiceByRule(List<String> services, RouteRule rule) { if (null == services || services.isEmpty() || rule == null) { return new HashSet<String>(); } RouteRule.MatchPair p = rule.getWhenCondition().get("service"); if (p == null) { return new HashSet<String>(); } Set<Strin... |
@Test public void test_isMatchCondition() throws Exception { Map<String, RouteRule.MatchPair> condition = new HashMap<String, RouteRule.MatchPair>(); Map<String, String> valueParams = new HashMap<String, String>(); Map<String, String> kv = new HashMap<String, String>(); boolean output = RouteRuleUtils.isMatchCondition(... | public static boolean isMatchCondition(Map<String, RouteRule.MatchPair> condition, Map<String, String> valueParams, Map<String, String> kv) { if (condition != null && condition.size() > 0) { for (Map.Entry<String, RouteRule.MatchPair> entry : condition.entrySet()) { String condName = entry.getKey(); RouteRule.MatchPair... | RouteRuleUtils { public static boolean isMatchCondition(Map<String, RouteRule.MatchPair> condition, Map<String, String> valueParams, Map<String, String> kv) { if (condition != null && condition.size() > 0) { for (Map.Entry<String, RouteRule.MatchPair> entry : condition.entrySet()) { String condName = entry.getKey(); Ro... | RouteRuleUtils { public static boolean isMatchCondition(Map<String, RouteRule.MatchPair> condition, Map<String, String> valueParams, Map<String, String> kv) { if (condition != null && condition.size() > 0) { for (Map.Entry<String, RouteRule.MatchPair> entry : condition.entrySet()) { String condName = entry.getKey(); Ro... | RouteRuleUtils { public static boolean isMatchCondition(Map<String, RouteRule.MatchPair> condition, Map<String, String> valueParams, Map<String, String> kv) { if (condition != null && condition.size() > 0) { for (Map.Entry<String, RouteRule.MatchPair> entry : condition.entrySet()) { String condName = entry.getKey(); Ro... | RouteRuleUtils { public static boolean isMatchCondition(Map<String, RouteRule.MatchPair> condition, Map<String, String> valueParams, Map<String, String> kv) { if (condition != null && condition.size() > 0) { for (Map.Entry<String, RouteRule.MatchPair> entry : condition.entrySet()) { String condName = entry.getKey(); Ro... |
@Test public void test_filterServiceByRule2() throws Exception { List<String> services = new ArrayList<String>(); services.add("com.alibaba.MemberService"); services.add("com.alibaba.ViewCacheService"); services.add("com.alibaba.PC2Service"); services.add("service2"); Route route = new Route(); route.setMatchRule("serv... | public static Set<String> filterServiceByRule(List<String> services, RouteRule rule) { if (null == services || services.isEmpty() || rule == null) { return new HashSet<String>(); } RouteRule.MatchPair p = rule.getWhenCondition().get("service"); if (p == null) { return new HashSet<String>(); } Set<String> filter = Parse... | RouteRuleUtils { public static Set<String> filterServiceByRule(List<String> services, RouteRule rule) { if (null == services || services.isEmpty() || rule == null) { return new HashSet<String>(); } RouteRule.MatchPair p = rule.getWhenCondition().get("service"); if (p == null) { return new HashSet<String>(); } Set<Strin... | RouteRuleUtils { public static Set<String> filterServiceByRule(List<String> services, RouteRule rule) { if (null == services || services.isEmpty() || rule == null) { return new HashSet<String>(); } RouteRule.MatchPair p = rule.getWhenCondition().get("service"); if (p == null) { return new HashSet<String>(); } Set<Strin... | RouteRuleUtils { public static Set<String> filterServiceByRule(List<String> services, RouteRule rule) { if (null == services || services.isEmpty() || rule == null) { return new HashSet<String>(); } RouteRule.MatchPair p = rule.getWhenCondition().get("service"); if (p == null) { return new HashSet<String>(); } Set<Strin... | RouteRuleUtils { public static Set<String> filterServiceByRule(List<String> services, RouteRule rule) { if (null == services || services.isEmpty() || rule == null) { return new HashSet<String>(); } RouteRule.MatchPair p = rule.getWhenCondition().get("service"); if (p == null) { return new HashSet<String>(); } Set<Strin... |
@Test public void testInterpolateDot() throws Exception { String regexp = ParseUtils.interpolate("com.alibaba.morgan.MemberService", new HashMap<String, String>()); assertEquals("com.alibaba.morgan.MemberService", regexp); } | public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expression); StringBu... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... |
@Test public void testInterpolateWildcard() throws Exception { String regexp = ParseUtils.interpolate("com.alibaba.morgan.*", new HashMap<String, String>()); assertEquals("com.alibaba.morgan.*", regexp); } | public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expression); StringBu... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... |
@Test() public void testTimeoutExceptionCode() { List<Invoker<DemoService>> invokers = new ArrayList<Invoker<DemoService>>(); invokers.add(new Invoker<DemoService>() { public Class<DemoService> getInterface() { return DemoService.class; } public URL getUrl() { return URL.valueOf("dubbo: } public boolean isAvailable() {... | public Result invoke(final Invocation invocation) throws RpcException { checkWheatherDestoried(); LoadBalance loadbalance; List<Invoker<T>> invokers = list(invocation); if (invokers != null && invokers.size() > 0) { loadbalance = ExtensionLoader.getExtensionLoader(LoadBalance.class).getExtension(invokers.get(0).getUrl(... | AbstractClusterInvoker implements Invoker<T> { public Result invoke(final Invocation invocation) throws RpcException { checkWheatherDestoried(); LoadBalance loadbalance; List<Invoker<T>> invokers = list(invocation); if (invokers != null && invokers.size() > 0) { loadbalance = ExtensionLoader.getExtensionLoader(LoadBala... | AbstractClusterInvoker implements Invoker<T> { public Result invoke(final Invocation invocation) throws RpcException { checkWheatherDestoried(); LoadBalance loadbalance; List<Invoker<T>> invokers = list(invocation); if (invokers != null && invokers.size() > 0) { loadbalance = ExtensionLoader.getExtensionLoader(LoadBala... | AbstractClusterInvoker implements Invoker<T> { public Result invoke(final Invocation invocation) throws RpcException { checkWheatherDestoried(); LoadBalance loadbalance; List<Invoker<T>> invokers = list(invocation); if (invokers != null && invokers.size() > 0) { loadbalance = ExtensionLoader.getExtensionLoader(LoadBala... | AbstractClusterInvoker implements Invoker<T> { public Result invoke(final Invocation invocation) throws RpcException { checkWheatherDestoried(); LoadBalance loadbalance; List<Invoker<T>> invokers = list(invocation); if (invokers != null && invokers.size() > 0) { loadbalance = ExtensionLoader.getExtensionLoader(LoadBala... |
@Test public void testInterpolateSequence() throws Exception { String regexp = ParseUtils.interpolate("1.0.[0-9]", new HashMap<String, String>()); assertEquals("1.0.[0-9]", regexp.toString()); } | public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expression); StringBu... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... |
@Test public void testInterpolateVariable() throws Exception { Map<String, String> params = new HashMap<String, String>(); params.put("consumer.address", "10.20.130.230"); String regexp = ParseUtils.interpolate("xx$consumer.address", params); assertEquals("xx10.20.130.230", regexp); } | public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expression); StringBu... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... |
@Test public void testInterpolateVariableWithParentheses() throws Exception { Map<String, String> params = new HashMap<String, String>(); params.put("consumer.address", "10.20.130.230"); String regexp = ParseUtils.interpolate("xx${consumer.address}yy", params); assertEquals("xx10.20.130.230yy", regexp); } | public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expression); StringBu... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... |
@Test public void testInterpolateCollMap_NormalCase() throws Exception { List<String> expressions = new ArrayList<String>(); expressions.add("xx$var1"); expressions.add("yy${var2}zz"); Map<String, String> params = new HashMap<String, String>(); params.put("var1", "CAT"); params.put("var2", "DOG"); List<String> interpol... | public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expression); StringBu... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... | ParseUtils { public static String interpolate(String expression, Map<String, String> params) { if (expression == null || expression.length() == 0) { throw new IllegalArgumentException("glob pattern is empty!"); } if (expression.indexOf('$') < 0) { return expression; } Matcher matcher = VARIABLE_PATTERN.matcher(expressi... |
@Test public void testIsMatchGlobPattern() throws Exception { assertTrue(ParseUtils.isMatchGlobPattern(null, null)); assertFalse(ParseUtils.isMatchGlobPattern("abc", null)); assertFalse(ParseUtils.isMatchGlobPattern(null, "xxx")); assertTrue(ParseUtils.isMatchGlobPattern("", "")); assertFalse(ParseUtils.isMatchGlobPatt... | public static boolean isMatchGlobPattern(String pattern, String value) { if ("*".equals(pattern)) return true; if ((pattern == null || pattern.length() == 0) && (value == null || value.length() == 0)) return true; if ((pattern == null || pattern.length() == 0) || (value == null || value.length() == 0)) return false; in... | ParseUtils { public static boolean isMatchGlobPattern(String pattern, String value) { if ("*".equals(pattern)) return true; if ((pattern == null || pattern.length() == 0) && (value == null || value.length() == 0)) return true; if ((pattern == null || pattern.length() == 0) || (value == null || value.length() == 0)) ret... | ParseUtils { public static boolean isMatchGlobPattern(String pattern, String value) { if ("*".equals(pattern)) return true; if ((pattern == null || pattern.length() == 0) && (value == null || value.length() == 0)) return true; if ((pattern == null || pattern.length() == 0) || (value == null || value.length() == 0)) ret... | ParseUtils { public static boolean isMatchGlobPattern(String pattern, String value) { if ("*".equals(pattern)) return true; if ((pattern == null || pattern.length() == 0) && (value == null || value.length() == 0)) return true; if ((pattern == null || pattern.length() == 0) || (value == null || value.length() == 0)) ret... | ParseUtils { public static boolean isMatchGlobPattern(String pattern, String value) { if ("*".equals(pattern)) return true; if ((pattern == null || pattern.length() == 0) && (value == null || value.length() == 0)) return true; if ((pattern == null || pattern.length() == 0) || (value == null || value.length() == 0)) ret... |
@Test public void testIsMatchGlobPatternsNeedInterpolate() throws Exception { Collection<String> patternsNeedInterpolate = new HashSet<String>(); Map<String, String> interpolateParams = new HashMap<String, String>(); boolean match = ParseUtils.isMatchGlobPatternsNeedInterpolate(patternsNeedInterpolate, interpolateParam... | public static boolean isMatchGlobPatternsNeedInterpolate( Collection<String> patternsNeedInterpolate, Map<String, String> interpolateParams, String value) { if (patternsNeedInterpolate != null && !patternsNeedInterpolate.isEmpty()) { for (String patternNeedItp : patternsNeedInterpolate) { if (StringUtils.isEmpty(patter... | ParseUtils { public static boolean isMatchGlobPatternsNeedInterpolate( Collection<String> patternsNeedInterpolate, Map<String, String> interpolateParams, String value) { if (patternsNeedInterpolate != null && !patternsNeedInterpolate.isEmpty()) { for (String patternNeedItp : patternsNeedInterpolate) { if (StringUtils.i... | ParseUtils { public static boolean isMatchGlobPatternsNeedInterpolate( Collection<String> patternsNeedInterpolate, Map<String, String> interpolateParams, String value) { if (patternsNeedInterpolate != null && !patternsNeedInterpolate.isEmpty()) { for (String patternNeedItp : patternsNeedInterpolate) { if (StringUtils.i... | ParseUtils { public static boolean isMatchGlobPatternsNeedInterpolate( Collection<String> patternsNeedInterpolate, Map<String, String> interpolateParams, String value) { if (patternsNeedInterpolate != null && !patternsNeedInterpolate.isEmpty()) { for (String patternNeedItp : patternsNeedInterpolate) { if (StringUtils.i... | ParseUtils { public static boolean isMatchGlobPatternsNeedInterpolate( Collection<String> patternsNeedInterpolate, Map<String, String> interpolateParams, String value) { if (patternsNeedInterpolate != null && !patternsNeedInterpolate.isEmpty()) { for (String patternNeedItp : patternsNeedInterpolate) { if (StringUtils.i... |
@Test public void test_hasIntersection() throws Exception { assertFalse(ParseUtils.hasIntersection(null, null)); assertFalse(ParseUtils.hasIntersection("dog", null)); assertFalse(ParseUtils.hasIntersection(null, "god")); assertTrue(ParseUtils.hasIntersection("hello", "hello*")); assertTrue(ParseUtils.hasIntersection("h... | public static boolean hasIntersection(String glob1, String glob2) { if (null == glob1 || null == glob2) { return false; } if (glob1.contains("*") && glob2.contains("*")) { int index1 = glob1.indexOf("*"); int index2 = glob2.indexOf("*"); String s11 = glob1.substring(0, index1); String s12 = glob1.substring(index1 + 1, ... | ParseUtils { public static boolean hasIntersection(String glob1, String glob2) { if (null == glob1 || null == glob2) { return false; } if (glob1.contains("*") && glob2.contains("*")) { int index1 = glob1.indexOf("*"); int index2 = glob2.indexOf("*"); String s11 = glob1.substring(0, index1); String s12 = glob1.substring... | ParseUtils { public static boolean hasIntersection(String glob1, String glob2) { if (null == glob1 || null == glob2) { return false; } if (glob1.contains("*") && glob2.contains("*")) { int index1 = glob1.indexOf("*"); int index2 = glob2.indexOf("*"); String s11 = glob1.substring(0, index1); String s12 = glob1.substring... | ParseUtils { public static boolean hasIntersection(String glob1, String glob2) { if (null == glob1 || null == glob2) { return false; } if (glob1.contains("*") && glob2.contains("*")) { int index1 = glob1.indexOf("*"); int index2 = glob2.indexOf("*"); String s11 = glob1.substring(0, index1); String s12 = glob1.substring... | ParseUtils { public static boolean hasIntersection(String glob1, String glob2) { if (null == glob1 || null == glob2) { return false; } if (glob1.contains("*") && glob2.contains("*")) { int index1 = glob1.indexOf("*"); int index2 = glob2.indexOf("*"); String s11 = glob1.substring(0, index1); String s12 = glob1.substring... |
@Test public void testFilterByGlobPattern() throws Exception { Collection<String> values = new ArrayList<String>(); values.add("abc123"); values.add("JQKxyz"); values.add("abc123"); values.add("abcLLL"); Set<String> filter = ParseUtils.filterByGlobPattern("abc*", values); Set<String> expected = new HashSet<String>(); e... | public static Set<String> filterByGlobPattern(String pattern, Collection<String> values) { Set<String> ret = new HashSet<String>(); if (pattern == null || values == null) { return ret; } for (String v : values) { if (isMatchGlobPattern(pattern, v)) { ret.add(v); } } return ret; } | ParseUtils { public static Set<String> filterByGlobPattern(String pattern, Collection<String> values) { Set<String> ret = new HashSet<String>(); if (pattern == null || values == null) { return ret; } for (String v : values) { if (isMatchGlobPattern(pattern, v)) { ret.add(v); } } return ret; } } | ParseUtils { public static Set<String> filterByGlobPattern(String pattern, Collection<String> values) { Set<String> ret = new HashSet<String>(); if (pattern == null || values == null) { return ret; } for (String v : values) { if (isMatchGlobPattern(pattern, v)) { ret.add(v); } } return ret; } private ParseUtils(); } | ParseUtils { public static Set<String> filterByGlobPattern(String pattern, Collection<String> values) { Set<String> ret = new HashSet<String>(); if (pattern == null || values == null) { return ret; } for (String v : values) { if (isMatchGlobPattern(pattern, v)) { ret.add(v); } } return ret; } private ParseUtils(); sta... | ParseUtils { public static Set<String> filterByGlobPattern(String pattern, Collection<String> values) { Set<String> ret = new HashSet<String>(); if (pattern == null || values == null) { return ret; } for (String v : values) { if (isMatchGlobPattern(pattern, v)) { ret.add(v); } } return ret; } private ParseUtils(); sta... |
@Test public void test_matchRoute() throws Exception { Route route = new Route(); route.setId(1L); route.setPriority(3); route.setMatchRule("consumer.host = 1.1.2.2"); route.setFilterRule("xxx = yyy"); routes.add(route); { assertTrue(RouteUtils.matchRoute("1.1.2.2:20880", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&appli... | public static boolean matchRoute(String consumerAddress, String consumerQueryUrl, Route route, Map<String, List<String>> clusters) { RouteRule rule = RouteRule.parseQuitely(route); Map<String, RouteRule.MatchPair> when = RouteRuleUtils.expandCondition( rule.getWhenCondition(), "consumer.cluster", "consumer.host", clust... | RouteUtils { public static boolean matchRoute(String consumerAddress, String consumerQueryUrl, Route route, Map<String, List<String>> clusters) { RouteRule rule = RouteRule.parseQuitely(route); Map<String, RouteRule.MatchPair> when = RouteRuleUtils.expandCondition( rule.getWhenCondition(), "consumer.cluster", "consumer... | RouteUtils { public static boolean matchRoute(String consumerAddress, String consumerQueryUrl, Route route, Map<String, List<String>> clusters) { RouteRule rule = RouteRule.parseQuitely(route); Map<String, RouteRule.MatchPair> when = RouteRuleUtils.expandCondition( rule.getWhenCondition(), "consumer.cluster", "consumer... | RouteUtils { public static boolean matchRoute(String consumerAddress, String consumerQueryUrl, Route route, Map<String, List<String>> clusters) { RouteRule rule = RouteRule.parseQuitely(route); Map<String, RouteRule.MatchPair> when = RouteRuleUtils.expandCondition( rule.getWhenCondition(), "consumer.cluster", "consumer... | RouteUtils { public static boolean matchRoute(String consumerAddress, String consumerQueryUrl, Route route, Map<String, List<String>> clusters) { RouteRule rule = RouteRule.parseQuitely(route); Map<String, RouteRule.MatchPair> when = RouteRuleUtils.expandCondition( rule.getWhenCondition(), "consumer.cluster", "consumer... |
@Test public void test_previewRoute() throws Exception { Route route = new Route(); route.setId(1L); route.setService("hello.HelloService"); route.setMatchRule("consumer.host=1.1.2.2,2.2.2.3"); route.setFilterRule("provider.host=3.3.4.4&provider.application=morgan"); { Map<String, String> preview = RouteUtils.previewRo... | public static Map<String, String> previewRoute(String serviceName, String consumerAddress, String queryUrl, Map<String, String> serviceUrls, Route route, Map<String, List<String>> clusters, List<Route> routed) { if (null == route) { throw new IllegalArgumentException("Route is null."); } List<Route> routes = new ArrayL... | RouteUtils { public static Map<String, String> previewRoute(String serviceName, String consumerAddress, String queryUrl, Map<String, String> serviceUrls, Route route, Map<String, List<String>> clusters, List<Route> routed) { if (null == route) { throw new IllegalArgumentException("Route is null."); } List<Route> routes... | RouteUtils { public static Map<String, String> previewRoute(String serviceName, String consumerAddress, String queryUrl, Map<String, String> serviceUrls, Route route, Map<String, List<String>> clusters, List<Route> routed) { if (null == route) { throw new IllegalArgumentException("Route is null."); } List<Route> routes... | RouteUtils { public static Map<String, String> previewRoute(String serviceName, String consumerAddress, String queryUrl, Map<String, String> serviceUrls, Route route, Map<String, List<String>> clusters, List<Route> routed) { if (null == route) { throw new IllegalArgumentException("Route is null."); } List<Route> routes... | RouteUtils { public static Map<String, String> previewRoute(String serviceName, String consumerAddress, String queryUrl, Map<String, String> serviceUrls, Route route, Map<String, List<String>> clusters, List<Route> routed) { if (null == route) { throw new IllegalArgumentException("Route is null."); } List<Route> routes... |
@Test public void testRoute() throws Exception { { Map<String, String> result = RouteUtils.route("hello.HelloService:1.0.0", "1.1.2.2:20880", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", serviceUrls, routes, clusters, null); Map<String, String> expected = new HashMap<String, String>(); expected.put("du... | public static List<Provider> route(String serviceName, String consumerAddress, String consumerQueryUrl, List<Provider> providers, List<Override> overrides, List<Route> routes, Map<String, List<String>> clusters, List<Route> routed) { if (providers == null) { return null; } Map<String, String> urls = new HashMap<String,... | RouteUtils { public static List<Provider> route(String serviceName, String consumerAddress, String consumerQueryUrl, List<Provider> providers, List<Override> overrides, List<Route> routes, Map<String, List<String>> clusters, List<Route> routed) { if (providers == null) { return null; } Map<String, String> urls = new Ha... | RouteUtils { public static List<Provider> route(String serviceName, String consumerAddress, String consumerQueryUrl, List<Provider> providers, List<Override> overrides, List<Route> routes, Map<String, List<String>> clusters, List<Route> routed) { if (providers == null) { return null; } Map<String, String> urls = new Ha... | RouteUtils { public static List<Provider> route(String serviceName, String consumerAddress, String consumerQueryUrl, List<Provider> providers, List<Override> overrides, List<Route> routes, Map<String, List<String>> clusters, List<Route> routed) { if (providers == null) { return null; } Map<String, String> urls = new Ha... | RouteUtils { public static List<Provider> route(String serviceName, String consumerAddress, String consumerQueryUrl, List<Provider> providers, List<Override> overrides, List<Route> routes, Map<String, List<String>> clusters, List<Route> routed) { if (providers == null) { return null; } Map<String, String> urls = new Ha... |
@Test public void testMockInvokerInvoke_normal() { URL url = URL.valueOf("remote: url = url.addParameter(Constants.MOCK_KEY, "fail"); Invoker<IHelloService> cluster = getClusterInvoker(url); URL mockUrl = URL.valueOf("mock: + "?getSomething.mock=return aa"); Protocol protocol = new MockProtocol(); Invoker<IHelloService... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void test_isSerivceNameMatched() throws Exception { assertTrue(RouteUtils.isSerivceNameMatched("com.alibaba.morgan.MemberService", "com.alibaba.morgan.MemberService:1.0.0")); assertTrue(RouteUtils.isSerivceNameMatched("com.alibaba.morgan.MemberService", "cn/com.alibaba.morgan.MemberService:1.0.0")); assert... | static boolean isSerivceNameMatched(String servicePattern, String serviceName) { final int pip = servicePattern.indexOf('/'); final int pi = serviceName.indexOf('/'); if (pip != -1) { if (pi == -1) return false; String gp = servicePattern.substring(0, pip); servicePattern = servicePattern.substring(pip + 1); String g =... | RouteUtils { static boolean isSerivceNameMatched(String servicePattern, String serviceName) { final int pip = servicePattern.indexOf('/'); final int pi = serviceName.indexOf('/'); if (pip != -1) { if (pi == -1) return false; String gp = servicePattern.substring(0, pip); servicePattern = servicePattern.substring(pip + 1... | RouteUtils { static boolean isSerivceNameMatched(String servicePattern, String serviceName) { final int pip = servicePattern.indexOf('/'); final int pi = serviceName.indexOf('/'); if (pip != -1) { if (pi == -1) return false; String gp = servicePattern.substring(0, pip); servicePattern = servicePattern.substring(pip + 1... | RouteUtils { static boolean isSerivceNameMatched(String servicePattern, String serviceName) { final int pip = servicePattern.indexOf('/'); final int pi = serviceName.indexOf('/'); if (pip != -1) { if (pi == -1) return false; String gp = servicePattern.substring(0, pip); servicePattern = servicePattern.substring(pip + 1... | RouteUtils { static boolean isSerivceNameMatched(String servicePattern, String serviceName) { final int pip = servicePattern.indexOf('/'); final int pi = serviceName.indexOf('/'); if (pip != -1) { if (pi == -1) return false; String gp = servicePattern.substring(0, pip); servicePattern = servicePattern.substring(pip + 1... |
@Test public void testGetPageCount() { PageList<Object> pl = new PageList<Object>(0, 100, 52, null); Assert.assertEquals(1, pl.getPageCount()); pl = new PageList<Object>(0, -100, -3, null); Assert.assertEquals(1, pl.getPageCount()); pl = new PageList<Object>(0, 30, 100, null); Assert.assertEquals(4, pl.getPageCount());... | public int getPageCount() { int lim = limit; if (limit < 1) { lim = 1; } int page = total / lim; if (page < 1) { return 1; } int remain = total % lim; if (remain > 0) { page += 1; } return page; } | PageList implements Serializable { public int getPageCount() { int lim = limit; if (limit < 1) { lim = 1; } int page = total / lim; if (page < 1) { return 1; } int remain = total % lim; if (remain > 0) { page += 1; } return page; } } | PageList implements Serializable { public int getPageCount() { int lim = limit; if (limit < 1) { lim = 1; } int page = total / lim; if (page < 1) { return 1; } int remain = total % lim; if (remain > 0) { page += 1; } return page; } PageList(); PageList(int start, int limit, int total, List<T> list); } | PageList implements Serializable { public int getPageCount() { int lim = limit; if (limit < 1) { lim = 1; } int page = total / lim; if (page < 1) { return 1; } int remain = total % lim; if (remain > 0) { page += 1; } return page; } PageList(); PageList(int start, int limit, int total, List<T> list); int getStart(); vo... | PageList implements Serializable { public int getPageCount() { int lim = limit; if (limit < 1) { lim = 1; } int page = total / lim; if (page < 1) { return 1; } int remain = total % lim; if (remain > 0) { page += 1; } return page; } PageList(); PageList(int start, int limit, int total, List<T> list); int getStart(); vo... |
@Test public void testHeartBeat() throws Exception { url = url.addParameter(Constants.DUBBO_VERSION_KEY, "2.1.1"); channel.setAttribute( HeaderExchangeHandler.KEY_READ_TIMESTAMP, System.currentTimeMillis()); channel.setAttribute( HeaderExchangeHandler.KEY_WRITE_TIMESTAMP, System.currentTimeMillis()); Thread.sleep(2000L... | public void run() { try { long now = System.currentTimeMillis(); for (Channel channel : channelProvider.getChannels()) { if (channel.isClosed()) { continue; } try { Long lastRead = (Long) channel.getAttribute( HeaderExchangeHandler.KEY_READ_TIMESTAMP); Long lastWrite = (Long) channel.getAttribute( HeaderExchangeHandler... | HeartBeatTask implements Runnable { public void run() { try { long now = System.currentTimeMillis(); for (Channel channel : channelProvider.getChannels()) { if (channel.isClosed()) { continue; } try { Long lastRead = (Long) channel.getAttribute( HeaderExchangeHandler.KEY_READ_TIMESTAMP); Long lastWrite = (Long) channel... | HeartBeatTask implements Runnable { public void run() { try { long now = System.currentTimeMillis(); for (Channel channel : channelProvider.getChannels()) { if (channel.isClosed()) { continue; } try { Long lastRead = (Long) channel.getAttribute( HeaderExchangeHandler.KEY_READ_TIMESTAMP); Long lastWrite = (Long) channel... | HeartBeatTask implements Runnable { public void run() { try { long now = System.currentTimeMillis(); for (Channel channel : channelProvider.getChannels()) { if (channel.isClosed()) { continue; } try { Long lastRead = (Long) channel.getAttribute( HeaderExchangeHandler.KEY_READ_TIMESTAMP); Long lastWrite = (Long) channel... | HeartBeatTask implements Runnable { public void run() { try { long now = System.currentTimeMillis(); for (Channel channel : channelProvider.getChannels()) { if (channel.isClosed()) { continue; } try { Long lastRead = (Long) channel.getAttribute( HeaderExchangeHandler.KEY_READ_TIMESTAMP); Long lastWrite = (Long) channel... |
@Test(expected = IndexOutOfBoundsException.class) public void writerIndexBoundaryCheck1() { buffer.writerIndex(-1); } | public int writerIndex() { return writerIndex; } | AbstractChannelBuffer implements ChannelBuffer { public int writerIndex() { return writerIndex; } } | AbstractChannelBuffer implements ChannelBuffer { public int writerIndex() { return writerIndex; } } | AbstractChannelBuffer implements ChannelBuffer { public int writerIndex() { return writerIndex; } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readable(); boolean writable(); int readab... | AbstractChannelBuffer implements ChannelBuffer { public int writerIndex() { return writerIndex; } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readable(); boolean writable(); int readab... |
@Test(expected = IndexOutOfBoundsException.class) public void getByteArrayBoundaryCheck1() { buffer.getBytes(-1, new byte[0]); } | public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } } | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } } | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readab... | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readab... |
@Test(expected = IndexOutOfBoundsException.class) public void getByteArrayBoundaryCheck2() { buffer.getBytes(-1, new byte[0], 0, 0); } | public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } } | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } } | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readab... | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readab... |
@Test(expected = IndexOutOfBoundsException.class) public void getByteBufferBoundaryCheck() { buffer.getBytes(-1, ByteBuffer.allocate(0)); } | public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } } | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } } | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readab... | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readab... |
@Test(expected = IndexOutOfBoundsException.class) public void copyBoundaryCheck1() { buffer.copy(-1, 0); } | public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readable(); bool... | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readable(); bool... |
@Test(expected = IndexOutOfBoundsException.class) public void copyBoundaryCheck2() { buffer.copy(0, buffer.capacity() + 1); } | public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readable(); bool... | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readable(); bool... |
@Test public void testMockInvokerInvoke_failmock() { URL url = URL.valueOf("remote: .addParameter(Constants.MOCK_KEY, "fail:return null") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); URL mockUrl = URL.valueOf("mock: + "?getSomething.mock=return aa").addParameter... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testRoute_ReturnEmpty() { Router router = new ConditionRouterFactory().getRouter(getRouteUrl("host = " + NetUtils.getLocalHost() + " => ")); List<Invoker<String>> invokers = new ArrayList<Invoker<String>>(); invokers.add(new MockInvoker<String>()); invokers.add(new MockInvoker<String>()); invokers.add... | public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new ArrayList<Invoker<T>>(); if (thenCondition == null) { logger... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... |
@Test(expected = IndexOutOfBoundsException.class) public void copyBoundaryCheck3() { buffer.copy(buffer.capacity() + 1, 0); } | public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readable(); bool... | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readable(); bool... |
@Test(expected = IndexOutOfBoundsException.class) public void copyBoundaryCheck4() { buffer.copy(buffer.capacity(), 1); } | public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readable(); bool... | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readable(); bool... |
@Test(expected = IndexOutOfBoundsException.class) public void setIndexBoundaryCheck1() { buffer.setIndex(-1, CAPACITY); } | public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } | AbstractChannelBuffer implements ChannelBuffer { public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } } | AbstractChannelBuffer implements ChannelBuffer { public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } } | AbstractChannelBuffer implements ChannelBuffer { public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } int readerIndex(); void re... | AbstractChannelBuffer implements ChannelBuffer { public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } int readerIndex(); void re... |
@Test(expected = IndexOutOfBoundsException.class) public void setIndexBoundaryCheck2() { buffer.setIndex(CAPACITY / 2, CAPACITY / 4); } | public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } | AbstractChannelBuffer implements ChannelBuffer { public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } } | AbstractChannelBuffer implements ChannelBuffer { public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } } | AbstractChannelBuffer implements ChannelBuffer { public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } int readerIndex(); void re... | AbstractChannelBuffer implements ChannelBuffer { public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } int readerIndex(); void re... |
@Test(expected = IndexOutOfBoundsException.class) public void setIndexBoundaryCheck3() { buffer.setIndex(0, CAPACITY + 1); } | public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } | AbstractChannelBuffer implements ChannelBuffer { public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } } | AbstractChannelBuffer implements ChannelBuffer { public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } } | AbstractChannelBuffer implements ChannelBuffer { public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } int readerIndex(); void re... | AbstractChannelBuffer implements ChannelBuffer { public void setIndex(int readerIndex, int writerIndex) { if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity()) { throw new IndexOutOfBoundsException(); } this.readerIndex = readerIndex; this.writerIndex = writerIndex; } int readerIndex(); void re... |
@Test(expected = IndexOutOfBoundsException.class) public void getDirectByteBufferBoundaryCheck() { buffer.getBytes(-1, ByteBuffer.allocateDirect(0)); } | public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } } | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } } | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readab... | AbstractChannelBuffer implements ChannelBuffer { public void getBytes(int index, byte[] dst) { getBytes(index, dst, 0, dst.length); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readab... |
@Test public void testCopy() { for (int i = 0; i < buffer.capacity(); i++) { byte value = (byte) random.nextInt(); buffer.setByte(i, value); } final int readerIndex = CAPACITY / 3; final int writerIndex = CAPACITY * 2 / 3; buffer.setIndex(readerIndex, writerIndex); ChannelBuffer copy = buffer.copy(); assertEquals(0, co... | public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } } | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readable(); bool... | AbstractChannelBuffer implements ChannelBuffer { public ChannelBuffer copy() { return copy(readerIndex, readableBytes()); } int readerIndex(); void readerIndex(int readerIndex); int writerIndex(); void writerIndex(int writerIndex); void setIndex(int readerIndex, int writerIndex); void clear(); boolean readable(); bool... |
@Test public void testDestroyAll() throws Exception { ReferenceConfigCache cache = ReferenceConfigCache.getCache(); MockReferenceConfig config = new MockReferenceConfig(); config.setInterface("FooService"); config.setGroup("group1"); config.setVersion("1.0.0"); cache.get(config); MockReferenceConfig configCopy = new Mo... | public void destroyAll() { Set<String> set = new HashSet<String>(cache.keySet()); for (String key : set) { destroyKey(key); } } | ReferenceConfigCache { public void destroyAll() { Set<String> set = new HashSet<String>(cache.keySet()); for (String key : set) { destroyKey(key); } } } | ReferenceConfigCache { public void destroyAll() { Set<String> set = new HashSet<String>(cache.keySet()); for (String key : set) { destroyKey(key); } } private ReferenceConfigCache(String name, KeyGenerator generator); } | ReferenceConfigCache { public void destroyAll() { Set<String> set = new HashSet<String>(cache.keySet()); for (String key : set) { destroyKey(key); } } private ReferenceConfigCache(String name, KeyGenerator generator); static ReferenceConfigCache getCache(); static ReferenceConfigCache getCache(String name); static Ref... | ReferenceConfigCache { public void destroyAll() { Set<String> set = new HashSet<String>(cache.keySet()); for (String key : set) { destroyKey(key); } } private ReferenceConfigCache(String name, KeyGenerator generator); static ReferenceConfigCache getCache(); static ReferenceConfigCache getCache(String name); static Ref... |
@Test public void testMockInvokerInvoke_forcemock() { URL url = URL.valueOf("remote: url = url.addParameter(Constants.MOCK_KEY, "force:return null"); Invoker<IHelloService> cluster = getClusterInvoker(url); URL mockUrl = URL.valueOf("mock: + "?getSomething.mock=return aa&getSomething3xx.mock=return xx") .addParameters(... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerInvoke_forcemock_defaultreturn() { URL url = URL.valueOf("remote: url = url.addParameter(Constants.MOCK_KEY, "force"); Invoker<IHelloService> cluster = getClusterInvoker(url); URL mockUrl = URL.valueOf("mock: + "?getSomething.mock=return aa&getSomething3xx.mock=return xx&sayHello.mock=r... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_Fock_someMethods() { URL url = URL.valueOf("remote: .addParameter("getSomething.mock", "fail:return x") .addParameter("getSomething2.mock", "force:return y"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation invocation = new RpcInvocation(); inv... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_Fock_WithOutDefault() { URL url = URL.valueOf("remote: .addParameter("getSomething.mock", "fail:return x") .addParameter("getSomething2.mock", "force:return y") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); Rpc... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_Fock_WithDefault() { URL url = URL.valueOf("remote: .addParameter("mock", "fail:return null") .addParameter("getSomething.mock", "fail:return x") .addParameter("getSomething2.mock", "force:return y") .addParameter("invoke_return_error", "true"); Invoker<IHelloService... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_Fock_WithFailDefault() { URL url = URL.valueOf("remote: .addParameter("mock", "fail:return z") .addParameter("getSomething.mock", "fail:return x") .addParameter("getSomething2.mock", "force:return y") .addParameter("invoke_return_error", "true"); Invoker<IHelloServic... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_Fock_WithForceDefault() { URL url = URL.valueOf("remote: .addParameter("mock", "force:return z") .addParameter("getSomething.mock", "fail:return x") .addParameter("getSomething2.mock", "force:return y") .addParameter("invoke_return_error", "true"); Invoker<IHelloServ... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_Fock_Default() { URL url = URL.valueOf("remote: .addParameter("mock", "fail:return x") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation invocation = new RpcInvocation(); invocation.setMethodName("get... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_checkCompatible_return() { URL url = URL.valueOf("remote: .addParameter("getSomething.mock", "return x") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation invocation = new RpcInvocation(); invocation.... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock() { URL url = URL.valueOf("remote: .addParameter("mock", "true") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation invocation = new RpcInvocation(); invocation.setMethodName("... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testRoute_ReturnAll() { Router router = new ConditionRouterFactory().getRouter(getRouteUrl("host = " + NetUtils.getLocalHost() + " => " + " host = " + NetUtils.getLocalHost())); List<Invoker<String>> invokers = new ArrayList<Invoker<String>>(); invokers.add(new MockInvoker<String>()); invokers.add(new... | public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new ArrayList<Invoker<T>>(); if (thenCondition == null) { logger... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... |
@Test public void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock2() { URL url = URL.valueOf("remote: .addParameter("mock", "fail") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation invocation = new RpcInvocation(); invocation.setMethodName(... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_checkCompatible_ImplMock3() { URL url = URL.valueOf("remote: .addParameter("mock", "force"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation invocation = new RpcInvocation(); invocation.setMethodName("getSomething"); Result ret = cluster.invoke... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_check_String() { URL url = URL.valueOf("remote: .addParameter("getSomething.mock", "force:return 1688") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation invocation = new RpcInvocation(); invocation.s... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_check_int() { URL url = URL.valueOf("remote: .addParameter("getInt1.mock", "force:return 1688") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation invocation = new RpcInvocation(); invocation.setMethod... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@SuppressWarnings("unchecked") @Test public void testMockInvokerFromOverride_Invoke_check_ListString_empty() { URL url = URL.valueOf("remote: .addParameter("getListString.mock", "force:return empty") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation inv... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@SuppressWarnings("unchecked") @Test public void testMockInvokerFromOverride_Invoke_check_ListString() { URL url = URL.valueOf("remote: .addParameter("getListString.mock", "force:return [\"hi\",\"hi2\"]") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocatio... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@SuppressWarnings("unchecked") @Test public void testMockInvokerFromOverride_Invoke_check_ListPojo_empty() { URL url = URL.valueOf("remote: .addParameter("getUsers.mock", "force:return empty") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation invocation... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@SuppressWarnings("unchecked") @Test public void testMockInvokerFromOverride_Invoke_check_ListPojo() { URL url = URL.valueOf("remote: .addParameter("getUsers.mock", "force:return [{id:1, name:\"hi1\"}, {id:2, name:\"hi2\"}]") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvok... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_check_ListPojo_error() { URL url = URL.valueOf("remote: .addParameter("getUsers.mock", "force:return [{id:x, name:\"hi1\"}]") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation invocation = new RpcInvo... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_force_throw() { URL url = URL.valueOf("remote: .addParameter("getBoolean2.mock", "force:throw ") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation invocation = new RpcInvocation(); invocation.setMetho... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testRoute_HostFilter() { Router router = new ConditionRouterFactory().getRouter(getRouteUrl("host = " + NetUtils.getLocalHost() + " => " + " host = " + NetUtils.getLocalHost())); List<Invoker<String>> invokers = new ArrayList<Invoker<String>>(); Invoker<String> invoker1 = new MockInvoker<String>(URL.v... | public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new ArrayList<Invoker<T>>(); if (thenCondition == null) { logger... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... |
@Test public void testMockInvokerFromOverride_Invoke_force_throwCustemException() throws Throwable { URL url = URL.valueOf("remote: .addParameter("getBoolean2.mock", "force:throw com.alibaba.dubbo.rpc.cluster.support.wrapper.MyMockException") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster ... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_force_throwCustemExceptionNotFound() { URL url = URL.valueOf("remote: .addParameter("getBoolean2.mock", "force:throw java.lang.RuntimeException2") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation inv... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testMockInvokerFromOverride_Invoke_mock_false() { URL url = URL.valueOf("remote: .addParameter("mock", "false") .addParameter("invoke_return_error", "true"); Invoker<IHelloService> cluster = getClusterInvoker(url); RpcInvocation invocation = new RpcInvocation(); invocation.setMethodName("getBoolean2")... | public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invo... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... | MockClusterInvoker implements Invoker<T> { public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory .getUrl() .getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("f... |
@Test public void testTimeOut() { HessianServiceImpl server = new HessianServiceImpl(); ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); URL url = URL.valueOf("hessian... | public void destroy() { super.destroy(); for (String key : new ArrayList<String>(serverMap.keySet())) { HttpServer server = serverMap.remove(key); if (server != null) { try { if (logger.isInfoEnabled()) { logger.info("Close hessian server " + server.getUrl()); } server.close(); } catch (Throwable t) { logger.warn(t.get... | HessianProtocol extends AbstractProxyProtocol { public void destroy() { super.destroy(); for (String key : new ArrayList<String>(serverMap.keySet())) { HttpServer server = serverMap.remove(key); if (server != null) { try { if (logger.isInfoEnabled()) { logger.info("Close hessian server " + server.getUrl()); } server.cl... | HessianProtocol extends AbstractProxyProtocol { public void destroy() { super.destroy(); for (String key : new ArrayList<String>(serverMap.keySet())) { HttpServer server = serverMap.remove(key); if (server != null) { try { if (logger.isInfoEnabled()) { logger.info("Close hessian server " + server.getUrl()); } server.cl... | HessianProtocol extends AbstractProxyProtocol { public void destroy() { super.destroy(); for (String key : new ArrayList<String>(serverMap.keySet())) { HttpServer server = serverMap.remove(key); if (server != null) { try { if (logger.isInfoEnabled()) { logger.info("Close hessian server " + server.getUrl()); } server.cl... | HessianProtocol extends AbstractProxyProtocol { public void destroy() { super.destroy(); for (String key : new ArrayList<String>(serverMap.keySet())) { HttpServer server = serverMap.remove(key); if (server != null) { try { if (logger.isInfoEnabled()) { logger.info("Close hessian server " + server.getUrl()); } server.cl... |
@Test public void test_share_connect() { init(0); Assert.assertEquals(demoClient.getLocalAddress(), helloClient.getLocalAddress()); Assert.assertEquals(demoClient, helloClient); destoy(); } | public InetSocketAddress getLocalAddress() { return client.getLocalAddress(); } | ReferenceCountExchangeClient implements ExchangeClient { public InetSocketAddress getLocalAddress() { return client.getLocalAddress(); } } | ReferenceCountExchangeClient implements ExchangeClient { public InetSocketAddress getLocalAddress() { return client.getLocalAddress(); } ReferenceCountExchangeClient(ExchangeClient client, ConcurrentMap<String, LazyConnectExchangeClient> ghostClientMap); } | ReferenceCountExchangeClient implements ExchangeClient { public InetSocketAddress getLocalAddress() { return client.getLocalAddress(); } ReferenceCountExchangeClient(ExchangeClient client, ConcurrentMap<String, LazyConnectExchangeClient> ghostClientMap); void reset(URL url); ResponseFuture request(Object request); URL ... | ReferenceCountExchangeClient implements ExchangeClient { public InetSocketAddress getLocalAddress() { return client.getLocalAddress(); } ReferenceCountExchangeClient(ExchangeClient client, ConcurrentMap<String, LazyConnectExchangeClient> ghostClientMap); void reset(URL url); ResponseFuture request(Object request); URL ... |
@Test public void test_not_share_connect() { init(1); Assert.assertNotSame(demoClient.getLocalAddress(), helloClient.getLocalAddress()); Assert.assertNotSame(demoClient, helloClient); destoy(); } | public InetSocketAddress getLocalAddress() { return client.getLocalAddress(); } | ReferenceCountExchangeClient implements ExchangeClient { public InetSocketAddress getLocalAddress() { return client.getLocalAddress(); } } | ReferenceCountExchangeClient implements ExchangeClient { public InetSocketAddress getLocalAddress() { return client.getLocalAddress(); } ReferenceCountExchangeClient(ExchangeClient client, ConcurrentMap<String, LazyConnectExchangeClient> ghostClientMap); } | ReferenceCountExchangeClient implements ExchangeClient { public InetSocketAddress getLocalAddress() { return client.getLocalAddress(); } ReferenceCountExchangeClient(ExchangeClient client, ConcurrentMap<String, LazyConnectExchangeClient> ghostClientMap); void reset(URL url); ResponseFuture request(Object request); URL ... | ReferenceCountExchangeClient implements ExchangeClient { public InetSocketAddress getLocalAddress() { return client.getLocalAddress(); } ReferenceCountExchangeClient(ExchangeClient client, ConcurrentMap<String, LazyConnectExchangeClient> ghostClientMap); void reset(URL url); ResponseFuture request(Object request); URL ... |
@Test public void testRoute_Empty_HostFilter() { Router router = new ConditionRouterFactory().getRouter(getRouteUrl(" => " + " host = " + NetUtils.getLocalHost())); List<Invoker<String>> invokers = new ArrayList<Invoker<String>>(); Invoker<String> invoker1 = new MockInvoker<String>(URL.valueOf("dubbo: Invoker<String> i... | public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new ArrayList<Invoker<T>>(); if (thenCondition == null) { logger... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... |
@Test public void testChangeLogLevel() throws RemotingException { mockChannel = EasyMock.createMock(Channel.class); EasyMock.replay(mockChannel); String result = log.telnet(mockChannel, "error"); assertTrue(result.contains("\r\nCURRENT LOG LEVEL:ERROR")); String result2 = log.telnet(mockChannel, "warn"); assertTrue(res... | public String telnet(Channel channel, String message) { long size = 0; File file = LoggerFactory.getFile(); StringBuffer buf = new StringBuffer(); if (message == null || message.trim().length() == 0) { buf.append("EXAMPLE: log error / log 100"); } else { String str[] = message.split(" "); if (!StringUtils.isInteger(str... | LogTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { long size = 0; File file = LoggerFactory.getFile(); StringBuffer buf = new StringBuffer(); if (message == null || message.trim().length() == 0) { buf.append("EXAMPLE: log error / log 100"); } else { String str[] = messag... | LogTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { long size = 0; File file = LoggerFactory.getFile(); StringBuffer buf = new StringBuffer(); if (message == null || message.trim().length() == 0) { buf.append("EXAMPLE: log error / log 100"); } else { String str[] = messag... | LogTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { long size = 0; File file = LoggerFactory.getFile(); StringBuffer buf = new StringBuffer(); if (message == null || message.trim().length() == 0) { buf.append("EXAMPLE: log error / log 100"); } else { String str[] = messag... | LogTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { long size = 0; File file = LoggerFactory.getFile(); StringBuffer buf = new StringBuffer(); if (message == null || message.trim().length() == 0) { buf.append("EXAMPLE: log error / log 100"); } else { String str[] = messag... |
@Test public void testPrintLog() throws RemotingException { mockChannel = EasyMock.createMock(Channel.class); EasyMock.replay(mockChannel); String result = log.telnet(mockChannel, "100"); assertTrue(result.contains("CURRENT LOG APPENDER")); EasyMock.reset(mockChannel); } | public String telnet(Channel channel, String message) { long size = 0; File file = LoggerFactory.getFile(); StringBuffer buf = new StringBuffer(); if (message == null || message.trim().length() == 0) { buf.append("EXAMPLE: log error / log 100"); } else { String str[] = message.split(" "); if (!StringUtils.isInteger(str... | LogTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { long size = 0; File file = LoggerFactory.getFile(); StringBuffer buf = new StringBuffer(); if (message == null || message.trim().length() == 0) { buf.append("EXAMPLE: log error / log 100"); } else { String str[] = messag... | LogTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { long size = 0; File file = LoggerFactory.getFile(); StringBuffer buf = new StringBuffer(); if (message == null || message.trim().length() == 0) { buf.append("EXAMPLE: log error / log 100"); } else { String str[] = messag... | LogTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { long size = 0; File file = LoggerFactory.getFile(); StringBuffer buf = new StringBuffer(); if (message == null || message.trim().length() == 0) { buf.append("EXAMPLE: log error / log 100"); } else { String str[] = messag... | LogTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { long size = 0; File file = LoggerFactory.getFile(); StringBuffer buf = new StringBuffer(); if (message == null || message.trim().length() == 0) { buf.append("EXAMPLE: log error / log 100"); } else { String str[] = messag... |
@Test public void testListClient() throws Exception { ExchangeClient client1 = Exchangers.connect("dubbo: ExchangeClient client2 = Exchangers.connect("dubbo: Thread.sleep(5000); String result = port.telnet(null, "-l 20887"); String client1Addr = client1.getLocalAddress().toString(); String client2Addr = client2.getLoca... | public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true; } else { if (!StringUtils.isInteger(part)) ... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... |
@Test public void testListDetail() throws RemotingException { String result = port.telnet(null, "-l"); assertEquals("dubbo: } | public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true; } else { if (!StringUtils.isInteger(part)) ... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... |
@Test public void testRoute_False_HostFilter() { Router router = new ConditionRouterFactory().getRouter(getRouteUrl("true => " + " host = " + NetUtils.getLocalHost())); List<Invoker<String>> invokers = new ArrayList<Invoker<String>>(); Invoker<String> invoker1 = new MockInvoker<String>(URL.valueOf("dubbo: Invoker<Strin... | public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new ArrayList<Invoker<T>>(); if (thenCondition == null) { logger... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... |
@Test public void testListAllPort() throws RemotingException { String result = port.telnet(null, ""); assertEquals("20887", result); } | public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true; } else { if (!StringUtils.isInteger(part)) ... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... |
@Test public void testErrorMessage() throws RemotingException { String result = port.telnet(null, "a"); assertEquals("Illegal port a, must be integer.", result); } | public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true; } else { if (!StringUtils.isInteger(part)) ... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... |
@Test public void testNoPort() throws RemotingException { String result = port.telnet(null, "-l 20880"); assertEquals("No such port 20880", result); } | public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true; } else { if (!StringUtils.isInteger(part)) ... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... | PortTelnetHandler implements TelnetHandler { public String telnet(Channel channel, String message) { StringBuilder buf = new StringBuilder(); String port = null; boolean detail = false; if (message.length() > 0) { String[] parts = message.split("\\s+"); for (String part : parts) { if ("-l".equals(part)) { detail = true... |
@Test public void testRoute_Placeholder() { Router router = new ConditionRouterFactory().getRouter(getRouteUrl("host = " + NetUtils.getLocalHost() + " => " + " host = $host")); List<Invoker<String>> invokers = new ArrayList<Invoker<String>>(); Invoker<String> invoker1 = new MockInvoker<String>(URL.valueOf("dubbo: Invok... | public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new ArrayList<Invoker<T>>(); if (thenCondition == null) { logger... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... |
@Test public void testDubboProtocol() throws Exception { DemoService service = new DemoServiceImpl(); protocol.export(proxy.getInvoker(service, DemoService.class, URL.valueOf("dubbo: service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("dubbo: assertEquals(service.enumlength(new Type[]{}), Type.Lower)... | public DubboProtocol() { INSTANCE = this; } | DubboProtocol extends AbstractProtocol { public DubboProtocol() { INSTANCE = this; } } | DubboProtocol extends AbstractProtocol { public DubboProtocol() { INSTANCE = this; } DubboProtocol(); } | DubboProtocol extends AbstractProtocol { public DubboProtocol() { INSTANCE = this; } DubboProtocol(); static DubboProtocol getDubboProtocol(); Collection<ExchangeServer> getServers(); Collection<Exporter<?>> getExporters(); Collection<Invoker<?>> getInvokers(); int getDefaultPort(); Exporter<T> export(Invoker<T> invoke... | DubboProtocol extends AbstractProtocol { public DubboProtocol() { INSTANCE = this; } DubboProtocol(); static DubboProtocol getDubboProtocol(); Collection<ExchangeServer> getServers(); Collection<Exporter<?>> getExporters(); Collection<Invoker<?>> getInvokers(); int getDefaultPort(); Exporter<T> export(Invoker<T> invoke... |
@Test public void testIsInjvmRefer() throws Exception { DemoService service = new DemoServiceImpl(); URL url = URL.valueOf("injvm: .addParameter(Constants.INTERFACE_KEY, DemoService.class.getName()); Exporter<?> exporter = protocol.export(proxy.getInvoker(service, DemoService.class, url)); exporters.add(exporter); url ... | public boolean isInjvmRefer(URL url) { final boolean isJvmRefer; String scope = url.getParameter(Constants.SCOPE_KEY); if (Constants.LOCAL_PROTOCOL.toString().equals(url.getProtocol())) { isJvmRefer = false; } else if (Constants.SCOPE_LOCAL.equals(scope) || (url.getParameter("injvm", false))) { isJvmRefer = true; } els... | InjvmProtocol extends AbstractProtocol implements Protocol { public boolean isInjvmRefer(URL url) { final boolean isJvmRefer; String scope = url.getParameter(Constants.SCOPE_KEY); if (Constants.LOCAL_PROTOCOL.toString().equals(url.getProtocol())) { isJvmRefer = false; } else if (Constants.SCOPE_LOCAL.equals(scope) || (... | InjvmProtocol extends AbstractProtocol implements Protocol { public boolean isInjvmRefer(URL url) { final boolean isJvmRefer; String scope = url.getParameter(Constants.SCOPE_KEY); if (Constants.LOCAL_PROTOCOL.toString().equals(url.getProtocol())) { isJvmRefer = false; } else if (Constants.SCOPE_LOCAL.equals(scope) || (... | InjvmProtocol extends AbstractProtocol implements Protocol { public boolean isInjvmRefer(URL url) { final boolean isJvmRefer; String scope = url.getParameter(Constants.SCOPE_KEY); if (Constants.LOCAL_PROTOCOL.toString().equals(url.getProtocol())) { isJvmRefer = false; } else if (Constants.SCOPE_LOCAL.equals(scope) || (... | InjvmProtocol extends AbstractProtocol implements Protocol { public boolean isInjvmRefer(URL url) { final boolean isJvmRefer; String scope = url.getParameter(Constants.SCOPE_KEY); if (Constants.LOCAL_PROTOCOL.toString().equals(url.getProtocol())) { isJvmRefer = false; } else if (Constants.SCOPE_LOCAL.equals(scope) || (... |
@Test public void testEncodeRequest() throws Exception { Request request = createRequest(); ChannelBuffer output = ChannelBuffers.dynamicBuffer(1024); codec.encode(channel, output, request); byte[] bytes = new byte[output.readableBytes()]; output.readBytes(bytes); ByteArrayInputStream bis = new ByteArrayInputStream(byt... | private void encodeRequest(Channel channel, ChannelBuffer buffer, Request request) throws IOException { RpcInvocation inv = (RpcInvocation) request.getData(); int seqId = nextSeqId(); String serviceName = inv.getAttachment(Constants.INTERFACE_KEY); if (StringUtils.isEmpty(serviceName)) { throw new IllegalArgumentExcept... | ThriftCodec implements Codec2 { private void encodeRequest(Channel channel, ChannelBuffer buffer, Request request) throws IOException { RpcInvocation inv = (RpcInvocation) request.getData(); int seqId = nextSeqId(); String serviceName = inv.getAttachment(Constants.INTERFACE_KEY); if (StringUtils.isEmpty(serviceName)) {... | ThriftCodec implements Codec2 { private void encodeRequest(Channel channel, ChannelBuffer buffer, Request request) throws IOException { RpcInvocation inv = (RpcInvocation) request.getData(); int seqId = nextSeqId(); String serviceName = inv.getAttachment(Constants.INTERFACE_KEY); if (StringUtils.isEmpty(serviceName)) {... | ThriftCodec implements Codec2 { private void encodeRequest(Channel channel, ChannelBuffer buffer, Request request) throws IOException { RpcInvocation inv = (RpcInvocation) request.getData(); int seqId = nextSeqId(); String serviceName = inv.getAttachment(Constants.INTERFACE_KEY); if (StringUtils.isEmpty(serviceName)) {... | ThriftCodec implements Codec2 { private void encodeRequest(Channel channel, ChannelBuffer buffer, Request request) throws IOException { RpcInvocation inv = (RpcInvocation) request.getData(); int seqId = nextSeqId(); String serviceName = inv.getAttachment(Constants.INTERFACE_KEY); if (StringUtils.isEmpty(serviceName)) {... |
@Test public void testRefer() throws Exception { } | public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException { ThriftInvoker<T> invoker = new ThriftInvoker<T>(type, url, getClients(url), invokers); invokers.add(invoker); return invoker; } | ThriftProtocol extends AbstractProtocol { public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException { ThriftInvoker<T> invoker = new ThriftInvoker<T>(type, url, getClients(url), invokers); invokers.add(invoker); return invoker; } } | ThriftProtocol extends AbstractProtocol { public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException { ThriftInvoker<T> invoker = new ThriftInvoker<T>(type, url, getClients(url), invokers); invokers.add(invoker); return invoker; } } | ThriftProtocol extends AbstractProtocol { public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException { ThriftInvoker<T> invoker = new ThriftInvoker<T>(type, url, getClients(url), invokers); invokers.add(invoker); return invoker; } int getDefaultPort(); Exporter<T> export(Invoker<T> invoker); void destroy(... | ThriftProtocol extends AbstractProtocol { public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException { ThriftInvoker<T> invoker = new ThriftInvoker<T>(type, url, getClients(url), invokers); invokers.add(invoker); return invoker; } int getDefaultPort(); Exporter<T> export(Invoker<T> invoker); void destroy(... |
@Test public void testGenerateMethodArgsClassName() { Assert.assertEquals( $__DemoStub.echoString_args.class.getName(), ThriftUtils.generateMethodArgsClassName( com.alibaba.dubbo.rpc.gen.dubbo.Demo.class.getName(), "echoString")); Assert.assertEquals( $__DemoStub.echoString_args.class.getName(), ExtensionLoader.getExte... | public static String generateMethodArgsClassName(String serviceName, String methodName) { int index = serviceName.lastIndexOf("."); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append("$__") .append(serviceName.substring(index + 1)) .append("Stub$") .append(methodName) .ap... | ThriftUtils { public static String generateMethodArgsClassName(String serviceName, String methodName) { int index = serviceName.lastIndexOf("."); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append("$__") .append(serviceName.substring(index + 1)) .append("Stub$") .append(m... | ThriftUtils { public static String generateMethodArgsClassName(String serviceName, String methodName) { int index = serviceName.lastIndexOf("."); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append("$__") .append(serviceName.substring(index + 1)) .append("Stub$") .append(m... | ThriftUtils { public static String generateMethodArgsClassName(String serviceName, String methodName) { int index = serviceName.lastIndexOf("."); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append("$__") .append(serviceName.substring(index + 1)) .append("Stub$") .append(m... | ThriftUtils { public static String generateMethodArgsClassName(String serviceName, String methodName) { int index = serviceName.lastIndexOf("."); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append("$__") .append(serviceName.substring(index + 1)) .append("Stub$") .append(m... |
@Test public void testGenerateMethodResultClassName() { Assert.assertEquals($__DemoStub.echoString_result.class.getName(), ThriftUtils.generateMethodResultClassName( com.alibaba.dubbo.rpc.gen.dubbo.Demo.class.getName(), "echoString")); Assert.assertEquals($__DemoStub.echoString_result.class.getName(), ExtensionLoader.g... | public static String generateMethodResultClassName(String serviceName, String method) { int index = serviceName.lastIndexOf("."); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append("$__") .append(serviceName.substring(index + 1)) .append("Stub$") .append(method) .append("... | ThriftUtils { public static String generateMethodResultClassName(String serviceName, String method) { int index = serviceName.lastIndexOf("."); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append("$__") .append(serviceName.substring(index + 1)) .append("Stub$") .append(met... | ThriftUtils { public static String generateMethodResultClassName(String serviceName, String method) { int index = serviceName.lastIndexOf("."); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append("$__") .append(serviceName.substring(index + 1)) .append("Stub$") .append(met... | ThriftUtils { public static String generateMethodResultClassName(String serviceName, String method) { int index = serviceName.lastIndexOf("."); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append("$__") .append(serviceName.substring(index + 1)) .append("Stub$") .append(met... | ThriftUtils { public static String generateMethodResultClassName(String serviceName, String method) { int index = serviceName.lastIndexOf("."); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append("$__") .append(serviceName.substring(index + 1)) .append("Stub$") .append(met... |
@Test public void testGenerateMethodArgsClassNameThrift() { Assert.assertEquals(com.alibaba.dubbo.rpc.gen.thrift.Demo.echoString_args.class.getName(), ThriftUtils.generateMethodArgsClassNameThrift( com.alibaba.dubbo.rpc.gen.thrift.Demo.Iface.class.getName(), "echoString")); Assert.assertEquals(com.alibaba.dubbo.rpc.gen... | public static String generateMethodArgsClassNameThrift(String serviceName, String methodName) { int index = serviceName.indexOf("$"); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append(methodName) .append("_args") .toString(); } return null; } | ThriftUtils { public static String generateMethodArgsClassNameThrift(String serviceName, String methodName) { int index = serviceName.indexOf("$"); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append(methodName) .append("_args") .toString(); } return null; } } | ThriftUtils { public static String generateMethodArgsClassNameThrift(String serviceName, String methodName) { int index = serviceName.indexOf("$"); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append(methodName) .append("_args") .toString(); } return null; } } | ThriftUtils { public static String generateMethodArgsClassNameThrift(String serviceName, String methodName) { int index = serviceName.indexOf("$"); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append(methodName) .append("_args") .toString(); } return null; } static String... | ThriftUtils { public static String generateMethodArgsClassNameThrift(String serviceName, String methodName) { int index = serviceName.indexOf("$"); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append(methodName) .append("_args") .toString(); } return null; } static String... |
@Test public void testGenerateMethodResultClassNameThrift() { Assert.assertEquals(com.alibaba.dubbo.rpc.gen.thrift.Demo.echoString_result.class.getName(), ThriftUtils.generateMethodResultClassNameThrift( com.alibaba.dubbo.rpc.gen.thrift.Demo.Iface.class.getName(), "echoString")); Assert.assertEquals(com.alibaba.dubbo.r... | public static String generateMethodResultClassNameThrift(String serviceName, String methodName) { int index = serviceName.indexOf("$"); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append(methodName) .append("_result") .toString(); } return null; } | ThriftUtils { public static String generateMethodResultClassNameThrift(String serviceName, String methodName) { int index = serviceName.indexOf("$"); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append(methodName) .append("_result") .toString(); } return null; } } | ThriftUtils { public static String generateMethodResultClassNameThrift(String serviceName, String methodName) { int index = serviceName.indexOf("$"); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append(methodName) .append("_result") .toString(); } return null; } } | ThriftUtils { public static String generateMethodResultClassNameThrift(String serviceName, String methodName) { int index = serviceName.indexOf("$"); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append(methodName) .append("_result") .toString(); } return null; } static St... | ThriftUtils { public static String generateMethodResultClassNameThrift(String serviceName, String methodName) { int index = serviceName.indexOf("$"); if (index > 0) { return new StringBuilder(32) .append(serviceName.substring(0, index + 1)) .append(methodName) .append("_result") .toString(); } return null; } static St... |
@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: Invoker... | public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new ArrayList<Invoker<T>>(); if (thenCondition == null) { logger... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... |
@SuppressWarnings("unchecked") @Test public void testRpcException() { Logger logger = EasyMock.createMock(Logger.class); RpcContext.getContext().setRemoteAddress("127.0.0.1", 1234); RpcException exception = new RpcException("TestRpcException"); logger.error(EasyMock.eq("Got unchecked and undeclared exception which call... | public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { try { Result result = invoker.invoke(invocation); if (result.hasException() && GenericService.class != invoker.getInterface()) { try { Throwable exception = result.getException(); if (!(exception instanceof RuntimeException) && (excep... | ExceptionFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { try { Result result = invoker.invoke(invocation); if (result.hasException() && GenericService.class != invoker.getInterface()) { try { Throwable exception = result.getException(); if (!(exception in... | ExceptionFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { try { Result result = invoker.invoke(invocation); if (result.hasException() && GenericService.class != invoker.getInterface()) { try { Throwable exception = result.getException(); if (!(exception in... | ExceptionFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { try { Result result = invoker.invoke(invocation); if (result.hasException() && GenericService.class != invoker.getInterface()) { try { Throwable exception = result.getException(); if (!(exception in... | ExceptionFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { try { Result result = invoker.invoke(invocation); if (result.hasException() && GenericService.class != invoker.getInterface()) { try { Throwable exception = result.getException(); if (!(exception in... |
@Test public void testDeprecatedFilter() { URL url = URL.valueOf("test: LogUtil.start(); deprecatedFilter.invoke(new MyInvoker<DemoService>(url), new MockInvocation()); assertEquals(1, LogUtil.findMessage("The service method com.alibaba.dubbo.rpc.support.DemoService.echo(String) is DEPRECATED")); LogUtil.stop(); } | public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { String key = invoker.getInterface().getName() + "." + invocation.getMethodName(); if (!logged.contains(key)) { logged.add(key); if (invoker.getUrl().getMethodParameter(invocation.getMethodName(), Constants.DEPRECATED_KEY, false)) { LO... | DeprecatedFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { String key = invoker.getInterface().getName() + "." + invocation.getMethodName(); if (!logged.contains(key)) { logged.add(key); if (invoker.getUrl().getMethodParameter(invocation.getMethodName(), C... | DeprecatedFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { String key = invoker.getInterface().getName() + "." + invocation.getMethodName(); if (!logged.contains(key)) { logged.add(key); if (invoker.getUrl().getMethodParameter(invocation.getMethodName(), C... | DeprecatedFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { String key = invoker.getInterface().getName() + "." + invocation.getMethodName(); if (!logged.contains(key)) { logged.add(key); if (invoker.getUrl().getMethodParameter(invocation.getMethodName(), C... | DeprecatedFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { String key = invoker.getInterface().getName() + "." + invocation.getMethodName(); if (!logged.contains(key)) { logged.add(key); if (invoker.getUrl().getMethodParameter(invocation.getMethodName(), C... |
@Test public void testInvokeNoActives() { URL url = URL.valueOf("test: Invoker<ActiveLimitFilterTest> invoker = new MyInvoker<ActiveLimitFilterTest>(url); Invocation invocation = new MockInvocation(); activeLimitFilter.invoke(invoker, invocation); } | public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStatus(invoker.getUrl(), invocation.getMet... | ActiveLimitFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStat... | ActiveLimitFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStat... | ActiveLimitFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStat... | ActiveLimitFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStat... |
@Test public void testInvokeLessActives() { URL url = URL.valueOf("test: Invoker<ActiveLimitFilterTest> invoker = new MyInvoker<ActiveLimitFilterTest>(url); Invocation invocation = new MockInvocation(); activeLimitFilter.invoke(invoker, invocation); } | public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStatus(invoker.getUrl(), invocation.getMet... | ActiveLimitFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStat... | ActiveLimitFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStat... | ActiveLimitFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStat... | ActiveLimitFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStat... |
@Test public void testInvokeGreaterActives() { URL url = URL.valueOf("test: final Invoker<ActiveLimitFilterTest> invoker = new MyInvoker<ActiveLimitFilterTest>(url); final Invocation invocation = new MockInvocation(); for (int i = 0; i < 100; i++) { Thread thread = new Thread(new Runnable() { public void run() { for (i... | public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStatus(invoker.getUrl(), invocation.getMet... | ActiveLimitFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStat... | ActiveLimitFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStat... | ActiveLimitFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStat... | ActiveLimitFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { URL url = invoker.getUrl(); String methodName = invocation.getMethodName(); int max = invoker.getUrl().getMethodParameter(methodName, Constants.ACTIVES_KEY, 0); RpcStatus count = RpcStatus.getStat... |
@SuppressWarnings("unchecked") @Test public void testSetContext() { invocation = EasyMock.createMock(Invocation.class); EasyMock.expect(invocation.getMethodName()).andReturn("$enumlength").anyTimes(); EasyMock.expect(invocation.getParameterTypes()).andReturn(new Class<?>[]{Enum.class}).anyTimes(); EasyMock.expect(invoc... | public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { Map<String, String> attachments = invocation.getAttachments(); if (attachments != null) { attachments = new HashMap<String, String>(attachments); attachments.remove(Constants.PATH_KEY); attachments.remove(Constants.GROUP_KEY); attachm... | ContextFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { Map<String, String> attachments = invocation.getAttachments(); if (attachments != null) { attachments = new HashMap<String, String>(attachments); attachments.remove(Constants.PATH_KEY); attachments.re... | ContextFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { Map<String, String> attachments = invocation.getAttachments(); if (attachments != null) { attachments = new HashMap<String, String>(attachments); attachments.remove(Constants.PATH_KEY); attachments.re... | ContextFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { Map<String, String> attachments = invocation.getAttachments(); if (attachments != null) { attachments = new HashMap<String, String>(attachments); attachments.remove(Constants.PATH_KEY); attachments.re... | ContextFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { Map<String, String> attachments = invocation.getAttachments(); if (attachments != null) { attachments = new HashMap<String, String>(attachments); attachments.remove(Constants.PATH_KEY); attachments.re... |
@Test public void testWithAttachments() { URL url = URL.valueOf("test: Invoker<DemoService> invoker = new MyInvoker<DemoService>(url); Invocation invocation = new MockInvocation(); Result result = contextFilter.invoke(invoker, invocation); assertNull(RpcContext.getContext().getInvoker()); } | public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { Map<String, String> attachments = invocation.getAttachments(); if (attachments != null) { attachments = new HashMap<String, String>(attachments); attachments.remove(Constants.PATH_KEY); attachments.remove(Constants.GROUP_KEY); attachm... | ContextFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { Map<String, String> attachments = invocation.getAttachments(); if (attachments != null) { attachments = new HashMap<String, String>(attachments); attachments.remove(Constants.PATH_KEY); attachments.re... | ContextFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { Map<String, String> attachments = invocation.getAttachments(); if (attachments != null) { attachments = new HashMap<String, String>(attachments); attachments.remove(Constants.PATH_KEY); attachments.re... | ContextFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { Map<String, String> attachments = invocation.getAttachments(); if (attachments != null) { attachments = new HashMap<String, String>(attachments); attachments.remove(Constants.PATH_KEY); attachments.re... | ContextFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { Map<String, String> attachments = invocation.getAttachments(); if (attachments != null) { attachments = new HashMap<String, String>(attachments); attachments.remove(Constants.PATH_KEY); attachments.re... |
@Test public void testRoute_Force() { Router router = new ConditionRouterFactory().getRouter(getRouteUrl("host = " + NetUtils.getLocalHost() + " => " + " host = 1.2.3.4").addParameter(Constants.FORCE_KEY, String.valueOf(true))); List<Invoker<String>> invokers = new ArrayList<Invoker<String>>(); Invoker<String> invoker1... | public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new ArrayList<Invoker<T>>(); if (thenCondition == null) { logger... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... |
@Test public void testSetContext() { URL url = URL.valueOf("test: Invoker<DemoService> invoker = new MyInvoker<DemoService>(url); Invocation invocation = new MockInvocation(); consumerContextFilter.invoke(invoker, invocation); assertEquals(invoker, RpcContext.getContext().getInvoker()); assertEquals(invocation, RpcCont... | public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { RpcContext.getContext() .setInvoker(invoker) .setInvocation(invocation) .setLocalAddress(NetUtils.getLocalHost(), 0) .setRemoteAddress(invoker.getUrl().getHost(), invoker.getUrl().getPort()); if (invocation instanceof RpcInvocation) {... | ConsumerContextFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { RpcContext.getContext() .setInvoker(invoker) .setInvocation(invocation) .setLocalAddress(NetUtils.getLocalHost(), 0) .setRemoteAddress(invoker.getUrl().getHost(), invoker.getUrl().getPort()); ... | ConsumerContextFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { RpcContext.getContext() .setInvoker(invoker) .setInvocation(invocation) .setLocalAddress(NetUtils.getLocalHost(), 0) .setRemoteAddress(invoker.getUrl().getHost(), invoker.getUrl().getPort()); ... | ConsumerContextFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { RpcContext.getContext() .setInvoker(invoker) .setInvocation(invocation) .setLocalAddress(NetUtils.getLocalHost(), 0) .setRemoteAddress(invoker.getUrl().getHost(), invoker.getUrl().getPort()); ... | ConsumerContextFilter implements Filter { public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { RpcContext.getContext() .setInvoker(invoker) .setInvocation(invocation) .setLocalAddress(NetUtils.getLocalHost(), 0) .setRemoteAddress(invoker.getUrl().getHost(), invoker.getUrl().getPort()); ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.