Examples of ExpressionContext


Examples of com.volantis.xml.expression.ExpressionContext

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

Examples of com.volantis.xml.expression.ExpressionContext

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

Examples of com.volantis.xml.expression.ExpressionContext

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

Examples of com.volantis.xml.expression.ExpressionContext

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

Examples of com.volantis.xml.expression.ExpressionContext

     * @throws Exception if an  error is encountered
     */
    public void testCreateContext() throws Exception {
        // ensure the correct object is created
        // @todo fix parameters
        ExpressionContext context = factory.createExpressionContext(null, null);
        assertTrue("JXPathExpressionFactory createContext() should create " +
                   "JXPathExpressionContext instance",
                   (context instanceof JXPathExpressionContext));
    }   
View Full Code Here

Examples of com.volantis.xml.expression.ExpressionContext

                    Expression expression = parser.parse(expressionStr);
                    // obtain the ExpressionContext from the PipelineContext
                    // the ExpressionContext is needed in order to evaluate the
                    // expression parsed
                    ExpressionContext expressionContext =
                            getPipelineContext().getExpressionContext();

                    // evaluate the experssion
                    Value result = expression.evaluate(expressionContext);
                    if (result.getSequence().getLength() == 0) {
View Full Code Here

Examples of com.volantis.xml.expression.ExpressionContext

                               final ExpandedName element,
                               final Attributes attributes) throws SAXException {

        // create a new stack frame and execute the pending variable
        // declarations
        final ExpressionContext expressionContext =
            dynamicProcess.getPipelineContext().getExpressionContext();
        expressionContext.pushStackFrame();
        final TemplateModel model = getModel(dynamicProcess);
        model.executePendingVariableDeclarations();
        return super.startElement(dynamicProcess, element, attributes);
    }
View Full Code Here

Examples of com.volantis.xml.expression.ExpressionContext

    protected void endElementImpl(final DynamicProcess dynamicProcess,
                                  final ExpandedName element,
                                  final Object object) throws SAXException {
        super.endElementImpl(dynamicProcess, element, object);
        // remove the stack frame created for the body of the template
        final ExpressionContext expressionContext =
            dynamicProcess.getPipelineContext().getExpressionContext();
        expressionContext.popStackFrame();
    }
View Full Code Here

Examples of com.volantis.xml.expression.ExpressionContext

                                         InternalResponse response,
                                         EnvironmentContext context)
            throws IOException, MarinerContextException {

        MarinerSessionContext sessionContext = null;
        ExpressionContext expressionContext = null;
        if (context != null) {
            sessionContext = context.getCurrentSessionContext();
            expressionContext = context.getExpressionContext();
        }
        try {
View Full Code Here

Examples of com.volantis.xml.expression.ExpressionContext

            // MarinerPageContext has been allocated but before it has been
            // initialised as this is needed during the initialisation.
            environmentContext.initialise(context);
            environmentContext.initialiseSession();

            ExpressionContext exprContext =
                    environmentContext.getExpressionContext();

            // If there is an expression context then it must have been associated
            // with an enclosing request context since we are still initialising
            // this instance of MarinerServletRequestContext. We now must associate
            // the expression context with this MarinerServletRequestContext.
            //
            // An expression context can be associated with more than one request
            // context, although not concurrently. When the request context is no
            // longer needed, the expression context (if any) should be reset to
            // the enclosing request context.
            if (exprContext == null) {
                ExpressionSupport.createExpressionEnv(this,
                        volantisBean, environmentContext,
                        context.getDevicePolicyAccessor());
            } else {
                exprContext.setProperty(MarinerRequestContext.class, this,
                        false);
            }

            ContextInternals.setEnvironmentContext(this, environmentContext);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.