Package org.apache.tiles.request

Examples of org.apache.tiles.request.Request


     * @throws IOException If something goes wrong during rendition.
     */
    @Test(expected = NullPointerException.class)
    public void testWriteNull() throws IOException {
        StringWriter writer = new StringWriter();
        Request requestContext = EasyMock
                .createMock(Request.class);

        replay(requestContext, stringRenderer, templateRenderer,
                definitionRenderer);
        try {
View Full Code Here


     * @throws IOException If something goes wrong during rendition.
     */
    @Test(expected = CannotRenderException.class)
    public void testWriteNotRenderable() throws IOException {
        StringWriter writer = new StringWriter();
        Request requestContext = EasyMock
                .createMock(Request.class);

        expect(
                definitionRenderer.isRenderable("Result",
                        requestContext)).andReturn(Boolean.FALSE);
View Full Code Here

     *
     * @throws IOException If something goes wrong during rendition.
     */
    @Test
    public void testWriteString() throws IOException {
        Request requestContext = EasyMock
                .createMock(Request.class);
        expect(
                definitionRenderer.isRenderable("Result",
                        requestContext)).andReturn(Boolean.FALSE);
        expect(
View Full Code Here

     * @throws IOException If something goes wrong during rendition.
     */
    @Test
    public void testWriteTemplate() throws IOException {
        StringWriter writer = new StringWriter();
        Request requestContext = EasyMock
                .createMock(Request.class);
        templateRenderer.render("/myTemplate.jsp", requestContext);
        expect(
                definitionRenderer.isRenderable("/myTemplate.jsp",
                        requestContext)).andReturn(Boolean.FALSE);
View Full Code Here

     * Tests
     * {@link DispatchRenderer#isRenderable(String, DispatchRequest)}.
     */
    @Test
    public void testIsRenderable() {
        Request requestContext = createMock(DispatchRequest.class);
        replay(requestContext);
        assertTrue(renderer.isRenderable("/myTemplate.jsp", requestContext));
        assertFalse(renderer.isRenderable(null, requestContext));
        verify(requestContext);
    }
View Full Code Here

    public boolean isRenderable(String path, Request request) {
        return path != null && getDispatchRequest(request) != null && path.startsWith("/");
    }

    private DispatchRequest getDispatchRequest(Request request) {
        Request result = request;
        while (!(result instanceof DispatchRequest) && result instanceof RequestWrapper) {
            result = ((RequestWrapper) result).getWrappedRequest();
        }
        if (!(result instanceof DispatchRequest)) {
            result = null;
View Full Code Here

     * @throws IOException If something goes wrong during rendition.
     */
    @Test
    public void testWrite() throws IOException {
        StringWriter writer = new StringWriter();
        Request requestContext = createMock(Request.class);
        expect(requestContext.getWriter()).andReturn(writer);
        replay(requestContext);
        renderer.render("Result", requestContext);
        writer.close();
        assertEquals("Not written 'Result'", "Result", writer.toString());
        verify(requestContext);
View Full Code Here

     * Tests
     * {@link StringRenderer#isRenderable(String, Request)}.
     */
    @Test
    public void testIsRenderable() {
        Request requestContext = createMock(Request.class);
        replay(requestContext);
        assertTrue(renderer.isRenderable("Result", requestContext));
        verify(requestContext);
    }
View Full Code Here

        replay(params, body);
        FreemarkerAutotagRuntime runtime = new FreemarkerAutotagRuntime();

        runtime.execute(env, params, new TemplateModel[0], body);
        Request request = runtime.createRequest();
        assertTrue(request instanceof FreemarkerRequest);
        verify(servlet, wrapper, servletContext, applicationContext,
                httpServletRequest, httpServletResponse,
                template, rootDataModel, out,
                params, body);
View Full Code Here

        JspAutotagRuntime runtime = new JspAutotagRuntime();
        runtime.setJspBody(jspBody);
        runtime.setJspContext(pageContext);
        runtime.setParent(parent);
        runtime.doTag();
        Request jspRequest = runtime.createRequest();
        assertTrue(jspRequest instanceof JspRequest);
        verify(jspBody, pageContext, parent, applicationContext, httpServletRequest, httpServletResponse);
    }
View Full Code Here

TOP

Related Classes of org.apache.tiles.request.Request

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.