Package org.apache.velocity.runtime.parser.node

Examples of org.apache.velocity.runtime.parser.node.Node.jjtGetChild()


        Node node = createMock(Node.class);
        ASTMap astMap = createMock(ASTMap.class);
        @SuppressWarnings("unchecked")
        Map<String, Object> params = createMock(Map.class);

        expect(node.jjtGetChild(0)).andReturn(astMap);
        expect(astMap.value(context)).andReturn(params);

        replay(context, node, astMap, params);
        assertSame(params, VelocityUtil.getParameters(context, node));
        verify(context, node, astMap, params);
View Full Code Here


    public void testCreateModelBody() {
        InternalContextAdapter context = createMock(InternalContextAdapter.class);
        Writer writer = createMock(Writer.class);
        Node node = createMock(Node.class);
        ASTBlock block = createMock(ASTBlock.class);
        expect(node.jjtGetChild(1)).andReturn(block);
        replay(context, writer, node, block);
        VelocityAutotagRuntime runtime = new VelocityAutotagRuntime();
        runtime.render(context, writer, node);
        ModelBody modelBody = runtime.createModelBody();
        assertTrue(modelBody instanceof VelocityModelBody);
View Full Code Here

        Writer writer = createMock(Writer.class);
        Node node = createMock(Node.class);
        ASTMap astMap = createMock(ASTMap.class);
        @SuppressWarnings("unchecked")
        Map<String, Object> params = createMock(Map.class);
        expect(node.jjtGetChild(0)).andReturn(astMap);
        expect(astMap.value(context)).andReturn(params);
        expect(params.get(eq("notnullParam"))).andReturn(new Integer(42)).anyTimes();
        expect(params.get(eq("nullParam"))).andReturn(null).anyTimes();
        replay(context, writer, node, astMap, params);
        VelocityAutotagRuntime runtime = new VelocityAutotagRuntime();
View Full Code Here

        Node node = createMock(Node.class);
        ASTMap astMap = createMock(ASTMap.class);
        @SuppressWarnings("unchecked")
        Map<String, Object> params = createMock(Map.class);

        expect(node.jjtGetChild(0)).andReturn(astMap);
        expect(astMap.value(context)).andReturn(params);

        replay(context, node, astMap, params);
        assertSame(params, VelocityUtil.getParameters(context, node));
        verify(context, node, astMap, params);
View Full Code Here

            // if this is a "chunk", evaluate its expression and prepend join if included...
            if (child instanceof ASTDirective
                && "chunk".equals(((ASTDirective) child).getDirectiveName())) {

                if (child.jjtGetNumChildren() < 2
                    || child.jjtGetChild(0).evaluate(context)) {

                    if (includedChunks > 0) {
                        childWriter.write(join);
                    }
View Full Code Here

            // if this is a "chunk", evaluate its expression and prepend join if included...
            if (child instanceof ASTDirective
                && "chunk".equals(((ASTDirective) child).getDirectiveName())) {

                if (child.jjtGetNumChildren() < 2
                    || child.jjtGetChild(0).evaluate(context)) {

                    if (includedChunks > 0) {
                        childWriter.write(join);
                    }
View Full Code Here

            // if this is a "chunk", evaluate its expression and prepend join if included...
            if (child instanceof ASTDirective
                && "chunk".equals(((ASTDirective) child).getDirectiveName())) {

                if (child.jjtGetNumChildren() < 2
                    || child.jjtGetChild(0).evaluate(context)) {

                    if (includedChunks > 0) {
                        childWriter.write(join);
                    }
View Full Code Here

            // if this is a "chunk", evaluate its expression and prepend join if included...
            if (child instanceof ASTDirective
                && "chunk".equals(((ASTDirective) child).getDirectiveName())) {

                if (child.jjtGetNumChildren() < 2
                    || child.jjtGetChild(0).evaluate(context)) {

                    if (includedChunks > 0) {
                        childWriter.write(join);
                    }
View Full Code Here

        expect(velocityContext.getInternalUserContext()).andReturn(viewContext);
        expect(viewContext.getRequest()).andReturn(request);
        expect(viewContext.getResponse()).andReturn(response);
        expect(viewContext.getServletContext()).andReturn(servletContext);
        expect(node.jjtGetChild(0)).andReturn(astMap);
        expect(astMap.value(velocityContext)).andReturn(params);
        expect(request.getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME)).andReturn(container);
        expect(tModel.getImportedAttributes(container, "myName", "myToName", false,
                velocityContext, request, response)).andReturn(attributes);
        expect(velocityContext.put("one", "value1")).andReturn("value1");
View Full Code Here

        expect(velocityContext.getInternalUserContext()).andReturn(viewContext);
        expect(viewContext.getRequest()).andReturn(request);
        expect(viewContext.getResponse()).andReturn(response);
        expect(viewContext.getServletContext()).andReturn(servletContext);
        expect(node.jjtGetChild(0)).andReturn(astMap);
        expect(astMap.value(velocityContext)).andReturn(params);
        expect(request.getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME)).andReturn(container);
        expect(tModel.getImportedAttributes(container, "myName", "myToName", false,
                velocityContext, request, response)).andReturn(attributes);
        request.setAttribute("one", "value1");
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.