Examples of MockHttpServletResponse


Examples of net.sourceforge.pebble.mock.MockHttpServletResponse

  protected void setUp() throws Exception {
    super.setUp();

    request = new MockHttpServletRequest();
    response = new MockHttpServletResponse();

    model = new Model();
    model.put(Constants.BLOG_KEY, blog);
    action.setModel(model);
  }
View Full Code Here

Examples of net.sourceforge.stripes.mock.MockHttpServletResponse

    }

    @Test(groups = "fast")
    public void testPermanantRedirect() throws Exception {
        RedirectResolution resolution = new RedirectResolution("http://www.stripesframework.org", false).setPermanent(true);
        MockHttpServletResponse response = new MockHttpServletResponse();
        resolution.execute(buildMockServletRequest(), response);
       
        Assert.assertEquals(response.getStatus(), HttpServletResponse.SC_MOVED_PERMANENTLY);
        Assert.assertEquals(response.getHeaderMap().get("Location").iterator().next(), "http://www.stripesframework.org");
    }
View Full Code Here

Examples of org.apache.axis2.transport.http.mock.MockHttpServletResponse

public abstract class CommonsHTTPTransportSenderTest extends TestCase  {
   
    protected abstract TransportSender getTransportSender();

    public void testInvokeWithServletBasedOutTransportInfo() throws Exception {
        MockHTTPResponse httpResponse = new MockHttpServletResponse();
        ServletBasedOutTransportInfo info = new ServletBasedOutTransportInfo(
                (HttpServletResponse) httpResponse);
        SOAPEnvelope envelope = getEnvelope();
        httpResponse = configAndRun(httpResponse, info, null, getTransportSender());

        assertEquals("Not the expected Header value", "application/xml", httpResponse.getHeaders()
                .get("Content-Type"));
        assertEquals("Not the expected Header value", "custom-value", httpResponse.getHeaders()
                .get("Custom-header"));
        assertEquals("Not the expected body content", envelope.toString().replace("utf", "UTF"),
                new String(httpResponse.getByteArrayOutputStream().toByteArray()));
    }
View Full Code Here

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

        this.request.setServletContext(this.servletContext);
    }

    protected void initResponse()
    {
        this.response = new MockHttpServletResponse();
    }
View Full Code Here

Examples of org.apache.myfaces.tobago.mock.servlet.MockHttpServletResponse

    tldPaths[0] = "META-INF/org/apache/myfaces/tobago/taglib/component/tobago.tld";
    super.setUp();

    ServletContext servletContext = new MockServletContext();
    HttpServletRequest request = new MockHttpServletRequest();
    HttpServletResponse response = new MockHttpServletResponse();
    pageContext = new MockPageContext(request);
    ExternalContext externalContext =
        new MockExternalContext(servletContext, request, response);
    Lifecycle lifecycle = null;
    facesContext = new MockFacesContext(externalContext, lifecycle);
View Full Code Here

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

Examples of org.apache.struts.mock.MockHttpServletResponse

        // -- configure the request
        this.request = new MockHttpServletRequest(new MockHttpSession());

        pageContext =
            new MockPageContext(servletConfig, request,
                new MockHttpServletResponse());
    }
View Full Code Here

Examples of org.apache.wicket.protocol.http.MockHttpServletResponse

    return ((WebRequest)cycle.getRequest()).getHttpServletRequest().getCookies();
  }

  private List<Cookie> getResponseCookies(final RequestCycle cycle)
  {
    MockHttpServletResponse response = (MockHttpServletResponse)((WebResponse)cycle.getResponse()).getHttpServletResponse();
    return (List<Cookie>)response.getCookies();
  }
View Full Code Here

Examples of org.apache.wicket.protocol.http.mock.MockHttpServletResponse

      application.getSharedResources().add("foo.gif", resource);
      MockHttpServletRequest request = new MockHttpServletRequest(application, null, null);
      request.setURL(request.getContextPath() + request.getServletPath() +
        "/wicket/resource/" + Application.class.getName() + "/foo.gif");
      setIfModifiedSinceToNextWeek(request);
      MockHttpServletResponse response = new MockHttpServletResponse(request);
      filter.doFilter(request, response, new FilterChain()
      {
        @Override
        public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
          throws IOException, ServletException
        {
        }
      });
      assertEquals(HttpServletResponse.SC_NOT_MODIFIED, response.getStatus());
      String responseExpiresHeader = response.getHeader("Expires");
      assertNotNull("Expires header must be set on not modified response",
        responseExpiresHeader);

      Date responseExpires = headerDateFormat.parse(responseExpiresHeader);
      assertTrue("Expected later than current date but was " + responseExpires,
View Full Code Here

Examples of org.jboss.seam.mock.MockHttpServletResponse

           
        };
        // Add some parameters to test passthrough
        String [] fooParams = {"bar"};
        request.getParameterMap().put("foo", fooParams);
        ServletResponse response = new MockHttpServletResponse();
        FilterChain chain = new FilterChain()
        {

            public void doFilter(ServletRequest request, ServletResponse response)
                    throws IOException, ServletException
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.