Class ETSAssert

java.lang.Object
org.opengis.cite.cat30.ETSAssert

public class ETSAssert extends Object
Provides a set of custom assertion methods.
  • Method Details

    • assertQualifiedName

      public static void assertQualifiedName(Node node, QName qName)
      Asserts that the qualified name of a DOM Node matches the expected value.
      Parameters:
      node - The Node to check.
      qName - A QName object containing a namespace name (URI) and a local part.
    • assertXPath

      public static void assertXPath(String expr, Node context, Map<String,String> namespaceBindings)
      Asserts that an XPath 1.0 expression holds true for the given evaluation context. The following standard namespace bindings do not need to be explicitly declared:
      Parameters:
      expr - A valid XPath 1.0 expression.
      context - The context node (Document or Element).
      namespaceBindings - A collection of namespace bindings for the XPath expression, where each entry maps a namespace URI (key) to a prefix (value). It may be null.
    • assertSchemaValid

      public static void assertSchemaValid(Validator validator, Source source)
      Asserts that an XML resource is schema-valid.
      Parameters:
      validator - The Validator to use.
      source - The XML Source to be validated.
    • assertSchematronValid

      public static void assertSchematronValid(URL schemaRef, Source xmlSource)
      Asserts that an XML resource satisfies all applicable constraints specified in a Schematron (ISO 19757-3) schema. The "xslt2" query language binding is supported. All patterns are checked.
      Parameters:
      schemaRef - A URL that denotes the location of a Schematron schema.
      xmlSource - The XML Source to be validated.
    • assertDescendantElementCount

      public static void assertDescendantElementCount(Document xmlEntity, QName elementName, int expectedCount)
      Asserts that the given XML entity contains the expected number of descendant elements having the specified name.
      Parameters:
      xmlEntity - A Document representing an XML entity.
      elementName - The qualified name of the element.
      expectedCount - The expected number of occurrences.
    • assertExceptionReport

      public static void assertExceptionReport(jakarta.ws.rs.core.Response rsp, String exceptionCode, String locator)
      Asserts that the given response message contains an OGC exception report. The message body must contain an XML document that has a document element with the following properties:
      • [local name] = "ExceptionReport"
      • [namespace name] = "http://www.opengis.net/ows/2.0"
      Parameters:
      rsp - A ClientResponse object representing an HTTP response message.
      exceptionCode - The expected OGC exception code.
      locator - A case-insensitive string value expected to occur in the locator attribute (e.g. a parameter name); the attribute value will be ignored if the argument is null or empty.
    • assertEnvelopeIntersectsBoundingBoxes

      public static void assertEnvelopeIntersectsBoundingBoxes(org.opengis.geometry.Envelope bbox, Source results)
      Asserts that all bounding boxes appearing in the search results intersect the given envelope. The following bounding box representations are recognized:
      • ows:BoundingBox
      • ows:WGS84BoundingBox
      • georss:box (EPSG 4326)
      • georss:where/{http://www.opengis.net/gml}Envelope
      Parameters:
      bbox - An envelope specifying a spatial extent in some CRS.
      results - A Source object for reading the query results (the document element is typically csw:GetRecordsResponse or atom:feed).
    • assertEmptyResultSet

      public static void assertEmptyResultSet(Document entity)
      Asserts that the given response entity includes no search results.
      Parameters:
      entity - A Document representing a search response (atom:feed, csw:GetRecordsResponse, or rss).
    • assertAllTermsOccur

      public static void assertAllTermsOccur(NodeList recordList, String... searchTerms)
      Asserts that the given search terms all occur in the content of each record in the given collection. The context includes the text content of all child elements and their attributes. The comparison is not case-sensitive.
      Parameters:
      recordList - A list of nodes representing catalog records (csw:Record or atom:entry).
      searchTerms - A list of search terms.