Package com.volantis.xml.expression.sequence

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


     */
    public void testEmptyPattern() throws Exception {
        ExpressionContext context = createExpressionContext();
        ExpressionFactory factory = context.getFactory();
        Function tokenize = new TokenizeFunction();
        Sequence sequence = createSequence(factory,
                new String[]{"my search string"});
        Value pattern = factory.createStringValue("");
        try {
            Value retVal = tokenize.invoke(context,
                    new Value[]{sequence, pattern});
View Full Code Here


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

        final Sequence retSeq = retVal.getSequence();

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

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

        final Sequence retSeq = retVal.getSequence();

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

     */
    public void testWhitespacePattern() throws Exception {
        ExpressionContext context = createExpressionContext();
        ExpressionFactory factory = context.getFactory();
        Function tokenize = new TokenizeFunction();
        Sequence sequence = createSequence(factory,
                new String[]{"the cat  sat   on    the     mat"});
        Value pattern = factory.createStringValue("\\s+");
        Value retVal = tokenize.invoke(context,
                new Value[]{sequence, pattern});

        final Sequence retSeq = retVal.getSequence();

        doSequenceEquality(retSeq,
                new String[]{"the", "cat", "sat", "on", "the", "mat"});
    }
View Full Code Here

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

        final Sequence retSeq = retVal.getSequence();

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

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

        final Sequence retSeq = retVal.getSequence();

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

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

        final Sequence retSeq = retVal.getSequence();

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

    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,
                new String[]{"", "", "", "", "", "", "", "", "", "", ""});
    }
View Full Code Here

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

     */
    public void testOneArgument() throws Exception {
        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

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.