Package com.mockrunner.mock.web

Examples of com.mockrunner.mock.web.MockHttpServletResponse


       
        String xml =
            "<style>" +
              "<name>Ponds</name>" +
            "</style>";
        MockHttpServletResponse response =
            postAsServletResponse( "/rest/layers/cite:BasicPolygons/styles", xml, "text/xml");
        assertEquals( 201, response.getStatusCode() );
       
        LayerInfo l2 = catalog.getLayerByName( "cite:BasicPolygons" );
        assertEquals( nstyles+1, l2.getStyles().size() );
       
        assertTrue( l2.getStyles().contains( catalog.getStyleByName( "Ponds") ) );
View Full Code Here


       
        String xml =
            "<style>" +
              "<name>Ponds</name>" +
            "</style>";
        MockHttpServletResponse response =
            postAsServletResponse( "/rest/layers/cite:BasicPolygons/styles?default=true", xml, "text/xml");
        assertEquals( 201, response.getStatusCode() );
       
        LayerInfo l2 = catalog.getLayerByName( "cite:BasicPolygons" );
        assertEquals( nstyles+1, l2.getStyles().size() );
        assertEquals( catalog.getStyleByName( "Ponds"), l.getDefaultStyle() );
    }
View Full Code Here

       
        String xml =
            "<style>" +
              "<name>Ponds</name>" +
            "</style>";
        MockHttpServletResponse response =
            postAsServletResponse( "/rest/layers/cite:BasicPolygons/styles?default=true", xml, "text/xml");
        assertEquals( 201, response.getStatusCode() );
       
        LayerInfo l2 = catalog.getLayerByName("cite:BasicPolygons");
        assertEquals( nstyles, l2.getStyles().size() );
        assertEquals( catalog.getStyleByName( "Ponds"), l.getDefaultStyle() );
    }
View Full Code Here

        } catch (InterruptedException ie) {
            // We dont really care
        }
      
        String layerId = getLayerId(MockData.BASIC_POLYGONS);
        MockHttpServletResponse sr = getAsServletResponse("gwc/service/wmts?request=GetTile&layer="
                + layerId
                + "&format=image/png&tilematrixset=EPSG:4326&tilematrix=EPSG:4326:0&tilerow=0&tilecol=0");
        assertEquals(200, sr.getErrorCode());
        assertEquals("image/png", sr.getContentType());
    }
View Full Code Here

            super.run(result);
    }

    public void testSimpleRequest() throws Exception {
        String request = "wfs?request=GetFeature&typename=" + getLayerId(MockData.BUILDINGS) + "&version=1.0.0&service=wfs&outputFormat=OGR-KML";
        MockHttpServletResponse resp = getAsServletResponse(request);
       
        // check content type
        assertEquals("application/zip", resp.getContentType());
       
        // check content disposition
        assertEquals("attachment; filename=Buildings.zip", resp.getHeader("Content-Disposition"));
       
        // read back
        ZipInputStream zis = new ZipInputStream(getBinaryInputStream(resp));
        ZipEntry entry = zis.getNextEntry();
        assertNotNull(entry);
View Full Code Here

                "<database>acme</database>" +
                "<dbtype>h2</dbtype>" +
              "</connectionParameters>" +
            "</dataStore>";
       
        MockHttpServletResponse resp =
            postAsServletResponse("/rest/workspaces/gs/datastores", xml );
        assertEquals( 201, resp.getStatusCode() );
       
        assertNotNull( catalog.getDataStoreByName( "gs", "acme") );
    }
View Full Code Here

        String xml =
            "<featureType>" +
              "<name>widgets</name>" +
            "</featureType>";
       
        MockHttpServletResponse resp =
            postAsServletResponse("/rest/workspaces/gs/datastores/acme/featuretypes", xml );
        assertEquals( 201, resp.getStatusCode() );
       
        assertNotNull( catalog.getFeatureTypeByDataStore(ds, "widgets"));
       
        //do a get feature for a sanity check
        Document dom = getAsDOM( "wfs?request=getfeature&typename=gs:widgets");
View Full Code Here

        String xml =
            "<featureType>" +
              "<name>widgetsNG</name>" +
            "</featureType>";
       
        MockHttpServletResponse resp =
            postAsServletResponse("/rest/workspaces/gs/datastores/acme/featuretypes", xml );
        assertEquals( 201, resp.getStatusCode() );
       
        assertNotNull( catalog.getFeatureTypeByDataStore(dsinfo, "widgetsNG"));
       
        //do a get feature for a sanity check
        Document dom = getAsDOM( "wfs?request=getfeature&typename=gs:widgetsNG");
View Full Code Here

            + typename.getLocalPart()
            + ".1107531493630.kml";

        getFeatureTypeInfo(typename).getMetadata().put("indexingEnabled", true);

        MockHttpServletResponse response = getAsServletResponse(path);
        assertEquals(200, response.getStatusCode());
    }
View Full Code Here

                  "<string>" + dir.getAbsolutePath() + "</string>" +
                 "</directory>" +
              "</connectionParameters>" +
              "<workspace>sf</workspace>" +
            "</dataStore>";
        MockHttpServletResponse response =
            postAsServletResponse( "/rest/workspaces/sf/datastores", xml, "text/xml" );
        assertEquals( 201, response.getStatusCode() );
        assertNotNull( response.getHeader( "Location") );
        assertTrue( response.getHeader("Location").endsWith( "/workspaces/sf/datastores/newDataStore" ) );

        DataStoreInfo newDataStore = catalog.getDataStoreByName( "newDataStore" );
        assertNotNull( newDataStore );
       
        DataStore ds = (DataStore) newDataStore.getDataStore(null);
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.