Package com.volantis.xml.expression.sequence

Examples of com.volantis.xml.expression.sequence.Sequence


     */
    public void testThreeArguments() throws Exception {
        try {
            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});
View Full Code Here


    /**
     * Test that an empty input sequence returns an empty sequence.
     */
    public void testEmpty() throws Exception {

        Sequence sequence = factory.createSequence(new Item[0]);
        Function function = new SubsequenceFunction();

        Value result;

        result = invokeSubsequence(function, sequence, 1);
View Full Code Here

     * Test that a range within the middle that does not overlap the ends
     * works.
     */
    public void testMiddleRange() throws Exception {

        Sequence sequence = factory.createSequence(flintstoneAndRubbleItems);
        Function function = new SubsequenceFunction();

        Value result;

        result = invokeSubsequence(function, sequence, 2, 2);
        Sequence subsequence = result.getSequence();
        assertEquals(subsequence.getLength(), 2);
        assertSame(flintstoneAndRubbleItems[1], subsequence.getItem(1));
        assertSame(flintstoneAndRubbleItems[2], subsequence.getItem(2));
    }
View Full Code Here

    /**
     * Test that a range that overlaps the start works.
     */
    public void testOverlappingStartRange() throws Exception {

        Sequence sequence = factory.createSequence(flintstoneAndRubbleItems);
        Function function = new SubsequenceFunction();

        Value result;

        result = invokeSubsequence(function, sequence, -2, 6);
        Sequence subsequence = result.getSequence();
        assertEquals(subsequence.getLength(), 3);
        assertSame(flintstoneAndRubbleItems[0], subsequence.getItem(1));
        assertSame(flintstoneAndRubbleItems[1], subsequence.getItem(2));
        assertSame(flintstoneAndRubbleItems[2], subsequence.getItem(3));
    }
View Full Code Here

    /**
     * Test that a range that overlaps the end works.
     */
    public void testOverlappingEndRange() throws Exception {

        Sequence sequence = factory.createSequence(flintstoneAndRubbleItems);
        Function function = new SubsequenceFunction();

        Value result;

        result = invokeSubsequence(function, sequence, 2, 6);
        Sequence subsequence = result.getSequence();
        assertEquals(subsequence.getLength(), 3);
        assertSame(flintstoneAndRubbleItems[1], subsequence.getItem(1));
        assertSame(flintstoneAndRubbleItems[2], subsequence.getItem(2));
        assertSame(flintstoneAndRubbleItems[3], subsequence.getItem(3));
    }
View Full Code Here

    /**
     * Test that a range that overlaps the whole sequence works.
     */
    public void testOverlappingRange() throws Exception {

        Sequence sequence = factory.createSequence(flintstoneAndRubbleItems);
        Function function = new SubsequenceFunction();

        Value result;

        result = invokeSubsequence(function, sequence, -2, 60);
        Sequence subsequence = result.getSequence();
        assertSame(sequence, subsequence);
    }
View Full Code Here

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

        Sequence sequence = (Sequence) result;

        assertEquals("Sequence is not empty", 0, sequence.getLength());
    }
View Full Code Here

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

        Sequence sequence = (Sequence) result;

        assertEquals("Sequence is not empty", 0, sequence.getLength());

    }
View Full Code Here

     * Tests if sequence for NodeList is created correctly.
     *
     * @throws Exception
     */
    public void testSequenceNodeValues() throws Exception {
        Sequence sequence = factory.createSequence((NodeList) null);
        assertSame("Sequence should be empty", sequence, Sequence.EMPTY);
       
        final Node node = getNodeWithChildrenForSequence();
        final NodeList listOfNodes = node.getChildNodes();
        sequence = factory.createSequence(listOfNodes);
        Node[] nodes = new Node[listOfNodes.getLength()];
        for (int i = 0; i < listOfNodes.getLength(); i++) {
            // store nodes for later comparision
            nodes[i] = listOfNodes.item(i);
            assertEquals("Sequence doesn't contains correct Values",
                    listOfNodes.item(i).getNodeName(),
                    ((NodeValue)sequence.getItem(i + 1)).asW3CNode()
                            .getNodeName());
            assertSame("Nodes from Sequence should be " +
                    "the same as used while creating an Sequence",
                    listOfNodes.item(i),
                    ((NodeValue) sequence.getItem(i + 1)).asW3CNode());
        }
        // now change NodeList, this should left sequence unchanged
        node.removeChild(nodes[0]);
        assertSame("Removed from list of nodes node isn't exists in sequence",
                nodes[0], ((NodeValue) sequence.getItem(1)).asW3CNode());
    }
View Full Code Here

    /**
     * Tests that the less than operator works with 2 sequences
     * @throws Exception if an error occurs
     */
    public void testLessThanWithSequences() throws Exception {
        Sequence first = factory.createSequence(new Item[] {
            factory.createIntValue(1000),
            factory.createIntValue(100),
            factory.createIntValue(10)
        });

        Sequence second = factory.createSequence(new Item[] {
            factory.createIntValue(1),
            factory.createIntValue(2)
        });

        context.getCurrentScope().declareVariable(
View Full Code Here

TOP

Related Classes of com.volantis.xml.expression.sequence.Sequence

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.