Package org.apache.shale.test.mock

Examples of org.apache.shale.test.mock.MockHttpServletResponse


        config = new MockServletConfig(servletContext);
        session = new MockHttpSession();
        session.setServletContext(servletContext);
        request = new MockHttpServletRequest(session);
        request.setServletContext(servletContext);
        response = new MockHttpServletResponse();
        FactoryFinder.releaseFactories();
        FactoryFinder.setFactory("javax.faces.application.ApplicationFactory", "org.apache.shale.test.mock.MockApplicationFactory");
        FactoryFinder.setFactory("javax.faces.context.FacesContextFactory", "org.apache.shale.test.mock.MockFacesContextFactory");
        FactoryFinder.setFactory("javax.faces.lifecycle.LifecycleFactory", "org.apache.shale.test.mock.MockLifecycleFactory");
        FactoryFinder.setFactory("javax.faces.render.RenderKitFactory", "org.apache.shale.test.mock.MockRenderKitFactory");
View Full Code Here


        session = new MockHttpSession();
        session.setServletContext(servletContext);
        request = new MockHttpServletRequest(session);
        request.setServletContext(servletContext);
        request.setLocale(new Locale("en"));
        response = new MockHttpServletResponse();

        // Set up JSF API Objects
        FactoryFinder.releaseFactories();
        FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY,
                "org.apache.shale.test.mock.MockApplicationFactory");
View Full Code Here

     * exception.
     */
    public void testObjectAttribute() throws IOException {
        Attribute attribute = new Attribute();
        HttpServletRequest request = new MockHttpServletRequest();
        HttpServletResponse response = new MockHttpServletResponse();
        boolean exceptionFound = false;

        attribute.setValue(new Integer(SAMPLE_INT)); // A simple object
        try {
            container.render(attribute, null, request, response);
View Full Code Here

     */
    public void testAttributeCredentials() throws TilesException, IOException {
        RoleMockHttpServletRequest request = new RoleMockHttpServletRequest("myrole");
        MockHttpSession session = new MockHttpSession();
        request.setHttpSession(session);
        MockHttpServletResponse response = new MockHttpServletResponse();
        Attribute attribute = new Attribute((Object) "This is the value", "myrole");
        StringWriter writer = new StringWriter();
        container.render(attribute, writer, request, response);
        writer.close();
        assertEquals("The attribute should have been rendered", writer
View Full Code Here

        super.setUp();
        MockServletContext servletContext = new MockServletContext();
        appContext = new ServletTilesApplicationContext(servletContext);
        MockHttpSession session = new MockHttpSession(servletContext);
        MockHttpServletRequest request = new MockHttpServletRequest(session);
        MockHttpServletResponse response = new MockHttpServletResponse();
        this.request = request;
        this.response = response;
    }
View Full Code Here

        servletContext = new MockServletContext();
        servletContext
                .addInitParameter("initParameter1", "initParameterValue1");
        MockHttpSession session = new MockHttpSession(servletContext);
        MockHttpServletRequest request = new MockHttpServletRequest(session);
        MockHttpServletResponse response = new MockHttpServletResponse();
        request.addHeader("Content-Type", "text/html");
        request.addParameter("myParam", "value1");
        request.addParameter("myParam", "value2");

        context = new ServletTilesRequestContext(servletContext, request,
View Full Code Here

     *
     * @throws IOException If something goes wrong.
     */
    public void testForceInclude() throws IOException {
        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new CommitSupportMockHttpServletResponse();
        MockServletTilesRequestContext context = new MockServletTilesRequestContext(
                servletContext, request, response);
        context.dispatch(TEST_PATH);
        assertEquals("Forward has not been called", 1, context.getForwardCount());
        assertEquals("Include has been called", 0, context.getIncludeCount());
View Full Code Here

        initParams.put("initParameter1", "initParameterValue1");
        EasyMock.expect(applicationContext.getInitParams()).andReturn(
                initParams);
        MockHttpSession session = new MockHttpSession(servletContext);
        MockHttpServletRequest request = new MockHttpServletRequest(session);
        MockHttpServletResponse response = new MockHttpServletResponse();
        request.addHeader("Content-Type", "text/html");
        request.addParameter("myParam", "value1");
        request.addParameter("myParam", "value2");

        context = new ServletTilesRequestContext(applicationContext, request,
View Full Code Here

     *
     * @throws IOException If something goes wrong.
     */
    public void testForceInclude() throws IOException {
        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new CommitSupportMockHttpServletResponse();
        MockServletTilesRequestContext context = new MockServletTilesRequestContext(
                applicationContext, request, response);
        context.dispatch(TEST_PATH);
        assertEquals("Forward has not been called", 1, context.getForwardCount());
        assertEquals("Include has been called", 0, context.getIncludeCount());
View Full Code Here

        config = new MockServletConfig(servletContext);
        session = new MockHttpSession();
        session.setServletContext(servletContext);
        request = new MockHttpServletRequest(session);
        request.setServletContext(servletContext);
        response = new MockHttpServletResponse();

        // Set up JSF API Objects
        FactoryFinder.releaseFactories();
        FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY,
        "org.apache.shale.test.mock.MockApplicationFactory");
View Full Code Here

TOP

Related Classes of org.apache.shale.test.mock.MockHttpServletResponse

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.