本文整理汇总了Java中com.alibaba.dubbo.registry.common.domain.Route.setPriority方法的典型用法代码示例。如果您正苦于以下问题:Java Route.setPriority方法的具体用法?Java Route.setPriority怎么用?Java Route.setPriority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.dubbo.registry.common.domain.Route
的用法示例。
在下文中一共展示了Route.setPriority方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: url2Route
import com.alibaba.dubbo.registry.common.domain.Route; //导入方法依赖的package包/类
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;
}
示例2: url2Route
import com.alibaba.dubbo.registry.common.domain.Route; //导入方法依赖的package包/类
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;
}
示例3: test_matchRoute
import com.alibaba.dubbo.registry.common.domain.Route; //导入方法依赖的package包/类
@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));
}
}
示例4: test_matchRoute
import com.alibaba.dubbo.registry.common.domain.Route; //导入方法依赖的package包/类
@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));
}
}