Package com.volantis.xml.expression.impl

Examples of com.volantis.xml.expression.impl.SimpleExpressionScope


        factory = ExpressionFactory.getDefaultInstance();
    }

    public void testGetEnclosingScope() throws Exception {

        ExpressionScope scopeA = new SimpleExpressionScope(factory,
                                                           null);
        ExpressionScope scopeB = new SimpleExpressionScope(factory,
                                                           scopeA);

        assertNull("Scope A should have a null enclosing scope",
                   scopeA.getEnclosingScope());
        assertSame("Scope B's enclosing scope should be scope A",
                   scopeA,
                   scopeB.getEnclosingScope());
    }
View Full Code Here


                                                        "x");
        Value x = factory.createStringValue("x");
        Value y = factory.createStringValue("y");
        Value x2 = factory.createStringValue("x2");

        ExpressionScope scopeA = new SimpleExpressionScope(factory,
                                                           null);
        ExpressionScope scopeB = new SimpleExpressionScope(factory,
                                                           scopeA);

        scopeA.declareVariable(nameX, x);

        try {
            scopeB.declareVariable(nameX, x2);
        } catch (IllegalArgumentException e) {
            fail("Declaring variable x in scope B should be OK even though " +
                 "it is declared in scope A");
        }

        try {
            scopeA.declareVariable(nameX2, x2);
        } catch (IllegalArgumentException e) {
            fail("Declaring another variable x but in a different namespace " +
                 "should not cause a problem");
        }

        scopeB.declareVariable(nameY, y);

        try {
            scopeB.declareVariable(nameY, x2);

            fail("Should have had an IllegalArgumentException when an " +
                 "attempt was made to redeclare the y variable in scope B");
        } catch (IllegalArgumentException e) {
            // Expected condition
View Full Code Here

                                                      "duff");
        Value x = factory.createStringValue("x");
        Value y = factory.createStringValue("y");
        Value x2 = factory.createStringValue("x2");

        ExpressionScope scopeA = new SimpleExpressionScope(factory,
                                                           null);
        ExpressionScope scopeB = new SimpleExpressionScope(factory,
                                                           scopeA);

        scopeA.declareVariable(nameX, x);
        scopeB.declareVariable(nameX, x2);
        scopeA.declareVariable(nameX2, x2);
        scopeB.declareVariable(nameY, y);

        assertSame("Scope A's variable x should have been available",
                   x,
                   scopeA.resolveVariable(nameX).getValue());
        assertSame("Scope A's variable x should be hidden",
                   x2,
                   scopeB.resolveVariable(nameX).getValue());
        assertSame("Scope A's variable x2 should have been available",
                   x2,
                   scopeB.resolveVariable(nameX2).getValue());
        assertNull("The duff variable should not have been available",
                   scopeB.resolveVariable(duff));
        assertNull("Scope A's variable y should not have been available",
                   scopeA.resolveVariable(nameY));
        assertSame("Scope B's variable y should have been available",
                   y,
                   scopeB.resolveVariable(nameY).getValue());
    }
View Full Code Here

TOP

Related Classes of com.volantis.xml.expression.impl.SimpleExpressionScope

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.