public void testInference() throws JaxenException {
Frame page1 = assertHasFrame(root, "page1");
Frame page2 = assertHasFrame(root, "page2");
SyncWire wire = (SyncWire) getWireBidirectional(root, page1, page2);
InputTextField field1 = assertHasInputTextField(page1, "field");
InputTextField field2 = assertHasInputTextField(page2, "field");
assertNotSame(field1, field2);
Function cond = assertHasFunction(root, "Always False");
SimpleCondition cw = assertHasSimpleCondition(root, cond, wire);
// [already in model]
// there should be a Function wire from cond to sync
assertEquals(cw.getFunction(), cond);
assertEquals(cw.getConditioned(), wire);
// [inferred]
// field1 and field2 should be connected by SyncWires
SyncWire sw = assertHasSyncWire(root, field1, field2);
// we should have Event 'edit' in source
Event srcEdit = field1.getOnChange();
Operation srcOp = assertHasOperation(field1, "update");
Event targetEdit = field2.getOnChange();
Operation targetOp = assertHasOperation(field2, "update");
assertNotSame(srcEdit, targetEdit);
assertNotSame(srcOp, targetOp);
// there should be a run wire between these two
ECARule srcRw = assertHasRunAction(wire, srcEdit, targetOp, "run");
ECARule targetRw = assertHasRunAction(wire, targetEdit, srcOp, "run");
// [new]
// there should be a Function wire to the new SyncWire
assertGenerated(assertHasSimpleCondition(root, cond, sw));
// there should be additional ConditionWires to these RunActions
assertGenerated(assertHasSimpleCondition(page1, cond, srcRw));
assertGenerated(assertHasSimpleCondition(page1, cond, targetRw));
// there doesn't need to be any parameters to these ConditionWires
// we should also have Function wires copied to the 'init' operations
Event srcAccess = field1.getOnAccess();
Operation srcInit = assertHasOperation(field1, "init");
Event targetAccess = field2.getOnAccess();
Operation targetInit = assertHasOperation(field2, "init");
assertNotSame(srcAccess, targetAccess);
assertNotSame(srcInit, targetInit);
// execution wires