Examples of NamedSelector


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

    }

    @Test( expected = ParsingException.class )
    public void shouldFailToParseConstraintFromStringWithOrExpressionWithNoSecondConstraint() {
        NamedSelector selector = new NamedSelector(selectorName("tableA"));
        parser.parseConstraint(tokens("ISSAMENODE('/a/b/c') OR WHAT THE HECK IS THIS"), typeSystem, selector);
    }
View Full Code Here

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

    // parseConstraint - CONTAINS
    // ----------------------------------------------------------------------------------------------------------------

    @Test
    public void shouldParseConstraintFromStringWithIsContainsExpressionWithPropertyAndNoSelectorNameOnlyIfThereIsOneSelectorSource() {
        NamedSelector selector = new NamedSelector(selectorName("tableA"));
        Constraint constraint = parser.parseConstraint(tokens("CONTAINS(propertyA,'term1 term2 -term3')"), typeSystem, selector);
        assertThat(constraint, is(instanceOf(FullTextSearch.class)));
        FullTextSearch search = (FullTextSearch)constraint;
        assertThat(search.selectorName(), is(selectorName("tableA")));
        assertThat(search.getPropertyName(), is("propertyA"));
View Full Code Here

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

    // parseConstraint - ISSAMENODE
    // ----------------------------------------------------------------------------------------------------------------

    @Test
    public void shouldParseConstraintFromStringWithIsSameNodeExpressionWithPathOnlyIfThereIsOneSelectorSource() {
        NamedSelector selector = new NamedSelector(selectorName("tableA"));
        Constraint constraint = parser.parseConstraint(tokens("ISSAMENODE('/a/b/c')"), typeSystem, selector);
        assertThat(constraint, is(instanceOf(SameNode.class)));
        SameNode same = (SameNode)constraint;
        assertThat(same.selectorName(), is(selectorName("tableA")));
        assertThat(same.getPath(), is("/a/b/c"));
View Full Code Here

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

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

    // 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

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

        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

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

        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

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

        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

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

        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

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

        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
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.