Examples of WFSInfo


Examples of org.geoserver.wfs.WFSInfo

     *
     * @throws Exception
     */

    public void testPropertyEncodingOrder_GeologicUnit() throws Exception {
        WFSInfo wfs = getGeoServer().getService(WFSInfo.class);
        wfs.setEncodeFeatureMember(true);
        getGeoServer().save(wfs);
        String path = "wfs?request=GetFeature&typename=gsml:GeologicUnit&featureid=gu.25699";
        Document doc = getAsDOM(path);
        LOGGER.info("WFS GetFeature&typename=gsml:GeologicUnit&featureid=gu.25699:\n"
                + prettyString(doc));
View Full Code Here

Examples of org.geoserver.wfs.WFSInfo

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

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

Examples of org.geoserver.wfs.WFSInfo

        return (request != null) && (request.getResultType() == ResultTypeType.HITS_LITERAL);
    }

    public void write(Object value, OutputStream output, Operation operation)
        throws IOException, ServiceException {
        WFSInfo wfs = getInfo();
       
        FeatureCollectionType featureCollection = (FeatureCollectionType) value;

        //create a new feautre collcetion type with just the numbers
        FeatureCollectionType hits = WfsFactory.eINSTANCE.createFeatureCollectionType();
        if (GML3OutputFormat.isComplexFeature(featureCollection)) {
            // we have to count the number of features here manually because complex feature
            // collection size() now returns 0. In order to count the number of features,
            // we have to build the features to count them and this has great performance
            // impact. Unless we introduce joins in our fetching of
            // data, we will have to count the number of features manually when needed. In
            // GML3Outputformat I use xslt to populate numberOfFeatures attribute.
            hits.setNumberOfFeatures(countFeature(featureCollection));
        } else {
            hits.setNumberOfFeatures(featureCollection.getNumberOfFeatures());
        }
        hits.setTimeStamp(featureCollection.getTimeStamp());

        Encoder encoder = new Encoder(configuration, configuration.schema());
        encoder.setEncoding(Charset.forName( wfs.getGeoServer().getGlobal().getCharset()) );
        encoder.setSchemaLocation(org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
            ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/1.1.0/wfs.xsd"));

        encoder.encode(hits, org.geoserver.wfs.xml.v1_1_0.WFS.FEATURECOLLECTION, output);
    }
View Full Code Here

Examples of org.geoserver.wfs.WFSInfo

        }
       
        Map<String, ?> formatOptions = request.getFormatOptions();
        final String requestedPrjFileFormat = (String) formatOptions.get("PRJFILEFORMAT");
        if (null == requestedPrjFileFormat) {
            WFSInfo bean = gs.getService(WFSInfo.class);
            MetadataMap metadata = bean.getMetadata();
            Boolean defaultIsEsri = metadata.get(SHAPE_ZIP_DEFAULT_PRJ_IS_ESRI, Boolean.class);
            useEsriFormat = defaultIsEsri != null && defaultIsEsri.booleanValue();
        }else{
            useEsriFormat = "ESRI".equalsIgnoreCase(requestedPrjFileFormat);
        }
View Full Code Here

Examples of org.geoserver.wfs.WFSInfo

    }
   
    @Override
    protected void oneTimeSetUp() throws Exception {
      super.oneTimeSetUp();
      WFSInfo wfs = getGeoServer().getService( WFSInfo.class );
        wfs.setFeatureBounding(true);
      getGeoServer().save(wfs);
    }
View Full Code Here

Examples of org.geoserver.wfs.WFSInfo

        super(binding, outputFormats);
        this.gs = gs;
    }
   
    protected WFSInfo getInfo() {
        WFSInfo wfs = gs.getService(WFSInfo.class);
        if (wfs == null) {
            throw new IllegalArgumentException("A valid WFS object must be provided");
        }
       
        return wfs;
View Full Code Here

Examples of org.geoserver.wfs.WFSInfo

     * Test FeatureCollection is encoded with multiple featureMember elements
     * @throws Exception
     */
    public void testEncodeFeatureMember() throws Exception {
        // change fixture settings (must restore this at end)
        WFSInfo wfs = getGeoServer().getService(WFSInfo.class);
        boolean encodeFeatureMember = wfs.isEncodeFeatureMember();
        wfs.setEncodeFeatureMember(true);
        getGeoServer().save(wfs);
       
        Document doc = getAsDOM("wfs?request=GetFeature&typename=gsml:MappedFeature,gsml:GeologicUnit");
        LOGGER.info("WFS GetFeature&typename=gsml:MappedFeature,gsml:GeologicUnit response:\n"
                + prettyString(doc));
       
       checkSchemaLocation(doc);

        assertXpathEvaluatesTo("7", "/wfs:FeatureCollection/@numberOfFeatures", doc);
        assertXpathCount(4, "//gsml:MappedFeature", doc);       

        assertEquals(7, doc.getElementsByTagName("gml:featureMember").getLength());
        assertEquals(0, doc.getElementsByTagName("gml:featureMembers").getLength());

        // mf1
        {
            String id = "mf1";
            checkMf1Content(id, doc);
        }

        // mf2
        {
            String id = "mf2";
            checkMf2Content(id, doc);
        }

        // mf3
        {
            String id = "mf3";
            checkMf3Content(id, doc);
        }

        // mf4
        {
            String id = "mf4";
            checkMf4Content(id, doc);
        }

        // check for duplicate gml:id
        assertXpathCount(1, "//gsml:GeologicUnit[@gml:id='gu.25699']", doc);
        assertXpathCount(1, "//gsml:GeologicUnit[@gml:id='gu.25678']", doc);
        assertXpathCount(1, "//gsml:GeologicUnit[@gml:id='gu.25682']", doc);

        // test for xlink:href is encoded within featureMember
        assertXpathCount(1, "//gml:featureMember[@xlink:href='#gu.25699']", doc);
        assertXpathCount(1, "//gml:featureMember[@xlink:href='#gu.25678']", doc);
        assertXpathCount(1, "//gml:featureMember[@xlink:href='#gu.25682']", doc);

        // restore fixture settings
        wfs = getGeoServer().getService(WFSInfo.class);
        wfs.setEncodeFeatureMember(encodeFeatureMember);
        getGeoServer().save(wfs);
    }
View Full Code Here

Examples of org.geoserver.wfs.WFSInfo

     * Test FeatureCollection is encoded with one featureMembers element
     * @throws Exception
     */
    public void testEncodeFeatureMembers() throws Exception {
        // change fixture settings (must restore this at end)
        WFSInfo wfs = getGeoServer().getService(WFSInfo.class);
        boolean encodeFeatureMember = wfs.isEncodeFeatureMember();
        wfs.setEncodeFeatureMember(false);
        getGeoServer().save(wfs);
       
        Document doc = getAsDOM("wfs?request=GetFeature&typename=gsml:MappedFeature,gsml:GeologicUnit");
        LOGGER.info("WFS GetFeature&typename=gsml:MappedFeature,gsml:GeologicUnit response:\n"
                + prettyString(doc));
       
        checkSchemaLocation(doc);
       
        assertXpathEvaluatesTo("7", "/wfs:FeatureCollection/@numberOfFeatures", doc);
        assertXpathCount(4, "//gsml:MappedFeature", doc);

        assertEquals(1, doc.getElementsByTagName("gml:featureMembers").getLength());
        assertEquals(0, doc.getElementsByTagName("gml:featureMember").getLength());

        // mf1
        {
            String id = "mf1";
            checkMf1Content(id, doc);
        }

        // mf2
        {
            String id = "mf2";
            checkMf2Content(id, doc);
        }

        // mf3
        {
            String id = "mf3";
            checkMf3Content(id, doc);
        }

        // mf4
        {
            String id = "mf4";
            checkMf4Content(id, doc);
        }

        // check for duplicate gml:id
        assertXpathCount(1, "//gsml:GeologicUnit[@gml:id='gu.25699']", doc);
        assertXpathCount(1, "//gsml:GeologicUnit[@gml:id='gu.25678']", doc);
        assertXpathCount(1, "//gsml:GeologicUnit[@gml:id='gu.25682']", doc);

        // check for xlink:href if encoded within GeologicUnit itself
        // note that this can never be schema-valid, but the best that the
        // encoder can do when configured to use featureMembers.
        assertXpathCount(1, "//gsml:GeologicUnit[@xlink:href='#gu.25699']", doc);
        assertXpathCount(1, "//gsml:GeologicUnit[@xlink:href='#gu.25678']", doc);
        assertXpathCount(1, "//gsml:GeologicUnit[@xlink:href='#gu.25682']", doc);

        // restore fixture settings
        wfs = getGeoServer().getService(WFSInfo.class);
        wfs.setEncodeFeatureMember(encodeFeatureMember);
        getGeoServer().save(wfs);
    }
View Full Code Here

Examples of org.geoserver.wfs.WFSInfo

     * @throws Exception
     */
    @Test
    public void testEncodeFeatureMember() throws Exception {
        // change fixture settings (must restore this at end)
        WFSInfo wfs = getGeoServer().getService(WFSInfo.class);
        boolean encodeFeatureMember = wfs.isEncodeFeatureMember();
        wfs.setEncodeFeatureMember(true);
        getGeoServer().save(wfs);
       
        Document doc = getAsDOM("wfs?request=GetFeature&version=1.1.0&typename=gsml:MappedFeature,gsml:GeologicUnit");
        LOGGER.info("WFS GetFeature&typename=gsml:MappedFeature,gsml:GeologicUnit response:\n"
                + prettyString(doc));
       
       checkSchemaLocation(doc);

        assertXpathEvaluatesTo("7", "/wfs:FeatureCollection/@numberOfFeatures", doc);
        assertXpathCount(4, "//gsml:MappedFeature", doc);       

        assertEquals(7, doc.getElementsByTagName("gml:featureMember").getLength());
        assertEquals(0, doc.getElementsByTagName("gml:featureMembers").getLength());

        // mf1
        {
            String id = "mf1";
            checkMf1Content(id, doc);
        }

        // mf2
        {
            String id = "mf2";
            checkMf2Content(id, doc);
        }

        // mf3
        {
            String id = "mf3";
            checkMf3Content(id, doc);
        }

        // mf4
        {
            String id = "mf4";
            checkMf4Content(id, doc);
        }

        // check for duplicate gml:id
        assertXpathCount(1, "//gsml:GeologicUnit[@gml:id='gu.25699']", doc);
        assertXpathCount(1, "//gsml:GeologicUnit[@gml:id='gu.25678']", doc);
        assertXpathCount(1, "//gsml:GeologicUnit[@gml:id='gu.25682']", doc);

        // test for xlink:href is encoded within featureMember
        assertXpathCount(1, "//gml:featureMember[@xlink:href='#gu.25699']", doc);
        assertXpathCount(1, "//gml:featureMember[@xlink:href='#gu.25678']", doc);
        assertXpathCount(1, "//gml:featureMember[@xlink:href='#gu.25682']", doc);

        // restore fixture settings
        wfs = getGeoServer().getService(WFSInfo.class);
        wfs.setEncodeFeatureMember(encodeFeatureMember);
        getGeoServer().save(wfs);
    }
View Full Code Here

Examples of org.geoserver.wfs.WFSInfo

     * @throws Exception
     */
    @Test
    public void testEncodeFeatureMembers() throws Exception {
        // change fixture settings (must restore this at end)
        WFSInfo wfs = getGeoServer().getService(WFSInfo.class);
        boolean encodeFeatureMember = wfs.isEncodeFeatureMember();
        wfs.setEncodeFeatureMember(false);
        getGeoServer().save(wfs);
       
        Document doc = getAsDOM("wfs?request=GetFeature&version=1.1.0&typename=gsml:MappedFeature,gsml:GeologicUnit");
        LOGGER.info("WFS GetFeature&typename=gsml:MappedFeature,gsml:GeologicUnit response:\n"
                + prettyString(doc));
       
        checkSchemaLocation(doc);
       
        assertXpathEvaluatesTo("7", "/wfs:FeatureCollection/@numberOfFeatures", doc);
        assertXpathCount(4, "//gsml:MappedFeature", doc);

        assertEquals(1, doc.getElementsByTagName("gml:featureMembers").getLength());
        assertEquals(0, doc.getElementsByTagName("gml:featureMember").getLength());

        // mf1
        {
            String id = "mf1";
            checkMf1Content(id, doc);
        }

        // mf2
        {
            String id = "mf2";
            checkMf2Content(id, doc);
        }

        // mf3
        {
            String id = "mf3";
            checkMf3Content(id, doc);
        }

        // mf4
        {
            String id = "mf4";
            checkMf4Content(id, doc);
        }

        // check for duplicate gml:id
        assertXpathCount(1, "//gsml:GeologicUnit[@gml:id='gu.25699']", doc);
        assertXpathCount(1, "//gsml:GeologicUnit[@gml:id='gu.25678']", doc);
        assertXpathCount(1, "//gsml:GeologicUnit[@gml:id='gu.25682']", doc);

        // check for xlink:href if encoded within GeologicUnit itself
        // note that this can never be schema-valid, but the best that the
        // encoder can do when configured to use featureMembers.
        assertXpathCount(1, "//gsml:GeologicUnit[@xlink:href='#gu.25699']", doc);
        assertXpathCount(1, "//gsml:GeologicUnit[@xlink:href='#gu.25678']", doc);
        assertXpathCount(1, "//gsml:GeologicUnit[@xlink:href='#gu.25682']", doc);

        // restore fixture settings
        wfs = getGeoServer().getService(WFSInfo.class);
        wfs.setEncodeFeatureMember(encodeFeatureMember);
        getGeoServer().save(wfs);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.