public void testRightOuterJoin1() throws RepositoryException { JoinCondition c = qf.equiJoinCondition( LEFT, propertyName1, RIGHT, propertyName2); QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER, c); checkQOM(qom, new Node[][]{{null, n1}, {n1, n2}, {n2, n2}}); }
public void testInnerJoin2() throws RepositoryException { JoinCondition c = qf.equiJoinCondition( LEFT, propertyName2, RIGHT, propertyName1); QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, c); checkQOM(qom, new Node[][]{{n2, n1}, {n2, n2}}); }
public void testInnerJoin1() throws RepositoryException { JoinCondition c = qf.equiJoinCondition( LEFT, propertyName1, RIGHT, propertyName2); QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, c); checkQOM(qom, new Node[][]{{n1, n2}, {n2, n2}}); }
public void testRightOuterJoin2() throws RepositoryException { JoinCondition c = qf.equiJoinCondition( LEFT, propertyName2, RIGHT, propertyName1); QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER, c); checkQOM(qom, new Node[][]{{n2, n1}, {n2, n2}}); }
public void testLeftOuterJoin1() throws RepositoryException { JoinCondition c = qf.equiJoinCondition( LEFT, propertyName1, RIGHT, propertyName2); QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, c); checkQOM(qom, new Node[][]{{n1, n2}, {n2, n2}}); }
public void testLeftOuterJoin2() throws RepositoryException { JoinCondition c = qf.equiJoinCondition( LEFT, propertyName2, RIGHT, propertyName1); QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, c); checkQOM(qom, new Node[][]{{n1, null}, {n2, n1}, {n2, n2}}); } }
protected QueryObjectModel createQuery(Ordering[] orderings) throws RepositoryException { JoinCondition c = qf.equiJoinCondition( LEFT, propertyName1, RIGHT, propertyName2); QueryObjectModel qom = createQuery( QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, c); return qf.createQuery(qom.getSource(), qom.getConstraint(), orderings, qom.getColumns()); } }
/** * Test case for {@link QueryObjectModelFactory#join(Source, Source, String, JoinCondition)} */ public void testJoin() throws RepositoryException { Selector s1 = qf.selector(ntBase, SELECTOR_NAME1); Selector s2 = qf.selector(testNodeType, SELECTOR_NAME1); JoinCondition cond = qf.equiJoinCondition(ntBase, jcrPrimaryType, testNodeType, jcrPrimaryType); for (Iterator<String> it = JOIN_TYPES.iterator(); it.hasNext(); ) { String joinType = it.next(); Join join = qf.join(s1, s2, joinType, cond); assertTrue("Not a selector source", join.getLeft() instanceof Selector); assertTrue("Not a selector source", join.getRight() instanceof Selector); assertEquals("Wrong join type", joinType, join.getJoinType()); assertTrue("Not an EquiJoinCondition", join.getJoinCondition() instanceof EquiJoinCondition); } }
qf.selector(testNodeType, SELECTOR_2), QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, qf.equiJoinCondition(SELECTOR_1, propertyName1, SELECTOR_2, propertyName1) ), qf.descendantNode(SELECTOR_1, testRoot),
/** * Test case for {@link QueryObjectModelFactory#equiJoinCondition(String, String, String, String)} */ public void testEquiJoinCondition() throws RepositoryException { EquiJoinCondition cond = qf.equiJoinCondition(SELECTOR_NAME1, propertyName1, SELECTOR_NAME2, propertyName2); assertEquals("Wrong selector name", SELECTOR_NAME1, cond.getSelector1Name()); assertEquals("Wrong property name", propertyName1, cond.getProperty1Name()); assertEquals("Wrong selector name", SELECTOR_NAME2, cond.getSelector2Name()); assertEquals("Wrong property name", propertyName2, cond.getProperty2Name()); }
@Test public void jcrNameConversion() throws RepositoryException { assertEquals("[nt:base]", f.column(null, NodeType.NT_BASE, null).toString()); assertEquals("[s1].[nt:base] = [s2].[nt:base]", f.equiJoinCondition("s1", NodeType.NT_BASE, "s2", NodeType.NT_BASE).toString()); assertEquals("CONTAINS([nt:base], null)", f.fullTextSearch(null, NodeType.NT_BASE, null).toString()); assertEquals("CAST('nt:base' AS NAME)", f.literal(vf.createValue(NodeType.NT_BASE, PropertyType.NAME)).toString()); assertEquals("[nt:base] IS NOT NULL", f.propertyExistence(null, NodeType.NT_BASE).toString()); assertEquals("[nt:base]", f.propertyValue(null, NodeType.NT_BASE).toString()); assertEquals("[nt:base]", f.selector(NodeType.NT_BASE, null).toString()); Source source1 = f.selector(NodeType.NT_BASE, "selector"); Column[] columns = new Column[] { f.column("selector", null, null) }; Constraint constraint2 = f.childNode("selector", "/"); QueryObjectModel qom = f.createQuery(source1, constraint2, null, columns); assertEquals("select [selector].* from " + "[nt:base] AS [selector] " + "where ISCHILDNODE([selector], [/])", qom.toString()); }
@Test public void equiJoinCondition() throws RepositoryException { EquiJoinCondition e = f.equiJoinCondition("selector1Name", "property1Name", "selector2Name", "property2Name"); assertEquals("selector1Name", e.getSelector1Name()); assertEquals("property1Name", e.getProperty1Name()); assertEquals("selector2Name", e.getSelector2Name()); assertEquals("property2Name", e.getProperty2Name()); assertEquals("[selector1Name].[property1Name] = [selector2Name].[property2Name]", e.toString()); }
String selector2 = readName(); read("."); return factory.equiJoinCondition(selector1, property1, selector2, readName());
String selector2 = readName(); read("."); return factory.equiJoinCondition(selector1, property1, selector2, readName());
String selector2 = readName(); read("."); return factory.equiJoinCondition(selector1, property1, selector2, readName());