Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.Expression


                                              value.createImmutable();

        serviceDefMock.expects.getCharacteristic(charateristic).returns(listVal);

        // invoke the function
        Expression expression = parser.parse(getFunctionQName() +
                                             "('" + charateristic + "')");

        // evalute the expression
        Value result = expression.evaluate(expressionContext);

        // Value returned should be a StringValue
        assertTrue("return value should be a DoubleValue instance",
                   result instanceof Sequence);
View Full Code Here


                                              value.createImmutable();

        serviceDefMock.expects.getCharacteristic(charateristic).returns(setVal);

        // invoke the function
        Expression expression = parser.parse(getFunctionQName() +
                                             "('" + charateristic + "')");

        // evalute the expression
        Value result = expression.evaluate(expressionContext);

        // Value returned should be a StringValue
        assertTrue("return value should be a DoubleValue instance",
                   result instanceof Sequence);
View Full Code Here

                                                 value.createImmutable();

        serviceDefMock.expects.getCharacteristic(charateristic).returns(structVal);

        // invoke the function
        Expression expression = parser.parse(getFunctionQName() +
                                             "('" + charateristic + "')");

        // evalute the expression
        Value result = expression.evaluate(expressionContext);

        // Value returned should be a StringValue
        assertTrue("return value should be a DoubleValue instance",
                   result instanceof Sequence);
View Full Code Here

                                              value.createImmutable();

        serviceDefMock.expects.getCharacteristic(charateristic).returns(quantityVal);

        // invoke the function
        Expression expression = parser.parse(getFunctionQName() +
                                             "('" + charateristic + "')");

        try {
            // evalute the expression
            Value result = expression.evaluate(expressionContext);
            fail("Do not expect QuantintyValues to be supported");
        } catch (IllegalArgumentException e) {
            // expected
        }
    }
View Full Code Here

     * Test invoke provides the first value for headers that have
     * mulitple values.
     * @throws Exception
     */
    public void testInvokeIgnoreSecondValue() throws Exception {
        Expression expression = parser.parse(getFunctionQName() +
            "('name')");

        addSingleValueExpectations("name", "value");
        addSingleValueExpectations("name", "other");

        Value result = expression.evaluate(expressionContext);

        Assert.assertEquals("Result not as",
                     "value",
                     result.stringValue().asJavaString());
    }
View Full Code Here

    }

    public RuntimePolicyReferenceExpression parseUnquotedExpression(String unquotedExpression) {
        ExpressionParser parser = getExpressionParser();

        Expression expression;
        try {
            expression = parser.parse(unquotedExpression);
        } catch (ExpressionException e) {
            throw new ExtendedRuntimeException(e);
        }
View Full Code Here

            MarinerRequestContext mrc = pageContext.getRequestContext();
            ExpressionContext ec =
                    MCSExpressionHelper.getExpressionContext(mrc);

            try {
                Expression expr = MCSExpressionHelper.createUnquotedExpression(
                        stem, mrc);

                if (expr != null) {
                    Value value = expr.evaluate(ec);

                    if (value instanceof FormatReferenceValue) {
                        ref = ((FormatReferenceValue)value).
                                asFormatReference();
                    } else {
View Full Code Here

     * Test invoke provides multiple values for headers that have
     * mulitple values.
     * @throws Exception
     */
    public void testInvokeMultiValue() throws Exception {
        Expression expression = parser.parse(getFunctionQName() +
            "('name')");

        addMultiValueExpectations("name", new String[] {
            "value", "other"
        });

        Value result = expression.evaluate(expressionContext);

        Assert.assertTrue("Result not a sequence",
                   result instanceof Sequence);

        Assert.assertEquals("Result not as",
View Full Code Here

    /**
     * Ensure that multiple values can be accessed via the [number] predicate
     * @throws Exception if an error occurs
     */
    public void testInvokeSecondValueWithPredicate() throws Exception {
        Expression expression = parser.parse(getFunctionQName() +
            "('name', 'default')[2]");

        addMultiValueExpectations("name", new String[] {
                    "value", "another value"
        });

        Value result = expression.evaluate(expressionContext);

        Assert.assertTrue("Result not a sequence",
                   result instanceof Sequence);

        Assert.assertEquals("Result not as",
View Full Code Here

    /**
     * Test invoke with no arguments.
     * @throws Exception
     */
    public void testInvokeNoArgs() throws Exception {
        Expression expression = parser.parse(getFunctionQName() + "()");
        try {
            expression.evaluate(expressionContext);

            fail("Should have had an exception thrown when evaluating " +
                 "expression");
        } catch (ExpressionException e) {
            // Expected condition
View Full Code Here

TOP

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

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.