diff --git a/src/main/java/org/opengis/cite/wfs30/CommonDataFixture.java b/src/main/java/org/opengis/cite/wfs30/CommonDataFixture.java
new file mode 100644
index 00000000..98bdc712
--- /dev/null
+++ b/src/main/java/org/opengis/cite/wfs30/CommonDataFixture.java
@@ -0,0 +1,55 @@
+package org.opengis.cite.wfs30;
+
+import static org.opengis.cite.wfs30.SuiteAttribute.REQUIREMENTCLASSES;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.opengis.cite.wfs30.conformance.RequirementClass;
+import org.testng.ITestContext;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeClass;
+
+/**
+ * @author Lyn Goltz
+ */
+public class CommonDataFixture extends CommonFixture {
+
+ private List requirementClasses;
+
+ @BeforeClass
+ public void requirementClasses( ITestContext testContext ) {
+ this.requirementClasses = (List) testContext.getSuite().getAttribute( REQUIREMENTCLASSES.getName() );
+ }
+
+ 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;
+ }
+
+}
diff --git a/src/main/java/org/opengis/cite/wfs30/SuiteAttribute.java b/src/main/java/org/opengis/cite/wfs30/SuiteAttribute.java
index 56bcfaa8..86d33120 100644
--- a/src/main/java/org/opengis/cite/wfs30/SuiteAttribute.java
+++ b/src/main/java/org/opengis/cite/wfs30/SuiteAttribute.java
@@ -34,6 +34,11 @@ public enum SuiteAttribute {
*/
API_MODEL( "apiModel", OpenApi3.class ),
+ /**
+ * Requirement classes parsed from /conformance; Added during execution.
+ */
+ REQUIREMENTCLASSES( "requirementclasses", List.class ),
+
/**
* Parsed collections from resource /collections; Added during execution.
*/
diff --git a/src/main/java/org/opengis/cite/wfs30/collections/FeatureCollectionsMetadataOperation.java b/src/main/java/org/opengis/cite/wfs30/collections/FeatureCollectionsMetadataOperation.java
index 3e35dbd5..dc145544 100644
--- a/src/main/java/org/opengis/cite/wfs30/collections/FeatureCollectionsMetadataOperation.java
+++ b/src/main/java/org/opengis/cite/wfs30/collections/FeatureCollectionsMetadataOperation.java
@@ -5,6 +5,7 @@
import static org.opengis.cite.wfs30.SuiteAttribute.API_MODEL;
import static org.opengis.cite.wfs30.WFS3.PATH.COLLECTIONS;
import static org.opengis.cite.wfs30.openapi3.OpenApiUtils.retrieveTestPoints;
+import static org.opengis.cite.wfs30.openapi3.OpenApiUtils.retrieveTestPointsForCollectionMetadata;
import static org.opengis.cite.wfs30.util.JsonUtils.findLinkByRel;
import static org.opengis.cite.wfs30.util.JsonUtils.findLinksWithSupportedMediaTypeByRel;
import static org.opengis.cite.wfs30.util.JsonUtils.findLinksWithoutRelOrType;
@@ -19,10 +20,10 @@
import java.util.List;
import java.util.Map;
-import org.opengis.cite.wfs30.CommonFixture;
+import org.opengis.cite.wfs30.CommonDataFixture;
import org.opengis.cite.wfs30.SuiteAttribute;
-import org.opengis.cite.wfs30.openapi3.OpenApiUtils;
import org.opengis.cite.wfs30.openapi3.TestPoint;
+import org.opengis.cite.wfs30.openapi3.UriBuilder;
import org.testng.ITestContext;
import org.testng.SkipException;
import org.testng.annotations.AfterClass;
@@ -30,7 +31,6 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import com.reprezen.kaizen.oasparser.model3.MediaType;
import com.reprezen.kaizen.oasparser.model3.OpenApi3;
import io.restassured.path.json.JsonPath;
@@ -39,14 +39,12 @@
/**
* @author Lyn Goltz
*/
-public class FeatureCollectionsMetadataOperation extends CommonFixture {
+public class FeatureCollectionsMetadataOperation extends CommonDataFixture {
private final Map testPointAndResponses = new HashMap<>();
private final Map>> testPointAndCollections = new HashMap<>();
- private final List collectionNamesFromLandingPage = new ArrayList<>();
-
private OpenApi3 apiModel;
private Object[][] testPointsData;
@@ -75,19 +73,6 @@ public Object[][] collections( ITestContext testContext ) {
return objects;
}
- @BeforeClass
- public void parseRequiredMetadata( ITestContext testContext ) {
- Response request = init().baseUri( rootUri.toString() ).accept( JSON ).when().request( GET, "/" );
- JsonPath jsonPath = request.jsonPath();
-
- List