+ * @return a boolean
+ */
+ public boolean isGenerateHtmlReport() {
+ return generateHtmlReport;
+ }
- public boolean isGenerateHtmlReport() {
- return generateHtmlReport;
- }
}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/ErrorMessage.java b/src/main/java/org/opengis/cite/ogcapifeatures10/ErrorMessage.java
index e7bf7ada..99fdecfd 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/ErrorMessage.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/ErrorMessage.java
@@ -4,46 +4,39 @@
import java.util.ResourceBundle;
/**
- * Utility class for retrieving and formatting localized error messages that
- * describe failed assertions.
+ * Utility class for retrieving and formatting localized error messages that describe
+ * failed assertions.
*/
public class ErrorMessage {
- private static final String BASE_NAME =
- "org.opengis.cite.ogcapifeatures10.MessageBundle";
- private static ResourceBundle msgResources =
- ResourceBundle.getBundle(BASE_NAME);
+ private static final String BASE_NAME = "org.opengis.cite.ogcapifeatures10.MessageBundle";
- /**
- * Produces a formatted error message using the supplied substitution
- * arguments and the current locale. The arguments should reflect the order
- * of the placeholders in the message template.
- *
- * @param msgKey
- * The key identifying the message template; it should be a
- * member of {@code ErrorMessageKeys}.
- * @param args
- * An array of arguments to be formatted and substituted in the
- * content of the message.
- * @return A String containing the message content. If no message is found
- * for the given key, a {@link java.util.MissingResourceException}
- * is thrown.
- */
- public static String format(String msgKey, Object... args) {
- return MessageFormat.format(msgResources.getString(msgKey), args);
- }
+ private static ResourceBundle msgResources = ResourceBundle.getBundle(BASE_NAME);
+
+ /**
+ * Produces a formatted error message using the supplied substitution arguments and
+ * the current locale. The arguments should reflect the order of the placeholders in
+ * the message template.
+ * @param msgKey The key identifying the message template; it should be a member of
+ * {@code ErrorMessageKeys}.
+ * @param args An array of arguments to be formatted and substituted in the content of
+ * the message.
+ * @return A String containing the message content. If no message is found for the
+ * given key, a {@link java.util.MissingResourceException} is thrown.
+ */
+ public static String format(String msgKey, Object... args) {
+ return MessageFormat.format(msgResources.getString(msgKey), args);
+ }
+
+ /**
+ * Retrieves a simple message according to the current locale.
+ * @param msgKey The key identifying the message; it should be a member of
+ * {@code ErrorMessageKeys}.
+ * @return A String containing the message content. If no message is found for the
+ * given key, a {@link java.util.MissingResourceException} is thrown.
+ */
+ public static String get(String msgKey) {
+ return msgResources.getString(msgKey);
+ }
- /**
- * Retrieves a simple message according to the current locale.
- *
- * @param msgKey
- * The key identifying the message; it should be a member of
- * {@code ErrorMessageKeys}.
- * @return A String containing the message content. If no message is found
- * for the given key, a {@link java.util.MissingResourceException}
- * is thrown.
- */
- public static String get(String msgKey) {
- return msgResources.getString(msgKey);
- }
}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/ErrorMessageKeys.java b/src/main/java/org/opengis/cite/ogcapifeatures10/ErrorMessageKeys.java
index dc901c7f..378c3f94 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/ErrorMessageKeys.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/ErrorMessageKeys.java
@@ -1,22 +1,44 @@
package org.opengis.cite.ogcapifeatures10;
/**
- * Defines keys used to access localized messages for assertion errors. The
- * messages are stored in Properties files that are encoded in ISO-8859-1
- * (Latin-1). For some languages the {@code native2ascii} tool must be used to
- * process the files and produce escaped Unicode characters.
+ * Defines keys used to access localized messages for assertion errors. The messages are
+ * stored in Properties files that are encoded in ISO-8859-1 (Latin-1). For some languages
+ * the {@code native2ascii} tool must be used to process the files and produce escaped
+ * Unicode characters.
*/
public class ErrorMessageKeys {
- public static final String NOT_SCHEMA_VALID = "NotSchemaValid";
- public static final String EMPTY_STRING = "EmptyString";
- public static final String XPATH_RESULT = "XPathResult";
- public static final String NAMESPACE_NAME = "NamespaceName";
- public static final String LOCAL_NAME = "LocalName";
- public static final String XML_ERROR = "XMLError";
- public static final String XPATH_ERROR = "XPathError";
- public static final String MISSING_INFOSET_ITEM = "MissingInfosetItem";
- public static final String UNEXPECTED_STATUS = "UnexpectedStatus";
- public static final String UNEXPECTED_MEDIA_TYPE = "UnexpectedMediaType";
- public static final String MISSING_ENTITY = "MissingEntity";
+ /** Constant NOT_SCHEMA_VALID="NotSchemaValid" */
+ public static final String NOT_SCHEMA_VALID = "NotSchemaValid";
+
+ /** Constant EMPTY_STRING="EmptyString" */
+ public static final String EMPTY_STRING = "EmptyString";
+
+ /** Constant XPATH_RESULT="XPathResult" */
+ public static final String XPATH_RESULT = "XPathResult";
+
+ /** Constant NAMESPACE_NAME="NamespaceName" */
+ public static final String NAMESPACE_NAME = "NamespaceName";
+
+ /** Constant LOCAL_NAME="LocalName" */
+ public static final String LOCAL_NAME = "LocalName";
+
+ /** Constant XML_ERROR="XMLError" */
+ public static final String XML_ERROR = "XMLError";
+
+ /** Constant XPATH_ERROR="XPathError" */
+ public static final String XPATH_ERROR = "XPathError";
+
+ /** Constant MISSING_INFOSET_ITEM="MissingInfosetItem" */
+ public static final String MISSING_INFOSET_ITEM = "MissingInfosetItem";
+
+ /** Constant UNEXPECTED_STATUS="UnexpectedStatus" */
+ public static final String UNEXPECTED_STATUS = "UnexpectedStatus";
+
+ /** Constant UNEXPECTED_MEDIA_TYPE="UnexpectedMediaType" */
+ public static final String UNEXPECTED_MEDIA_TYPE = "UnexpectedMediaType";
+
+ /** Constant MISSING_ENTITY="MissingEntity" */
+ public static final String MISSING_ENTITY = "MissingEntity";
+
}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/EtsAssert.java b/src/main/java/org/opengis/cite/ogcapifeatures10/EtsAssert.java
index 516271f1..0ae87b26 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/EtsAssert.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/EtsAssert.java
@@ -16,171 +16,166 @@
*/
public class EtsAssert {
- private static Envelope CRS84_BBOX = new Envelope( -180, 180, -90, 90 );
+ private static Envelope CRS84_BBOX = new Envelope(-180, 180, -90, 90);
- /**
- * @param valueToAssert
- * the boolean to assert to be true
- * @param failureMsg
- * the message to throw in case of a failure, should not be null
- */
- public static void assertTrue( boolean valueToAssert, String failureMsg ) {
- if ( !valueToAssert )
- throw new AssertionError( failureMsg );
- }
+ /**
+ *
+ * assertTrue.
+ *
+ * @param valueToAssert the boolean to assert to be true
+ * @param failureMsg the message to throw in case of a failure, should not be
+ * null
+ */
+ public static void assertTrue(boolean valueToAssert, String failureMsg) {
+ if (!valueToAssert)
+ throw new AssertionError(failureMsg);
+ }
- /**
- * @param valueToAssert
- * the boolean to assert to be false
- * @param failureMsg
- * the message to throw in case of a failure, should not be null
- */
- public static void assertFalse( boolean valueToAssert, String failureMsg ) {
- if ( valueToAssert )
- throw new AssertionError( failureMsg );
- }
+ /**
+ *
+ * assertFalse.
+ *
+ * @param valueToAssert the boolean to assert to be false
+ * @param failureMsg the message to throw in case of a failure, should not be
+ * null
+ */
+ public static void assertFalse(boolean valueToAssert, String failureMsg) {
+ if (valueToAssert)
+ throw new AssertionError(failureMsg);
+ }
- /**
- *
- * 1. For http-URIs (starting with http:) validate that the string conforms to the syntax specified
- * by RFC 7230, section 2.7.1.
- * 2. For https-URIs (starting with https:) validate that the string conforms to the syntax specified
- * by RFC 7230, section 2.7.2.
- * 3. For URNs (starting with urn:) validate that the string conforms to the syntax specified
- * by RFC 8141, section 2.
- * 4. For OGC URNs (starting with urn:ogc:def:crs:) and OGC http-URIs (starting with http://www.opengis.net/def/crs/)
- * validate that the string conforms to the syntax specified by OGC Name Type Specification - definitions - part 1 – basic name.
- *
- *
- * @param coordinateSystem
- * the coordinate system to assert as valid identifier (see above). If null an
- * AssertionError is thrown.
- * @param failureMsg
- * the message to throw in case of a failure, should not be null
- */
- public static void assertValidCrsIdentifier( CoordinateSystem coordinateSystem, String failureMsg ) {
- if ( coordinateSystem == null )
- throw new AssertionError( failureMsg );
- if ( !coordinateSystem.isValid() )
- throw new AssertionError( failureMsg );
- }
+ /**
+ *
+ * 1. For http-URIs (starting with http:) validate that the string conforms to the syntax specified
+ * by RFC 7230, section 2.7.1.
+ * 2. For https-URIs (starting with https:) validate that the string conforms to the syntax specified
+ * by RFC 7230, section 2.7.2.
+ * 3. For URNs (starting with urn:) validate that the string conforms to the syntax specified
+ * by RFC 8141, section 2.
+ * 4. For OGC URNs (starting with urn:ogc:def:crs:) and OGC http-URIs (starting with http://www.opengis.net/def/crs/)
+ * validate that the string conforms to the syntax specified by OGC Name Type Specification - definitions - part 1 – basic name.
+ *
+ * @param coordinateSystem the coordinate system to assert as valid identifier (see
+ * above). If null an AssertionError is thrown.
+ * @param failureMsg the message to throw in case of a failure, should not be
+ * null
+ */
+ public static void assertValidCrsIdentifier(CoordinateSystem coordinateSystem, String failureMsg) {
+ if (coordinateSystem == null)
+ throw new AssertionError(failureMsg);
+ if (!coordinateSystem.isValid())
+ throw new AssertionError(failureMsg);
+ }
- /**
- * Assert that one of the default CRS
- *
- *
- * * http://www.opengis.net/def/crs/OGC/1.3/CRS84 (for coordinates without height)
- * * http://www.opengis.net/def/crs/OGC/0/CRS84h (for coordinates with height)
- *
- *
- * is in the list of passed crs.
- *
- * @param valueToAssert
- * list of CRS which should contain the default crs, never null
- * @param failureMsg
- * the message to throw in case of a failure, should not be null
- * @return the default CRS
- */
- public static CoordinateSystem assertDefaultCrs( List valueToAssert, String failureMsg ) {
- if ( valueToAssert.contains( OgcApiFeatures10.DEFAULT_CRS_CODE ) )
- return DEFAULT_CRS;
- if ( valueToAssert.contains( OgcApiFeatures10.DEFAULT_CRS_WITH_HEIGHT_CODE ) )
- return DEFAULT_CRS_WITH_HEIGHT;
- throw new AssertionError( failureMsg );
- }
+ /**
+ * Assert that one of the default CRS
+ *
+ *
+ * * http://www.opengis.net/def/crs/OGC/1.3/CRS84 (for coordinates without height)
+ * * http://www.opengis.net/def/crs/OGC/0/CRS84h (for coordinates with height)
+ *
+ *
+ * is in the list of passed crs.
+ * @param valueToAssert list of CRS which should contain the default crs, never
+ * null
+ * @param failureMsg the message to throw in case of a failure, should not be
+ * null
+ * @return the default CRS
+ */
+ public static CoordinateSystem assertDefaultCrs(List valueToAssert, String failureMsg) {
+ if (valueToAssert.contains(OgcApiFeatures10.DEFAULT_CRS_CODE))
+ return DEFAULT_CRS;
+ if (valueToAssert.contains(OgcApiFeatures10.DEFAULT_CRS_WITH_HEIGHT_CODE))
+ return DEFAULT_CRS_WITH_HEIGHT;
+ throw new AssertionError(failureMsg);
+ }
- /**
- * Assert that the first is one of the default CRS
- *
- *
- * * http://www.opengis.net/def/crs/OGC/1.3/CRS84 (for coordinates without height)
- * * http://www.opengis.net/def/crs/OGC/0/CRS84h (for coordinates with height)
- *
- *
- * @param valueToAssert
- * list of CRS which should contain the default crs, never null
- * @param failureMsg
- * the message to throw in case of a failure, should not be null
- */
- public static void assertDefaultCrsAtFirst( List valueToAssert, String failureMsg ) {
- if ( !valueToAssert.isEmpty() ) {
- String firstCrs = valueToAssert.get( 0 );
- if ( OgcApiFeatures10.DEFAULT_CRS_CODE.equals( firstCrs ) )
- return;
- if ( OgcApiFeatures10.DEFAULT_CRS_WITH_HEIGHT_CODE.equals( firstCrs ) )
- return;
- }
- throw new AssertionError( failureMsg );
- }
+ /**
+ * Assert that the first is one of the default CRS
+ *
+ *
+ * * http://www.opengis.net/def/crs/OGC/1.3/CRS84 (for coordinates without height)
+ * * http://www.opengis.net/def/crs/OGC/0/CRS84h (for coordinates with height)
+ *
+ * @param valueToAssert list of CRS which should contain the default crs, never
+ * null
+ * @param failureMsg the message to throw in case of a failure, should not be
+ * null
+ */
+ public static void assertDefaultCrsAtFirst(List valueToAssert, String failureMsg) {
+ if (!valueToAssert.isEmpty()) {
+ String firstCrs = valueToAssert.get(0);
+ if (OgcApiFeatures10.DEFAULT_CRS_CODE.equals(firstCrs))
+ return;
+ if (OgcApiFeatures10.DEFAULT_CRS_WITH_HEIGHT_CODE.equals(firstCrs))
+ return;
+ }
+ throw new AssertionError(failureMsg);
+ }
- /**
- * Assert that the passed string is one of the the default CRS
- *
- *
- * * http://www.opengis.net/def/crs/OGC/1.3/CRS84 (for coordinates without height)
- * * http://www.opengis.net/def/crs/OGC/0/CRS84h (for coordinates with height)
- *
- *
- * @param crsHeaderValue
- * CRS which should be the default crs, never null
- * @param failureMsg
- * the message to throw in case of a failure, should not be null
- */
- public static void assertDefaultCrs( String crsHeaderValue, String failureMsg ) {
- if ( !crsHeaderValue.matches( "<" + OgcApiFeatures10.DEFAULT_CRS_CODE + ">" )
- && !crsHeaderValue.matches( "<" + OgcApiFeatures10.DEFAULT_CRS_WITH_HEIGHT_CODE + ">" ) ) {
- throw new AssertionError( failureMsg );
- }
- }
+ /**
+ * Assert that the passed string is one of the the default CRS
+ *
+ *
+ * * http://www.opengis.net/def/crs/OGC/1.3/CRS84 (for coordinates without height)
+ * * http://www.opengis.net/def/crs/OGC/0/CRS84h (for coordinates with height)
+ *
+ * @param crsHeaderValue CRS which should be the default crs, never null
+ * @param failureMsg the message to throw in case of a failure, should not be
+ * null
+ */
+ public static void assertDefaultCrs(String crsHeaderValue, String failureMsg) {
+ if (!crsHeaderValue.matches("<" + OgcApiFeatures10.DEFAULT_CRS_CODE + ">")
+ && !crsHeaderValue.matches("<" + OgcApiFeatures10.DEFAULT_CRS_WITH_HEIGHT_CODE + ">")) {
+ throw new AssertionError(failureMsg);
+ }
+ }
- /**
- * @param crsHeaderValue
- * the value from the header, never null
- * @param expectedCrs
- * th expected value, never null
- * @param failureMsg
- * the message to throw in case of a failure, should not be null
- */
- public static void assertCrsHeader( String crsHeaderValue, CoordinateSystem expectedCrs, String failureMsg ) {
- if ( !crsHeaderValue.matches( expectedCrs.getAsHeaderValue() ) ) {
- throw new AssertionError( failureMsg );
- }
- }
+ /**
+ *
+ * assertCrsHeader.
+ *
+ * @param crsHeaderValue the value from the header, never null
+ * @param expectedCrs th expected value, never null
+ * @param failureMsg the message to throw in case of a failure, should not be
+ * null
+ */
+ public static void assertCrsHeader(String crsHeaderValue, CoordinateSystem expectedCrs, String failureMsg) {
+ if (!crsHeaderValue.matches(expectedCrs.getAsHeaderValue())) {
+ throw new AssertionError(failureMsg);
+ }
+ }
- /**
- * Assert that one of the default CRS
- *
- *
- * * http://www.opengis.net/def/crs/OGC/1.3/CRS84 (for coordinates without height)
- * * http://www.opengis.net/def/crs/OGC/0/CRS84h (for coordinates with height)
- *
- *
- * @param crsHeaderValue
- * the value from the header, never null
- * @param failureMsg
- * the message to throw in case of a failure, should not be null
- */
- public static void assertDefaultCrsHeader( String crsHeaderValue, String failureMsg ) {
- if ( !crsHeaderValue.matches( "<" + OgcApiFeatures10.DEFAULT_CRS_CODE + ">" )
- && !crsHeaderValue.matches( "<" + OgcApiFeatures10.DEFAULT_CRS_WITH_HEIGHT_CODE + ">" ) ) {
- throw new AssertionError( failureMsg );
- }
- }
+ /**
+ * Assert that one of the default CRS
+ *
+ *
+ * * http://www.opengis.net/def/crs/OGC/1.3/CRS84 (for coordinates without height)
+ * * http://www.opengis.net/def/crs/OGC/0/CRS84h (for coordinates with height)
+ *
+ * @param crsHeaderValue the value from the header, never null
+ * @param failureMsg the message to throw in case of a failure, should not be
+ * null
+ */
+ public static void assertDefaultCrsHeader(String crsHeaderValue, String failureMsg) {
+ if (!crsHeaderValue.matches("<" + OgcApiFeatures10.DEFAULT_CRS_CODE + ">")
+ && !crsHeaderValue.matches("<" + OgcApiFeatures10.DEFAULT_CRS_WITH_HEIGHT_CODE + ">")) {
+ throw new AssertionError(failureMsg);
+ }
+ }
- /**
- * Assert that the passed geometry is in the valid area of CRS84.
- *
- * @param geometry
- * to check, may be null
- * @param failureMsg
- * the message to throw in case of a failure, should not be null
- */
- public static void assertInCrs84( Geometry geometry, String failureMsg ) {
- if ( geometry == null )
- return;
- if ( !CRS84_BBOX.contains( geometry.getEnvelopeInternal() ) ) {
- throw new AssertionError( failureMsg );
- }
- }
+ /**
+ * Assert that the passed geometry is in the valid area of CRS84.
+ * @param geometry to check, may be null
+ * @param failureMsg the message to throw in case of a failure, should not be
+ * null
+ */
+ public static void assertInCrs84(Geometry geometry, String failureMsg) {
+ if (geometry == null)
+ return;
+ if (!CRS84_BBOX.contains(geometry.getEnvelopeInternal())) {
+ throw new AssertionError(failureMsg);
+ }
+ }
}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/Namespaces.java b/src/main/java/org/opengis/cite/ogcapifeatures10/Namespaces.java
index d4096ca0..37fa85b3 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/Namespaces.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/Namespaces.java
@@ -4,28 +4,30 @@
/**
* XML namespace names.
- *
- * @see Namespaces in XML 1.0
*
+ * @see Namespaces in XML 1.0
*/
public class Namespaces {
- private Namespaces() {
- }
-
- /** SOAP 1.2 message envelopes. */
- public static final String SOAP_ENV = "http://www.w3.org/2003/05/soap-envelope";
- /** W3C XLink */
- public static final String XLINK = "http://www.w3.org/1999/xlink";
- /** OGC 06-121r3 (OWS 1.1) */
- public static final String OWS = "http://www.opengis.net/ows/1.1";
- /** ISO 19136 (GML 3.2) */
- public static final String GML = "http://www.opengis.net/gml/3.2";
- /** W3C XML Schema namespace */
- public static final URI XSD = URI
- .create("http://www.w3.org/2001/XMLSchema");
- /** Schematron (ISO 19757-3) namespace */
- public static final URI SCH = URI
- .create("http://purl.oclc.org/dsdl/schematron");
+ private Namespaces() {
+ }
+
+ /** SOAP 1.2 message envelopes. */
+ public static final String SOAP_ENV = "http://www.w3.org/2003/05/soap-envelope";
+
+ /** W3C XLink */
+ public static final String XLINK = "http://www.w3.org/1999/xlink";
+
+ /** OGC 06-121r3 (OWS 1.1) */
+ public static final String OWS = "http://www.opengis.net/ows/1.1";
+
+ /** ISO 19136 (GML 3.2) */
+ public static final String GML = "http://www.opengis.net/gml/3.2";
+
+ /** W3C XML Schema namespace */
+ public static final URI XSD = URI.create("http://www.w3.org/2001/XMLSchema");
+
+ /** Schematron (ISO 19757-3) namespace */
+ public static final URI SCH = URI.create("http://purl.oclc.org/dsdl/schematron");
}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/OgcApiFeatures10.java b/src/main/java/org/opengis/cite/ogcapifeatures10/OgcApiFeatures10.java
index 5135e47d..fbb3b07e 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/OgcApiFeatures10.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/OgcApiFeatures10.java
@@ -9,34 +9,56 @@
*/
public class OgcApiFeatures10 {
- private OgcApiFeatures10() {
- }
+ private OgcApiFeatures10() {
+ }
- public static final String OPEN_API_MIME_TYPE = "application/vnd.oai.openapi+json;version=3.0";
+ /**
+ * Constant
+ * OPEN_API_MIME_TYPE="application/vnd.oai.openapi+json;versio"{trunked}
+ */
+ public static final String OPEN_API_MIME_TYPE = "application/vnd.oai.openapi+json;version=3.0";
- public static final String GEOJSON_MIME_TYPE = "application/geo+json";
+ /** Constant GEOJSON_MIME_TYPE="application/geo+json" */
+ public static final String GEOJSON_MIME_TYPE = "application/geo+json";
- /** Conformance class: CRS **/
+ /** Conformance class: CRS **/
- public static final String DEFAULT_CRS_CODE = "http://www.opengis.net/def/crs/OGC/1.3/CRS84";
+ public static final String DEFAULT_CRS_CODE = "http://www.opengis.net/def/crs/OGC/1.3/CRS84";
- public static final String DEFAULT_CRS_WITH_HEIGHT_CODE = "http://www.opengis.net/def/crs/OGC/0/CRS84h";
+ /**
+ * Constant
+ * DEFAULT_CRS_WITH_HEIGHT_CODE="http://www.opengis.net/def/crs/OGC/0/CR"{trunked}
+ */
+ public static final String DEFAULT_CRS_WITH_HEIGHT_CODE = "http://www.opengis.net/def/crs/OGC/0/CRS84h";
- public static final CoordinateSystem DEFAULT_CRS = new CoordinateSystem( DEFAULT_CRS_CODE );
+ /** Constant DEFAULT_CRS */
+ public static final CoordinateSystem DEFAULT_CRS = new CoordinateSystem(DEFAULT_CRS_CODE);
- public static final CoordinateSystem DEFAULT_CRS_WITH_HEIGHT = new CoordinateSystem( DEFAULT_CRS_WITH_HEIGHT_CODE );
+ /** Constant DEFAULT_CRS_WITH_HEIGHT */
+ public static final CoordinateSystem DEFAULT_CRS_WITH_HEIGHT = new CoordinateSystem(DEFAULT_CRS_WITH_HEIGHT_CODE);
- public static final String UNSUPPORTED_CRS = "http://www.opengis.net/def/crs/0/unsupported";
+ /**
+ * Constant
+ * UNSUPPORTED_CRS="http://www.opengis.net/def/crs/0/unsupp"{trunked}
+ */
+ public static final String UNSUPPORTED_CRS = "http://www.opengis.net/def/crs/0/unsupported";
- public static final String CRS_PARAMETER = "crs";
+ /** Constant CRS_PARAMETER="crs" */
+ public static final String CRS_PARAMETER = "crs";
- public static final int PAGING_LIMIT = 3;
+ /** Constant PAGING_LIMIT=3 */
+ public static final int PAGING_LIMIT = 3;
- public static final int COLLECTIONS_LIMIT = 20;
+ /** Constant COLLECTIONS_LIMIT=20 */
+ public static final int COLLECTIONS_LIMIT = 20;
- public static final int CRS_LIMIT = 20;
+ /** Constant CRS_LIMIT=20 */
+ public static final int CRS_LIMIT = 20;
+
+ /** Constant FEATURES_LIMIT=100 */
+ public static final int FEATURES_LIMIT = 100;
+
+ /** Constant NUMBERMATCHED_LIMIT=10000 */
+ public static final int NUMBERMATCHED_LIMIT = 10000;
- public static final int FEATURES_LIMIT = 100;
-
- public static final int NUMBERMATCHED_LIMIT = 10000;
}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/ReusableEntityFilter.java b/src/main/java/org/opengis/cite/ogcapifeatures10/ReusableEntityFilter.java
deleted file mode 100644
index daa33b14..00000000
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/ReusableEntityFilter.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.opengis.cite.ogcapifeatures10;
-
-import com.sun.jersey.api.client.ClientHandlerException;
-import com.sun.jersey.api.client.ClientRequest;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.filter.ClientFilter;
-
-/**
- * Buffers the (response) entity so it can be read multiple times.
- *
- *
WARNING: The entity InputStream must be reset after each
- * read attempt.
- */
-public class ReusableEntityFilter extends ClientFilter {
-
- @Override
- public ClientResponse handle(ClientRequest req) throws ClientHandlerException {
- // leave request entity--it can usually be read multiple times
- ClientResponse rsp = getNext().handle(req);
- if (rsp.hasEntity()) {
- rsp.bufferEntity();
- }
- return rsp;
- }
-
-}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/TestNGController.java b/src/main/java/org/opengis/cite/ogcapifeatures10/TestNGController.java
index 2d5969c1..62287ae3 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/TestNGController.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/TestNGController.java
@@ -30,155 +30,155 @@
*/
public class TestNGController implements TestSuiteController {
- private TestRunExecutor executor;
- private Properties etsProperties = new Properties();
-
- /**
- * A convenience method for running the test suite using a command-line
- * interface. The default values of the test run arguments are as follows:
- *
- *
XML properties file: ${user.home}/test-run-props.xml
- *
- * @param args
- * Test run arguments (optional). The first argument must refer
- * to an XML properties file containing the expected set of test
- * run arguments. If no argument is supplied, the file located at
- * ${user.home}/test-run-props.xml will be used.
- * @throws Exception
- * If the test run cannot be executed (usually due to
- * unsatisfied pre-conditions).
- */
- public static void main(String[] args) throws Exception {
- CommandLineArguments testRunArgs = new CommandLineArguments();
- JCommander cmd = new JCommander(testRunArgs);
- try {
- cmd.parse(args);
- } catch (ParameterException px) {
- System.out.println(px.getMessage());
- cmd.usage();
- }
- if (testRunArgs.doDeleteSubjectOnFinish()) {
- System.setProperty("deleteSubjectOnFinish", "true");
- }
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db = dbf.newDocumentBuilder();
- File xmlArgs = testRunArgs.getPropertiesFile();
- Document testRunProps = db.parse(xmlArgs);
- TestNGController controller = new TestNGController(testRunArgs.getOutputDir(), testRunArgs.isGenerateHtmlReport());
- Source testResults = controller.doTestRun(testRunProps);
- System.out.println("Test results: " + testResults.getSystemId());
- }
-
- /**
- * Default constructor uses the location given by the "java.io.tmpdir"
- * system property as the root output directory.
- */
- public TestNGController() {
- this(System.getProperty("java.io.tmpdir"), false);
- }
-
- /**
- * Construct a controller that writes results to the given output directory.
- *
- * @param outputDir
- * The location of the directory in which test results will be
- * written (a file system path or a 'file' URI). It will be
- * created if it does not exist.
- */
- public TestNGController(String outputDir) {
- this(outputDir, false);
- }
-
- /**
- * Construct a controller that writes results to the given output directory.
- *
- * @param outputDir
- * The location of the directory in which test results will be
- * written (a file system path or a 'file' URI). It will be
- * created if it does not exist.
- * @param generateHtmlReport
- * Enable HTML report generation.
- */
- public TestNGController(String outputDir, boolean generateHtmlReport) {
- InputStream is = getClass().getResourceAsStream("ets.properties");
- try {
- this.etsProperties.load(is);
- } catch (IOException ex) {
- TestSuiteLogger.log(Level.WARNING, "Unable to load ets.properties. " + ex.getMessage());
- }
- URL tngSuite = TestNGController.class.getResource("testng.xml");
- File resultsDir;
- if (null == outputDir || outputDir.isEmpty()) {
- resultsDir = new File(System.getProperty("user.home"));
- } else if (outputDir.startsWith("file:")) {
- resultsDir = new File(URI.create(outputDir));
- } else {
- resultsDir = new File(outputDir);
- }
- TestSuiteLogger.log(Level.CONFIG, "Using TestNG config: " + tngSuite);
- TestSuiteLogger.log(Level.CONFIG, "Using outputDirPath: " + resultsDir.getAbsolutePath());
- // NOTE: setting third argument to 'true' enables the default listeners
- this.executor = new TestNGExecutor(tngSuite.toString(), resultsDir.getAbsolutePath(), generateHtmlReport);
- }
-
- @Override
- public String getCode() {
- return etsProperties.getProperty("ets-code");
- }
-
- @Override
- public String getVersion() {
- return etsProperties.getProperty("ets-version");
- }
-
- @Override
- public String getTitle() {
- return etsProperties.getProperty("ets-title");
- }
-
- @Override
- public Source doTestRun(Document testRunArgs) throws Exception {
- validateTestRunArgs(testRunArgs);
- return executor.execute(testRunArgs);
- }
-
- /**
- * Validates the test run arguments. The test run is aborted if any of these
- * checks fail.
- *
- * @param testRunArgs
- * A DOM Document containing a set of XML properties (key-value
- * pairs).
- * @throws IllegalArgumentException
- * If any arguments are missing or invalid for some reason.
- */
- void validateTestRunArgs(Document testRunArgs) {
- if (null == testRunArgs || !testRunArgs.getDocumentElement().getNodeName().equals("properties")) {
- throw new IllegalArgumentException("Input is not an XML properties document.");
- }
- NodeList entries = testRunArgs.getDocumentElement().getElementsByTagName("entry");
- if (entries.getLength() == 0) {
- throw new IllegalArgumentException("No test run arguments found.");
- }
- Map args = new HashMap();
- for (int i = 0; i < entries.getLength(); i++) {
- Element entry = (Element) entries.item(i);
- args.put(entry.getAttribute("key"), entry.getTextContent());
- }
- if (!args.containsKey(TestRunArg.IUT.toString())) {
- throw new IllegalArgumentException(
- String.format("Missing argument: '%s' must be present.", TestRunArg.IUT));
- }
- }
+ private TestRunExecutor executor;
+
+ private Properties etsProperties = new Properties();
+
+ /**
+ * A convenience method for running the test suite using a command-line interface. The
+ * default values of the test run arguments are as follows:
+ *
+ *
XML properties file: ${user.home}/test-run-props.xml
+ * @param args Test run arguments (optional). The first argument must refer to an XML
+ * properties file containing the expected set of test run arguments. If no argument
+ * is supplied, the file located at ${user.home}/test-run-props.xml will be used.
+ * @throws java.lang.Exception If the test run cannot be executed (usually due to
+ * unsatisfied pre-conditions).
+ */
+ public static void main(String[] args) throws Exception {
+ CommandLineArguments testRunArgs = new CommandLineArguments();
+ JCommander cmd = new JCommander(testRunArgs);
+ try {
+ cmd.parse(args);
+ }
+ catch (ParameterException px) {
+ System.out.println(px.getMessage());
+ cmd.usage();
+ }
+ if (testRunArgs.doDeleteSubjectOnFinish()) {
+ System.setProperty("deleteSubjectOnFinish", "true");
+ }
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ File xmlArgs = testRunArgs.getPropertiesFile();
+ Document testRunProps = db.parse(xmlArgs);
+ TestNGController controller = new TestNGController(testRunArgs.getOutputDir(),
+ testRunArgs.isGenerateHtmlReport());
+ Source testResults = controller.doTestRun(testRunProps);
+ System.out.println("Test results: " + testResults.getSystemId());
+ }
+
+ /**
+ * Default constructor uses the location given by the "java.io.tmpdir" system property
+ * as the root output directory.
+ */
+ public TestNGController() {
+ this(System.getProperty("java.io.tmpdir"), false);
+ }
+
+ /**
+ * Construct a controller that writes results to the given output directory.
+ * @param outputDir The location of the directory in which test results will be
+ * written (a file system path or a 'file' URI). It will be created if it does not
+ * exist.
+ */
+ public TestNGController(String outputDir) {
+ this(outputDir, false);
+ }
+
+ /**
+ * Construct a controller that writes results to the given output directory.
+ * @param outputDir The location of the directory in which test results will be
+ * written (a file system path or a 'file' URI). It will be created if it does not
+ * exist.
+ * @param generateHtmlReport Enable HTML report generation.
+ */
+ public TestNGController(String outputDir, boolean generateHtmlReport) {
+ InputStream is = getClass().getResourceAsStream("ets.properties");
+ try {
+ this.etsProperties.load(is);
+ }
+ catch (IOException ex) {
+ TestSuiteLogger.log(Level.WARNING, "Unable to load ets.properties. " + ex.getMessage());
+ }
+ URL tngSuite = TestNGController.class.getResource("testng.xml");
+ File resultsDir;
+ if (null == outputDir || outputDir.isEmpty()) {
+ resultsDir = new File(System.getProperty("user.home"));
+ }
+ else if (outputDir.startsWith("file:")) {
+ resultsDir = new File(URI.create(outputDir));
+ }
+ else {
+ resultsDir = new File(outputDir);
+ }
+ TestSuiteLogger.log(Level.CONFIG, "Using TestNG config: " + tngSuite);
+ TestSuiteLogger.log(Level.CONFIG, "Using outputDirPath: " + resultsDir.getAbsolutePath());
+ // NOTE: setting third argument to 'true' enables the default listeners
+ this.executor = new TestNGExecutor(tngSuite.toString(), resultsDir.getAbsolutePath(), generateHtmlReport);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getCode() {
+ return etsProperties.getProperty("ets-code");
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getVersion() {
+ return etsProperties.getProperty("ets-version");
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getTitle() {
+ return etsProperties.getProperty("ets-title");
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Source doTestRun(Document testRunArgs) throws Exception {
+ validateTestRunArgs(testRunArgs);
+ return executor.execute(testRunArgs);
+ }
+
+ /**
+ * Validates the test run arguments. The test run is aborted if any of these checks
+ * fail.
+ * @param testRunArgs A DOM Document containing a set of XML properties (key-value
+ * pairs).
+ * @throws IllegalArgumentException If any arguments are missing or invalid for some
+ * reason.
+ */
+ void validateTestRunArgs(Document testRunArgs) {
+ if (null == testRunArgs || !testRunArgs.getDocumentElement().getNodeName().equals("properties")) {
+ throw new IllegalArgumentException("Input is not an XML properties document.");
+ }
+ NodeList entries = testRunArgs.getDocumentElement().getElementsByTagName("entry");
+ if (entries.getLength() == 0) {
+ throw new IllegalArgumentException("No test run arguments found.");
+ }
+ Map args = new HashMap();
+ for (int i = 0; i < entries.getLength(); i++) {
+ Element entry = (Element) entries.item(i);
+ args.put(entry.getAttribute("key"), entry.getTextContent());
+ }
+ if (!args.containsKey(TestRunArg.IUT.toString())) {
+ throw new IllegalArgumentException(
+ String.format("Missing argument: '%s' must be present.", TestRunArg.IUT));
+ }
+ }
+
}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/TestRunArg.java b/src/main/java/org/opengis/cite/ogcapifeatures10/TestRunArg.java
index 5b6bf5b1..923b3256 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/TestRunArg.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/TestRunArg.java
@@ -5,18 +5,22 @@
*/
public enum TestRunArg {
- /**
- * An absolute URI that refers to a representation of the test subject or metadata about it.
- */
- IUT,
+ /**
+ * An absolute URI that refers to a representation of the test subject or metadata
+ * about it.
+ */
+ IUT,
- /**
- * The number of collections to test (a value less or equal to 0 means all collections).
- */
- NOOFCOLLECTIONS;
+ /**
+ * The number of collections to test (a value less or equal to 0 means all
+ * collections).
+ */
+ NOOFCOLLECTIONS;
+
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return name().toLowerCase();
+ }
- @Override
- public String toString() {
- return name().toLowerCase();
- }
}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/CommonDataFixture.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/CommonDataFixture.java
index 826b1e6b..4be2287f 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/CommonDataFixture.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/CommonDataFixture.java
@@ -14,68 +14,119 @@
import org.testng.annotations.BeforeClass;
/**
+ *
+ * CommonDataFixture class.
+ *
+ *
* @author Lyn Goltz
*/
public class CommonDataFixture extends CommonFixture {
- private static final int DEFAULT_NUMBER_OF_COLLECTIONS = 3;
-
- private OpenApi3 apiModel;
-
- private List requirementClasses;
-
- protected int noOfCollections = DEFAULT_NUMBER_OF_COLLECTIONS;
-
- @BeforeClass
- public void requirementClasses( ITestContext testContext ) {
- this.requirementClasses = (List) testContext.getSuite().getAttribute( REQUIREMENTCLASSES.getName() );
- }
-
- @BeforeClass
- public void noOfCollections( ITestContext testContext ) {
- Object noOfCollections = testContext.getSuite().getAttribute( NO_OF_COLLECTIONS.getName() );
- if ( noOfCollections != null ) {
- this.noOfCollections = (Integer) noOfCollections;
- }
- }
-
- @BeforeClass
- public void retrieveApiModel( ITestContext testContext ) {
- this.apiModel = (OpenApi3) testContext.getSuite().getAttribute( API_MODEL.getName() );
- }
-
- public OpenApi3 getApiModel() {
- if ( apiModel == null )
- throw new SkipException( "ApiModel is not available." );
- return apiModel;
- }
-
- protected List createListOfMediaTypesToSupportForOtherResources( Map linkToSelf ) {
- if ( this.requirementClasses == null )
- throw new SkipException( "No requirement classes described in resource /conformance available" );
- List mediaTypesToSupport = new ArrayList<>();
- for ( RequirementClass requirementClass : this.requirementClasses )
- if ( requirementClass.hasMediaTypeForOtherResources() )
- mediaTypesToSupport.add( requirementClass.getMediaTypeOtherResources() );
- if ( linkToSelf != null )
- mediaTypesToSupport.remove( linkToSelf.get( "type" ) );
- return mediaTypesToSupport;
- }
-
- protected List createListOfMediaTypesToSupportForFeatureCollectionsAndFeatures() {
- if ( this.requirementClasses == null )
- throw new SkipException( "No requirement classes described in resource /conformance available" );
- List mediaTypesToSupport = new ArrayList<>();
- for ( RequirementClass requirementClass : this.requirementClasses )
- if ( requirementClass.hasMediaTypeForFeaturesAndCollections() )
- mediaTypesToSupport.add( requirementClass.getMediaTypeFeaturesAndCollections() );
- return mediaTypesToSupport;
- }
-
- protected List createListOfMediaTypesToSupportForFeatureCollectionsAndFeatures( Map linkToSelf ) {
- List mediaTypesToSupport = createListOfMediaTypesToSupportForFeatureCollectionsAndFeatures();
- if ( linkToSelf != null )
- mediaTypesToSupport.remove( linkToSelf.get( "type" ) );
- return mediaTypesToSupport;
- }
+ private static final int DEFAULT_NUMBER_OF_COLLECTIONS = 3;
+
+ private OpenApi3 apiModel;
+
+ private List requirementClasses;
+
+ protected int noOfCollections = DEFAULT_NUMBER_OF_COLLECTIONS;
+
+ /**
+ *
+ * @param linkToSelf a {@link java.util.Map} object
+ * @return a {@link java.util.List} object
+ */
+ protected List createListOfMediaTypesToSupportForFeatureCollectionsAndFeatures(
+ Map linkToSelf) {
+ List mediaTypesToSupport = createListOfMediaTypesToSupportForFeatureCollectionsAndFeatures();
+ if (linkToSelf != null)
+ mediaTypesToSupport.remove(linkToSelf.get("type"));
+ return mediaTypesToSupport;
+ }
+
}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/CommonFixture.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/CommonFixture.java
index 5161b960..23d199a3 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/CommonFixture.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/CommonFixture.java
@@ -22,84 +22,108 @@
import io.restassured.specification.RequestSpecification;
/**
- * A supporting base class that sets up a common test fixture. These configuration methods are invoked before those
- * defined in a subclass.
+ * A supporting base class that sets up a common test fixture. These configuration methods
+ * are invoked before those defined in a subclass.
*/
public class CommonFixture {
- private ByteArrayOutputStream requestOutputStream = new ByteArrayOutputStream();
-
- private ByteArrayOutputStream responseOutputStream = new ByteArrayOutputStream();
-
- protected RequestLoggingFilter requestLoggingFilter;
-
- protected ResponseLoggingFilter responseLoggingFilter;
-
- protected URI rootUri;
-
- /**
- * Initializes the common test fixture with a client component for interacting with HTTP endpoints.
- *
- * @param testContext
- * The test context that contains all the information for a test run, including suite attributes.
- */
- @BeforeClass
- public void initCommonFixture( ITestContext testContext ) {
- initLogging();
- rootUri = (URI) testContext.getSuite().getAttribute( SuiteAttribute.IUT.getName() );
- }
-
- @BeforeMethod
- public void clearMessages() {
- initLogging();
- }
-
- public String getRequest() {
- return requestOutputStream.toString();
- }
-
- public String getResponse() {
- return responseOutputStream.toString();
- }
-
- protected RequestSpecification init() {
- JsonConfig jsonConfig = JsonConfig.jsonConfig().numberReturnType(NumberReturnType.DOUBLE);
- RestAssuredConfig config = RestAssuredConfig.newConfig().jsonConfig(jsonConfig) ;
- return given().filters( new RequestLimitFilter(), requestLoggingFilter, responseLoggingFilter ).log().all().with().config(config);
- }
-
- /**
- * Obtains the (XML) response entity as a DOM Document. This convenience method wraps a static method call to
- * facilitate unit testing (Mockito workaround).
- *
- * @param response
- * A representation of an HTTP response message.
- * @param targetURI
- * The target URI from which the entity was retrieved (may be null).
- * @return A Document representing the entity.
- *
- * @see ClientUtils#getResponseEntityAsDocument public Document getResponseEntityAsDocument( ClientResponse
- * response, String targetURI ) { return ClientUtils.getResponseEntityAsDocument( response, targetURI ); }
- */
-
- /**
- * Builds an HTTP request message that uses the GET method. This convenience method wraps a static method call to
- * facilitate unit testing (Mockito workaround).
- *
- * @return A ClientRequest object.
- *
- * @see ClientUtils#buildGetRequest public ClientRequest buildGetRequest( URI endpoint, Map
- * qryParams, MediaType... mediaTypes ) { return ClientUtils.buildGetRequest( endpoint, qryParams, mediaTypes
- * ); }
- */
-
- private void initLogging() {
- this.requestOutputStream = new ByteArrayOutputStream();
- this.responseOutputStream = new ByteArrayOutputStream();
- PrintStream requestPrintStream = new PrintStream( requestOutputStream, true );
- PrintStream responsePrintStream = new PrintStream( responseOutputStream, true );
- requestLoggingFilter = new RequestLoggingFilter( requestPrintStream );
- responseLoggingFilter = new ResponseLoggingFilter( responsePrintStream );
- }
-
-}
\ No newline at end of file
+ private ByteArrayOutputStream requestOutputStream = new ByteArrayOutputStream();
+
+ private ByteArrayOutputStream responseOutputStream = new ByteArrayOutputStream();
+
+ protected RequestLoggingFilter requestLoggingFilter;
+
+ protected ResponseLoggingFilter responseLoggingFilter;
+
+ protected URI rootUri;
+
+ /**
+ * Initializes the common test fixture with a client component for interacting with
+ * HTTP endpoints.
+ * @param testContext The test context that contains all the information for a test
+ * run, including suite attributes.
+ */
+ @BeforeClass
+ public void initCommonFixture(ITestContext testContext) {
+ initLogging();
+ rootUri = (URI) testContext.getSuite().getAttribute(SuiteAttribute.IUT.getName());
+ }
+
+ /**
+ *
+ * @return a {@link io.restassured.specification.RequestSpecification} object
+ */
+ protected RequestSpecification init() {
+ JsonConfig jsonConfig = JsonConfig.jsonConfig().numberReturnType(NumberReturnType.DOUBLE);
+ RestAssuredConfig config = RestAssuredConfig.newConfig().jsonConfig(jsonConfig);
+ return given().filters(new RequestLimitFilter(), requestLoggingFilter, responseLoggingFilter)
+ .log()
+ .all()
+ .with()
+ .config(config);
+ }
+
+ /**
+ * Obtains the (XML) response entity as a DOM Document. This convenience method wraps
+ * a static method call to facilitate unit testing (Mockito workaround).
+ * @param response A representation of an HTTP response message.
+ * @param targetURI The target URI from which the entity was retrieved (may be null).
+ * @return A Document representing the entity.
+ *
+ * @see ClientUtils#getResponseEntityAsDocument public Document
+ * getResponseEntityAsDocument( ClientResponse response, String targetURI ) { return
+ * ClientUtils.getResponseEntityAsDocument( response, targetURI ); }
+ */
+
+ /**
+ * Builds an HTTP request message that uses the GET method. This convenience method
+ * wraps a static method call to facilitate unit testing (Mockito workaround).
+ * @return A ClientRequest object.
+ *
+ * @see ClientUtils#buildGetRequest public ClientRequest buildGetRequest( URI
+ * endpoint, Map qryParams, MediaType... mediaTypes ) { return
+ * ClientUtils.buildGetRequest( endpoint, qryParams, mediaTypes ); }
+ */
+
+ private void initLogging() {
+ this.requestOutputStream = new ByteArrayOutputStream();
+ this.responseOutputStream = new ByteArrayOutputStream();
+ PrintStream requestPrintStream = new PrintStream(requestOutputStream, true);
+ PrintStream responsePrintStream = new PrintStream(responseOutputStream, true);
+ requestLoggingFilter = new RequestLoggingFilter(requestPrintStream);
+ responseLoggingFilter = new ResponseLoggingFilter(responsePrintStream);
+ }
+
+}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/RequirementClass.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/RequirementClass.java
index ef063943..746fe089 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/RequirementClass.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/RequirementClass.java
@@ -8,81 +8,97 @@
*/
public enum RequirementClass {
- CORE( "http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/core" ),
-
- HTML( "http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/html", "text/html", "text/html" ),
-
- GEOJSON( "http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/geojson", "application/geo+json", "application/json" ),
-
- GMLSF0( "http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/gmlsf0",
- "application/gml+xml;version=3.2;profile=http://www.opengis.net/def/profile/ogc/2.0/gml-sf0",
- "application/xml" ),
-
- GMLSF2( "http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/gmlsf2",
- "application/gml+xml;version=3.2;profile=http://www.opengis.net/def/profile/ogc/2.0/gml-sf2",
- "application/xml" ),
-
- OPENAPI30( "http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/oas30" ),
-
- CRS( "http://www.opengis.net/spec/ogcapi-features-2/1.0/conf/crs" );
-
- private final String conformanceClass;
-
- private final String mediaTypeFeaturesAndCollections;
-
- private final String mediaTypeOtherResources;
-
- RequirementClass( String conformanceClass ) {
- this( conformanceClass, null, null );
- }
-
- RequirementClass( String conformanceClass, String mediaTypeFeaturesAndCollections, String mediaTypeOtherResources ) {
- this.conformanceClass = conformanceClass;
- this.mediaTypeFeaturesAndCollections = mediaTypeFeaturesAndCollections;
- this.mediaTypeOtherResources = mediaTypeOtherResources;
- }
-
- /**
- * @return true if the RequirementClass has a media type for features and collections,
- * true otherwise
- */
- public boolean hasMediaTypeForFeaturesAndCollections() {
- return mediaTypeFeaturesAndCollections != null;
- }
-
- /**
- * @return media type for features and collections, null if not available
- */
- public String getMediaTypeFeaturesAndCollections() {
- return mediaTypeFeaturesAndCollections;
- }
-
- /**
- * @return true if the RequirementClass has a media type for other resources,
- * true otherwise
- */
- public boolean hasMediaTypeForOtherResources() {
- return mediaTypeOtherResources != null;
- }
-
- /**
- * @return media type of other resources, null if not available
- */
- public String getMediaTypeOtherResources() {
- return mediaTypeOtherResources;
- }
-
- /**
- * @param conformanceClass
- * the conformance class of the RequirementClass to return.
- * @return the RequirementClass with the passed conformance class, null if RequirementClass exists
- */
- public static RequirementClass byConformanceClass( String conformanceClass ) {
- for ( RequirementClass requirementClass : values() ) {
- if ( requirementClass.conformanceClass.equals( conformanceClass ) )
- return requirementClass;
- }
- return null;
- }
-
-}
\ No newline at end of file
+ CORE("http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/core"),
+
+ HTML("http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/html", "text/html", "text/html"),
+
+ GEOJSON("http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/geojson", "application/geo+json",
+ "application/json"),
+
+ GMLSF0("http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/gmlsf0",
+ "application/gml+xml;version=3.2;profile=http://www.opengis.net/def/profile/ogc/2.0/gml-sf0",
+ "application/xml"),
+
+ GMLSF2("http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/gmlsf2",
+ "application/gml+xml;version=3.2;profile=http://www.opengis.net/def/profile/ogc/2.0/gml-sf2",
+ "application/xml"),
+
+ OPENAPI30("http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/oas30"),
+
+ CRS("http://www.opengis.net/spec/ogcapi-features-2/1.0/conf/crs");
+
+ private final String conformanceClass;
+
+ private final String mediaTypeFeaturesAndCollections;
+
+ private final String mediaTypeOtherResources;
+
+ RequirementClass(String conformanceClass) {
+ this(conformanceClass, null, null);
+ }
+
+ RequirementClass(String conformanceClass, String mediaTypeFeaturesAndCollections, String mediaTypeOtherResources) {
+ this.conformanceClass = conformanceClass;
+ this.mediaTypeFeaturesAndCollections = mediaTypeFeaturesAndCollections;
+ this.mediaTypeOtherResources = mediaTypeOtherResources;
+ }
+
+ /**
+ *
+ * hasMediaTypeForFeaturesAndCollections.
+ *
+ * @return true if the RequirementClass has a media type for features and
+ * collections, true otherwise
+ */
+ public boolean hasMediaTypeForFeaturesAndCollections() {
+ return mediaTypeFeaturesAndCollections != null;
+ }
+
+ /**
+ *
+ * Getter for the field mediaTypeFeaturesAndCollections.
+ *
+ * @return media type for features and collections, null if not available
+ */
+ public String getMediaTypeFeaturesAndCollections() {
+ return mediaTypeFeaturesAndCollections;
+ }
+
+ /**
+ *
+ * hasMediaTypeForOtherResources.
+ *
+ * @return true if the RequirementClass has a media type for other
+ * resources, true otherwise
+ */
+ public boolean hasMediaTypeForOtherResources() {
+ return mediaTypeOtherResources != null;
+ }
+
+ /**
+ *
+ * Getter for the field mediaTypeOtherResources.
+ *
+ * @return media type of other resources, null if not available
+ */
+ public String getMediaTypeOtherResources() {
+ return mediaTypeOtherResources;
+ }
+
+ /**
+ *
+ * byConformanceClass.
+ *
+ * @param conformanceClass the conformance class of the RequirementClass to return.
+ * @return the RequirementClass with the passed conformance class, null
+ * if RequirementClass exists
+ */
+ public static RequirementClass byConformanceClass(String conformanceClass) {
+ for (RequirementClass requirementClass : values()) {
+ if (requirementClass.conformanceClass.equals(conformanceClass))
+ return requirementClass;
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/SuiteAttribute.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/SuiteAttribute.java
index a6f36957..d738ae49 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/SuiteAttribute.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/SuiteAttribute.java
@@ -6,95 +6,115 @@
import java.util.Map;
import com.reprezen.kaizen.oasparser.model3.OpenApi3;
-import com.sun.jersey.api.client.Client;
+
+import jakarta.ws.rs.client.Client;
/**
- * An enumerated type defining ISuite attributes that may be set to constitute a shared test fixture.
+ * An enumerated type defining ISuite attributes that may be set to constitute a shared
+ * test fixture.
*/
@SuppressWarnings("rawtypes")
public enum SuiteAttribute {
- /**
- * A client component for interacting with HTTP endpoints.
- */
- CLIENT( "httpClient", Client.class ),
-
- /**
- * The root URL.
- */
- IUT( "instanceUnderTest", URI.class ),
-
- /**
- * A File containing the test subject or a description of it.
- */
- TEST_SUBJ_FILE( "testSubjectFile", File.class ),
-
- /**
- * The number of collections to test.
- */
- NO_OF_COLLECTIONS( "noOfCollections", Integer.class ),
-
- /**
- * Parsed OpenApi3 document resource /api; Added during execution.
- */
- API_MODEL( "apiModel", OpenApi3.class ),
-
- /**
- * Requirement classes parsed from /conformance; Added during execution.
- */
- REQUIREMENTCLASSES( "requirementclasses", List.class ),
-
- /**
- * Response of resource /collections; Added during execution.
- */
- COLLECTIONS_RESPONSE( "collectionsResponse", Map.class ),
-
- /**
- * Parsed collections from resource /collections; Added during execution.
- */
- COLLECTIONS( "collections", List.class ),
-
- /**
- * collectionId mapped to response of resource /collection/{collectionId}; Added during execution.
- */
- COLLECTION_BY_ID( "collectionById", Map.class ),
-
- /**
- * collectionId mapped to parsed CRSs of resource /collection/{collectionId}; Added during execution.
- */
- COLLECTION_CRS_BY_ID( "collectionCrsById", Map.class ),
-
- /**
- * collectionId mapped to parsed default CRS of resource /collection/{collectionId}; Added during execution.
- */
- COLLECTION_DEFAULT_CRS_BY_ID( "collectionDefaultCrsById", Map.class ),
-
- /**
- * Collection names assigned to a feature id parsed from resource /collections/{name}/items; Added during execution.
- */
- FEATUREIDS( "featureIds", Map.class );
-
- private final Class attrType;
-
- private final String attrName;
-
- SuiteAttribute( String attrName, Class attrType ) {
- this.attrName = attrName;
- this.attrType = attrType;
- }
-
- public Class getType() {
- return attrType;
- }
-
- public String getName() {
- return attrName;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder( attrName );
- sb.append( '(' ).append( attrType.getName() ).append( ')' );
- return sb.toString();
- }
+ /**
+ * A client component for interacting with HTTP endpoints.
+ */
+ CLIENT("httpClient", Client.class),
+
+ /**
+ * The root URL.
+ */
+ IUT("instanceUnderTest", URI.class),
+
+ /**
+ * A File containing the test subject or a description of it.
+ */
+ TEST_SUBJ_FILE("testSubjectFile", File.class),
+
+ /**
+ * The number of collections to test.
+ */
+ NO_OF_COLLECTIONS("noOfCollections", Integer.class),
+
+ /**
+ * Parsed OpenApi3 document resource /api; Added during execution.
+ */
+ API_MODEL("apiModel", OpenApi3.class),
+
+ /**
+ * Requirement classes parsed from /conformance; Added during execution.
+ */
+ REQUIREMENTCLASSES("requirementclasses", List.class),
+
+ /**
+ * Response of resource /collections; Added during execution.
+ */
+ COLLECTIONS_RESPONSE("collectionsResponse", Map.class),
+
+ /**
+ * Parsed collections from resource /collections; Added during execution.
+ */
+ COLLECTIONS("collections", List.class),
+
+ /**
+ * collectionId mapped to response of resource /collection/{collectionId}; Added
+ * during execution.
+ */
+ COLLECTION_BY_ID("collectionById", Map.class),
+
+ /**
+ * collectionId mapped to parsed CRSs of resource /collection/{collectionId}; Added
+ * during execution.
+ */
+ COLLECTION_CRS_BY_ID("collectionCrsById", Map.class),
+
+ /**
+ * collectionId mapped to parsed default CRS of resource /collection/{collectionId};
+ * Added during execution.
+ */
+ COLLECTION_DEFAULT_CRS_BY_ID("collectionDefaultCrsById", Map.class),
+
+ /**
+ * Collection names assigned to a feature id parsed from resource
+ * /collections/{name}/items; Added during execution.
+ */
+ FEATUREIDS("featureIds", Map.class);
+
+ private final Class attrType;
+
+ private final String attrName;
+
+ SuiteAttribute(String attrName, Class attrType) {
+ this.attrName = attrName;
+ this.attrType = attrType;
+ }
+
+ /**
+ *
+ * getType.
+ *
+ * @return a {@link java.lang.Class} object
+ */
+ public Class getType() {
+ return attrType;
+ }
+
+ /**
+ *
+ * getName.
+ *
+ * @return a {@link java.lang.String} object
+ */
+ public String getName() {
+ return attrName;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(attrName);
+ sb.append('(').append(attrType.getName()).append(')');
+ return sb.toString();
+ }
+
}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/SuitePreconditions.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/SuitePreconditions.java
index f8ab6d06..8da2ff30 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/SuitePreconditions.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/SuitePreconditions.java
@@ -4,36 +4,38 @@
import java.util.logging.Logger;
import org.testng.ITestContext;
+import org.testng.Reporter;
import org.testng.annotations.BeforeSuite;
/**
- * Checks that various preconditions are satisfied before the test suite is run.
- * If any of these (BeforeSuite) methods fail, all tests will be skipped.
+ * Checks that various preconditions are satisfied before the test suite is run. If any of
+ * these (BeforeSuite) methods fail, all tests will be skipped.
*/
public class SuitePreconditions {
- private static final Logger LOGR = Logger.getLogger(SuitePreconditions.class.getName());
+ private static final Logger LOGR = Logger.getLogger(SuitePreconditions.class.getName());
+
+ /**
+ * Verifies that the referenced test subject exists and has the expected type.
+ */
+ @BeforeSuite
+ @SuppressWarnings("rawtypes")
+ public void verifyTestSubject() {
+ // ITestcontext was removed from the BeforeSuite annotation, see here:
+ // https://github.com/testng-team/testng/issues/3032
+ ITestContext testContext = Reporter.getCurrentTestResult().getTestContext();
+ SuiteAttribute testFileAttr = SuiteAttribute.TEST_SUBJ_FILE;
+ Object sutObj = testContext.getSuite().getAttribute(testFileAttr.getName());
+ Class expectedType = testFileAttr.getType();
+ if (null != sutObj && expectedType.isInstance(sutObj)) {
+ // TODO: Verify test subject
+ }
+ else {
+ String msg = String.format("Value of test suite attribute '%s' is missing or is not an instance of %s",
+ testFileAttr.getName(), expectedType.getName());
+ LOGR.log(Level.SEVERE, msg);
+ throw new AssertionError(msg);
+ }
+ }
- /**
- * Verifies that the referenced test subject exists and has the expected
- * type.
- *
- * @param testContext
- * Information about the (pending) test run.
- */
- @BeforeSuite
- @SuppressWarnings("rawtypes")
- public void verifyTestSubject(ITestContext testContext) {
- SuiteAttribute testFileAttr = SuiteAttribute.TEST_SUBJ_FILE;
- Object sutObj = testContext.getSuite().getAttribute(testFileAttr.getName());
- Class expectedType = testFileAttr.getType();
- if (null != sutObj && expectedType.isInstance(sutObj)) {
- // TODO: Verify test subject
- } else {
- String msg = String.format("Value of test suite attribute '%s' is missing or is not an instance of %s",
- testFileAttr.getName(), expectedType.getName());
- LOGR.log(Level.SEVERE, msg);
- throw new AssertionError(msg);
- }
- }
}
diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/core/apidefinition/ApiDefinition.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/core/apidefinition/ApiDefinition.java
index 10c37fa1..371796fa 100644
--- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/core/apidefinition/ApiDefinition.java
+++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/core/apidefinition/ApiDefinition.java
@@ -30,100 +30,103 @@
*/
public class ApiDefinition extends CommonFixture {
- private String response;
-
- private String apiUrl;
-
- @BeforeClass(dependsOnMethods = "initCommonFixture")
- public void retrieveApiUrl() {
- Response request = init().baseUri( rootUri.toString() ).accept( JSON ).when().request( GET );
- JsonPath jsonPath = request.jsonPath();
-
- this.apiUrl = parseApiUrl( jsonPath );
- }
-
- /**
- *
- * Abstract Test 5: /ats/core/api-definition-op
- * Test Purpose: Validate that the API Definition document can be retrieved from the expected location.
- * Requirement: /req/core/api-definition-op
- *
- * Test Method
- *
- * 1. Construct a path for each API Definition link on the landing page
- * 2. Issue a HTTP GET request on each path
- * 3. Validate that a document was returned with a status code 200
- * 4. Validate the contents of the returned document using test /ats/core/api-definition-success.
- *
- */
- @Test(description = "Implements A.2.3. API Definition Path {root}/api (link), Abstract Test 5 (Requirement /req/core/api-definition-op)", groups = "apidefinition", dependsOnGroups = "landingpage")
- public void openapiDocumentRetrieval() {
- if ( apiUrl == null || apiUrl.isEmpty() )
- throw new AssertionError( "Path to the API Definition could not be constructed from the landing page" );
- Response request = init().baseUri( apiUrl ).accept( OPEN_API_MIME_TYPE ).when().request( GET );
- request.then().statusCode( 200 );
- response = request.asString();
- }
-
- /**
- *
- * Abstract Test 6: /ats/core/api-definition-success
- * Test Purpose: Validate that the API Definition complies with the required structure and contents.
- * Requirement: /req/core/api-definition-success
- *
- * Test Method: Validate the API Definition document against an appropriate schema document.
- *
+ * Abstract Test 5: /ats/core/api-definition-op
+ * Test Purpose: Validate that the API Definition document can be retrieved from the expected location.
+ * Requirement: /req/core/api-definition-op
+ *
+ * Test Method
+ *
+ * 1. Construct a path for each API Definition link on the landing page
+ * 2. Issue a HTTP GET request on each path
+ * 3. Validate that a document was returned with a status code 200
+ * 4. Validate the contents of the returned document using test /ats/core/api-definition-success.
+ *
+ */
+ @Test(description = "Implements A.2.3. API Definition Path {root}/api (link), Abstract Test 5 (Requirement /req/core/api-definition-op)",
+ groups = "apidefinition", dependsOnGroups = "landingpage")
+ public void openapiDocumentRetrieval() {
+ if (apiUrl == null || apiUrl.isEmpty())
+ throw new AssertionError("Path to the API Definition could not be constructed from the landing page");
+ Response request = init().baseUri(apiUrl).accept(OPEN_API_MIME_TYPE).when().request(GET);
+ request.then().statusCode(200);
+ response = request.asString();
+ }
+
+ /**
+ *
+ * Abstract Test 6: /ats/core/api-definition-success
+ * Test Purpose: Validate that the API Definition complies with the required structure and contents.
+ * Requirement: /req/core/api-definition-success
+ *
+ * Test Method: Validate the API Definition document against an appropriate schema document.
+ *
+ *
* @author Lyn Goltz
*/
public class AbstractFeatures extends CommonDataFixture {
- protected final Map collectionIdAndResponse = new HashMap<>();
-
- protected List