Package org.modeshape.jcr.query.model

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


    // parseConstraint - ISCHILDNODE
    // ----------------------------------------------------------------------------------------------------------------

    @Test
    public void shouldParseConstraintFromStringWithIsChildNodeExpressionWithPathOnlyIfThereIsOneSelectorSource() {
        NamedSelector selector = new NamedSelector(selectorName("tableA"));
        Constraint constraint = parser.parseConstraint(tokens("ISCHILDNODE('/a/b/c')"), typeSystem, selector);
        assertThat(constraint, is(instanceOf(ChildNode.class)));
        ChildNode child = (ChildNode)constraint;
        assertThat(child.selectorName(), is(selectorName("tableA")));
        assertThat(child.getParentPath(), is("/a/b/c"));
View Full Code Here


    // parseConstraint - ISDESCENDANTNODE
    // ----------------------------------------------------------------------------------------------------------------

    @Test
    public void shouldParseConstraintFromStringWithIsDescendantNodeExpressionWithPathOnlyIfThereIsOneSelectorSource() {
        NamedSelector selector = new NamedSelector(selectorName("tableA"));
        Constraint constraint = parser.parseConstraint(tokens("ISDESCENDANTNODE('/a/b/c')"), typeSystem, selector);
        assertThat(constraint, is(instanceOf(DescendantNode.class)));
        DescendantNode descendant = (DescendantNode)constraint;
        assertThat(descendant.selectorName(), is(selectorName("tableA")));
        assertThat(descendant.getAncestorPath(), is("/a/b/c"));
View Full Code Here

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

    @Test
    public void shouldParsePropertyExistanceFromPropertyNameWithPropertyNameAndNoSelectorNameFollowedByIsNotNull() {
        NamedSelector source = new NamedSelector(selectorName("tableA"));
        Constraint constraint = parser.parsePropertyExistance(tokens("property1 IS NOT NULL"), typeSystem, source);
        assertThat(constraint, is(instanceOf(PropertyExistence.class)));
        PropertyExistence p = (PropertyExistence)constraint;
        assertThat(p.getPropertyName(), is("property1"));
        assertThat(p.selectorName(), is(selectorName("tableA")));
View Full Code Here

        Length length = (Length)operand;
        assertThat(length.getPropertyValue().getPropertyName(), is("property"));
        assertThat(length.getPropertyValue().selectorName(), is(selectorName("tableA")));
        assertThat(length.selectorName(), is(selectorName("tableA")));

        Source source = new NamedSelector(selectorName("tableA"));
        operand = parser.parseDynamicOperand(tokens("LENGTH(property)"), typeSystem, source);
        assertThat(operand, is(instanceOf(Length.class)));
        length = (Length)operand;
        assertThat(length.getPropertyValue().getPropertyName(), is("property"));
        assertThat(length.getPropertyValue().selectorName(), is(selectorName("tableA")));
View Full Code Here

        assertThat(lower.getOperand(), is(instanceOf(PropertyValue.class)));
        PropertyValue value = (PropertyValue)lower.getOperand();
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("tableA")));

        Source source = new NamedSelector(selectorName("tableA"));
        operand = parser.parseDynamicOperand(tokens("LOWER(property)"), typeSystem, source);
        assertThat(operand, is(instanceOf(LowerCase.class)));
        lower = (LowerCase)operand;
        assertThat(lower.selectorName(), is(selectorName("tableA")));
        assertThat(lower.getOperand(), is(instanceOf(PropertyValue.class)));
View Full Code Here

        assertThat(upper.getOperand(), is(instanceOf(PropertyValue.class)));
        PropertyValue value = (PropertyValue)upper.getOperand();
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("tableA")));

        Source source = new NamedSelector(selectorName("tableA"));
        operand = parser.parseDynamicOperand(tokens("UPPER(property)"), typeSystem, source);
        assertThat(operand, is(instanceOf(UpperCase.class)));
        upper = (UpperCase)operand;
        assertThat(upper.selectorName(), is(selectorName("tableA")));
        assertThat(upper.getOperand(), is(instanceOf(PropertyValue.class)));
View Full Code Here

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

    @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

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

    @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

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

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

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

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

TOP

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

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.