Package org.modeshape.jcr.query.model

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


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


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

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

    @Test
    public void shouldParseDynamicOperandFromStringContainingChildCountWithNoSelectorOnlyIfThereIsOneSelectorAsSource() {
        Source source = new NamedSelector(selectorName("tableA"));
View Full Code Here

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

    @Test( expected = ParsingException.class )
    public void shouldFailToParseDynamicOperandFromStringContainingChildCountWithNoSelectorIfTheSourceIsNotASelector() {
        parser.parseDynamicOperand(tokens("CHILDCOUNT()"), 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.