Package com.mockrunner.mock.web

Examples of com.mockrunner.mock.web.MockHttpServletRequest


               String namespace,
               String actionName,
               Map<String, String> requestParams,
               Map<String, Object> sessionAttributes) throws Exception
    {
        mockRequest = new MockHttpServletRequest();
        mockRequest.setSession(new MockHttpSession());
        mockResponse = new MockHttpServletResponse();

        if (requestParams != null)
        {
View Full Code Here


        assertEquals(0, handler.getStarted());
        assertEquals(0, handler.getEnded());

        filter.doFilter(
                new MockHttpServletRequest(),
                new MockHttpServletResponse(),
                new MockFilterChain());
        assertEquals(1, handler.getStarted());
        assertEquals(1, handler.getEnded());

        filter.doFilter(
                new MockHttpServletRequest(),
                new MockHttpServletResponse(),
                new MockFilterChain());
        assertEquals(2, handler.getStarted());
        assertEquals(2, handler.getEnded());
    }
View Full Code Here

                return null;
            }
        };
        HessianService service = new HessianService(factory, map);

        MockHttpServletRequest request = new MockHttpServletRequest();
        HttpSession session = new MockHttpSession();
        request.setSession(session);

        // for some eason need to call this to get session activated in the mock request
        request.getSession();

        try {
            ServiceContext.begin(request, null, null);
            assertSame(session, service.getSession(false));
        }
View Full Code Here

       
    }
   
    Request buildRequest(String gsCookieValue) {
        Request request = new Request();
        MockHttpServletRequest httpRequest = new MockHttpServletRequest();
        request.setHttpRequest(httpRequest);
        request.setHttpResponse(new MockHttpServletResponse());
       
        if(gsCookieValue != null) {
            httpRequest.addCookie(new Cookie(UserFlowController.COOKIE_NAME, gsCookieValue));
        }
        return request;
    }
View Full Code Here

    authenticationManager.setProviders(
        Arrays.asList(new AuthenticationProvider[]{new OpenPlansAuthenticationProvider()})
        );
    testFilter.setAuthenticationManager(authenticationManager);
       
    MockHttpServletRequest request   = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();
    SecurityContextHolder.setContext(new SecurityContextImpl());
    request.addCookie(new Cookie("__ac", generateCookie("cdwinslow")));
    testFilter.doFilter(request, response, new MockFilterChain());
    assertEquals(
        SecurityContextHolder.getContext()
        .getAuthentication()
        .getPrincipal()
View Full Code Here

     ProviderManager authenticationManager = new ProviderManager();
     authenticationManager.setProviders(
         Arrays.asList(new AuthenticationProvider[]{new OpenPlansAuthenticationProvider()})
         );
    
     MockHttpServletRequest request = new MockHttpServletRequest();
     MockHttpServletResponse response = new MockHttpServletResponse();
     request.addCookie(new Cookie("__ac", "this is an invalid cookie"));
    
     SecurityContextHolder.setContext(new SecurityContextImpl());
     testFilter.doFilter(request, response, new MockFilterChain());
    
     assertNull(SecurityContextHolder.getContext().getAuthentication());
View Full Code Here

        } catch (IOException e) {
            throw new RuntimeException("shouldn't happen", e);
        }
        request.setRawKvp(new HashMap<String, Serializable>());

        MockHttpServletRequest servletRequest = new MockHttpServletRequest();
        request.setHttpServletRequest(servletRequest);
        MockHttpSession session = new MockHttpSession();
        servletRequest.setSession(session);
        MockServletContext context = new MockServletContext();
        session.setupServletContext(context);

        return request;
    }
View Full Code Here

        WMSMapContext mapContext = new WMSMapContext();
        request = mockData.createRequest();
        request.setLayers(new MapLayerInfo[] { layer });

        request.setFormatOptions(Collections.singletonMap("relLinks", "true"));
        MockHttpServletRequest httpreq = (MockHttpServletRequest) request.getHttpServletRequest();
        httpreq.setScheme("http");
        httpreq.setServerName("geoserver.org");
        httpreq.setServerPort(8181);
        httpreq.setContextPath("/geoserver");
        mapContext.setRequest(request);
    }
View Full Code Here

        FeatureSource<SimpleFeatureType, SimpleFeature> featureSource;
        featureSource = (FeatureSource<SimpleFeatureType, SimpleFeature>) ((FeatureTypeInfo)layer.getFeature()).getFeatureSource(null, null);
       
        mapLayer = new DefaultMapLayer(featureSource, mockData.getDefaultStyle().getStyle());

        MockHttpServletRequest httpreq = (MockHttpServletRequest) request.getHttpServletRequest();
        httpreq.setScheme("http");
        httpreq.setServerName("geoserver.org");
        httpreq.setServerPort(8181);
        httpreq.setContextPath("/geoserver");
        mapContext.setRequest(request);
    }
View Full Code Here

  protected void setUp() throws Exception {
    geoServerImpl = new GeoServerImpl();
    geoServerImpl.add(new WMSInfoImpl());
    wms = new WMS(geoServerImpl);
    request = new MockHttpServletRequest();
    params = new HashMap<String, String>();
  }
View Full Code Here

TOP

Related Classes of com.mockrunner.mock.web.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.