n.setProperty(propertyName1, TEST_VALUE);
superuser.save();
String columnName1 = SELECTOR_1 + "." + propertyName1;
String columnName2 = SELECTOR_2 + "." + propertyName1;
QueryObjectModel qom = qf.createQuery(
qf.join(
qf.selector(testNodeType, SELECTOR_1),
qf.selector(testNodeType, SELECTOR_2),
QueryObjectModelConstants.JCR_JOIN_TYPE_INNER,
qf.equiJoinCondition(SELECTOR_1, propertyName1, SELECTOR_2, propertyName1)
),
qf.descendantNode(SELECTOR_1, testRoot),
null,
new Column[]{
qf.column(SELECTOR_1, propertyName1, columnName1),
qf.column(SELECTOR_2, propertyName1, columnName2)
}
);
RowIterator rows = qom.execute().getRows();
assertTrue("empty result", rows.hasNext());
Row r = rows.nextRow();
assertEquals("unexpected value", TEST_VALUE, r.getValue(columnName1).getString());
assertEquals("unexpected value", TEST_VALUE, r.getValue(columnName2).getString());
}