Example #1
0
  @Test
  public void testGMLAttributeMapping() throws Exception {
    WFSInfo wfs = getWFS();
    GMLInfo gml = wfs.getGML().get(WFSInfo.Version.V_11);
    gml.setOverrideGMLAttributes(false);
    getGeoServer().save(wfs);

    Document dom =
        getAsDOM(
            "ows?service=WFS&version=1.1.0&request=GetFeature"
                + "&typename="
                + getLayerId(SystemTestData.PRIMITIVEGEOFEATURE));
    XMLAssert.assertXpathExists("//gml:name", dom);
    XMLAssert.assertXpathExists("//gml:description", dom);
    XMLAssert.assertXpathNotExists("//sf:name", dom);
    XMLAssert.assertXpathNotExists("//sf:description", dom);

    gml.setOverrideGMLAttributes(true);
    getGeoServer().save(wfs);

    dom =
        getAsDOM(
            "ows?service=WFS&version=1.1.0&request=GetFeature"
                + "&typename="
                + getLayerId(SystemTestData.PRIMITIVEGEOFEATURE));
    XMLAssert.assertXpathNotExists("//gml:name", dom);
    XMLAssert.assertXpathNotExists("//gml:description", dom);
    XMLAssert.assertXpathExists("//sf:name", dom);
    XMLAssert.assertXpathExists("//sf:description", dom);

    gml.setOverrideGMLAttributes(false);
    getGeoServer().save(wfs);
  }
Example #2
0
  void doTestSrsNameSyntax(SrsNameStyle srsNameStyle, boolean doSave) throws Exception {
    if (doSave) {
      WFSInfo wfs = getWFS();
      GMLInfo gml = wfs.getGML().get(WFSInfo.Version.V_20);
      gml.setSrsNameStyle(srsNameStyle);
      getGeoServer().save(wfs);
    }

    String q = "wfs?request=getfeature&service=wfs&version=2.0.0&typenames=cgf:Points";
    Document d = getAsDOM(q);
    assertEquals("wfs:FeatureCollection", d.getDocumentElement().getNodeName());

    XMLAssert.assertXpathExists(
        "//gml:Envelope[@srsName = '" + srsNameStyle.getPrefix() + "32615']", d);
    XMLAssert.assertXpathExists(
        "//gml:Point[@srsName = '" + srsNameStyle.getPrefix() + "32615']", d);
  }