Package org.apache.shale.test.mock

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


        public void setContentLength(int length) {
          addIntHeader("Content-Length", length);
        }

      };
      MockHttpServletRequest req = new MockHttpServletRequest(session);
      req.setServletContext(servletContext);
      req.setPathElements(request.getContextPath(), request
          .getServletPath(), request.getPathInfo(), data);
      MockResourceRequest resourceRequest = new MockResourceRequest(req);
      service.serviceResource(key, resourceRequest, response);
      byte[] content = ((MockServletOutputStream) response
          .getOutputStream()).content();
View Full Code Here


     * Create instance of faces context for current thread.
     * @return
     */
    protected FacesContext createFacesContext() {
        MockHttpSession tsession = new MockHttpSession();
        MockHttpServletRequest trequest = new MockHttpServletRequest(tsession);
        trequest.setAttribute(AjaxContext.AJAX_CONTEXT_KEY, new AjaxContextImpl());
        MockHttpServletResponse tresponse = new MockHttpServletResponse();
        MockFacesContext tfacesContext = (MockFacesContext)
        facesContextFactory.getFacesContext(servletContext,
                                            trequest,
                                            tresponse,
View Full Code Here

        super.setUp();
        MockServletContext 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,
                response);

        Map<String, Object> requestScope = context.getRequestScope();
View Full Code Here

        Map<String, String> initParams = new HashMap<String, String>();
        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,
                response);

        Map<String, Object> requestScope = context.getRequestScope();
View Full Code Here

     * Tests the forced inclusion in the request.
     *
     * @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());
View Full Code Here

     * @throws IOException If something goes wrong, but it's not a Tiles
     * 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 {
View Full Code Here

        // Set up Servlet API Objects
        servletContext = new MockServletContext();
        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();
View Full Code Here

        // Set up Servlet API Objects
        servletContext = new MockServletContext();
        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();
View Full Code Here

TOP

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

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.