Package org.geoserver.wfs

Examples of org.geoserver.wfs.WFSInfo


     * <tt>&lt;canonicalSchemaLocation&gt;true&lt;/canonicalSchemaLocation&gt;<tt>
     */
    @Override
    protected void oneTimeSetUp() throws Exception {
        super.oneTimeSetUp();
        WFSInfo wfs = getGeoServer().getService(WFSInfo.class);
        wfs.setCanonicalSchemaLocation(true);
        getGeoServer().save(wfs);
    }
View Full Code Here


            if (wcs == null) {
                LOGGER.warning("Missing WCS service. Creating default one.");
                HibDefaultsFactoryImpl.createWCS(global, geoserver);
            }

            WFSInfo wfs = geoserver.getService(WFSInfo.class);
            if (wfs == null) {
                LOGGER.warning("Missing WFS service. Creating default one.");
                HibDefaultsFactoryImpl.createWFS(global, geoserver);
            }
View Full Code Here

        bootstrapper.createDefaultWorkspace();
        bootstrapper.createBaseObjects();

       
        // WS should already be loaded
        WFSInfo wfs = (WFSInfo)geoServer.getService("wfs");
        assertNotNull(wfs);

        Map<WFSInfo.Version,GMLInfo> gml = wfs.getGML();
//
//
//        gml.setSrsNameStyle(SrsNameStyle.NORMAL);
//        wfs.getGML().put(WFSInfo.Version.V_10, gml);
//
View Full Code Here

import org.geoserver.wfs.WFSInfo;
import org.geoserver.web.GeoServerWicketTestSupport;

public class WFSAdminPageTest extends GeoServerWicketTestSupport {
    public void testValues() throws Exception {
        WFSInfo wfs = getGeoServerApplication().getGeoServer().getService(WFSInfo.class);

        login();
        tester.startPage(WFSAdminPage.class);
        tester.assertModelValue("form:maxFeatures", wfs.getMaxFeatures());
        tester.assertModelValue("form:keywords", wfs.getKeywords());
    }
View Full Code Here

    public static Test suite() {
        return new OneTimeTestSetup(new GetFeatureBboxTest());
    }
   
    public void testFeatureBoudingOn() throws Exception {
        WFSInfo wfs = getWFS();
        wfs.setFeatureBounding( true );
        getGeoServer().save( wfs );

        Document doc = getAsDOM("wfs?request=GetFeature&typeName=" + getLayerId(MockData.BUILDINGS) + "&version=1.1.0&service=wfs&propertyName=ADDRESS");
        // print(doc);
       
View Full Code Here

        assertTrue(xpath.getMatchingNodes("//cite:Buildings/gml:boundedBy/gml:Envelope", doc).getLength() > 0);
       
    }
   
    public void testFeatureBoudingOff() throws Exception {
        WFSInfo wfs = getWFS();
        wfs.setFeatureBounding( false );
        getGeoServer().save( wfs );
       
        Document doc = getAsDOM("wfs?request=GetFeature&typeName=" + getLayerId(MockData.BUILDINGS) + "&version=1.1.0&service=wfs&propertyName=ADDRESS");
//        print(doc);
       
View Full Code Here

                .getLength());
    }
   
    public void testPostWithBoundsEnabled() throws Exception {
        // enable feature bounds computation
        WFSInfo wfs = getWFS();
        boolean oldFeatureBounding = wfs.isFeatureBounding();
        wfs.setFeatureBounding(true);
        getGeoServer().save( wfs );
       
       
        try {
            String xml = "<wfs:GetFeature " + "service=\"WFS\" "
                    + "version=\"1.1.0\" "
                    + "xmlns:cdf=\"http://www.opengis.net/cite/data\" "
                    + "xmlns:ogc=\"http://www.opengis.net/ogc\" "
                    + "xmlns:wfs=\"http://www.opengis.net/wfs\" " + "> "
                    + "<wfs:Query typeName=\"cdf:Other\"> "
                    + "<wfs:PropertyName>cdf:string2</wfs:PropertyName> "
                    + "</wfs:Query> " + "</wfs:GetFeature>";
   
            Document doc = postAsDOM("wfs", xml);
            assertEquals("wfs:FeatureCollection", doc.getDocumentElement()
                    .getNodeName());
   
            NodeList features = doc.getElementsByTagName("cdf:Other");
            assertFalse(features.getLength() == 0);
   
            for (int i = 0; i < features.getLength(); i++) {
                Element feature = (Element) features.item(i);
                assertTrue(feature.hasAttribute("gml:id"));
                NodeList boundList = feature.getElementsByTagName("gml:boundedBy");
                assertEquals(1, boundList.getLength());
                Element boundedBy = (Element) boundList.item(0);
                NodeList boxList = boundedBy.getElementsByTagName("gml:Envelope");
                assertEquals(1, boxList.getLength());
                Element box = (Element) boxList.item(0);
                assertTrue(box.hasAttribute("srsName"));
            }
        } finally {
            wfs.setFeatureBounding(oldFeatureBounding);
            getGeoServer().save( wfs );
        }
    }
View Full Code Here

   
        CoordinateReferenceSystem epsgTarget = CRS.decode(TARGET_CRS_CODE);
        CoordinateReferenceSystem epsg32615 = CRS.decode("urn:x-ogc:def:crs:EPSG:6.11.2:32615");
       
        tx = CRS.findMathTransform(epsg32615, epsgTarget);
        WFSInfo wfs = getWFS();
        wfs.setFeatureBounding(true);
        getGeoServer().save( wfs );
    }
View Full Code Here

       
        runTest(dom1, dom2);
    }
   
    public void testGetFeatureWithProjectedBoxGet() throws Exception {
        WFSInfo wfs = getWFS();
        boolean oldFeatureBounding = wfs.isFeatureBounding();
        wfs.setFeatureBounding(true);
        getGeoServer().save(wfs);
           
        try {
            String q = "wfs?request=getfeature&service=wfs&version=1.1&typeName=" +
                MockData.POLYGONS.getLocalPart();
            Document dom = getAsDOM( q );
    //        print(dom);
            Element envelope = getFirstElementByTagName(dom, "gml:Envelope" );
            String lc = getFirstElementByTagName(envelope, "gml:lowerCorner" )
                .getFirstChild().getNodeValue();
            String uc = getFirstElementByTagName(envelope, "gml:upperCorner" )
                .getFirstChild().getNodeValue();
            double[] c = new double[]{
                Double.parseDouble(lc.split( " " )[0]), Double.parseDouble(lc.split( " " )[1]),
                Double.parseDouble(uc.split( " " )[0]), Double.parseDouble(uc.split( " " )[1])
            };
            double[] cr = new double[4];
            tx.transform(c, 0, cr, 0, 2);
           
            q += "&bbox=" + cr[0] + "," + cr[1] + "," + cr[2] + "," + cr[3] + "," + TARGET_CRS_CODE;
            dom = getAsDOM( q );
           
            assertEquals( 1, dom.getElementsByTagName( MockData.POLYGONS.getPrefix() + ":" + MockData.POLYGONS.getLocalPart()).getLength() );
        }
        finally {
            wfs.setFeatureBounding(oldFeatureBounding);
            getGeoServer().save( wfs );
        }
    }
View Full Code Here

            getGeoServer().save( wfs );
        }
    }
   
    public void testGetFeatureWithProjectedBoxPost() throws Exception {
        WFSInfo wfs = getWFS();
        boolean oldFeatureBounding = wfs.isFeatureBounding();
        wfs.setFeatureBounding(true);
        getGeoServer().save(wfs);
       
        try {
            String q = "wfs?request=getfeature&service=wfs&version=1.1&typeName=" +
                MockData.POLYGONS.getLocalPart();
            Document dom = getAsDOM( q );
            Element envelope = getFirstElementByTagName(dom, "gml:Envelope" );
            String lc = getFirstElementByTagName(envelope, "gml:lowerCorner" )
                .getFirstChild().getNodeValue();
            String uc = getFirstElementByTagName(envelope, "gml:upperCorner" )
                .getFirstChild().getNodeValue();
            double[] c = new double[]{
                Double.parseDouble(lc.split( " " )[0]), Double.parseDouble(lc.split( " " )[1]),
                Double.parseDouble(uc.split( " " )[0]), Double.parseDouble(uc.split( " " )[1])
            };
            double[] cr = new double[4];
            tx.transform(c, 0, cr, 0, 2);
           
            String xml = "<wfs:GetFeature service=\"WFS\" version=\"1.1.0\""
                + " xmlns:" + MockData.POLYGONS.getPrefix() + "=\"" + MockData.POLYGONS.getNamespaceURI() + "\""
                + " xmlns:ogc=\"http://www.opengis.net/ogc\" "
                + " xmlns:gml=\"http://www.opengis.net/gml\" "
                + " xmlns:wfs=\"http://www.opengis.net/wfs\" " + "> "
                + "<wfs:Query typeName=\"" + MockData.POLYGONS.getPrefix() + ":" + MockData.POLYGONS.getLocalPart() + "\">"
                + "<wfs:PropertyName>cgf:polygonProperty</wfs:PropertyName> "
                + "<ogc:Filter>"
                "<ogc:BBOX>"
                +   "<ogc:PropertyName>polygonProperty</ogc:PropertyName>"
                +   "<gml:Envelope srsName=\"" + TARGET_CRS_CODE + "\">"
                +      "<gml:lowerCorner>" + cr[0] + " " + cr[1] + "</gml:lowerCorner>"
                +      "<gml:upperCorner>" + cr[2] + " " + cr[3] + "</gml:upperCorner>"
                +   "</gml:Envelope>" 
                "</ogc:BBOX>"
                + "</ogc:Filter>"
                + "</wfs:Query> " + "</wfs:GetFeature>";
           
            dom = postAsDOM( "wfs", xml );
           
            assertEquals( 1, dom.getElementsByTagName( MockData.POLYGONS.getPrefix() + ":" + MockData.POLYGONS.getLocalPart()).getLength() );
        }
        finally {
            wfs.setFeatureBounding(oldFeatureBounding);
            getGeoServer().save( wfs );
        }
    }
View Full Code Here

TOP

Related Classes of org.geoserver.wfs.WFSInfo

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.