Package com.mockrunner.mock.web

Examples of com.mockrunner.mock.web.MockHttpServletResponse


        String xml =
            "<coverageStore>" +
            "<name>changed</name>" +
            "</coverageStore>";

        MockHttpServletResponse response =
            putAsServletResponse("/rest/workspaces/wcs/coveragestores/nonExistant", xml, "text/xml" );
        assertEquals( 404, response.getStatusCode() );
    }
View Full Code Here


        Document dom = getAsDOM( "wfs?request=getfeature&typename=gs:pds" );
        assertFeatures( dom );
    }
  
    public void testGet() throws Exception {
        MockHttpServletResponse resp = getAsServletResponse("/rest/workspaces/gs/datastores/pds/file.properties");
        assertEquals( 404, resp.getStatusCode() );
       
        byte[] bytes = propertyFile();
        put( "/rest/workspaces/gs/datastores/pds/file.properties", bytes, "text/plain");
       
        resp = getAsServletResponse("/rest/workspaces/gs/datastores/pds/file.properties");
        assertEquals( 200, resp.getStatusCode() );
        assertEquals( "application/zip", resp.getContentType() );
       
        ByteArrayInputStream bin = getBinaryInputStream(resp);
        ZipInputStream zin = new ZipInputStream( bin );
       
        ZipEntry entry = zin.getNextEntry();
View Full Code Here

                  "<style>polygon</style>" +
                  "<style>point</style>" +
                "</styles>" +
              "</layerGroup>";
       
        MockHttpServletResponse response = postAsServletResponse("/rest/layergroups", xml );
        assertEquals( 201, response.getStatusCode() );
       
        assertNotNull( response.getHeader( "Location") );
        assertTrue( response.getHeader("Location").endsWith( "/layergroups/newLayerGroup" ) );

        LayerGroupInfo lg = catalog.getLayerGroupByName( "newLayerGroup");
        assertNotNull( lg );
       
        assertEquals( 2, lg.getLayers().size() );
View Full Code Here

                  "<layer>Ponds</layer>" +
                  "<layer>Forests</layer>" +
                "</layers>" +
              "</layerGroup>";
       
        MockHttpServletResponse response = postAsServletResponse("/rest/layergroups", xml );
        assertEquals( 201, response.getStatusCode() );
       
        LayerGroupInfo lg = catalog.getLayerGroupByName( "newLayerGroup");
        assertNotNull( lg );
       
        assertEquals( 2, lg.getLayers().size() );
View Full Code Here

                  "<style>polygon</style>" +
                  "<style>line</style>" +
                "</styles>" +
              "</layerGroup>";
       
        MockHttpServletResponse response = putAsServletResponse("/rest/layergroups/sfLayerGroup", xml, "text/xml" );
        assertEquals( 200, response.getStatusCode() );
       
        LayerGroupInfo lg = catalog.getLayerGroupByName( "sfLayerGroup" );
       
        assertEquals( 2, lg.getLayers().size() );
        assertEquals( 2, lg.getStyles().size() );
View Full Code Here

        assertEquals( "polygon", lg.getStyles().get( 0 ).getName() );
        assertEquals( "line", lg.getStyles().get( 1 ).getName() );
    }
   
    public void testDelete() throws Exception {
        MockHttpServletResponse response = deleteAsServletResponse( "/rest/layergroups/sfLayerGroup");
        assertEquals( 200, response.getStatusCode() );
       
        assertEquals( 0, catalog.getLayerGroups().size() );
    }
View Full Code Here

              "<defaultStyle>Forests</defaultStyle>" +
              "<styles>" +
                "<style>Ponds</style>" +
              "</styles>" +
            "</layer>";
        MockHttpServletResponse response =
            putAsServletResponse("/rest/layers/cite:Buildings", xml, "text/xml");
        assertEquals( 200, response.getStatusCode() );
       
        l = catalog.getLayerByName("cite:Buildings");
        assertEquals( "Forests", l.getDefaultStyle().getName() );
    }
View Full Code Here

    public void testPostAsXML() throws Exception {
        String xml =
            "<workspace>" +
              "<name>foo</name>" +
            "</workspace>";
        MockHttpServletResponse response = postAsServletResponse( "/rest/workspaces", xml, "text/xml" );
        assertEquals( 201, response.getStatusCode() );
        assertNotNull( response.getHeader( "Location") );
        assertTrue( response.getHeader("Location").endsWith( "/workspaces/foo" ) );
       
        WorkspaceInfo ws = getCatalog().getWorkspaceByName( "foo" );
        assertNotNull(ws);
    }
View Full Code Here

    }
   
    public void testPostAsJSON() throws Exception {
        String json = "{'workspace':{ 'name':'foo' }}";
       
        MockHttpServletResponse response = postAsServletResponse( "/rest/workspaces", json, "text/json" );
        assertEquals( 201, response.getStatusCode() );
        assertNotNull( response.getHeader( "Location") );
        assertTrue( response.getHeader("Location").endsWith( "/workspaces/foo" ) );
       
       
        WorkspaceInfo ws = getCatalog().getWorkspaceByName( "foo" );
        assertNotNull(ws);
    }
View Full Code Here

        String xml =
            "<workspace>" +
              "<name>changed</name>" +
            "</workspace>";
       
        MockHttpServletResponse response =
            postAsServletResponse("/rest/workspaces/gs", xml, "text/xml" );
        assertEquals( 405, response.getStatusCode() );
    }
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.