Package com.mockrunner.mock.web

Examples of com.mockrunner.mock.web.MockHttpServletResponse


        params.add(new Integer(5)); // numposts
        String message = buildXmlRpcString("blogger.getRecentPosts", params);
       
        mockRequest.setBodyContent(message);
        servletTestModule.doPost();
        MockHttpServletResponse response = mockFactory.getMockResponse();
        String responseBody = response.getOutputStreamContent();
       
        // assert no fault code
        assertTrue(responseBody,
            responseBody.indexOf("<name>faultCode</name>") == -1);
       
View Full Code Here


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

        if (requestParams != null)
        {
            for (Map.Entry<String, String> param :
                       requestParams.entrySet())
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

public class ExcelOutputFormatTest extends WFSTestSupport {

    public void testOutputFormat() throws Exception {
        // grab the real binary stream, avoiding mangling to due char conversion
        MockHttpServletResponse resp = getAsServletResponse( "wfs?request=GetFeature&version=1.0.0&typeName=sf:PrimitiveGeoFeature&outputFormat=excel");
        InputStream in = getBinaryInputStream(resp);
       
        // check the mime type
        assertEquals("application/msexcel", resp.getContentType());
       
        // check the content disposition
        assertEquals("attachment; filename=PrimitiveGeoFeature.xls", resp.getHeader("Content-Disposition"));
       
        // check we have the expected sheet
        HSSFWorkbook wb = new HSSFWorkbook(in);
        HSSFSheet sheet = wb.getSheet("PrimitiveGeoFeature");
        assertNotNull(sheet);
View Full Code Here

        assertNull(cell);
    }
   
    public void testMultipleFeatureTypes() throws Exception {
        // grab the real binary stream, avoiding mangling to due char conversion
        MockHttpServletResponse resp = getAsServletResponse( "wfs?request=GetFeature&typeName=sf:PrimitiveGeoFeature,sf:GenericEntity&outputFormat=excel");
        InputStream in = getBinaryInputStream(resp);
       
        // check we have the expected sheets
        HSSFWorkbook wb = new HSSFWorkbook(in);
        HSSFSheet sheet = wb.getSheet("PrimitiveGeoFeature");
View Full Code Here

    /**
     * Test a request with two queries.
     * @throws Exception
     */
    public void testMultiLayer() throws Exception {
        MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=Points,MPoints&outputFormat=dxf");
        String sResponse = testBasicResult(resp, "Points_MPoints");
        checkSequence(sResponse,new String[] {"LAYER","LAYER","LAYER","POINTS","LAYER","MPOINTS"});       
    }
View Full Code Here

    /**
     * Test DXF-ZIP format.
     * @throws Exception
     */
    public void testZipOutput() throws Exception {
        MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=Points&outputFormat=dxf-zip");
        // check mime type
        assertEquals("application/zip", resp.getContentType());
    }
View Full Code Here

    /**
     * Test a Point geometry.
     * @throws Exception
     */
    public void testPoints() throws Exception {
        MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=Points&outputFormat=dxf");
        String sResponse = testBasicResult(resp, "Points");
        int pos = getGeometrySearchStart(sResponse);
        assertTrue(pos != -1);
        checkSequence(sResponse,new String[] {"POINT"},pos);
       
View Full Code Here

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

    /**
     * Test a LineString geometry.
     * @throws Exception
     */
    public void testLines() throws Exception {
        MockHttpServletResponse resp = getAsServletResponse("wfs?request=GetFeature&typeName=Lines&outputFormat=dxf");
        String sResponse = testBasicResult(resp, "Lines");
        int pos = getGeometrySearchStart(sResponse);
        assertTrue(pos != -1);
        checkSequence(sResponse,new String[] {"LWPOLYLINE"},pos);       
    }
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.