Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.Value


    /**
     * Tests min on sequence of integers and doubles
     */
    public void testSequenceOfNumbers() throws ExpressionException {
        final Function function = new MinFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                factory.createSequence(new Item[]{
                      factory.createIntValue(6),
                      factory.createIntValue(3),
                      factory.createDoubleValue(4.3)
                })});
View Full Code Here


                new ImmutableExpandedName("", "myVar"),
                factory.createSequence(items));

        Expression exp = compileExpression("$myVar[4]");

        Value result = exp.evaluate(context);

        // result should be an empty sequence
        assertTrue("Result is not a Sequence instance",
                   result instanceof Sequence);
View Full Code Here

     * Tests on sequence of strings. Values should be compared using
     * Unicode code point collation (http://www.w3.org/2005/xpath-functions/collation/codepoint).
     */
    public void testSequenceOfStrings() throws ExpressionException {
        final Function function = new MinFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                factory.createSequence(new Item[]{
                      factory.createStringValue("qwe"),
                      factory.createStringValue("rty"),
                      factory.createStringValue("asd")
                })});
        assertTrue(result instanceof StringValue);
        assertEquals("asd", result.stringValue().asJavaString());
    }
View Full Code Here

                factory.createSequence(items));


        Expression exp = compileExpression("$myVar[0]");

        Value result = exp.evaluate(context);

        // result should be an empty sequence
        assertTrue("Result is not a Sequence instance",
                   result instanceof Sequence);
View Full Code Here

    /**
     * Tests on sequence of dates. Earliest date should be returned.
     */
    public void testSequenceOfDates() throws ExpressionException {
        final Function function = new MinFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                factory.createSequence(new Item[]{
                      factory.createDateValue("2008-03-11"),
                      factory.createDateValue("2006-04-16"),
                      factory.createDateValue("2009-01-02")
                })});
View Full Code Here

    /**
     * Tests on sequence of datetimes. Earliest datetime should be returned.
     */
    public void testSequenceOfDatetimes() throws ExpressionException {
        final Function function = new MinFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                factory.createSequence(new Item[]{
                      factory.createDateTimeValue("2008-03-11T07:56:16+00:00"),
                      factory.createDateTimeValue("2006-04-16T12:30:16+00:00"),
                      factory.createDateTimeValue("2006-04-16T06:56:16+00:00"),
                      factory.createDateTimeValue("2009-01-02T02:56:16+00:00")
View Full Code Here

        context.getCurrentScope().declareVariable(
                new ImmutableExpandedName("", "right"),
                factory.createSequence(right));

        Expression exp = compileExpression("$left = $right");
        Value result = exp.evaluate(context);

        assertTrue("Sequence comparison failed",
                   ((BooleanValue) result).asJavaBoolean());
    }
View Full Code Here

    /**
     * Tests on sequence of times. Earliest time should be returned.
     */
    public void testSequenceOfTimeValues() throws ExpressionException {
        final Function function = new MinFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                factory.createSequence(new Item[]{
                      factory.createTimeValue("07:56:16+00:00"),
                      factory.createTimeValue("12:30:16+00:00"),
                      factory.createTimeValue("02:55:21+00:00"),
                      factory.createTimeValue("02:56:16+00:00")
View Full Code Here

        context.getCurrentScope().declareVariable(
                new ImmutableExpandedName("", "right"),
                factory.createSequence(right));

        Expression exp = compileExpression("$left != $right");
        Value result = exp.evaluate(context);

        // the sequences are not equal as the first item in both
        // sequences are not equal. Note these same 2 sequences
        // are both equal and not equal.
        assertTrue("Sequence comparison failed",
View Full Code Here

                result);

        Expression exp = compileExpression("$myVar = \"" +
                                           result.stringValue().
                                           asJavaString() + "\"");
        Value result = exp.evaluate(context);

        assertTrue("Equality expression should result in a boolean value",
                   result instanceof BooleanValue);
        assertTrue("Equality expression result should be true",
                   ((BooleanValue) result).asJavaBoolean());
View Full Code Here

TOP

Related Classes of com.volantis.xml.expression.Value

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.