Package org.geotools.data.wfs

Examples of org.geotools.data.wfs.TestHttpResponse


        @Override
        public DescribeFeatureTypeResponse issueRequest(DescribeFeatureTypeRequest request) throws IOException {
            if (describeFeatureTypeUrlOverride == null) {
                return super.issueRequest(request);
            }           
            HTTPResponse response = new TestHttpResponse(request.getOutputFormat(), "UTF-8", describeFeatureTypeUrlOverride);
            try {
                return new DescribeFeatureTypeResponse(request, response);
            } catch (ServiceException e) {
                throw new IOException(e);
            }
View Full Code Here


        }

        @Override
        public HTTPResponse get(final URL baseUrl) throws IOException {
            if (baseUrl.getProtocol().equals("file")) {
                return new TestHttpResponse(baseUrl, "text/xml");
            }
            this.targetUrl = baseUrl;
            return mockResponse;
        }
View Full Code Here

        WFSDataStore wfs = getWFSDataStore(new TestHttpClient() {
           
            @Override
            public HTTPResponse get(URL url) throws IOException {
                if (url.getQuery().contains("REQUEST=GetCapabilities")) {
                    return new TestHttpResponse(TestData.getResource(this, "MapServer/GetCapabilities_1_1_0.xml"), "text/xml");
                } else {
                    return new TestHttpResponse(TestData.getResource(this, "MapServer/GetFeature_GovernmentalUnitCE.xml"), "text/xml");                   
                }
               
            }

            @Override
            public HTTPResponse post(URL url, InputStream postContent, String postContentType) throws IOException {
                String request = new String(IOUtils.toByteArray(postContent), "UTF-8");    
                if (request.contains("<wfs:DescribeFeatureType"))
                {
                    return new TestHttpResponse(TestData.getResource(this, "MapServer/DescribeFeatureType_GovernmentalUnitCE.xsd"), "text/xml");
                } else {
                    return new TestHttpResponse(TestData.getResource(this, "MapServer/GetFeature_GovernmentalUnitCE.xml"), "text/xml");
                }
            }
        });
       
        SimpleFeatureSource source = wfs.getFeatureSource(new NameImpl("http://mapserver.gis.umn.edu/mapserver", "ms_GovernmentalUnitCE"));
View Full Code Here

     * @throws ServiceException
     */
    @Test
    public void testGetSchema() throws IOException, ServiceException {
        final InputStream schemaStream = TestData.openStream(this, CUBEWERX_GOVUNITCE.SCHEMA);
        TestHttpResponse httpResponse = new TestHttpResponse("", "UTF-8", schemaStream);
        TestHttpProtocol mockHttp = new TestHttpProtocol(httpResponse);
        createTestProtocol(CUBEWERX_GOVUNITCE.CAPABILITIES, mockHttp);

        // override the describe feature type url so it loads from the test resource
        URL describeUrl = TestData.getResource(this, CUBEWERX_GOVUNITCE.SCHEMA);
View Full Code Here

    }

    @Test
    public void testGetDefaultOutputFormat() throws IOException, ServiceException {
        final InputStream schemaStream = TestData.openStream(this, "CubeWerx_nsdi/gml212.xml");
        TestHttpResponse httpResponse = new TestHttpResponse("text/xml; subtype=gml/2.1.2", "UTF-8", schemaStream);
        TestHttpProtocol mockHttp = new TestHttpProtocol(httpResponse);
        createTestProtocol(CUBEWERX_GOVUNITCE.CAPABILITIES, mockHttp);

        // override the describe feature type url so it loads from the test resource
        URL describeUrl = TestData.getResource(this, CUBEWERX_GOVUNITCE.SCHEMA);
View Full Code Here

    @Test
    public void tesUseDefaultSRS() throws IOException,
            NoSuchAuthorityCodeException, FactoryException, ServiceException {
        final InputStream dataStream = TestData.openStream(this,
                CUBEWERX_GOVUNITCE.DATA);
        TestHttpResponse httpResponse = new TestHttpResponse(
                "text/xml; subtype=gml/3.1.1", "UTF-8", dataStream);
        TestHttpProtocol mockHttp = new TestHttpProtocol(httpResponse);
        createTestProtocol(CUBEWERX_GOVUNITCE.CAPABILITIES, mockHttp);
   
        // override the describe feature type url so it loads from the test resource
View Full Code Here

    @Test
    public void tesUseOtherSRS() throws IOException, NoSuchAuthorityCodeException,
            FactoryException, ServiceException {
        final InputStream dataStream = TestData.openStream(this,
                CUBEWERX_GOVUNITCE.DATA);
        TestHttpResponse httpResponse = new TestHttpResponse(
                "text/xml; subtype=gml/3.1.1", "UTF-8", dataStream);
        TestHttpProtocol mockHttp = new TestHttpProtocol(httpResponse);
        createTestProtocol(CUBEWERX_GOVUNITCE.CAPABILITIES, mockHttp);
   
        // override the describe feature type url so it loads from the test resource
View Full Code Here

    @Test
    public void tesUseOtherSRSUsingURN() throws IOException,
            NoSuchAuthorityCodeException, FactoryException, ServiceException {
        final InputStream dataStream = TestData.openStream(this,
                CUBEWERX_GOVUNITCE.DATA);
        TestHttpResponse httpResponse = new TestHttpResponse(
                "text/xml; subtype=gml/3.1.1", "UTF-8", dataStream);
        TestHttpProtocol mockHttp = new TestHttpProtocol(httpResponse);
        createTestProtocol(CUBEWERX_GOVUNITCE.CAPABILITIES, mockHttp);
   
        // override the describe feature type url so it loads from the test resource
View Full Code Here

    }
   
    @Test
    public void tesGetFeatureReader() throws IOException, ServiceException {
        final InputStream dataStream = TestData.openStream(this, CUBEWERX_GOVUNITCE.DATA);
        TestHttpResponse httpResponse = new TestHttpResponse("text/xml; subtype=gml/3.1.1",
                "UTF-8", dataStream);
        TestHttpProtocol mockHttp = new TestHttpProtocol(httpResponse);
        createTestProtocol(CUBEWERX_GOVUNITCE.CAPABILITIES, mockHttp);

        // override the describe feature type url so it loads from the test resource
View Full Code Here

                        "maxFeatures=\"20\"",
                        "resultType=\"hits\"",
                        queryXml))
                {
                    assertXMLEqual("tinyows/CountFirstFeaturesRequest.xml", request);
                    return new TestHttpResponse(TestData.getResource(this, "tinyows/CountFirstFeatures.xml"), "text/xml");
                }
                else if (stringContains(request,
                        "<wfs:GetFeature",
                        "maxFeatures=\"20\"",
                        "resultType=\"results\"",
                        queryXml))
                {
                    assertXMLEqual("tinyows/GetFirstFeaturesRequest.xml", request);                   
                    return new TestHttpResponse(TestData.getResource(this, "tinyows/GetFirstFeatures.xml"), "text/xml");
                } else {
                    return super.post(url, new ByteArrayInputStream(request.getBytes("UTF-8")), postContentType);
                }
            }       
        });
View Full Code Here

TOP

Related Classes of org.geotools.data.wfs.TestHttpResponse

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.