Class ComparisonOperatorTests


public class ComparisonOperatorTests extends QueryFilterFixture
Tests the response to a GetFeature request that includes a filter predicate containing one of the following comparison operators:
  • PropertyIsLessThan
  • PropertyIsGreaterThan
  • PropertyIsLessThanOrEqualTo
  • PropertyIsGreaterThanOrEqualTo

These operators compare the value of a simple property against some specified value; they can be applied to numeric, temporal, and text data types (although lexicographic order may depend on the collation rules). If a property has multiple values, the matchAction parameter affects the scope of the comparison ("All", "Any", "One").

Sources

  • ISO 19142:2010, cl. A.1.2: Basic WFS
  • ISO 19143:2010, cl. 7.7: Comparison operators
  • ISO 19143:2010, cl. A.5: Test cases for minimum standard filter
  • Constructor Details

    • ComparisonOperatorTests

      public ComparisonOperatorTests()
  • Method Details

    • propertyIsLessThan_matchAny

      public void propertyIsLessThan_matchAny(ProtocolBinding binding, QName featureType)
      [Test] Submits a GetFeature request containing a PropertyIsLessThan predicate that applies to some simple (numeric or temporal) feature property. The response entity must include only feature instances that satisfy the predicate; if multiple values exist, at least one must match (matchAction="Any").
      Parameters:
      binding - The ProtocolBinding to use for this request.
      featureType - A QName representing the qualified name of some feature type.
    • propertyIsLessThan_matchAll

      public void propertyIsLessThan_matchAll(ProtocolBinding binding, QName featureType)
      [Test] Submits a GetFeature request containing a PropertyIsLessThan predicate that applies to some simple (numeric or temporal) feature property. The response entity must include only feature instances that satisfy the predicate; if multiple values exist, all of them must match (matchAction="All").
      Parameters:
      binding - The ProtocolBinding to use for this request.
      featureType - A QName representing the qualified name of some feature type.
    • propertyIsGreaterThan_matchAny

      public void propertyIsGreaterThan_matchAny(ProtocolBinding binding, QName featureType)
      [Test] Submits a GetFeature request containing a PropertyIsGreaterThan predicate that applies to some simple (numeric or temporal) feature property. The response entity must include only feature instances that satisfy the predicate; if multiple values exist, at least one must match (matchAction="Any").
      Parameters:
      binding - The ProtocolBinding to use for this request.
      featureType - A QName representing the qualified name of some feature type.
    • propertyIsGreaterThanEqualTo_matchAny

      public void propertyIsGreaterThanEqualTo_matchAny(ProtocolBinding binding, QName featureType)
      [Test] Submits a GetFeature request containing a PropertyIsGreaterThanOrEqualTo predicate that applies to some simple (numeric or temporal) feature property. The response entity must include only feature instances that satisfy the predicate; if multiple values exist, at least one must match (matchAction="Any").
      Parameters:
      binding - The ProtocolBinding to use for this request.
      featureType - A QName representing the qualified name of some feature type.
    • propertyIsLessThanEqualTo_matchAny

      public void propertyIsLessThanEqualTo_matchAny(ProtocolBinding binding, QName featureType)
      [Test] Submits a GetFeature request containing a PropertyIsLessThanOrEqualTo predicate that applies to some simple (numeric or temporal) feature property. The response entity must include only feature instances that satisfy the predicate; if multiple values exist, at least one must match (matchAction="Any").
      Parameters:
      binding - The ProtocolBinding to use for this request.
      featureType - A QName representing the qualified name of some feature type.
    • invalidPropertyReference

      public void invalidPropertyReference(ProtocolBinding binding)
      [Test] Submits a GetFeature request containing a comparison filter predicate that refers to an invalid feature property. An exception report is expected in response with status code 400 and exception code InvalidParameterValue.
      Parameters:
      binding - The ProtocolBinding to use for this request.
      See Also:
      • "ISO 19143:2010, cl. 8.3: Exceptions"
    • invalidOperand_boundedBy

      public void invalidOperand_boundedBy(ProtocolBinding binding)
      [Test] Submits a GetFeature request containing a comparison filter predicate that refers to the complex feature property gml:boundedBy (with fes:Literal/gml:Envelope as the literal operand). An exception report is expected in response with exception code OperationProcessingFailed and status code 400 or 403.

      Sources

      • ISO 19142:2010, cl. 11.4: Exceptions
      • ISO 19142:2010, Table 3 - WFS exception codes
      Parameters:
      binding - The ProtocolBinding to use for this request.
    • addComparisonPredicate

      void addComparisonPredicate(Document request, String operator, QName propertyName, Object literalValue, boolean matchCase, String matchAction)
      Adds a comparison predicate to a GetFeature request entity with the given property name and literal value. The predicate is structured as shown in the listing below.
       
       <Filter xmlns="http://www.opengis.net/fes/2.0">
         <PropertyIsLessThan matchCase="true" matchAction="Any">
           <Literal>value</Literal>
           <ValueReference>tns:featureProperty</ValueReference>
         </PropertyIsLessThan>
       </Filter>
       
       
      Parameters:
      request - The request entity (/wfs:GetFeature).
      operator - The name of the comparison operator.
      propertyName - A QName that specifies the feature property to check.
      literalValue - The literal object to compare the property value with; it must be a String or a DOM Document (in which case the document element is used to represent a complex literal).
      matchCase - A boolean value indicating whether or not the comparison should be case-sensitive.
      matchAction - A String specifying how the predicate should be applied to a multi-valued property; the default value is "Any".
    • findFeaturePropertyValue

      Map<org.apache.xerces.xs.XSElementDeclaration,String[]> findFeaturePropertyValue(org.apache.xerces.xs.XSModel model, QName featureType, Set<org.apache.xerces.xs.XSTypeDefinition> dataTypes)
      Inspects sample data retrieved from the SUT and determines the range of simple property values for the specified feature type. The method finds the first feature property that (a) conforms to one of the given type definitions, and (b) has at least one value in the data sample.
      Parameters:
      model - An XSModel object representing an application schema.
      featureType - The qualified name of some feature type.
      dataTypes - A Set of simple data types that possess an interval or ratio scale of measurement (e.g. numeric or temporal data types).
      Returns:
      A Map containing a single entry where the key is an element declaration and the value is a String[] array containing two String objects representing the minimum and maximum values of the property.
    • calculateRange

      String[] calculateRange(String[] values, QName datatype)
      Calculates the range of the given values and returns the minimum and maximum values as valid string literals.
      Parameters:
      values - An array of strings representing numeric or temporal values.
      datatype - The name of the built-in XML Schema datatype to which the values must conform.
      Returns:
      An array containing the (min, max) values.
    • sortValues

      void sortValues(String[] values)
      Sorts the given array into ascending order, assuming its elements represent either numeric (Double) or temporal (Calendar) values. Temporal values are expressed in UTC. The corresponding built-in datatypes from XML Schema are:
      • xsd:decimal (including xsd:integer and its subtypes)
      • xsd:double
      • xsd:float
      • xsd:dateTime
      • xsd:date
      Parameters:
      values - An array containing String representations of numeric or temporal values.
    • getNumericDataTypes

      Set<org.apache.xerces.xs.XSTypeDefinition> getNumericDataTypes(org.apache.xerces.xs.XSModel model)
      Returns a set of primitive numeric data type definitions (xsd:decimal, xsd:double, xsd:float). Derived data types are also implicitly included (e.g. xsd:integer).
      Parameters:
      model - An XSModel object representing an application schema.
      Returns:
      A Set of simple type definitions corresponding to numeric data types.