Java Code Examples for com.alibaba.dubbo.registry.common.domain.Route#setId()
The following examples show how to use
com.alibaba.dubbo.registry.common.domain.Route#setId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SyncUtils.java From dubbox with Apache License 2.0 | 6 votes |
public static Route url2Route(Pair<Long, URL> pair) { if (pair == null) { return null; } Long id = pair.getKey(); URL url = pair.getValue(); if (null == url) return null; Route r = new Route(); r.setId(id); r.setName(url.getParameter("name")); r.setService(url.getServiceKey()); r.setPriority(url.getParameter(Constants.PRIORITY_KEY, 0)); r.setEnabled(url.getParameter(Constants.ENABLED_KEY, true)); r.setForce(url.getParameter(Constants.FORCE_KEY, false)); r.setRule(url.getParameterAndDecoded(Constants.RULE_KEY)); return r; }
Example 2
Source File: SyncUtils.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public static Route url2Route(Pair<Long, URL> pair) { if (pair == null) { return null; } Long id = pair.getKey(); URL url = pair.getValue(); if (null == url) return null; Route r = new Route(); r.setId(id); r.setName(url.getParameter("name")); r.setService(url.getServiceKey()); r.setPriority(url.getParameter(Constants.PRIORITY_KEY, 0)); r.setEnabled(url.getParameter(Constants.ENABLED_KEY, true)); r.setForce(url.getParameter(Constants.FORCE_KEY, false)); r.setRule(url.getParameterAndDecoded(Constants.RULE_KEY)); return r; }
Example 3
Source File: SyncUtils.java From dubbo3 with Apache License 2.0 | 6 votes |
public static Route url2Route(Pair<Long, URL> pair) { if (pair == null) { return null; } Long id = pair.getKey(); URL url = pair.getValue(); if (null == url) return null; Route r = new Route(); r.setId(id); r.setName(url.getParameter("name")); r.setService(url.getServiceKey()); r.setPriority(url.getParameter(Constants.PRIORITY_KEY, 0)); r.setEnabled(url.getParameter(Constants.ENABLED_KEY, true)); r.setForce(url.getParameter(Constants.FORCE_KEY, false)); r.setRule(url.getParameterAndDecoded(Constants.RULE_KEY)); return r; }
Example 4
Source File: SyncUtils.java From dubbox with Apache License 2.0 | 6 votes |
public static Route url2Route(Pair<Long, URL> pair) { if (pair == null) { return null; } Long id = pair.getKey(); URL url = pair.getValue(); if (null == url) return null; Route r = new Route(); r.setId(id); r.setName(url.getParameter("name")); r.setService(url.getServiceKey()); r.setPriority(url.getParameter(Constants.PRIORITY_KEY, 0)); r.setEnabled(url.getParameter(Constants.ENABLED_KEY, true)); r.setForce(url.getParameter(Constants.FORCE_KEY, false)); r.setRule(url.getParameterAndDecoded(Constants.RULE_KEY)); return r; }
Example 5
Source File: SyncUtils.java From dubbox with Apache License 2.0 | 6 votes |
public static Route url2Route(Pair<Long, URL> pair) { if (pair == null) { return null; } Long id = pair.getKey(); URL url = pair.getValue(); if (null == url) return null; Route r = new Route(); r.setId(id); r.setName(url.getParameter("name")); r.setService(url.getServiceKey()); r.setPriority(url.getParameter(Constants.PRIORITY_KEY, 0)); r.setEnabled(url.getParameter(Constants.ENABLED_KEY, true)); r.setForce(url.getParameter(Constants.FORCE_KEY, false)); r.setRule(url.getParameterAndDecoded(Constants.RULE_KEY)); return r; }
Example 6
Source File: RouteUtilsTest.java From dubbox with Apache License 2.0 | 5 votes |
@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&application=kylin", route, clusters)); assertFalse(RouteUtils.matchRoute("9.9.9.9", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.host = 1.1.2.2 & consumer.application = kylin"); assertTrue(RouteUtils.matchRoute("1.1.2.2", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.host = 1.1.2.2 & consumer.application = notExstied"); assertFalse(RouteUtils.matchRoute("1.1.2.2", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&methods=getPort,say&application=kylin", route, clusters)); } { route.setMatchRule("consumer.cluster = cluster1"); assertTrue(RouteUtils.matchRoute("7.7.7.7:20880", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); assertFalse(RouteUtils.matchRoute("9.9.9.9", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.cluster = cluster1 & consumer.application = kylin"); assertTrue(RouteUtils.matchRoute("7.7.7.7", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.cluster = cluster1 & consumer.application = notExstied"); assertFalse(RouteUtils.matchRoute("7.7.7.7", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&methods=getPort,say&application=kylin", route, clusters)); } }
Example 7
Source File: RouteUtilsTest.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
@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&application=kylin", route, clusters)); assertFalse(RouteUtils.matchRoute("9.9.9.9", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.host = 1.1.2.2 & consumer.application = kylin"); assertTrue(RouteUtils.matchRoute("1.1.2.2", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.host = 1.1.2.2 & consumer.application = notExstied"); assertFalse(RouteUtils.matchRoute("1.1.2.2", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&methods=getPort,say&application=kylin", route, clusters)); } { route.setMatchRule("consumer.cluster = cluster1"); assertTrue(RouteUtils.matchRoute("7.7.7.7:20880", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); assertFalse(RouteUtils.matchRoute("9.9.9.9", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.cluster = cluster1 & consumer.application = kylin"); assertTrue(RouteUtils.matchRoute("7.7.7.7", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.cluster = cluster1 & consumer.application = notExstied"); assertFalse(RouteUtils.matchRoute("7.7.7.7", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&methods=getPort,say&application=kylin", route, clusters)); } }
Example 8
Source File: RouteUtilsTest.java From dubbo3 with Apache License 2.0 | 5 votes |
@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&application=kylin", route, clusters)); assertFalse(RouteUtils.matchRoute("9.9.9.9", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.host = 1.1.2.2 & consumer.application = kylin"); assertTrue(RouteUtils.matchRoute("1.1.2.2", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.host = 1.1.2.2 & consumer.application = notExstied"); assertFalse(RouteUtils.matchRoute("1.1.2.2", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&methods=getPort,say&application=kylin", route, clusters)); } { route.setMatchRule("consumer.cluster = cluster1"); assertTrue(RouteUtils.matchRoute("7.7.7.7:20880", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); assertFalse(RouteUtils.matchRoute("9.9.9.9", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.cluster = cluster1 & consumer.application = kylin"); assertTrue(RouteUtils.matchRoute("7.7.7.7", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.cluster = cluster1 & consumer.application = notExstied"); assertFalse(RouteUtils.matchRoute("7.7.7.7", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&methods=getPort,say&application=kylin", route, clusters)); } }
Example 9
Source File: RouteUtilsTest.java From dubbox with Apache License 2.0 | 5 votes |
@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&application=kylin", route, clusters)); assertFalse(RouteUtils.matchRoute("9.9.9.9", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.host = 1.1.2.2 & consumer.application = kylin"); assertTrue(RouteUtils.matchRoute("1.1.2.2", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.host = 1.1.2.2 & consumer.application = notExstied"); assertFalse(RouteUtils.matchRoute("1.1.2.2", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&methods=getPort,say&application=kylin", route, clusters)); } { route.setMatchRule("consumer.cluster = cluster1"); assertTrue(RouteUtils.matchRoute("7.7.7.7:20880", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); assertFalse(RouteUtils.matchRoute("9.9.9.9", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.cluster = cluster1 & consumer.application = kylin"); assertTrue(RouteUtils.matchRoute("7.7.7.7", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.cluster = cluster1 & consumer.application = notExstied"); assertFalse(RouteUtils.matchRoute("7.7.7.7", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&methods=getPort,say&application=kylin", route, clusters)); } }
Example 10
Source File: RouteUtilsTest.java From dubbox with Apache License 2.0 | 5 votes |
@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&application=kylin", route, clusters)); assertFalse(RouteUtils.matchRoute("9.9.9.9", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.host = 1.1.2.2 & consumer.application = kylin"); assertTrue(RouteUtils.matchRoute("1.1.2.2", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.host = 1.1.2.2 & consumer.application = notExstied"); assertFalse(RouteUtils.matchRoute("1.1.2.2", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&methods=getPort,say&application=kylin", route, clusters)); } { route.setMatchRule("consumer.cluster = cluster1"); assertTrue(RouteUtils.matchRoute("7.7.7.7:20880", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); assertFalse(RouteUtils.matchRoute("9.9.9.9", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.cluster = cluster1 & consumer.application = kylin"); assertTrue(RouteUtils.matchRoute("7.7.7.7", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&application=kylin", route, clusters)); route.setMatchRule("consumer.cluster = cluster1 & consumer.application = notExstied"); assertFalse(RouteUtils.matchRoute("7.7.7.7", "dubbo=2.0.0&version=3.0.0&revision=3.0.0&methods=getPort,say&application=kylin", route, clusters)); } }