Class UserDefinedDataTests

java.lang.Object
org.opengis.cite.kml22.BaseFixture
org.opengis.cite.kml22.level1.UserDefinedDataTests

public class UserDefinedDataTests extends BaseFixture
Contains test methods that verify constraints applicable to user-defined data elements and their corresponding definitions.

Sources

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final Set<QName>
    List of XML Schema data types that may be used to define simple fields.
    (package private) static final Map<QName,Class<?>>
    Java type mappings for XML Schema datatypes (from JAXB specification).

    Fields inherited from class org.opengis.cite.kml22.BaseFixture

    NS_MAP, testSubject
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    checkSimpleDataElements(Element schemaData, net.sf.saxon.s9api.XdmNode schemaNode, org.opengis.cite.validation.ValidationErrorHandler errHandler)
    Checks that the content of a kml:SchemaData element conforms to the declarations in the referenced Schema.
    (package private) QName
    Determines the data type declared for a given kml:SimpleField element.
    void
    [Test] Verifies that a kml:Schema element has an 'id' attribute value.
    (package private) boolean
    valueConformsToType(String value, QName dataType)
    Determines whether or not the given datum value conforms to a specified XML Schema datatype.
    void
    [Test] Verifies that a kml:SchemaData element satisfies all of the following constraints: the 'schemaUrl' attribute value is a URL with a fragment component that refers to a kml:Schema element; all kml:SimpleData child elements have a 'name' attribute that matches the name of a declared kml:SimpleField element in the corresponding Schema; the values of all kml:SimpleData child elements conform to their declared types.
    void
    [Test] Verifies that a kml:SimpleField element satisfies all of the following constraints: it has a 'name' attribute; the value of the 'type' attribute is one of the following XML Schema data types: xsd:string xsd:int xsd:unsignedInt xsd:short xsd:unsignedShort xsd:float xsd:double xsd:boolean
    void
    [Test] Verifies that the value of the 'name' attribute on a kml:Data element is unique within the context of the parent kml:ExtendedData element.

    Methods inherited from class org.opengis.cite.kml22.BaseFixture

    obtainTestSubject, setTestSubject, verifyElementNotEmpty

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SIMPLE_FIELD_TYPES

      static final Set<QName> SIMPLE_FIELD_TYPES
      List of XML Schema data types that may be used to define simple fields.
    • XSD_JAVA_MAPPINGS

      static final Map<QName,Class<?>> XSD_JAVA_MAPPINGS
      Java type mappings for XML Schema datatypes (from JAXB specification).
  • Constructor Details

    • UserDefinedDataTests

      public UserDefinedDataTests()
  • Method Details

    • schemaHasIdAttribute

      public void schemaHasIdAttribute()
      [Test] Verifies that a kml:Schema element has an 'id' attribute value.
      See Also:
      • "OGC 07-134r2, ATC 25: Schema"
    • verifySimpleField

      public void verifySimpleField()
      [Test] Verifies that a kml:SimpleField element satisfies all of the following constraints:
      1. it has a 'name' attribute;
      2. the value of the 'type' attribute is one of the following XML Schema data types:
        • xsd:string
        • xsd:int
        • xsd:unsignedInt
        • xsd:short
        • xsd:unsignedShort
        • xsd:float
        • xsd:double
        • xsd:boolean
      See Also:
      • "OGC 07-134r2, ATC 26: Schema - SimpleField"
    • verifySchemaData

      public void verifySchemaData()
      [Test] Verifies that a kml:SchemaData element satisfies all of the following constraints:
      1. the 'schemaUrl' attribute value is a URL with a fragment component that refers to a kml:Schema element;
      2. all kml:SimpleData child elements have a 'name' attribute that matches the name of a declared kml:SimpleField element in the corresponding Schema;
      3. the values of all kml:SimpleData child elements conform to their declared types.
      See Also:
      • "OGC 07-134r2, ATC 27: ExtendedData - SchemaData"
    • verifyUntypedDataAreUnique

      public void verifyUntypedDataAreUnique() throws XPathExpressionException
      [Test] Verifies that the value of the 'name' attribute on a kml:Data element is unique within the context of the parent kml:ExtendedData element.
      Throws:
      XPathExpressionException - If an error occurred while evaluating an XPath expression.
      See Also:
      • "OGC 07-134r2, ATC 28: ExtendedData - Data"
    • checkSimpleDataElements

      void checkSimpleDataElements(Element schemaData, net.sf.saxon.s9api.XdmNode schemaNode, org.opengis.cite.validation.ValidationErrorHandler errHandler)
      Checks that the content of a kml:SchemaData element conforms to the declarations in the referenced Schema.
      Parameters:
      schemaData - A kml:SchemaData element (with parent kml:ExtendedData).
      schemaNode - An XdmNode representing the referenced kml:Schema element.
      errHandler - An error handler that accepts reported constraint violations.
    • valueConformsToType

      boolean valueConformsToType(String value, QName dataType)
      Determines whether or not the given datum value conforms to a specified XML Schema datatype. The assessment is based on the type mappings defined in the JAXB specification.
      Parameters:
      value - A String representing a datum value.
      dataType - A QName identifying some simple datatype.
      Returns:
      true if the value conforms to the data type; false otherwise.
    • getFieldType

      QName getFieldType(Element field)
      Determines the data type declared for a given kml:SimpleField element.
      Parameters:
      field - A kml:SimpleField element.
      Returns:
      A QName representing a (simple) XML Schema data type.