Package org.apache.tiles.template

Examples of org.apache.tiles.template.InsertTemplateModel


        importAttribute = new ImportAttributeFMModel(new ImportAttributeModel());
        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


                servletContext);
        insertAttribute = new InsertAttributeVModel(new InsertAttributeModel(
                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

                servletContext);
        insertAttribute = new InsertAttributeVModel(new InsertAttributeModel(
                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 IOException If something goes wrong.
     * @throws TemplateException If something goes wrong.
     */
    @Test
    public void testExecute() throws TemplateException, IOException {
        InsertTemplateModel tModel = createMock(InsertTemplateModel.class);
        InsertTemplateFMModel fmModel = new InsertTemplateFMModel(tModel);
        TilesContainer container = createMock(TilesContainer.class);

        HttpServletRequest request = createMock(HttpServletRequest.class);
        expect(request.getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME)).andReturn(null).times(2);
        request.setAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
        expectLastCall().times(2);
        request.setAttribute(ServletUtil.FORCE_INCLUDE_ATTRIBUTE_NAME, true);
        replay(request);
        HttpRequestHashModel requestModel = new HttpRequestHashModel(request, objectWrapper);

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

        TemplateDirectiveBody body = createMock(TemplateDirectiveBody.class);
        Map<String, Object> params = new HashMap<String, Object>();
        Attribute attribute = createMock(Attribute.class);
        params.put("template", objectWrapper.wrap("myTemplate"));
        params.put("templateType", objectWrapper.wrap("myTemplateType"));
        params.put("templateExpression", objectWrapper.wrap("myTemplateExpression"));
        params.put("role", objectWrapper.wrap("myRole"));
        params.put("preparer", objectWrapper.wrap("myPreparer"));

        tModel.start(container, env);
        tModel.end(container, "myTemplate", "myTemplateType",
                "myTemplateExpression", "myRole",
                "myPreparer", env);
        body.render(isA(NullWriter.class));

        replay(tModel, body, container, attribute);
View Full Code Here

TOP

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

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.