private QueryObjectModel createQomQuery(String joinType, String relPath) throws RepositoryException { JoinCondition c; if (relPath != null) { c = qf.sameNodeJoinCondition(LEFT, RIGHT, relPath); } else { c = qf.sameNodeJoinCondition(LEFT, RIGHT, "."); } return createQuery(joinType, c); } }
/** * Test case for {@link QueryObjectModelFactory#sameNodeJoinCondition(String, String, String)} */ public void testSameNodeJoinCondition() throws RepositoryException { SameNodeJoinCondition cond = qf.sameNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2, "."); assertEquals("Wrong selector name", SELECTOR_NAME1, cond.getSelector1Name()); assertEquals("Wrong selector name", SELECTOR_NAME2, cond.getSelector2Name()); assertEquals("Wrong selector path", ".", cond.getSelector2Path()); }
public void testLeftOuterJoin() throws RepositoryException { QueryObjectModel qom = qf.createQuery( qf.join( qf.selector(testNodeType, LEFT), qf.selector(mixReferenceable, RIGHT), QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, qf.sameNodeJoinCondition(LEFT, RIGHT, ".")), qf.descendantNode(LEFT, testRoot), null, null); checkQOM(qom, new Node[][]{{n1, null}, {n2, n2}}); }
public void testRightOuterJoin() throws RepositoryException { QueryObjectModel qom = qf.createQuery( qf.join( qf.selector(mixReferenceable, LEFT), qf.selector(testNodeType, RIGHT), QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER, qf.sameNodeJoinCondition(LEFT, RIGHT, ".")), qf.descendantNode(RIGHT, testRoot), null, null); checkQOM(qom, new Node[][]{{null, n1}, {n2, n2}}); }
/** * Test case for {@link QueryObjectModelFactory#sameNodeJoinCondition(String, String, String)} */ public void testSameNodeJoinConditionWithPath() throws RepositoryException { SameNodeJoinCondition cond = qf.sameNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2, nodeName1); assertEquals("Wrong selector name", SELECTOR_NAME1, cond.getSelector1Name()); assertEquals("Wrong selector name", SELECTOR_NAME2, cond.getSelector2Name()); assertEquals("Wrong path", nodeName1, cond.getSelector2Path()); }
public void testRightOuterJoinWithPath() throws RepositoryException { QueryObjectModel qom = qf.createQuery( qf.join( qf.selector(mixReferenceable, LEFT), qf.selector(testNodeType, RIGHT), QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER, qf.sameNodeJoinCondition(LEFT, RIGHT, nodeName2)), qf.descendantNode(RIGHT, testRoot), null, null); checkQOM(qom, new Node[][]{{n2, n1}, {null, n2}}); }
@Test public void escapedName() throws RepositoryException { assertEquals("[[n]]]", f.selector("[n]", null).toString()); assertEquals("[[s]]].[[p]]]", f.propertyValue("[s]", "[p]").toString()); assertEquals("ISSAMENODE([[s1]]], [[s2]]], [[p]]])", f.sameNodeJoinCondition("[s1]", "[s2]", "[p]").toString()); assertEquals("ISSAMENODE([[s]]], [[p]]])", f.sameNode("[s]", "[p]").toString()); } }
String selector2 = readName(); if (readIf(",")) { c = factory.sameNodeJoinCondition(selector1, selector2, readPath()); } else { c = factory.sameNodeJoinCondition(selector1, selector2, ".");
@Test public void sameNodeJoinCondition() throws RepositoryException { SameNodeJoinCondition s = f.sameNodeJoinCondition("selector1Name", "selector2Name", "selector2Path"); assertEquals("selector1Name", s.getSelector1Name()); assertEquals("selector2Name", s.getSelector2Name()); assertEquals("selector2Path", s.getSelector2Path()); assertEquals("ISSAMENODE([selector1Name], [selector2Name], [selector2Path])", s.toString()); }
String selector2 = readName(); if (readIf(",")) { c = factory.sameNodeJoinCondition(selector1, selector2, readPath()); } else { c = factory.sameNodeJoinCondition(selector1, selector2, ".");
String selector2 = readName(); if (readIf(",")) { c = factory.sameNodeJoinCondition(selector1, selector2, readPath()); } else { c = factory.sameNodeJoinCondition(selector1, selector2, ".");