Examples of HttpServletRequestMock


Examples of br.com.caelum.vraptor.test.HttpServletRequestMock

    Enumeration<String> emptyEnumeration = enumeration(Collections.<String>emptyList());
    when(servletContext.getInitParameterNames()).thenReturn(emptyEnumeration);
    when(servletContext.getAttributeNames()).thenReturn(emptyEnumeration);
 
    session = new HttpSessionMock(servletContext, "session");
    request = new HttpServletRequestMock(session, mock(MutableRequest.class));
    response = mock(MutableResponse.class);

    FilterChain chain = mock(FilterChain.class);
    VRaptorRequestHolder.setRequestForCurrentThread(new RequestInfo(servletContext, chain, request, response));
    RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
View Full Code Here

Examples of br.com.caelum.vraptor.test.HttpServletRequestMock

  protected <T> T executeInsideRequest(final WhatToDo<T> execution) {
  Callable<T> task = new Callable<T>(){
      public T call() throws Exception {
        T result = null;
        HttpSessionMock session = new HttpSessionMock(context, "session" + ++counter);
        HttpServletRequestMock httpRequest = new HttpServletRequestMock(session,
            mock(MutableRequest.class, "request" + counter));
        MutableResponse response = mock(MutableResponse.class, "response" + counter);

        RequestInfo request = new RequestInfo(context, null, httpRequest, response);
        VRaptorRequestHolder.setRequestForCurrentThread(request);
View Full Code Here

Examples of br.com.caelum.vraptor.test.HttpServletRequestMock

  @Before
  public void init() {
    servletContext = mock(ServletContext.class);

    session = new HttpSessionMock(servletContext, "session");
    request = new HttpServletRequestMock(session, mock(MutableRequest.class));

    ServletRequestAttributes requestAttributes = new ServletRequestAttributes(request);
    RequestContextHolder.setRequestAttributes(requestAttributes);
  }
View Full Code Here

Examples of br.com.caelum.vraptor.test.HttpServletRequestMock

  when(request.getSession()).thenReturn(session);
  when(request.getParameterMap()).thenReturn(new HashMap<String, String[]>());
  when(request.getParameter("view")).thenReturn(null);
 
  MutableResponse response = mock(MutableResponse.class, "response" + counter);
  RequestInfo webRequest = new RequestInfo(context, null, new HttpServletRequestMock(session, request), response);
  return execution.execute(webRequest, counter);
  }
View Full Code Here

Examples of br.com.caelum.vraptor.test.HttpServletRequestMock

  }

  @Override
  protected <T> T executeInsideRequest(WhatToDo<T> execution) {
  final HttpSessionMock session = new HttpSessionMock(context, "session" + ++counter);
  final MutableRequest request = new HttpServletRequestMock(session,
      mock(MutableRequest.class, "request" + counter));
  MutableResponse response = mock(MutableResponse.class, "response" + counter);
  RequestInfo webRequest = new RequestInfo(context, null, request, response);
  return execution.execute(webRequest, counter);
  }
View Full Code Here

Examples of com.volantis.mcs.testtools.request.mocks.HttpServletRequestMock

     * @note rest of javadoc inherited
     */
    protected MarinerRequestContext
            createInitialRequestContext(EnvironmentContext initialEnvContext)
            throws Exception {
        final HttpServletRequestMock servletRequest =
                new HttpServletRequestMock();
        final HttpServletResponse servletResponse =
                new HttpServletResponseStub();
        return new MarinerServletRequestContext(servletContext,
                servletRequest,
                servletResponse,
View Full Code Here

Examples of mock.javax.servlet.http.HttpServletRequestMock

        ResourceDescriptor descriptor = ResourceDescriptorFactory.getInstance()
            .createDescriptor("ics", "image.");
        URL sourceURL = TestUtilities.class.getResource("images/" + fileName);
        descriptor.getInputParameters().setParameterValue(ParameterNames.SOURCE_URL, sourceURL.toExternalForm());

        HttpServletRequestMock request = new HttpServletRequestMock(
            "test-request", expectationContainer);
        String pathInfo = "/" + rule + "/" + fileName;
        request.expects.getPathInfo().returns(pathInfo).any();
        final MockFactory mf = MockFactory.getDefaultInstance();
View Full Code Here

Examples of mock.javax.servlet.http.HttpServletRequestMock

       
        dom2TransRespConverterMock =
            new DOM2TranscodingResponseConverterMock("DOM2TransRespConverter", expectations);

        httpServletRequestMock =
            new HttpServletRequestMock("httpServletRequest", expectations);

        httpServletResponseMock =
            new HttpServletResponseMock("httpServletResponse", expectations);
       
        resourceDescriptorMock =
View Full Code Here

Examples of mock.javax.servlet.http.HttpServletRequestMock

        transcoderMock =
            new TranscoderMock("transcoder", expectations);

        httpServletRequestMock =
            new HttpServletRequestMock("HTTP servlet request", expectations);

        httpServletResponseMock =
            new HttpServletResponseMock("HTTP servlet response", expectations);

        resourceDescriptorMock =
View Full Code Here

Examples of mock.javax.servlet.http.HttpServletRequestMock

            port + context + servletPath + pathInfo;
    private static final String requestURL = scheme  + schemeSuffix + requestURI;

    protected void setUp() throws Exception {
        super.setUp();
        request = new HttpServletRequestMock("request", expectations);
        wrapper = new RemappableServletRequestWrapper(request);
        url = new URL(externalForm);
        request.expects.getPathInfo().returns(pathInfo);
    }
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.