本文整理汇总了Java中com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair类的典型用法代码示例。如果您正苦于以下问题:Java MatchPair类的具体用法?Java MatchPair怎么用?Java MatchPair使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MatchPair类属于com.alibaba.dubbo.registry.common.route.RouteRule包,在下文中一共展示了MatchPair类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testParse_Simple
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void testParse_Simple() throws Exception {
final Map<String, RouteRule.MatchPair> whenParams = new HashMap<String, RouteRule.MatchPair>();
final Map<String, RouteRule.MatchPair> thenParams = new HashMap<String, RouteRule.MatchPair>();
RouteRule.MatchPair p = new RouteRule.MatchPair();
p.matches.add("com.alibaba.morgan.*");
p.unmatches.add("com.alibaba.morgan.MemberService");
whenParams.put("service", p);
p = new RouteRule.MatchPair();
p.matches.add("10.16.26.51");
thenParams.put("provider.host", p);
assertEquals(RouteRule.createFromCondition(whenParams, thenParams),
RouteRule.parse("service=com.alibaba.morgan.*&service!=com.alibaba.morgan.MemberService", "provider.host=10.16.26.51"));
}
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:18,代码来源:RouteRuleTest.java
示例2: testParse_Simple
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void testParse_Simple() throws Exception {
final Map<String, RouteRule.MatchPair> whenParams = new HashMap<String, RouteRule.MatchPair>();
final Map<String, RouteRule.MatchPair> thenParams = new HashMap<String, RouteRule.MatchPair>();
RouteRule.MatchPair p = new RouteRule.MatchPair();
p.matches.add("com.alibaba.morgan.*");
p.unmatches.add("com.alibaba.morgan.MemberService");
whenParams.put("service", p);
p = new RouteRule.MatchPair();
p.matches.add("10.16.26.51");
thenParams.put("provider.host", p);
assertEquals(RouteRule.createFromCondition(whenParams, thenParams),
RouteRule.parse("service=com.alibaba.morgan.*&service!=com.alibaba.morgan.MemberService", "provider.host=10.16.26.51"));
}
开发者ID:l1325169021,项目名称:github-test,代码行数:18,代码来源:RouteRuleTest.java
示例3: test_MatchPair_copy
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void test_MatchPair_copy() throws Exception {
MatchPair copy = pair.copy();
assertEquals(pair, copy);
copy.matches.remove("+a");
assertFalse(pair.equals(copy));
copy = pair.copy();
copy.matches.add("+z");
assertFalse(pair.equals(copy));
}
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:13,代码来源:RouteRuleTest.java
示例4: testParse_MatchRight
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void testParse_MatchRight() throws Exception {
final Map<String, RouteRule.MatchPair> whenParams = new HashMap<String, RouteRule.MatchPair>();
final Map<String, RouteRule.MatchPair> thenParams = new HashMap<String, RouteRule.MatchPair>();
RouteRule.MatchPair p = new RouteRule.MatchPair();
p.matches.add("com.alibaba.MemberService");
p.matches.add("AuthService");
whenParams.put("service", p);
p = new RouteRule.MatchPair();
p.matches.add("127.0.0.1");
p.matches.add("17.58.25.62");
whenParams.put("consumer.host", p);
p = new RouteRule.MatchPair();
p.matches.add("1.0.0");
p.matches.add("1.0.6");
whenParams.put("consumer.version", p);
p = new RouteRule.MatchPair();
p.matches.add("morgan");
p.matches.add("pc2");
thenParams.put("provider.application", p);
p = new RouteRule.MatchPair();
p.matches.add("10.16.26.51");
thenParams.put("provider.host", p);
p = new RouteRule.MatchPair();
p.matches.add("1020");
thenParams.put("provider.port", p);
assertEquals(RouteRule.createFromCondition(whenParams, thenParams),
RouteRule.parse("service=com.alibaba.MemberService,AuthService&consumer.host=127.0.0.1,17.58.25.62&consumer.version = 1.0.0,1.0.6",
"provider.application=morgan,pc2&provider.host=10.16.26.51&provider.port=1020"));
}
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:38,代码来源:RouteRuleTest.java
示例5: testParse_MisMatchRight
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void testParse_MisMatchRight() throws Exception {
final Map<String, RouteRule.MatchPair> whenParams = new HashMap<String, RouteRule.MatchPair>();
final Map<String, RouteRule.MatchPair> thenParams = new HashMap<String, RouteRule.MatchPair>();
RouteRule.MatchPair p = new RouteRule.MatchPair();
p.unmatches.add("com.alibaba.MemberService");
p.unmatches.add("AuthService");
whenParams.put("service", p);
p = new RouteRule.MatchPair();
p.unmatches.add("127.0.0.1");
whenParams.put("consumer.host", p);
p = new RouteRule.MatchPair();
p.unmatches.add("1.0.0");
p.unmatches.add("1.0.6");
whenParams.put("consumer.version", p);
p = new RouteRule.MatchPair();
p.unmatches.add("morgan");
p.unmatches.add("pc2");
thenParams.put("provider.application", p);
p = new RouteRule.MatchPair();
p.unmatches.add("10.16.26.51");
thenParams.put("provider.host", p);
p = new RouteRule.MatchPair();
p.unmatches.add("1020");
thenParams.put("provider.port", p);
assertEquals(RouteRule.createFromCondition(whenParams, thenParams),
RouteRule.parse("service!=com.alibaba.MemberService,AuthService&consumer.host!=127.0.0.1&consumer.version != 1.0.0,1.0.6",
"provider.application!=morgan,pc2&provider.host!=10.16.26.51&provider.port!=1020"));
}
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:37,代码来源:RouteRuleTest.java
示例6: testParse_AllRight
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void testParse_AllRight() throws Exception {
final Map<String, RouteRule.MatchPair> whenParams = new HashMap<String, RouteRule.MatchPair>();
final Map<String, RouteRule.MatchPair> thenParams = new HashMap<String, RouteRule.MatchPair>();
RouteRule.MatchPair p = new RouteRule.MatchPair();
p.matches.add("com.alibaba.MemberService");
p.matches.add("AuthService");
p.unmatches.add("com.alibaba.DomainService");
p.unmatches.add("com.alibaba.ViewCacheService");
whenParams.put("service", p);
p = new RouteRule.MatchPair();
p.unmatches.add("127.0.0.1");
p.unmatches.add("15.11.57.6");
whenParams.put("consumer.host", p);
p = new RouteRule.MatchPair();
p.matches.add("2.0.0");
p.unmatches.add("1.0.0");
whenParams.put("consumer.version", p);
p = new RouteRule.MatchPair();
p.matches.add("morgan");
p.matches.add("pc2");
thenParams.put("provider.application", p);
p = new RouteRule.MatchPair();
p.matches.add("10.16.26.51");
thenParams.put("provider.host", p);
p = new RouteRule.MatchPair();
p.matches.add("1020");
thenParams.put("provider.port", p);
assertEquals(RouteRule.createFromCondition(whenParams, thenParams),
RouteRule.parse("service=com.alibaba.MemberService,AuthService&service!=com.alibaba.DomainService,com.alibaba.ViewCacheService" +
"&consumer.host!=127.0.0.1,15.11.57.6&consumer.version = 2.0.0&consumer.version != 1.0.0",
"provider.application=morgan,pc2&provider.host=10.16.26.51&provider.port=1020"));
}
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:41,代码来源:RouteRuleTest.java
示例7: testParseRule_empty
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void testParseRule_empty() throws Exception {
Map<String, RouteRule.MatchPair> condtion = RouteRule.parseRule(null);
assertEquals(0, condtion.size());
condtion = RouteRule.parseRule("");
assertEquals(0, condtion.size());
condtion = RouteRule.parseRule(" ");
assertEquals(0, condtion.size());
}
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:12,代码来源:RouteRuleTest.java
示例8: testParseRule_complex
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void testParseRule_complex() throws Exception {
Map<String, RouteRule.MatchPair> when = RouteRule.parseRule("when1=valueW1 ,valueW1 & when2 = valueW2,valueW3, valueW4 & when2 != valueWu,valueWv & when3!=valueWx,valueWy");
Map<String, RouteRule.MatchPair> then = RouteRule.parseRule("then1 = valueT1 & then2 = valueT2,valueT3, valueT4");
Map<String, RouteRule.MatchPair> expectedWhen = new HashMap<String, RouteRule.MatchPair>();
RouteRule.MatchPair p = new RouteRule.MatchPair();
p.matches.add("valueW1");
expectedWhen.put("when1", p);
p = new RouteRule.MatchPair();
p.matches.add("valueW2");
p.matches.add("valueW3");
p.matches.add("valueW4");
p.unmatches.add("valueWu");
p.unmatches.add("valueWv");
expectedWhen.put("when2", p);
p = new RouteRule.MatchPair();
p.unmatches.add("valueWx");
p.unmatches.add("valueWy");
expectedWhen.put("when3", p);
assertEquals(expectedWhen, when);
Map<String, RouteRule.MatchPair> expectedThen = new HashMap<String, RouteRule.MatchPair>();
p = new RouteRule.MatchPair();
p.matches.add("valueT1");
expectedThen.put("then1", p);
p = new RouteRule.MatchPair();
p.matches.add("valueT2");
p.matches.add("valueT3");
p.matches.add("valueT4");
expectedThen.put("then2", p);
assertEquals(expectedThen, then);
}
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:41,代码来源:RouteRuleTest.java
示例9: test_MatchPair_copy
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void test_MatchPair_copy() throws Exception {
MatchPair copy = pair.copy();
assertEquals(pair, copy);
copy.matches.remove("+a");
assertFalse(pair.equals(copy));
copy = pair.copy();
copy.matches.add("+z");
assertFalse(pair.equals(copy));
}
开发者ID:l1325169021,项目名称:github-test,代码行数:13,代码来源:RouteRuleTest.java
示例10: testParse_MatchRight
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void testParse_MatchRight() throws Exception {
final Map<String, RouteRule.MatchPair> whenParams = new HashMap<String, RouteRule.MatchPair>();
final Map<String, RouteRule.MatchPair> thenParams = new HashMap<String, RouteRule.MatchPair>();
RouteRule.MatchPair p = new RouteRule.MatchPair();
p.matches.add("com.alibaba.MemberService");
p.matches.add("AuthService");
whenParams.put("service", p);
p = new RouteRule.MatchPair();
p.matches.add("127.0.0.1");
p.matches.add("17.58.25.62");
whenParams.put("consumer.host", p);
p = new RouteRule.MatchPair();
p.matches.add("1.0.0");
p.matches.add("1.0.6");
whenParams.put("consumer.version", p);
p = new RouteRule.MatchPair();
p.matches.add("morgan");
p.matches.add("pc2");
thenParams.put("provider.application", p);
p = new RouteRule.MatchPair();
p.matches.add("10.16.26.51");
thenParams.put("provider.host", p);
p = new RouteRule.MatchPair();
p.matches.add("1020");
thenParams.put("provider.port", p);
assertEquals(RouteRule.createFromCondition(whenParams, thenParams),
RouteRule.parse("service=com.alibaba.MemberService,AuthService&consumer.host=127.0.0.1,17.58.25.62&consumer.version = 1.0.0,1.0.6",
"provider.application=morgan,pc2&provider.host=10.16.26.51&provider.port=1020"));
}
开发者ID:l1325169021,项目名称:github-test,代码行数:38,代码来源:RouteRuleTest.java
示例11: testParse_MisMatchRight
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void testParse_MisMatchRight() throws Exception {
final Map<String, RouteRule.MatchPair> whenParams = new HashMap<String, RouteRule.MatchPair>();
final Map<String, RouteRule.MatchPair> thenParams = new HashMap<String, RouteRule.MatchPair>();
RouteRule.MatchPair p = new RouteRule.MatchPair();
p.unmatches.add("com.alibaba.MemberService");
p.unmatches.add("AuthService");
whenParams.put("service", p);
p = new RouteRule.MatchPair();
p.unmatches.add("127.0.0.1");
whenParams.put("consumer.host", p);
p = new RouteRule.MatchPair();
p.unmatches.add("1.0.0");
p.unmatches.add("1.0.6");
whenParams.put("consumer.version", p);
p = new RouteRule.MatchPair();
p.unmatches.add("morgan");
p.unmatches.add("pc2");
thenParams.put("provider.application", p);
p = new RouteRule.MatchPair();
p.unmatches.add("10.16.26.51");
thenParams.put("provider.host", p);
p = new RouteRule.MatchPair();
p.unmatches.add("1020");
thenParams.put("provider.port", p);
assertEquals(RouteRule.createFromCondition(whenParams, thenParams),
RouteRule.parse("service!=com.alibaba.MemberService,AuthService&consumer.host!=127.0.0.1&consumer.version != 1.0.0,1.0.6",
"provider.application!=morgan,pc2&provider.host!=10.16.26.51&provider.port!=1020"));
}
开发者ID:l1325169021,项目名称:github-test,代码行数:37,代码来源:RouteRuleTest.java
示例12: testParse_AllRight
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void testParse_AllRight() throws Exception {
final Map<String, RouteRule.MatchPair> whenParams = new HashMap<String, RouteRule.MatchPair>();
final Map<String, RouteRule.MatchPair> thenParams = new HashMap<String, RouteRule.MatchPair>();
RouteRule.MatchPair p = new RouteRule.MatchPair();
p.matches.add("com.alibaba.MemberService");
p.matches.add("AuthService");
p.unmatches.add("com.alibaba.DomainService");
p.unmatches.add("com.alibaba.ViewCacheService");
whenParams.put("service", p);
p = new RouteRule.MatchPair();
p.unmatches.add("127.0.0.1");
p.unmatches.add("15.11.57.6");
whenParams.put("consumer.host", p);
p = new RouteRule.MatchPair();
p.matches.add("2.0.0");
p.unmatches.add("1.0.0");
whenParams.put("consumer.version", p);
p = new RouteRule.MatchPair();
p.matches.add("morgan");
p.matches.add("pc2");
thenParams.put("provider.application", p);
p = new RouteRule.MatchPair();
p.matches.add("10.16.26.51");
thenParams.put("provider.host", p);
p = new RouteRule.MatchPair();
p.matches.add("1020");
thenParams.put("provider.port", p);
assertEquals(RouteRule.createFromCondition(whenParams, thenParams),
RouteRule.parse("service=com.alibaba.MemberService,AuthService&service!=com.alibaba.DomainService,com.alibaba.ViewCacheService" +
"&consumer.host!=127.0.0.1,15.11.57.6&consumer.version = 2.0.0&consumer.version != 1.0.0",
"provider.application=morgan,pc2&provider.host=10.16.26.51&provider.port=1020"));
}
开发者ID:l1325169021,项目名称:github-test,代码行数:41,代码来源:RouteRuleTest.java
示例13: testParseRule_empty
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void testParseRule_empty() throws Exception {
Map<String, RouteRule.MatchPair> condtion = RouteRule.parseRule(null);
assertEquals(0, condtion.size());
condtion = RouteRule.parseRule("");
assertEquals(0, condtion.size());
condtion = RouteRule.parseRule(" ");
assertEquals(0, condtion.size());
}
开发者ID:l1325169021,项目名称:github-test,代码行数:12,代码来源:RouteRuleTest.java
示例14: testParseRule_complex
import com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair; //导入依赖的package包/类
@org.junit.Test
public void testParseRule_complex() throws Exception {
Map<String, RouteRule.MatchPair> when = RouteRule.parseRule("when1=valueW1 ,valueW1 & when2 = valueW2,valueW3, valueW4 & when2 != valueWu,valueWv & when3!=valueWx,valueWy");
Map<String, RouteRule.MatchPair> then = RouteRule.parseRule("then1 = valueT1 & then2 = valueT2,valueT3, valueT4");
Map<String, RouteRule.MatchPair> expectedWhen = new HashMap<String, RouteRule.MatchPair>();
RouteRule.MatchPair p = new RouteRule.MatchPair();
p.matches.add("valueW1");
expectedWhen.put("when1", p);
p = new RouteRule.MatchPair();
p.matches.add("valueW2");
p.matches.add("valueW3");
p.matches.add("valueW4");
p.unmatches.add("valueWu");
p.unmatches.add("valueWv");
expectedWhen.put("when2", p);
p = new RouteRule.MatchPair();
p.unmatches.add("valueWx");
p.unmatches.add("valueWy");
expectedWhen.put("when3", p);
assertEquals(expectedWhen, when);
Map<String, RouteRule.MatchPair> expectedThen = new HashMap<String, RouteRule.MatchPair>();
p = new RouteRule.MatchPair();
p.matches.add("valueT1");
expectedThen.put("then1", p);
p = new RouteRule.MatchPair();
p.matches.add("valueT2");
p.matches.add("valueT3");
p.matches.add("valueT4");
expectedThen.put("then2", p);
assertEquals(expectedThen, then);
}
开发者ID:l1325169021,项目名称:github-test,代码行数:41,代码来源:RouteRuleTest.java
注:本文中的com.alibaba.dubbo.registry.common.route.RouteRule.MatchPair类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论