Package org.modeshape.jcr.query.model

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


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

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


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

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

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

    @Test
    public void shouldParseDynamicOperandFromStringWithOnlyPropertyNameIfSourceIsSelector() {
        Source source = new NamedSelector(selectorName("tableA"));
        DynamicOperand operand = parser.parseDynamicOperand(tokens("property"), typeSystem, source);
        assertThat(operand, is(instanceOf(PropertyValue.class)));
        PropertyValue value = (PropertyValue)operand;
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("tableA")));
View Full Code Here

        assertThat(value.getPropertyName(), is(nullValue()));
    }

    @Test
    public void shouldParseDynamicOperandFromStringContainingReferenceValueWithNoSelectorOnlyIfThereIsOneSelectorAsSource() {
        Source source = new NamedSelector(selectorName("tableA"));
        DynamicOperand operand = parser.parseDynamicOperand(tokens("REFERENCE()"), typeSystem, source);
        assertThat(operand, is(instanceOf(ReferenceValue.class)));
        ReferenceValue value = (ReferenceValue)operand;
        assertThat(value.selectorName(), is(selectorName("tableA")));
        assertThat(value.getPropertyName(), is(nullValue()));
View Full Code Here

        assertThat(value.getPropertyName(), is(nullValue()));
    }

    @Test
    public void shouldParseDynamicOperandFromStringContainingReferenceValueWithWithOnlyPropertyNameIfThereIsOneSelectorAsSource() {
        Source source = new NamedSelector(selectorName("tableA"));
        DynamicOperand operand = parser.parseDynamicOperand(tokens("REFERENCE(property) other"), typeSystem, source);
        assertThat(operand, is(instanceOf(ReferenceValue.class)));
        ReferenceValue value = (ReferenceValue)operand;
        assertThat(value.selectorName(), is(selectorName("tableA")));
        assertThat(value.getPropertyName(), is("property"));
View Full Code Here

        assertThat(value.getPropertyName(), is("property"));
    }

    @Test
    public void shouldParseDynamicOperandFromStringContainingReferenceValueWithWithSelectorNameAndPropertyNameIfThereIsOneSelectorAsSource() {
        Source source = new NamedSelector(selectorName("tableA"));
        DynamicOperand operand = parser.parseDynamicOperand(tokens("REFERENCE(tableA.property) other"), typeSystem, source);
        assertThat(operand, is(instanceOf(ReferenceValue.class)));
        ReferenceValue value = (ReferenceValue)operand;
        assertThat(value.selectorName(), is(selectorName("tableA")));
        assertThat(value.getPropertyName(), is("property"));
View Full Code Here

        assertThat(value.getPropertyName(), is("property"));
    }

    @Test
    public void shouldParseDynamicOperandFromStringContainingReferenceValueWithWithOnlySelectorNameMatchingThatOfOneSelectorAsSource() {
        Source source = new NamedSelector(selectorName("tableA"));
        DynamicOperand operand = parser.parseDynamicOperand(tokens("REFERENCE(tableA) other"), typeSystem, source);
        assertThat(operand, is(instanceOf(ReferenceValue.class)));
        ReferenceValue value = (ReferenceValue)operand;
        assertThat(value.selectorName(), is(selectorName("tableA")));
        assertThat(value.getPropertyName(), is(nullValue()));
View Full Code Here

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

    @Test
    public void shouldParsePropertyValueFromStringWithOnlyPropertyNameIfSourceIsSelector() {
        Source source = new NamedSelector(selectorName("tableA"));
        PropertyValue value = parser.parsePropertyValue(tokens("property"), typeSystem, source);
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

    public void shouldParseReferenceValueFromStringWithUnquotedSelectorNameAndUnquotedPropertyName() {
        ReferenceValue value = parser.parseReferenceValue(tokens("tableA.property"), typeSystem, mock(Join.class));
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("tableA")));

        Source source = new NamedSelector(selectorName("tableA"));
        value = parser.parseReferenceValue(tokens("tableA.property"), typeSystem, source);
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

    public void shouldParseReferenceValueFromStringWithQuotedSelectorNameAndUnquotedPropertyName() {
        ReferenceValue value = parser.parseReferenceValue(tokens("[mode:tableA].property"), typeSystem, mock(Join.class));
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("mode:tableA")));

        Source source = new NamedSelector(selectorName("mode:tableA"));
        value = parser.parseReferenceValue(tokens("[mode:tableA].property"), typeSystem, source);
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("mode: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.