Package org.apache.tiles.template

Examples of org.apache.tiles.template.GetAsStringModel


        addAttribute = new AddAttributeFMModel(new AddAttributeModel());
        addListAttribute = new AddListAttributeFMModel(
                new AddListAttributeModel());
        definition = new DefinitionFMModel(new DefinitionModel());
        AttributeResolver attributeResolver = new DefaultAttributeResolver();
        getAsString = new GetAsStringFMModel(new GetAsStringModel(
                attributeResolver));
        importAttribute = new ImportAttributeFMModel(new ImportAttributeModel());
        insertAttribute = new InsertAttributeFMModel(new InsertAttributeModel(
                attributeResolver));
        insertDefinition = new InsertDefinitionFMModel(
View Full Code Here


        addAttribute = new AddAttributeVModel(new AddAttributeModel());
        addListAttribute = new AddListAttributeVModel(
                new AddListAttributeModel());
        definition = new DefinitionVModel(new DefinitionModel(), servletContext);
        getAsString = new GetAsStringVModel(new GetAsStringModel(
                attributeResolver), servletContext);
        importAttribute = new ImportAttributeVModel(new ImportAttributeModel(),
                servletContext);
        insertAttribute = new InsertAttributeVModel(new InsertAttributeModel(
                attributeResolver), servletContext);
View Full Code Here

        addAttribute = new AddAttributeVModel(new AddAttributeModel());
        addListAttribute = new AddListAttributeVModel(
                new AddListAttributeModel());
        definition = new DefinitionVModel(new DefinitionModel(), servletContext);
        getAsString = new GetAsStringVModel(new GetAsStringModel(
                attributeResolver), servletContext);
        importAttribute = new ImportAttributeVModel(new ImportAttributeModel(),
                servletContext);
        insertAttribute = new InsertAttributeVModel(new InsertAttributeModel(
                attributeResolver), servletContext);
View Full Code Here

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

        HttpServletRequest request = createMock(HttpServletRequest.class);
        ArrayStack<Object> composeStack = new ArrayStack<Object>();
        expect(request.getAttribute(FreeMarkerUtil.COMPOSE_STACK_ATTRIBUTE_NAME)).andReturn(composeStack).times(2);
        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(CALL_COUNT);
        expect(model.get(FreemarkerServlet.KEY_APPLICATION)).andReturn(servletContextModel);
        initEnvironment();

        TemplateDirectiveBody body = createMock(TemplateDirectiveBody.class);
        Map<String, Object> params = new HashMap<String, Object>();
        Attribute attribute = createMock(Attribute.class);
        params.put("preparer", objectWrapper.wrap("myPreparer"));
        params.put("role", objectWrapper.wrap("myRole"));
        params.put("defaultValue", objectWrapper.wrap("myDefaultValue"));
        params.put("defaultValueRole", objectWrapper.wrap("myDefaultValueRole"));
        params.put("defaultValueType", objectWrapper.wrap("myDefaultValueType"));
        params.put("name", objectWrapper.wrap("myName"));
        params.put("value", objectWrapper.wrap(attribute));

        tModel.start(composeStack, container, false, "myPreparer", "myRole", "myDefaultValue", "myDefaultValueRole",
                "myDefaultValueType", "myName", attribute, env);
        tModel.end(composeStack, container, writer, false, env);
        body.render(isA(NullWriter.class));

        replay(tModel, body, container, attribute);
        fmModel.execute(env, params, null, body);
        verify(template, model, request, tModel, body, container, servlet, servletContext, attribute);
View Full Code Here

TOP

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

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.