fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Twet.delete", null);
assertFalse(rule.isDefinedAt(fact));
}
public void testNamespaceRuleNormallyWithCustomActionPatternSeparator() {
IBatisNamespaceRule rule = new IBatisNamespaceRule("com.alibaba.cobar.client.entity.Tweet",
"p1, p2");
rule.setActionPatternSeparator(";");
List<String> shards = rule.action();
assertTrue(CollectionUtils.isNotEmpty(shards));
assertEquals(1, shards.size());
rule = new IBatisNamespaceRule("com.alibaba.cobar.client.entity.Tweet", "p1; p2");
rule.setActionPatternSeparator(";");
shards = null;
shards = rule.action();
assertTrue(CollectionUtils.isNotEmpty(shards));
assertEquals(2, shards.size());
IBatisRoutingFact fact = new IBatisRoutingFact(
"com.alibaba.cobar.client.entity.Tweet.update", null);
assertTrue(rule.isDefinedAt(fact));
fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Tweet.delete", null);
assertTrue(rule.isDefinedAt(fact));
fact = new IBatisRoutingFact("com.alibaba.cobar.client.entity.Twet.delete", null);
assertFalse(rule.isDefinedAt(fact));
}