Package com.mockrunner.mock.web

Examples of com.mockrunner.mock.web.MockHttpServletResponse


    /**
     * Test a MultiLineString geometry.
     * @throws Exception
     */
    public void testMultiLines() throws Exception {
        MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=MLines&outputFormat=dxf");
        String sResponse = testBasicResult(resp, "MLines");
        int pos = getGeometrySearchStart(sResponse);
        assertTrue(pos != -1);
        // has to insert two lwpolyline
        checkSequence(sResponse,new String[] {"LWPOLYLINE","LWPOLYLINE"},pos);       
View Full Code Here


    /**
     * Test a Polygon geometry.
     * @throws Exception
     */
    public void testPolygons() throws Exception {
        MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=Polygons&outputFormat=dxf");
        String sResponse = testBasicResult(resp, "Polygons");
        int pos = getGeometrySearchStart(sResponse);
        assertTrue(pos != -1);
        // has to insert an lwpolyline
        checkSequence(sResponse,new String[] {"LWPOLYLINE"},pos);
View Full Code Here

    /**
     * Test a MultiPolygon geometry.
     * @throws Exception
     */
    public void testMultiPolygons() throws Exception {
        MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=MPolygons&outputFormat=dxf");
        String sResponse = testBasicResult(resp, "MPolygons");
        int pos = getGeometrySearchStart(sResponse);
        assertTrue(pos != -1);
        // has to insert two lwpolyline
        checkSequence(sResponse,new String[] {"LWPOLYLINE","LWPOLYLINE"},pos);       
View Full Code Here

     * @throws Exception
     */
    public void testGeometryAsBlock() {
        try {
            // geometry as blocks false
            MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=Polygons&outputFormat=dxf");
            String sResponse = resp.getOutputStreamContent();
            assertNotNull(sResponse);
            // no insert block generated
            assertFalse(sResponse.indexOf("INSERT") != -1);
            // geometry as blocks true
            resp = getAsServletResponse("wfs?request=GetFeature&typeName=Polygons&outputFormat=dxf&format_options=asblocks:true");
            sResponse = resp.getOutputStreamContent();
            assertNotNull(sResponse);
            // one insert block generated
            assertTrue(sResponse.indexOf("INSERT") != -1);
        } catch (Throwable t) {
            fail(t.getMessage());
View Full Code Here

     * @throws Exception
     */
    public void testVersion() throws Exception {
        try {
            // good request, version 14
            MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=Polygons&outputFormat=dxf&format_options=version:14");
            String sResponse = resp.getOutputStreamContent();
            assertNotNull(sResponse);
            assertTrue(sResponse.startsWith("  0"));
            // bad request, version 13: not supported
            resp = getAsServletResponse("wfs?request=GetFeature&typeName=Polygons&outputFormat=dxf&format_options=version:13");
            sResponse = resp.getOutputStreamContent();
            assertNotNull(sResponse);
            // has to return an exception
            assertTrue(sResponse.indexOf("</ows:ExceptionReport>") != -1);
        } catch (Throwable t) {
            fail(t.getMessage());
View Full Code Here

    /**
     * Test the ltypes format option.
     * @throws Exception
     */
    public void testCustomLineTypes() throws Exception {
        MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=Lines&outputFormat=dxf&format_options=ltypes:DASHED!--_*_!0.5");
        String sResponse = testBasicResult(resp, "Lines");
        checkSequence(sResponse,new String[] {"DASHED"});
    }
View Full Code Here

    /**
     * Test the colors format option.
     * @throws Exception
     */
    public void testCustomColors() throws Exception {
        MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=Points,MPoints&outputFormat=dxf&format_options=colors:1,2");
        String sResponse = testBasicResult(resp, "Points_MPoints");
        checkSequence(sResponse,new String[] {"LAYER","LAYER","LAYER"," 62\n     1","LAYER"," 62\n     2"});       
    }
View Full Code Here

    /**
     * Test custom naming for layers.
     * @throws Exception
     */
    public void testLayerNames() throws Exception {
        MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=Points,MPoints&outputFormat=dxf&format_options=layers:MyLayer1,MyLayer2");
        String sResponse = testBasicResult(resp, "Points_MPoints");
        checkSequence(sResponse,new String[] {"LAYER","LAYER","LAYER","MYLAYER1","LAYER","MYLAYER2"});       
    }
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

        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()
View Full Code Here

TOP

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