Package org.apache.tiles

Examples of org.apache.tiles.TilesContainer


        Attribute attribute = new Attribute("my.definition", null, "definition");
        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        TilesContextFactory contextFactory = EasyMock
                .createMock(TilesContextFactory.class);
        TilesContainer container = EasyMock.createMock(TilesContainer.class);
        TilesRequestContext requestContext = EasyMock
                .createMock(TilesRequestContext.class);
        EasyMock.expect(contextFactory.createRequestContext(applicationContext))
                .andReturn(requestContext);
        container.render("my.definition");
        EasyMock.replay(applicationContext, contextFactory, requestContext,
                container);
        renderer.setApplicationContext(applicationContext);
        renderer.setContextFactory(contextFactory);
        renderer.setContainer(container);
View Full Code Here


        EasyMock.expect(context.getResource("/WEB-INF/tiles.xml")).andReturn(url);
        EasyMock.replay(context);

        AbstractTilesContainerFactory factory = AbstractTilesContainerFactory
                .getTilesContainerFactory(context);
        TilesContainer container = factory.createContainer(context);

        assertNotNull(container);
        //now make sure it's initialized
        try {
            container.init(new HashMap<String, String>());
            fail("Container should have already been initialized");
        } catch (IllegalStateException te) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Intercepted an exception, it is OK", te);
            }
View Full Code Here

     * {@link JspUtil#setCurrentContainer(PageContext, String)}.
     */
    public void testSetCurrentContainer() {
        PageContext pageContext = EasyMock.createMock(PageContext.class);
        ServletContext context = EasyMock.createMock(ServletContext.class);
        TilesContainer container = EasyMock.createMock(TilesContainer.class);
        EasyMock.expect(pageContext.getServletContext()).andReturn(context);
        EasyMock.expect(context.getAttribute("myKey")).andReturn(container);
        pageContext.setAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME,
                container, PageContext.REQUEST_SCOPE);
        EasyMock.expect(pageContext.getAttribute(ServletUtil
View Full Code Here

     * {@link JspUtil#setCurrentContainer(PageContext, TilesContainer)}.
     */
    public void testSetCurrentContainerWithContainer() {
        PageContext pageContext = EasyMock.createMock(PageContext.class);
        ServletContext context = EasyMock.createMock(ServletContext.class);
        TilesContainer container = EasyMock.createMock(TilesContainer.class);
        pageContext.setAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME,
                container, PageContext.REQUEST_SCOPE);
        EasyMock.expect(pageContext.getAttribute(ServletUtil
                .CURRENT_CONTAINER_ATTRIBUTE_NAME, PageContext.REQUEST_SCOPE))
                .andReturn(container);
View Full Code Here

     * Tests {@link JspUtil#getCurrentContainer(PageContext)}.
     */
    public void testGetCurrentContainer() {
        PageContext pageContext = EasyMock.createMock(PageContext.class);
        ServletContext context = EasyMock.createMock(ServletContext.class);
        TilesContainer defaultContainer = EasyMock.createMock(
                TilesContainer.class);
        TilesContainer alternateContainer = EasyMock.createMock(
                TilesContainer.class);
        EasyMock.expect(pageContext.getServletContext()).andReturn(context);
        EasyMock.expect(pageContext.getAttribute(ServletUtil
                .CURRENT_CONTAINER_ATTRIBUTE_NAME, PageContext.REQUEST_SCOPE))
                .andReturn(null);
        EasyMock.expect(context.getAttribute(TilesAccess.CONTAINER_ATTRIBUTE))
                .andReturn(defaultContainer);
        pageContext.setAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME,
                defaultContainer, PageContext.REQUEST_SCOPE);
        pageContext.setAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME,
                alternateContainer, PageContext.REQUEST_SCOPE);
        EasyMock.expect(pageContext.getAttribute(ServletUtil
                .CURRENT_CONTAINER_ATTRIBUTE_NAME, PageContext.REQUEST_SCOPE))
                .andReturn(alternateContainer);
        EasyMock.replay(pageContext, context, defaultContainer, alternateContainer);
        TilesContainer currentContainer = JspUtil.getCurrentContainer(pageContext);
        assertTrue("The containers are not the same",
                currentContainer == defaultContainer);
        JspUtil.setCurrentContainer(pageContext, alternateContainer);
        currentContainer = JspUtil.getCurrentContainer(pageContext);
        EasyMock.verify(pageContext, context, defaultContainer, alternateContainer);
View Full Code Here

        Attribute attribute = new Attribute("my.definition", null, "definition");
        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        TilesContextFactory contextFactory = EasyMock
                .createMock(TilesContextFactory.class);
        TilesContainer container = EasyMock.createMock(TilesContainer.class);
        TilesRequestContext requestContext = EasyMock
                .createMock(TilesRequestContext.class);
        EasyMock.expect(contextFactory.createRequestContext(applicationContext))
                .andReturn(requestContext);
        EasyMock.expect(container.isValidDefinition("my.definition"))
                .andReturn(Boolean.TRUE);
        container.render("my.definition");
        EasyMock.replay(applicationContext, contextFactory, requestContext,
                container);
        renderer.setApplicationContext(applicationContext);
        renderer.setContextFactory(contextFactory);
        renderer.setContainer(container);
View Full Code Here

        Attribute attribute = new Attribute("Result", null, "string");
        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        TilesContextFactory contextFactory = EasyMock
                .createMock(TilesContextFactory.class);
        TilesContainer container = EasyMock.createMock(TilesContainer.class);
        TilesRequestContext requestContext = EasyMock
                .createMock(TilesRequestContext.class);
        EasyMock.expect(contextFactory.createRequestContext(applicationContext))
                .andReturn(requestContext);
        EasyMock.expect(container.isValidDefinition("my.definition"))
                .andReturn(Boolean.TRUE);
        EasyMock.replay(applicationContext, contextFactory, requestContext);
        renderer.setApplicationContext(applicationContext);
        renderer.setContextFactory(contextFactory);
        renderer.setContainer(container);
View Full Code Here

        Attribute attribute = new Attribute("/myTemplate.jsp", null, "template");
        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        TilesContextFactory contextFactory = EasyMock
                .createMock(TilesContextFactory.class);
        TilesContainer container = EasyMock.createMock(TilesContainer.class);
        TilesRequestContext requestContext = EasyMock
                .createMock(TilesRequestContext.class);
        EasyMock.expect(contextFactory.createRequestContext(applicationContext))
                .andReturn(requestContext);
        requestContext.dispatch("/myTemplate.jsp");
        EasyMock.expect(container.isValidDefinition("my.definition"))
                .andReturn(Boolean.TRUE);
        EasyMock.replay(applicationContext, contextFactory, requestContext);
        renderer.setApplicationContext(applicationContext);
        renderer.setContextFactory(contextFactory);
        renderer.setContainer(container);
View Full Code Here

    /**
     * Tests the setting of the context.
     */
    public void testSetContext() {
        TilesContainer container = EasyMock.createMock(TilesContainer.class);
        context.setAttribute(TilesAccess.CONTAINER_ATTRIBUTE, container);
        EasyMock.replay(context);
        TilesAccess.setContainer(context, container);
        EasyMock.verify(context);
    }
View Full Code Here

    /**
     * Tests the setting of the context.
     */
    public void testSetContextWithKey() {
        TilesContainer container = EasyMock.createMock(TilesContainer.class);
        context.setAttribute("myKey", container);
        EasyMock.replay(context);
        TilesAccess.setContainer(context, container, "myKey");
        EasyMock.verify(context);
    }
View Full Code Here

TOP

Related Classes of org.apache.tiles.TilesContainer

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.