Package org.modeshape.jcr.query.model

Examples of org.modeshape.jcr.query.model.DynamicOperand


    // parseDynamicOperand - LENGTH
    // ----------------------------------------------------------------------------------------------------------------

    @Test
    public void shouldParseDynamicOperandFromStringContainingLengthOfPropertyValue() {
        DynamicOperand operand = parser.parseDynamicOperand(tokens("LENGTH(tableA.property)"), typeSystem, mock(Source.class));
        assertThat(operand, is(instanceOf(Length.class)));
        Length length = (Length)operand;
        assertThat(length.getPropertyValue().getPropertyName(), is("property"));
        assertThat(length.getPropertyValue().selectorName(), is(selectorName("tableA")));
        assertThat(length.selectorName(), is(selectorName("tableA")));
View Full Code Here


    // parseDynamicOperand - LOWER
    // ----------------------------------------------------------------------------------------------------------------

    @Test
    public void shouldParseDynamicOperandFromStringContainingLowerOfAnotherDynamicOperand() {
        DynamicOperand operand = parser.parseDynamicOperand(tokens("LOWER(tableA.property)"), typeSystem, mock(Source.class));
        assertThat(operand, is(instanceOf(LowerCase.class)));
        LowerCase lower = (LowerCase)operand;
        assertThat(lower.selectorName(), is(selectorName("tableA")));
        assertThat(lower.getOperand(), is(instanceOf(PropertyValue.class)));
        PropertyValue value = (PropertyValue)lower.getOperand();
View Full Code Here

        assertThat(value.selectorName(), is(selectorName("tableA")));
    }

    @Test
    public void shouldParseDynamicOperandFromStringContainingLowerOfUpperCaseOfAnotherOperand() {
        DynamicOperand operand = parser.parseDynamicOperand(tokens("LOWER(UPPER(tableA.property))"),
                                                            typeSystem,
                                                            mock(Source.class));
        assertThat(operand, is(instanceOf(LowerCase.class)));
        LowerCase lower = (LowerCase)operand;
        assertThat(lower.selectorName(), is(selectorName("tableA")));
View Full Code Here

    // parseDynamicOperand - UPPER
    // ----------------------------------------------------------------------------------------------------------------

    @Test
    public void shouldParseDynamicOperandFromStringContainingUpperOfAnotherDynamicOperand() {
        DynamicOperand operand = parser.parseDynamicOperand(tokens("UPPER(tableA.property)"), typeSystem, mock(Source.class));
        assertThat(operand, is(instanceOf(UpperCase.class)));
        UpperCase upper = (UpperCase)operand;
        assertThat(upper.selectorName(), is(selectorName("tableA")));
        assertThat(upper.getOperand(), is(instanceOf(PropertyValue.class)));
        PropertyValue value = (PropertyValue)upper.getOperand();
View Full Code Here

        assertThat(value.selectorName(), is(selectorName("tableA")));
    }

    @Test
    public void shouldParseDynamicOperandFromStringContainingUpperOfLowerCaseOfAnotherOperand() {
        DynamicOperand operand = parser.parseDynamicOperand(tokens("UPPER(LOWER(tableA.property))"),
                                                            typeSystem,
                                                            mock(Source.class));
        assertThat(operand, is(instanceOf(UpperCase.class)));
        UpperCase upper = (UpperCase)operand;
        assertThat(upper.selectorName(), is(selectorName("tableA")));
View Full Code Here

    // parseDynamicOperand - CHILDCOUNT
    // ----------------------------------------------------------------------------------------------------------------

    @Test
    public void shouldParseDynamicOperandFromStringContainingChildCountOfSelector() {
        DynamicOperand operand = parser.parseDynamicOperand(tokens("CHILDCOUNT(tableA)"), typeSystem, mock(Source.class));
        assertThat(operand, is(instanceOf(ChildCount.class)));
        ChildCount count = (ChildCount)operand;
        assertThat(count.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

    }

    @Test
    public void shouldParseDynamicOperandFromStringContainingChildCountWithNoSelectorOnlyIfThereIsOneSelectorAsSource() {
        Source source = new NamedSelector(selectorName("tableA"));
        DynamicOperand operand = parser.parseDynamicOperand(tokens("CHILDCOUNT()"), typeSystem, source);
        assertThat(operand, is(instanceOf(ChildCount.class)));
        ChildCount count = (ChildCount)operand;
        assertThat(count.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

    // parseDynamicOperand - DEPTH
    // ----------------------------------------------------------------------------------------------------------------

    @Test
    public void shouldParseDynamicOperandFromStringContainingDepthOfSelector() {
        DynamicOperand operand = parser.parseDynamicOperand(tokens("DEPTH(tableA)"), typeSystem, mock(Source.class));
        assertThat(operand, is(instanceOf(NodeDepth.class)));
        NodeDepth depth = (NodeDepth)operand;
        assertThat(depth.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

    }

    @Test
    public void shouldParseDynamicOperandFromStringContainingDepthWithNoSelectorOnlyIfThereIsOneSelectorAsSource() {
        Source source = new NamedSelector(selectorName("tableA"));
        DynamicOperand operand = parser.parseDynamicOperand(tokens("DEPTH()"), typeSystem, source);
        assertThat(operand, is(instanceOf(NodeDepth.class)));
        NodeDepth depth = (NodeDepth)operand;
        assertThat(depth.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

    // parseDynamicOperand - PATH
    // ----------------------------------------------------------------------------------------------------------------

    @Test
    public void shouldParseDynamicOperandFromStringContainingPathOfSelector() {
        DynamicOperand operand = parser.parseDynamicOperand(tokens("PATH(tableA)"), typeSystem, mock(Source.class));
        assertThat(operand, is(instanceOf(NodePath.class)));
        NodePath path = (NodePath)operand;
        assertThat(path.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.query.model.DynamicOperand

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.