assertNotSame(match.getSources().get(0), match.getSources().get(1));
}
public void testSingleNodeMatch() throws FrontendException {
// search for Load
OperatorPlan pattern = new SillyPlan();
pattern.add(new OP_Load("mmm", pattern));
Rule r = new SillyRule("basic", pattern);
List<OperatorPlan> l = r.match(plan);
assertEquals(l.size(), 2);
Operator m1 = l.get(0).getSources().get(0);
assertTrue(m1.getName().equals("p1") || m1.getName().equals("p2"));
assertEquals(l.get(0).size(), 1);
Operator m2 = l.get(1).getSources().get(0);
assertTrue(m2.getName().equals("p1") || m2.getName().equals("p2"));
assertEquals(l.get(1).size(), 1);
assertNotSame(m1.getName(), m2.getName());
// search for filter
pattern = new SillyPlan();
pattern.add(new OP_Filter("mmm",pattern));
r = new SillyRule("basic", pattern);
l = r.match(plan);
assertEquals(l.size(), 4);
m1 = l.get(0).getSources().get(0);
assertTrue(m1.getName().equals("f1") || m1.getName().equals("f2")
|| m1.getName().equals("f3") || m1.getName().equals("f4"));
assertEquals(l.get(0).size(), 1);
m2 = l.get(1).getSources().get(0);
assertTrue(m1.getName().equals("f1") || m1.getName().equals("f2")
|| m1.getName().equals("f3") || m1.getName().equals("f4"));
assertEquals(l.get(1).size(), 1);
assertNotSame(m1.getName(), m2.getName());
// search for store
pattern = new SillyPlan();
pattern.add(new OP_Store("mmm",pattern));
r = new SillyRule("basic", pattern);
l = r.match(plan);
assertEquals(l.size(), 2);
m1 = l.get(0).getSources().get(0);
assertTrue(m1.getName().equals("s1") || m1.getName().equals("s2"));
assertEquals(l.get(0).size(), 1);
m2 = l.get(1).getSources().get(0);
assertTrue(m2.getName().equals("s1") || m2.getName().equals("s2"));
assertEquals(l.get(1).size(), 1);
assertNotSame(m1.getName(), m2.getName());
// search for split
pattern = new SillyPlan();
pattern.add(new OP_Split("mmm",pattern));
r = new SillyRule("basic", pattern);
l = r.match(plan);
assertEquals(l.size(), 1);
m1 = l.get(0).getSources().get(0);
assertTrue(m1.getName().equals("t1"));
assertEquals(l.get(0).size(), 1);
// search for join
pattern = new SillyPlan();
pattern.add(new OP_Join("mmm",pattern));
r = new SillyRule("basic", pattern);
l = r.match(plan);
assertEquals(l.size(), 1);
m1 = l.get(0).getSources().get(0);