Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.ExpressionContext


    /**
     * Tests a 'comma x' pattern.
     */
    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,
View Full Code Here


    public Object startElement(
            DynamicProcess dynamicProcess, ExpandedName element,
            Attributes attributes) throws SAXException {

        XMLPipelineContext pipelineContext = dynamicProcess.getPipelineContext();
        ExpressionContext context = pipelineContext.getExpressionContext();

        // Get the expr attribute.
        String expr = attributes.getValue("expr");
        if (expr == null) {
            forwardError(dynamicProcess,
View Full Code Here

    /**
     * Tests when input matches pattern, a sequence with an empty string
     * results.
     */
    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");
View Full Code Here

     * Tests when input equals multiple occurrences of pattern that a sequence
     * of empty strings (one for each match, plus one extra) results.
     */
    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,
View Full Code Here

     * Tests when input equals multiple occurrences of pattern that a sequence
     * of empty strings (one for each match, plus one extra) results.
     */
    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,
View Full Code Here

     * Tests when input is a multiple concatenation of pattern with a
     * 'leftover', that each match generates an empty string and the last
     * 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,
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

    /**
     * Tests that failure occurs when function is given one argument.
     */
    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");
View Full Code Here

    /**
     * Tests that failure occurs when function is given three arguments.
     */
    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,
View Full Code Here

     */
    private ExpressionContext createExpressionContext() {
        EnvironmentInteractionTracker eit =
                new SimpleEnvironmentInteractionTracker();
        NamespacePrefixTracker npt = new DefaultNamespacePrefixTracker();
        ExpressionContext context = ExpressionFactory.getDefaultInstance().
                createExpressionContext(eit, npt);
        return context;
    }
View Full Code Here

TOP

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

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.