Package com.volantis.xml.expression.atomic

Examples of com.volantis.xml.expression.atomic.StringValue


    /**
    * Tests invocation.
    */
    public void testErrorMessage() throws Exception {

       StringValue expected = factory.createStringValue(ERROR_MESSAGE);
       Value result =
           errorMessageFunction.invoke(context, new Value[0]);
       assertEquals(expected, result);
    }
View Full Code Here


    /**
    * Tests error code name.
    */
    public void testErrorCodeName() throws Exception {

       StringValue expected = factory.createStringValue(ERROR_CODENAME);
       Value result =
           errorCodeNameFunction.invoke(context, new Value[0]);
       assertEquals(expected, result);
    }
View Full Code Here

    /**
    * Tests error code URI.
    */
    public void testErrorCodeURI() throws Exception {

       StringValue expected = factory.createStringValue(ERROR_CODEURI);
       Value result =
           errorCodeURIfunction.invoke(context, new Value[0]);
       assertEquals(expected, result);
    }
View Full Code Here

    /**
    * Tests error info.
    */
    public void testErrorInfo() throws Exception {
        StringValue propertyName = factory.createStringValue(STRING_PROPERTY_NAME);
        Value result =
            errorInfoFunction.invoke(context, new Value[]{propertyName});
        assertEquals(factory.createStringValue(STRING_PROPERTY_VALUE), result);

        propertyName = factory.createStringValue(INT_PROPERTY_NAME);
View Full Code Here

    /**
    * Tests error source ID.
    */
    public void testErrorSourceID() throws Exception {

       StringValue expected = factory.createStringValue(ERROR_SOURCEID);
       Value result =
           errorSourceIDfunction.invoke(context, new Value[0]);
       assertEquals(expected, result);
    }
View Full Code Here

            fail("Exception was expected");
        } catch (ExpressionException x) {
            //OK
        }

        StringValue propertyName = factory.createStringValue(STRING_PROPERTY_NAME);
        try {
            errorInfoFunction.invoke(context, new Value[]{propertyName});
            fail("Exception was expected");
        } catch (ExpressionException x) {
            //OK
View Full Code Here

*/
public class ErrorInfoFunction extends AbstractErrorFunction {

    public Value invoke(ExpressionContext context, Value[] arguments) throws ExpressionException {
        assertArgumentCount(arguments, 1);
        StringValue arg = (StringValue) arguments[0];
        SAXParseException x = getException(context);
        ExpressionFactory factory = context.getFactory();
        Value result = Sequence.EMPTY;

        if (x instanceof XMLPipelineException) {
            XMLPipelineException pipelineException = (XMLPipelineException) x;
            Map errorProperties = pipelineException.getErrorProperties();
            if (errorProperties != null) {
                Object value = errorProperties.get(arg.asJavaString());
                if (value != null) {
                    result = factory.createStringValue(value.toString());
                }
            }
        }
View Full Code Here

        assertEquals("1234567890.0987654", getAsJavaString(1234567890.0987654));
    }

    private String getAsJavaString(final double d) {
        SimpleDoubleValue value = new SimpleDoubleValue(expressionFactory, d);
        StringValue stringValue = value.stringValue();
        return stringValue.asJavaString();
    }
View Full Code Here

                            new Item[sequenceItems.size()]));
        }

        // javadoc inhertied
        public void visit(ImmutableStringValue immutableStringValue) {
            StringValue strValue = expressionFactory.createStringValue(
                    immutableStringValue.getAsString());
            if (sequenceItems == null) {
                // not creating a sequence of items set the value to be
                // the string
                value = strValue;
View Full Code Here

        // Value returned should be a StringValue
        assertTrue("Item in list should be a StringValue instance",
                  item instanceof StringValue);

        StringValue str = (StringValue)item;
        // check the StringValues string
        assertEquals("Unexpected StringValue value",
                     "str",
                     str.asJavaString());
    }
View Full Code Here

TOP

Related Classes of com.volantis.xml.expression.atomic.StringValue

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.