Package org.modeshape.jcr.query.model

Examples of org.modeshape.jcr.query.model.NodePath.selectorName()


            if (replacement == null) return operand;
            return new NodeDepth(replacement);
        }
        if (operand instanceof NodePath) {
            NodePath path = (NodePath)operand;
            SelectorName replacement = rewrittenSelectors.get(path.selectorName());
            if (replacement == null) return operand;
            return new NodePath(replacement);
        }
        if (operand instanceof ChildCount) {
            ChildCount count = (ChildCount)operand;
View Full Code Here


            node.addSelector(mapping.getSingleMappedSelectorName());
            return new NodeDepth(mapping.getSingleMappedSelectorName());
        }
        if (operand instanceof NodePath) {
            NodePath path = (NodePath)operand;
            if (!mapping.getOriginalName().equals(path.selectorName())) return path;
            if (!mapping.isMappedToSingleSelector()) return path;
            node.addSelector(mapping.getSingleMappedSelectorName());
            return new NodePath(mapping.getSingleMappedSelectorName());
        }
        if (operand instanceof ChildCount) {
View Full Code Here

    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")));
    }

    @Test( expected = ParsingException.class )
    public void shouldFailToParseDynamicOperandFromStringContainingPathWithNoSelectorIfTheSourceIsNotASelector() {
        parser.parseDynamicOperand(tokens("PATH()"), typeSystem, mock(Source.class));
View Full Code Here

    @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")));
    }

    @Test
    public void shouldParseDynamicOperandFromStringContainingPathWithNoSelectorOnlyIfThereIsOneSelectorAsSource() {
        Source source = new NamedSelector(selectorName("tableA"));
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.