Package org.opengis.cite.kml22
Class ETSAssert
java.lang.Object
org.opengis.cite.kml22.ETSAssert
Provides a set of custom assertion methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertDescendantElementCount(Document xmlEntity, QName elementName, int expectedCount) Asserts that the given XML entity contains the expected number of descendant elements having the specified name.static voidassertQualifiedName(Node node, QName qName) Asserts that the qualified name of a DOM Node matches the expected value.static voidassertReferentExists(String xpath, Node linkNode, jakarta.ws.rs.client.Client httpClient, String... mediaTypes) Asserts that the resource identified by the given link element exists.static voidassertReferentExists(URI uriRef, String baseURI, jakarta.ws.rs.client.Client httpClient, String... mediaTypes) Asserts that the resource identified by the given URI reference exists.static voidassertSchematronValid(URL schemaRef, Source xmlSource) Asserts that an XML resource satisfies all applicable constraints specified in a Schematron (ISO 19757-3) schema.static voidassertSchemaValid(Validator validator, Source source) Asserts that an XML resource is schema-valid.static voidassertValidUpdate(Node updateNode) Asserts that the given kml:Update element is valid.static voidAsserts that an XPath 1.0 expression holds true for the given evaluation context.static voidAsserts that an XPath 2.0 expression evaluates totruefor the given XML source.
-
Method Details
-
assertQualifiedName
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
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.namespaceBindings- A collection of namespace bindings for the XPath expression, where each entry maps a namespace URI (key) to a prefix (value). It may benull.
-
assertXPath2
Asserts that an XPath 2.0 expression evaluates totruefor the given XML source. That is, the result set is not empty.- Parameters:
expr- An XPath 2.0 expression.source- A Source object representing an XML resource.namespaceBindings- A collection of namespace bindings for the XPath expression, where each entry maps a namespace URI (key) to a prefix (value). It may benull.
-
assertSchemaValid
Asserts that an XML resource is schema-valid.- Parameters:
validator- The Validator to use.source- The XML Source to be validated.
-
assertSchematronValid
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.
-
assertReferentExists
public static void assertReferentExists(String xpath, Node linkNode, jakarta.ws.rs.client.Client httpClient, String... mediaTypes) Asserts that the resource identified by the given link element exists.- Parameters:
xpath- An XPath expression that is evaluated against the given linkNode to yield a URI reference.linkNode- A DOM node containing a URI reference (e.g. kml:Link, kml:Icon).httpClient- An HTTP client component. Ifnull, one will be created.mediaTypes- An array or sequence of String values that describe the expected media type(s) of the target resource.
-
assertReferentExists
public static void assertReferentExists(URI uriRef, String baseURI, jakarta.ws.rs.client.Client httpClient, String... mediaTypes) Asserts that the resource identified by the given URI reference exists.- Parameters:
uriRef- A URI reference.baseURI- A base URI for resolving a relative URI reference.httpClient- An HTTP client component. Ifnull, one will be created.mediaTypes- An array or sequence of String values that describe the expected media type(s) of the target resource.
-
assertValidUpdate
Asserts that the given kml:Update element is valid. More precisely, for each targetId attribute appearing in the update, the expression //kml:*[ @id = targetId] must evaluate totruewhen evaluated against the referenced data (kml:targetHref).- Parameters:
updateNode- A node representing a kml:Update element.
-