Package org.geotools.data.wfs

Examples of org.geotools.data.wfs.MockHttpResponse


                        "maxFeatures=\"20\"",
                        "resultType=\"hits\"",
                        queryXml))
                {
                    assertXMLEqual("tinyows/CountFirstFeaturesRequest.xml", request);
                    return new MockHttpResponse(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 MockHttpResponse(TestData.getResource(this, "tinyows/GetFirstFeatures.xml"), "text/xml");
                } else {
                    return super.post(url, new ByteArrayInputStream(request.getBytes("UTF-8")), postContentType);
                }
            }       
        });
View Full Code Here


                        "<wfs:GetFeature",
                        "maxFeatures=\"20\"",
                        "resultType=\"results\"",
                        "<ogc:PropertyIsGreaterThan")) {
                    assertXMLEqual("tinyows/GetFeatureIncludeAndPropertyGreaterThanAndIncludeRequest.xml", request);
                    return new MockHttpResponse(TestData.getResource(this, "tinyows/GetFirstFeatures.xml"), "text/xml");
                } else {
                    return super.post(url, postContent, postContentType);
                }
            }
        });
View Full Code Here

            @Override
            public HTTPResponse post(URL url, InputStream postContent, String postContentType) throws IOException {
                String request = new String(IOUtils.toByteArray(postContent), "UTF-8");
                if (isHitsRequest(request, queryTokens)) {
                    assertXMLEqual("tinyows/CountFeaturesByBBoxRequest.xml", request)
                    return new MockHttpResponse(TestData.getResource(this, "tinyows/CountFeaturesByBBox.xml"), "text/xml");
                } else if (isResultsRequest(request, queryTokens)) {
                    assertXMLEqual("tinyows/GetFeaturesByBBoxRequest.xml", request)
                    return new MockHttpResponse(TestData.getResource(this, "tinyows/GetFeaturesByBBox.xml"), "text/xml");
                } else {
                    return super.post(url, new ByteArrayInputStream(request.getBytes("UTF-8")), postContentType);
                }
            }           
        });
View Full Code Here

            @Override
            public HTTPResponse post(URL url, InputStream postContent, String postContentType) throws IOException {
                String request = new String(IOUtils.toByteArray(postContent), "UTF-8");
                if (isResultsRequest(request, queryTokens)) {
                    assertXMLEqual("tinyows/GetFeaturesByBBoxRequest.xml", request)
                    return new MockHttpResponse(TestData.getResource(this, "tinyows/GetFeaturesByBBox.xml"), "text/xml");
                } else {
                    return super.post(url, new ByteArrayInputStream(request.getBytes("UTF-8")), postContentType);
                }
            }           
        });
View Full Code Here

            @Override
            public HTTPResponse post(URL url, InputStream postContent, String postContentType) throws IOException {
                String request = new String(IOUtils.toByteArray(postContent), "UTF-8");
                if (isResultsRequest(request, queryTokens)) {
                    assertXMLEqual("tinyows/GetFeaturesByBBoxRequest.xml", request)
                    return new MockHttpResponse(TestData.getResource(this, "tinyows/GetFeaturesByBBox.xml"), "text/xml");
                } else {
                    return super.post(url, new ByteArrayInputStream(request.getBytes("UTF-8")), postContentType);
                }
            }           
        });
View Full Code Here

        WFSDataStore wfs = getWFSDataStore(new TinyOwsMockHttpClient() {
            @Override
            public HTTPResponse post(URL url, InputStream postContent, String postContentType) throws IOException {
                String request = new String(IOUtils.toByteArray(postContent), "UTF-8");
                if (isHitsRequest(request, idQueryTokens)) {
                    return new MockHttpResponse(TestData.getResource(this, "tinyows/CountFeatureById.xml"), "text/xml");
                } else if (isResultsRequest(request, idQueryTokens)) {
                    return new MockHttpResponse(TestData.getResource(this, "tinyows/GetFeatureById.xml"), "text/xml");
                } else if (isResultsRequest(request, bboxQueryTokens)) {
                    return new MockHttpResponse(TestData.getResource(this, "tinyows/GetFeaturesByBBox.xml"), "text/xml");
                } else {
                    return super.post(url, new ByteArrayInputStream(request.getBytes("UTF-8")), postContentType);
                }
            }           
        });
View Full Code Here

   
    class TinyOwsMockHttpClient extends MockHttpClient {
        @Override
        public HTTPResponse get(URL url) throws IOException {
            if (url.getQuery().contains("REQUEST=GetCapabilities")) {
                return new MockHttpResponse(TestData.getResource(this, "tinyows/GetCapabilities.xml"), "text/xml");
            } else {
                return super.get(url);
            }
        }
View Full Code Here

            String query = "<ogc:FeatureId fid=\"comuni11.2671\"/>";
            String request = new String(IOUtils.toByteArray(postContent), "UTF-8");
            if (isHitsRequest(request, query))
            {
                assertXMLEqual("tinyows/CountFeatureByIdRequest.xml", request);
                return new MockHttpResponse(TestData.getResource(this, "tinyows/CountFeatureById.xml"), "text/xml");
            }
            else if (isResultsRequest(request, query))
            {
                assertXMLEqual("tinyows/GetFeatureByIdRequest.xml", request);
                return new MockHttpResponse(TestData.getResource(this, "tinyows/GetFeatureById.xml"), "text/xml");
            }
            else
            {
                return super.post(url, new ByteArrayInputStream(request.getBytes("UTF-8")), postContentType);
            }
View Full Code Here

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

            @Override
            public HTTPResponse post(URL url, InputStream postContent, String postContentType) throws IOException {
                return new MockHttpResponse(TestData.getResource(this, "MapServer/GetFeature_GovernmentalUnitCE.xml"), "text/xml");
            }           
        });
        ((WFS_1_1_0_DataStore)wfs).setMappedURIs(new MapServerStrategy().getNamespaceURIMappings());
       
        SimpleFeatureSource source = wfs.getFeatureSource(MAPSRV_GOVUNITCE.FEATURETYPENAME);
View Full Code Here

            @Override
            public HTTPResponse post(URL url, InputStream postContent, String postContentType) throws IOException {
                String request = new String(IOUtils.toByteArray(postContent), "UTF-8");
                if (!postContentType.isEmpty())
                {
                  return new MockHttpResponse(TestData.getResource(this, "arcgisserver/GetFeaturesResult.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.MockHttpResponse

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.