Package org.apache.jackrabbit.spi.commons.query.jsr283.qom

Examples of org.apache.jackrabbit.spi.commons.query.jsr283.qom.JoinCondition


     * Test case for {@link QueryObjectModelFactory#join(Source, Source, int, JoinCondition)}
     */
    public void testJoin() throws RepositoryException {
        Selector s1 = qomFactory.selector(ntBase);
        Selector s2 = qomFactory.selector(testNodeType);
        JoinCondition cond = qomFactory.equiJoinCondition(ntBase, jcrPrimaryType, testNodeType, jcrPrimaryType);
        for (Iterator it = JOIN_TYPES.iterator(); it.hasNext(); ) {
            int joinType = ((Integer) it.next()).intValue();
            Join join = qomFactory.join(s1, s2, joinType, cond);
            assertTrue("Not a selector source", join.getLeft() instanceof Selector);
            assertTrue("Not a selector source", join.getRight() instanceof Selector);
View Full Code Here


            }
            read("JOIN");
            selector = parseSelector();
            selectors.add(selector);
            read("ON");
            JoinCondition on = parseJoinCondition();
            source = factory.join(source, selector, type, on);
        }
        return source;
    }
View Full Code Here

   
    // Page 130
    private JoinCondition parseJoinCondition() throws RepositoryException {
        boolean identifier = currentTokenType == IDENTIFIER;
        String name = readName();
        JoinCondition c;
        if (identifier && readIf("(")) {
            if ("ISSAMENODE".equals(name)) {
                String selector1 = readName();
                read(",");
                String selector2 = readName();
View Full Code Here

     * Test case for {@link QueryObjectModelFactory#and(Constraint, Constraint)}
     */
    public void testAnd() throws RepositoryException {
        PropertyExistence c1 = qomFactory.propertyExistence(propertyName1);
        PropertyExistence c2 = qomFactory.propertyExistence(propertyName2);
        And and = qomFactory.and(c1, c2);
        assertTrue("Not a PropertyExistence constraint",
                and.getConstraint1() instanceof PropertyExistence);
        assertTrue("Not a PropertyExistence constraint",
                and.getConstraint2() instanceof PropertyExistence);
    }
View Full Code Here

            read();
            return literal;
        } else if (currentTokenType == PARAMETER) {
            read();
            String name = readName();
            BindVariableValue var = (BindVariableValue) bindVariables.get(name);
            if (var == null) {
                var = factory.bindVariable(name);
                bindVariables.put(name, var);
            }
            return var;
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#bindVariable(String)}
     */
    public void testBindVariableValue() throws RepositoryException {
        BindVariableValue bindVar = qomFactory.bindVariable(propertyName1);
        assertEquals("Wrong variable name", propertyName1, bindVar.getBindVariableName());
    }
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#comparison(DynamicOperand, int, StaticOperand)}
     */
    public void testComparison() throws RepositoryException {
        PropertyValue op1 = qomFactory.propertyValue(propertyName1);
        BindVariableValue op2 = qomFactory.bindVariable(VARIABLE_NAME);
        for (Iterator it = OPERATORS.iterator(); it.hasNext(); ) {
            int operator = ((Integer) it.next()).intValue();
            Comparison comp = qomFactory.comparison(op1, operator, op2);
            assertTrue("Not a PropertyValue operand", comp.getOperand1() instanceof PropertyValue);
            assertTrue("Not a BindVariableValue operand", comp.getOperand2() instanceof BindVariableValue);
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#childNode(String)}
     */
    public void testChildNode() throws RepositoryException {
        ChildNode childNode = qomFactory.childNode(testRootNode.getPath());
        assertEquals("Wrong path", testRootNode.getPath(), childNode.getPath());
        assertNull("Selector must be null", childNode.getSelectorName());
    }
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#childNode(String, String)}
     */
    public void testChildNodeWithSelector() throws RepositoryException {
        ChildNode childNode = qomFactory.childNode(SELECTOR_NAME1, testRootNode.getPath());
        assertEquals("Wrong path", testRootNode.getPath(), childNode.getPath());
        assertEquals("Wrong selector name", SELECTOR_NAME1, childNode.getSelectorName());
    }
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#childNodeJoinCondition(String, String)}
     */
    public void testChildNodeJoinCondition() throws RepositoryException {
        ChildNodeJoinCondition cond = qomFactory.childNodeJoinCondition(SELECTOR_NAME1, SELECTOR_NAME2);
        assertEquals("Wrong selector name", cond.getChildSelectorName(), SELECTOR_NAME1);
        assertEquals("Wrong selector name", cond.getParentSelectorName(), SELECTOR_NAME2);
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.spi.commons.query.jsr283.qom.JoinCondition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.