@Override protected ElementPath initialElementPath() { return new ElementPath("configuration"); }
@Override protected ElementPath initialElementPath() { return new ElementPath("configuration"); }
protected ElementPath initialElementPath() { return new ElementPath(); }
public ElementPath duplicate() { ElementPath p = new ElementPath(); p.partList.addAll(this.partList); return p; }
@Override protected ElementPath initialElementPath() { return new ElementPath("configuration"); }
@Override protected ElementPath initialElementPath() { return new ElementPath("configuration"); }
@Override protected ElementPath initialElementPath() { return new ElementPath("configuration"); }
public ElementPath duplicate() { ElementPath p = new ElementPath(); p.partList.addAll(this.partList); return p; }
public ElementPath duplicate() { ElementPath p = new ElementPath(); p.partList.addAll(this.partList); return p; }
public ElementPath duplicate() { ElementPath p = new ElementPath(); p.partList.addAll(this.partList); return p; }
public ElementPath duplicate() { ElementPath p = new ElementPath(); p.partList.addAll(this.partList); return p; }
public ElementPath duplicate() { ElementPath p = new ElementPath(); p.partList.addAll(this.partList); return p; }
@Test public void testTail1() throws Exception { srs.addRule(new ElementSelector("*/b"), new XAction()); for (String s : cc.combinations("a/b")) { List<Action> r = srs.matchActions(new ElementPath(s)); assertNotNull(r); assertEquals(1, r.size()); if (!(r.get(0) instanceof XAction)) { fail("Wrong type"); } } }
@Test public void smoke() throws Exception { srs.addRule(new ElementSelector("a/b"), new XAction()); // test for all possible case combinations of "a/b" for (String s : cc.combinations("a/b")) { List<Action> r = srs.matchActions(new ElementPath(s)); assertNotNull(r); assertEquals(1, r.size()); if (!(r.get(0) instanceof XAction)) { fail("Wrong type"); } } }
@Test public void testSlashSuffix() throws Exception { ElementSelector pa = new ElementSelector("a/"); srs.addRule(pa, new XAction()); for (String s : cc.combinations("a")) { List<Action> r = srs.matchActions(new ElementPath(s)); assertNotNull(r); assertEquals(1, r.size()); if (!(r.get(0) instanceof XAction)) { fail("Wrong type"); } } }
@Test public void testSuffix() throws Exception { srs.addRule(new ElementSelector("a"), new XAction()); srs.addRule(new ElementSelector("a/*"), new YAction()); for (String s : cc.combinations("a/b")) { List<Action> r = srs.matchActions(new ElementPath(s)); assertNotNull(r); assertEquals(1, r.size()); assertTrue(r.get(0) instanceof YAction); } }
@Test public void testTail2() throws Exception { SimpleRuleStore srs = new SimpleRuleStore(new ContextBase()); srs.addRule(new ElementSelector("*/c"), new XAction()); for (String s : cc.combinations("a/b/c")) { List<Action> r = srs.matchActions(new ElementPath(s)); assertNotNull(r); assertEquals(1, r.size()); if (!(r.get(0) instanceof XAction)) { fail("Wrong type"); } } }
@Test public void testTail3() throws Exception { srs.addRule(new ElementSelector("*/b"), new XAction()); srs.addRule(new ElementSelector("*/a/b"), new YAction()); for (String s : cc.combinations("a/b")) { List<Action> r = srs.matchActions(new ElementPath(s)); assertNotNull(r); assertEquals(1, r.size()); if (!(r.get(0) instanceof YAction)) { fail("Wrong type"); } } }
@Test public void testDeepSuffix() throws Exception { srs.addRule(new ElementSelector("a"), new XAction(1)); srs.addRule(new ElementSelector("a/b/*"), new XAction(2)); for (String s : cc.combinations("a/other")) { List<Action> r = srs.matchActions(new ElementPath(s)); assertNull(r); } }
@Test public void testPrefixSuffixInteraction2() throws Exception { srs.addRule(new ElementSelector("tG"), new XAction()); srs.addRule(new ElementSelector("tG/tS"), new YAction()); srs.addRule(new ElementSelector("tG/tS/test"), new ZAction()); srs.addRule(new ElementSelector("tG/tS/test/*"), new XAction(9)); for (String s : cc.combinations("tG/tS/toto")) { List<Action> r = srs.matchActions(new ElementPath(s)); assertNull(r); } }