RulePlanJoins.findJoinRegions(source, null, regions);
assertEquals(1, regions.size());
JoinRegion region = (JoinRegion)regions.get(0);
assertEquals(3, region.getJoinSourceNodes().size());
assertEquals(joinRoot, region.getJoinRoot());
region.changeJoinOrder(new Object[] {new Integer(1), new Integer(0), new Integer(2)});
region.reconstructJoinRegoin();
PlanNode root = region.getJoinRoot();
assertEquals(NodeConstants.Types.JOIN, root.getFirstChild().getType());
//the tree is now left linear so go down a couple of levels to get to the first source
assertEquals(NodeConstants.Types.SOURCE, root.getFirstChild().getFirstChild().getFirstChild().getType());