Package org.modeshape.jcr.query.model

Examples of org.modeshape.jcr.query.model.Ordering.order()


        assertThat(constraint.getPropertyName(), is("car:model"));
        assertThat(constraint.selectorName(), is(selectorName("car:Car")));
        // ORDER BY ...
        assertThat(query.orderings().size(), is(1));
        Ordering ordering = query.orderings().get(0);
        assertThat(ordering.order(), is(Order.ASCENDING));
        assertThat(ordering.getOperand(), is((DynamicOperand)propertyValue(selectorName("car:Car"), "car:model")));
    }

    /**
     * Tests that the child nodes (but no grandchild nodes) are returned.
View Full Code Here


        assertThat(constraint.getPropertyName(), is("car:model"));
        assertThat(constraint.selectorName(), is(selectorName("car:Car")));
        // ORDER BY ...
        assertThat(query.orderings().size(), is(1));
        Ordering ordering = query.orderings().get(0);
        assertThat(ordering.order(), is(Order.ASCENDING));
        assertThat(ordering.getOperand(), is((DynamicOperand)propertyValue(selectorName("car:Car"), "car:model")));
    }

    /**
     * Tests that the child nodes (but no grandchild nodes) are returned.
View Full Code Here

    public void shouldParserOrderByWithOneOrdering() {
        List<Ordering> orderBy = parser.parseOrderBy(tokens("ORDER BY NAME(tableA) ASC"), typeSystem, mock(Source.class));
        assertThat(orderBy.size(), is(1));
        Ordering first = orderBy.get(0);
        assertThat(first.getOperand(), is(instanceOf(NodeName.class)));
        assertThat(first.order(), is(Order.ASCENDING));
    }

    @Test
    public void shouldParserOrderByWithTwoOrderings() {
        List<Ordering> orderBy = parser.parseOrderBy(tokens("ORDER BY NAME(tableA) ASC, SCORE(tableB) DESC"),
View Full Code Here

                                                     typeSystem,
                                                     mock(Source.class));
        assertThat(orderBy.size(), is(2));
        Ordering first = orderBy.get(0);
        assertThat(first.getOperand(), is(instanceOf(NodeName.class)));
        assertThat(first.order(), is(Order.ASCENDING));
        Ordering second = orderBy.get(1);
        assertThat(second.getOperand(), is(instanceOf(FullTextSearchScore.class)));
        assertThat(second.order(), is(Order.DESCENDING));
    }
View Full Code Here

        Ordering first = orderBy.get(0);
        assertThat(first.getOperand(), is(instanceOf(NodeName.class)));
        assertThat(first.order(), is(Order.ASCENDING));
        Ordering second = orderBy.get(1);
        assertThat(second.getOperand(), is(instanceOf(FullTextSearchScore.class)));
        assertThat(second.order(), is(Order.DESCENDING));
    }

    @Test
    public void shouldParserOrderByWithMultipleOrderings() {
        List<Ordering> orderBy = parser.parseOrderBy(tokens("ORDER BY NAME(tableA) ASC, SCORE(tableB) DESC, LENGTH(tableC.id) ASC"),
View Full Code Here

                                                     typeSystem,
                                                     mock(Source.class));
        assertThat(orderBy.size(), is(3));
        Ordering first = orderBy.get(0);
        assertThat(first.getOperand(), is(instanceOf(NodeName.class)));
        assertThat(first.order(), is(Order.ASCENDING));
        Ordering second = orderBy.get(1);
        assertThat(second.getOperand(), is(instanceOf(FullTextSearchScore.class)));
        assertThat(second.order(), is(Order.DESCENDING));
        Ordering third = orderBy.get(2);
        assertThat(third.getOperand(), is(instanceOf(Length.class)));
View Full Code Here

        Ordering first = orderBy.get(0);
        assertThat(first.getOperand(), is(instanceOf(NodeName.class)));
        assertThat(first.order(), is(Order.ASCENDING));
        Ordering second = orderBy.get(1);
        assertThat(second.getOperand(), is(instanceOf(FullTextSearchScore.class)));
        assertThat(second.order(), is(Order.DESCENDING));
        Ordering third = orderBy.get(2);
        assertThat(third.getOperand(), is(instanceOf(Length.class)));
        assertThat(third.order(), is(Order.ASCENDING));
    }
View Full Code Here

        Ordering second = orderBy.get(1);
        assertThat(second.getOperand(), is(instanceOf(FullTextSearchScore.class)));
        assertThat(second.order(), is(Order.DESCENDING));
        Ordering third = orderBy.get(2);
        assertThat(third.getOperand(), is(instanceOf(Length.class)));
        assertThat(third.order(), is(Order.ASCENDING));
    }

    @Test( expected = ParsingException.class )
    public void shouldFailToParseOrderByIfCommaNotFollowedByAnotherOrdering() {
        parser.parseOrderBy(tokens("ORDER BY NAME(tableA) ASC, NOT A VALID ORDERING"), typeSystem, mock(Source.class));
View Full Code Here

    @Test
    public void shouldParseOrderingFromDynamicOperandFollowedByAscendingKeyword() {
        Ordering ordering = parser.parseOrdering(tokens("NAME(tableA) ASC"), typeSystem, mock(Source.class));
        assertThat(ordering.getOperand(), is(instanceOf(NodeName.class)));
        assertThat(ordering.order(), is(Order.ASCENDING));
    }

    @Test
    public void shouldParseOrderingFromDynamicOperandFollowedByDecendingKeyword() {
        Ordering ordering = parser.parseOrdering(tokens("NAME(tableA) DESC"), typeSystem, mock(Source.class));
View Full Code Here

    @Test
    public void shouldParseOrderingFromDynamicOperandFollowedByDecendingKeyword() {
        Ordering ordering = parser.parseOrdering(tokens("NAME(tableA) DESC"), typeSystem, mock(Source.class));
        assertThat(ordering.getOperand(), is(instanceOf(NodeName.class)));
        assertThat(ordering.order(), is(Order.DESCENDING));
    }

    @Test
    public void shouldParseOrderingFromDynamicOperandAndDefaultToAscendingWhenNotFollowedByAscendingOrDescendingKeyword() {
        Ordering ordering = parser.parseOrdering(tokens("NAME(tableA) OTHER"), typeSystem, mock(Source.class));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.