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

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


            assertEquals("Wrong operator", operator, comp.getOperator());
        }
    }

    public void testCreateQuery() throws RepositoryException {
        Selector selector = qomFactory.selector(testNodeType);
        QueryObjectModel qom = qomFactory.createQuery(selector, null, null, null);
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertNull("Constraint must be null", qom.getConstraint());
        assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 0, qom.getColumns().length);
View Full Code Here


        assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 0, qom.getColumns().length);
    }

    public void testCreateQueryWithConstraint() throws RepositoryException {
        Selector selector = qomFactory.selector(testNodeType);
        PropertyExistence propExist = qomFactory.propertyExistence(propertyName1);
        QueryObjectModel qom = qomFactory.createQuery(
                selector, propExist, null, null);
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
View Full Code Here

        assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 0, qom.getColumns().length);
    }

    public void testCreateQueryWithConstraintAndOrdering() throws RepositoryException {
        Selector selector = qomFactory.selector(testNodeType);
        PropertyExistence propExist = qomFactory.propertyExistence(propertyName1);
        PropertyValue propValue = qomFactory.propertyValue(propertyName1);
        Ordering ordering = qomFactory.ascending(propValue);
        QueryObjectModel qom = qomFactory.createQuery(selector, propExist,
                new Ordering[]{ordering}, null);
View Full Code Here

        assertEquals("Wrong size of orderings", 1, qom.getOrderings().length);
        assertEquals("Wrong size of columns", 0, qom.getColumns().length);
    }

    public void testCreateQueryWithConstraintOrderingAndColumn() throws RepositoryException {
        Selector selector = qomFactory.selector(testNodeType);
        PropertyExistence propExist = qomFactory.propertyExistence(propertyName1);
        PropertyValue propValue = qomFactory.propertyValue(propertyName1);
        Ordering ordering = qomFactory.ascending(propValue);
        Column column = qomFactory.column(propertyName1);
        QueryObjectModel qom = qomFactory.createQuery(selector, propExist,
View Full Code Here

    /**
     * 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);
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#selector(String)}
     */
    public void testSelector() throws RepositoryException {
        Selector selector = qomFactory.selector(ntBase);
        assertEquals("Wrong node type name", ntBase, selector.getNodeTypeName());
        assertEquals("Wrong selector name", ntBase, selector.getSelectorName());
    }
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#selector(String, String)}
     */
    public void testSelectorWithName() throws RepositoryException {
        Selector selector = qomFactory.selector(ntBase, SELECTOR_NAME1);
        assertEquals("Wrong node type name", ntBase, selector.getNodeTypeName());
        assertEquals("Wrong selector name", SELECTOR_NAME1, selector.getSelectorName());
    }
View Full Code Here

        bindVariables = new HashMap();
        read();
        read("SELECT");
        ArrayList list = parseColumns();
        read("FROM");
        Source source = parseSource();
        Column[] columnArray = resolveColumns(list);
        Constraint constraint = null;
        if (readIf("WHERE")) {
            constraint = parseConstraint();
        }
View Full Code Here

    // Page 129
    private Source parseSource() throws RepositoryException {
        Selector selector = parseSelector();
        selectors.add(selector);
        Source source = selector;
        while (true) {
            int type;
            if (readIf("RIGHT")) {
                read("OUTER");
                type = QueryObjectModelConstants.JOIN_TYPE_RIGHT_OUTER;
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#upperCase(DynamicOperand)}
     */
    public void testUpperCase() throws RepositoryException {
        PropertyValue propValue = qomFactory.propertyValue(propertyName1);
        UpperCase upper = qomFactory.upperCase(propValue);
        assertTrue("Not a property value operand", upper.getOperand() instanceof PropertyValue);
    }
View Full Code Here

TOP

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

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.