Ejemplo n.º 1
0
  @Test
  public void testLikeMatchCase() throws Exception {
    // first run, without matching case, should match both buildings
    String xml =
        "<GetFeature version='1.1.0' xmlns:gml=\"http://www.opengis.net/gml\">"
            + " <Query typeName=\""
            + SystemTestData.BUILDINGS.getLocalPart()
            + "\">"
            + "   <PropertyName>ADDRESS</PropertyName>"
            + "   <Filter>"
            + "     <PropertyIsLike wildCard=\"*\" singleChar=\".\" escapeChar=\"\\\" matchCase=\"false\">"
            + "       <PropertyName>ADDRESS</PropertyName>"
            + "       <Literal>* MAIN STREET</Literal>"
            + "     </PropertyIsLike>"
            + "   </Filter>"
            + " </Query>"
            + "</GetFeature>";

    Document doc = postAsDOM("wfs", xml);
    assertEquals("wfs:FeatureCollection", doc.getDocumentElement().getNodeName());

    NodeList featureMembers = doc.getElementsByTagName("cite:Buildings");
    assertEquals(2, featureMembers.getLength());

    // second run, with match case, should match none
    xml =
        "<GetFeature version='1.1.0' xmlns:gml=\"http://www.opengis.net/gml\">"
            + " <Query typeName=\""
            + SystemTestData.BUILDINGS.getLocalPart()
            + "\">"
            + "   <PropertyName>ADDRESS</PropertyName>"
            + "   <Filter>"
            + "     <PropertyIsLike wildCard=\"*\" singleChar=\".\" escapeChar=\"\\\" matchCase=\"true\">"
            + "       <PropertyName>ADDRESS</PropertyName>"
            + "       <Literal>* MAIN STREET</Literal>"
            + "     </PropertyIsLike>"
            + "   </Filter>"
            + " </Query>"
            + "</GetFeature>";
    doc = postAsDOM("wfs", xml);
    assertEquals("wfs:FeatureCollection", doc.getDocumentElement().getNodeName());

    featureMembers = doc.getElementsByTagName("cite:Buildings");
    assertEquals(0, featureMembers.getLength());
  }
Ejemplo n.º 2
0
  @Test
  public void testLax() throws Exception {
    String xml =
        "<GetFeature version='1.1.0' xmlns:gml=\"http://www.opengis.net/gml\">"
            + " <Query typeName=\""
            + SystemTestData.BUILDINGS.getLocalPart()
            + "\">"
            + "   <PropertyName>ADDRESS</PropertyName>"
            + "   <Filter>"
            + "     <PropertyIsEqualTo>"
            + "       <PropertyName>ADDRESS</PropertyName>"
            + "       <Literal>123 Main Street</Literal>"
            + "     </PropertyIsEqualTo>"
            + "   </Filter>"
            + " </Query>"
            + "</GetFeature>";

    Document doc = postAsDOM("wfs", xml);
    // print( doc );
    assertEquals("wfs:FeatureCollection", doc.getDocumentElement().getNodeName());

    NodeList featureMembers = doc.getElementsByTagName("cite:Buildings");
    assertEquals(1, featureMembers.getLength());
  }