Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.Function


     */
    public void testStringEqualsMultipleMultipleLetterPattern()
            throws Exception {
        ExpressionContext context = createExpressionContext();
        ExpressionFactory factory = context.getFactory();
        Function tokenize = new TokenizeFunction();
        Sequence sequence = createSequence(factory,
                new String[]{"abcabcabcabcabcabcabcabcabcabc"});
        Value pattern = factory.createStringValue("abc");
        Value retVal = tokenize.invoke(context,
                new Value[]{sequence, pattern});

        final Sequence retSeq = retVal.getSequence();

        doSequenceEquality(retSeq,
View Full Code Here


     * sequence member is the leftover bit.
     */
    public void testRemainderX() throws Exception {
        ExpressionContext context = createExpressionContext();
        ExpressionFactory factory = context.getFactory();
        Function tokenize = new TokenizeFunction();
        Sequence sequence = createSequence(factory,
                new String[]{"xxxxxxxxxx"});
        Value pattern = factory.createStringValue("xxx");
        Value retVal = tokenize.invoke(context,
                new Value[]{sequence, pattern});

        final Sequence retSeq = retVal.getSequence();

        doSequenceEquality(retSeq, new String[]{"", "", "", "x"});
View Full Code Here

     * Tests that failure occurs when function is given no arguments.
     */
    public void testNoArguments() throws Exception {
        try {
            ExpressionContext context = createExpressionContext();
            Function tokenize = new TokenizeFunction();
            Value retVal = tokenize.invoke(context, new Value[]{});
            fail("Should have failed when invoked with no arguments");
        } catch (ExpressionException expected) {
        }
    }
View Full Code Here

        try {
            ExpressionContext context = createExpressionContext();
            ExpressionFactory factory = context.getFactory();
            Sequence sequence = createSequence(factory,
                    new String[]{"xxxxxxxxxx"});
            Function tokenize = new TokenizeFunction();
            Value retVal = tokenize.invoke(context, new Value[]{sequence});
            fail("Should have failed when invoked with only one argument");
        } catch (ExpressionException expected) {
        }
    }
View Full Code Here

            ExpressionContext context = createExpressionContext();
            ExpressionFactory factory = context.getFactory();
            Sequence sequence = createSequence(factory,
                    new String[]{"xxxxxxxxxx"});
            Value pattern = factory.createStringValue("xxx");
            Function tokenize = new TokenizeFunction();
            Value retVal = tokenize.invoke(context,
                    new Value[]{sequence, pattern, pattern});
            fail("Should have failed when invoked with three arguments");
        } catch (ExpressionException expected) {
        }
    }
View Full Code Here

    /**
     * Tests if {@link ExpressionException} is thrown when min is called without
     * arguments
     */
    public void testNoArguments() {
        final Function function = new MinFunction();
        try {
            function.invoke(expressionContextMock, new Value[]{});
            fail("Exception wasn't thrown when min was invoked with 0 arguments");
        } catch (ExpressionException e) {
            //do nothing, expected situation
        }
    }
View Full Code Here

    /**
     * Tests if {@link ExpressionException} is thrown when min is called with
     * two arguments
     */
    public void testTwoArguments() {
        final Function function = new MinFunction();
        try {
            function.invoke(expressionContextMock, new Value[]{
                    factory.createSequence(new Item[]{}),
                    factory.createDoubleValue(20.0)});
            fail("Exception wasn't thrown when min was invoked with 2 arguments");
        } catch (ExpressionException e) {
            //do nothing, expected situation
View Full Code Here

   
    /**
     * Tests if empty sequence is returned for empty sequence
     */
    public void testEmptySequence() throws ExpressionException {
        final Function function = new MinFunction();
        Value result = function.invoke(expressionContextMock,
                new Value[]{factory.createSequence(new Item[]{})});
        assertTrue(result instanceof Sequence);
        assertEquals(0, result.getSequence().getLength());
    }
View Full Code Here

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

        manager.startPrefixMapping("function",
                                   functionName.getNamespaceURI());

        context.registerFunction(
                functionName,
                new Function() {
                    public Value invoke(ExpressionContext context,
                                        Value[] arguments)
                            throws ExpressionException {
                        StringBuffer buffer = new StringBuffer();
View Full Code Here

TOP

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

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.