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

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


    /**
     * Test case for {@link QueryObjectModelFactory#nodeName(String)}
     */
    public void testNodeNameWithSelector() throws RepositoryException {
        NodeName nodeName = qomFactory.nodeName(SELECTOR_NAME1);
        assertEquals("Wrong selector name", SELECTOR_NAME1, nodeName.getSelectorName());
    }
View Full Code Here


    /**
     * Test case for {@link QueryObjectModelFactory#not(Constraint)}
     */
    public void testNot() throws RepositoryException {
        PropertyExistence propExist = qomFactory.propertyExistence(propertyName1);
        Not not = qomFactory.not(propExist);
        assertTrue("Not a property existence constraint", not.getConstraint() instanceof PropertyExistence);
    }
View Full Code Here

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

    // Page 157
    private Ordering[] parseOrder() throws RepositoryException {
        ArrayList orderList = new ArrayList();
        do {
            Ordering ordering;
            DynamicOperand op = parseDynamicOperand();
            if (readIf("DESC")) {
                ordering = factory.descending(op);
            } else {
                readIf("ASC");
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#ascending(DynamicOperand)}
     */
    public void testOrderingAscending() throws RepositoryException {
        PropertyValue op = qomFactory.propertyValue(propertyName1);
        Ordering asc = qomFactory.ascending(op);
        assertEquals("Ordering.getOrder() must return QueryObjectModelConstants.ORDER_ASCENDING",
                QueryObjectModelConstants.ORDER_ASCENDING, asc.getOrder());
        assertTrue("Not a PropertyValue operand", asc.getOperand() instanceof PropertyValue);
    }
View Full Code Here

    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);
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
        assertEquals("Wrong size of orderings", 1, qom.getOrderings().length);
View Full Code Here

    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,
                new Ordering[]{ordering}, new Column[]{column});
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
View Full Code Here

    public void testCreateQueryFromSourceWithConstraintAndOrdering() throws RepositoryException {
        Source 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);
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
        assertEquals("Wrong size of orderings", 1, qom.getOrderings().length);
View Full Code Here

    public void testCreateQueryFromSourceWithConstraintOrderingAndColumn() throws RepositoryException {
        Source 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,
                new Ordering[]{ordering}, new Column[]{column});
        assertTrue("Not a selector source", qom.getSource() instanceof Selector);
        assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
View Full Code Here

    /**
     * Test case for {@link QueryObjectModelFactory#descending(DynamicOperand)}
     */
    public void testOrderingDescending() throws RepositoryException {
        PropertyValue op = qomFactory.propertyValue(propertyName1);
        Ordering desc = qomFactory.descending(op);
        assertEquals("Ordering.getOrder() must return QueryObjectModelConstants.ORDER_DESCENDING",
                QueryObjectModelConstants.ORDER_DESCENDING, desc.getOrder());
        assertTrue("Not a PropertyValue operand", desc.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.