Package org.apache.tiles.template

Examples of org.apache.tiles.template.PutAttributeModel


        insertAttribute = new InsertAttributeFMModel(new InsertAttributeModel(
                attributeResolver));
        insertDefinition = new InsertDefinitionFMModel(
                new InsertDefinitionModel());
        insertTemplate = new InsertTemplateFMModel(new InsertTemplateModel());
        putAttribute = new PutAttributeFMModel(new PutAttributeModel());
        putListAttribute = new PutListAttributeFMModel(
                new PutListAttributeModel());
        setCurrentContainer = new SetCurrentContainerFMModel();
    }
View Full Code Here


                attributeResolver), servletContext);
        insertDefinition = new InsertDefinitionVModel(
                new InsertDefinitionModel(), servletContext);
        insertTemplate = new InsertTemplateVModel(new InsertTemplateModel(),
                servletContext);
        putAttribute = new PutAttributeVModel(new PutAttributeModel(),
                servletContext);
        putListAttribute = new PutListAttributeVModel(
                new PutListAttributeModel(), servletContext);
    }
View Full Code Here

                attributeResolver), servletContext);
        insertDefinition = new InsertDefinitionVModel(
                new InsertDefinitionModel(), servletContext);
        insertTemplate = new InsertTemplateVModel(new InsertTemplateModel(),
                servletContext);
        putAttribute = new PutAttributeVModel(new PutAttributeModel(),
                servletContext);
        putListAttribute = new PutListAttributeVModel(
                new PutListAttributeModel(), servletContext);
    }
View Full Code Here

     * @throws TemplateException If something goes wrong.
     */
    @Test
    public void testExecute() throws TemplateException, IOException {
        TilesContainer container = createMock(TilesContainer.class);
        PutAttributeModel tModel = createMock(PutAttributeModel.class);
        PutAttributeFMModel fmModel = new PutAttributeFMModel(tModel);

        HttpServletRequest request = createMock(HttpServletRequest.class);
        ArrayStack<Object> composeStack = new ArrayStack<Object>();
        expect(request.getAttribute(FreeMarkerUtil.COMPOSE_STACK_ATTRIBUTE_NAME)).andReturn(composeStack);
        expect(request.getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME)).andReturn(null);
        request.setAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
        replay(request);
        HttpRequestHashModel requestModel = new HttpRequestHashModel(request, objectWrapper);

        GenericServlet servlet = createMock(GenericServlet.class);
        ServletContext servletContext = createMock(ServletContext.class);
        expect(servlet.getServletContext()).andReturn(servletContext).times(2);
        expect(servletContext.getAttribute(TilesAccess.CONTAINER_ATTRIBUTE)).andReturn(container);
        replay(servlet, servletContext);
        ServletContextHashModel servletContextModel = new ServletContextHashModel(servlet, objectWrapper);
        expect(model.get(FreemarkerServlet.KEY_REQUEST)).andReturn(requestModel).times(2);
        expect(model.get(FreemarkerServlet.KEY_APPLICATION)).andReturn(servletContextModel);
        initEnvironment();

        TemplateDirectiveBody body = createMock(TemplateDirectiveBody.class);
        Map<String, Object> params = new HashMap<String, Object>();
        Integer value = new Integer(1);
        params.put("name", objectWrapper.wrap("myName"));
        params.put("value", objectWrapper.wrap(value));
        params.put("expression", objectWrapper.wrap("myExpression"));
        params.put("role", objectWrapper.wrap("myRole"));
        params.put("type", objectWrapper.wrap("myType"));
        params.put("cascade", objectWrapper.wrap(false));

        tModel.start(composeStack);
        tModel.end(container, composeStack, "myName", value, "myExpression",
                "", "myRole", "myType", false, env);
        body.render(isA(StringWriter.class));

        replay(tModel, body, container);
        fmModel.execute(env, params, null, body);
View Full Code Here

TOP

Related Classes of org.apache.tiles.template.PutAttributeModel

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.