Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.ExpressionContext


    // javadoc inherited
    public void startProcess() throws SAXException {

        // declare the variabe in the current ExpressionContext.
        ExpressionContext expressionContext
                = getPipelineContext().getExpressionContext();

        // The given name could be a prefixed name, so go through these hoops
        // to ensure that we register the variable against the correct
        // namespace (the namespace for no prefix is "no namespace" according
        // to http://www.w3.org/TR/xpath20/#id-variables - this is modelled
        // using the "default namespace" for variables)
        expressionContext.getCurrentScope().declareVariable(
            expressionContext.getNamespacePrefixTracker().
            resolveQName(new ImmutableQName(variableName), ""),
            expressionContext.getFactory().
            createStringValue(variableValue));
    }
View Full Code Here


    }

    // javadoc inherited
    public void startProcess() throws SAXException {
        // declare a variable scope
        ExpressionContext context =
                getPipelineContext().getExpressionContext();
        context.pushStackFrame();
    }
View Full Code Here

    }

    // javadoc inherited
    public void stopProcess() throws SAXException {
        // undeclare a variable scope
        ExpressionContext context =
                getPipelineContext().getExpressionContext();
        context.popStackFrame();
    }
View Full Code Here

        ProtocolBuilder builder = new ProtocolBuilder();
        DOMProtocol protocol = (DOMProtocol) builder.build(
                new TestProtocolRegistry.TestDOMProtocolFactory(),
                InternalDeviceTestHelper.createTestDevice());

        ExpressionContext expressionContext =
                ExpressionFactory.getDefaultInstance().createExpressionContext(
                        null,
                        NamespaceFactory.getDefaultInstance().createPrefixTracker());

        ContextInternals.setEnvironmentContext(requestContext, environmentContext);
        ContextInternals.setMarinerPageContext(requestContext, pageContext);
        MCSExpressionHelper.setExpressionContext(requestContext, expressionContext);

        pageContext.pushRequestContext(requestContext);
        pageContext.setProtocol(protocol);

        ExpressionSupport.registerFunctions(expressionContext);
        expressionContext.setProperty(MarinerRequestContext.class,
                                      requestContext,
                                      true);

        protocol.setMarinerPageContext(pageContext);
View Full Code Here

        ContextInternals.setEnvironmentContext(requestContext,
                environmentContext);

        ExpressionFactory expressionFactory = ExpressionFactory.getDefaultInstance();

        ExpressionContext expressionContext =
                expressionFactory.createExpressionContext(
                        null,
                        NamespaceFactory.getDefaultInstance()
                        .createPrefixTracker());

        expressionContext.setProperty(MarinerRequestContext.class,
                                      requestContext, false);

        final CurrentProjectProviderMock projectProviderMock =
                new CurrentProjectProviderMock("projectProviderMock",
                        expectations);
        projectProviderMock.expects.getCurrentProject().returns(project).any();

        // Add a project provider in for resolving relative policy expressions
        // without a project into absolute IDs containing a project.
        expressionContext.setProperty(CurrentProjectProvider.class,
                projectProviderMock, false);

        environmentContext.setExpressionContext(expressionContext);
        return requestContext;
    }
View Full Code Here

   
    public void testParameters() throws Exception {
        ExpressionFactory factory = new JXPathExpressionFactory();
        TestFunction testFunction = new TestFunction(factory);
        // @todo later fix parameters
        ExpressionContext context = factory.createExpressionContext(null, null);
        JXPathExpressionFunctionAdapter adapter =
                new JXPathExpressionFunctionAdapter(factory,
                                                    testFunction,
                                                    context);
        Item[] items = {factory.createIntValue(1),
View Full Code Here

                pipelineFactory.createPipelineContext(
                        createPipelineConfiguration(),
                        createRootEnvironmentInteraction());

        // extract the expression context
        ExpressionContext expressionContext
                = pipelineContext.getExpressionContext();

        // allow subclasses to register functions that are specific to
        // their tests
        registerExpressionFunctions(expressionContext);
View Full Code Here

        // create the actual parser
        XMLReader parser = XMLReaderFactory.createXMLReader(false);

        // extract the expression context
        ExpressionContext expresisonContext
                = context.getExpressionContext();

        // allow subclasses to register functions that are specific to
        // their tests
        registerExpressionFunctions(expresisonContext);
View Full Code Here

        // Create an expression context for the environment context.
        final ExpressionFactory factory = ExpressionFactory.getDefaultInstance();
        final EnvironmentInteractionTracker simpleTracker =
                new SimpleEnvironmentInteractionTracker();
        final ExpressionContext exprContext = factory.
                createExpressionContext(simpleTracker,
                        new DefaultNamespacePrefixTracker());

        // Associate the expression context with the environment context.
        envContext.setExpressionContext(exprContext);
View Full Code Here

        // Get the initial environment and expression contexts from the page
        // context.
        final TestEnvironmentContext initialEnvContext =
                (TestEnvironmentContext) pageContext.getEnvironmentContext();
        final ExpressionContext initialExprContext =
                initialEnvContext.getExpressionContext();

        // Retrieve the initial MarinerRequestContext.
        final MarinerRequestContext initialRequestContext =
                pageContext.getRequestContext();

        assertSame("Expression context should be copied to first nested " +
                "context",
                initialRequestContext.getEnvironmentContext().
                getExpressionContext(),
                initialExprContext);

        // Initially, the  expression context is associated with the page
        // context's request context.
        assertSame("MRC class property should be the same for the page " +
                "context's request context",
                initialExprContext.getProperty(MarinerRequestContext.class),
                initialRequestContext);

        // Create the first nested context.
        MarinerRequestContext nestedContext1 =
                initialRequestContext.createNestedContext();

        // Test that the initial expression context has been copied to the
        // first nested context.
        assertSame("Expression context should be copied to first nested " +
                "context",
                nestedContext1.getEnvironmentContext().getExpressionContext(),
                initialExprContext);

        // The expression context is now associated with the
        // MarinerServletRequestContext.
        assertSame("MRC class property should be the same on first nested " +
                "context",
                initialExprContext.getProperty(MarinerRequestContext.class),
                nestedContext1);

        // Create the second nested context.
        MarinerRequestContext nestedContext2 =
                nestedContext1.createNestedContext();

        // Test that the initial expression context has been copied to the
        // second nested context.
        assertSame("Expression context should be copied to second nested " +
                "context",
                nestedContext2.getEnvironmentContext().getExpressionContext(),
                initialExprContext);

        // The expression context is now associated with the second nested
        // context.
        assertSame("MRC class property should be the same on second nested " +
                "context",
                initialExprContext.getProperty(MarinerRequestContext.class),
                nestedContext2);

        // Clean up the context's resources; in particular the expression
        // context should be "reset".
        nestedContext2.release();

        // After releasing, the expression context should now be re-associated
        // with the first nested context.
        assertSame("MRC class property should be the same on first nested " +
                "context after second nested context release",
                initialExprContext.getProperty(MarinerRequestContext.class),
                nestedContext1);

        // Clean up the context's resources; in particular the expression
        // context should be "reset".
        nestedContext1.release();

        // After releasing, the expression context should now be re-associated
        // with the internal request context.
        assertSame("MRC class property should be the same on " +
                "MarinerServletRequestContext after first nested release",
                initialExprContext.getProperty(MarinerRequestContext.class),
                initialRequestContext);
    }
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.