From 99f1565a5af64235a78721c235f8da8f476f8632 Mon Sep 17 00:00:00 2001 From: Lyn Elisa Goltz Date: Mon, 13 Aug 2018 11:32:32 +0200 Subject: [PATCH] #30 - removed assert from test validateFeatureCollectionsMetadataOperationResponse_Collections as it collects the collections --- .../FeatureCollectionsMetadataOperation.java | 41 +------------------ ...FeatureCollectionsMetadataOperationIT.java | 1 - 2 files changed, 2 insertions(+), 40 deletions(-) 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..3dbee72c 100644 --- a/src/main/java/org/opengis/cite/wfs30/collections/FeatureCollectionsMetadataOperation.java +++ b/src/main/java/org/opengis/cite/wfs30/collections/FeatureCollectionsMetadataOperation.java @@ -45,8 +45,6 @@ public class FeatureCollectionsMetadataOperation extends CommonFixture { 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 collections = jsonPath.getList( "collections" ); - for ( Object collectionObject : collections ) { - Map collection = (Map) collectionObject; - String collectionName = (String) collection.get( "name" ); - this.collectionNamesFromLandingPage.add( collectionName ); - } - } - @BeforeClass public void openApiDocument( ITestContext testContext ) { this.apiModel = (OpenApi3) testContext.getSuite().getAttribute( API_MODEL.getName() ); @@ -201,10 +186,8 @@ public void validateFeatureCollectionsMetadataOperationResponse_Collections( Tes JsonPath jsonPath = response.jsonPath(); List collections = jsonPath.getList( "collections" ); - List missingCollectionNames = findMissingCollectionNames( collections ); - assertTrue( missingCollectionNames.isEmpty(), - "Feature Collection Metadata document must include a collections property for each collection in the dataset. Missing collection properties " - + missingCollectionNames ); + // Test method cannot be verified as the provided collections are not known. + this.testPointAndCollections.put( testPoint, createCollectionsMap( collections ) ); } @@ -356,26 +339,6 @@ private void validateFeatureCollectionMetadataOperationResponse( Response respon assertEquals( collection, jsonPath.get() ); } - private List findMissingCollectionNames( List collections ) { - List missingCollectionNames = new ArrayList<>(); - for ( String collectionNameFromLandingPage : this.collectionNamesFromLandingPage ) { - Map collection = findCollectionByName( collectionNameFromLandingPage, collections ); - if ( collection == null ) - missingCollectionNames.add( collectionNameFromLandingPage ); - } - return missingCollectionNames; - } - - private Map findCollectionByName( String collectionNameFromLandingPage, List collections ) { - for ( Object collectionObject : collections ) { - Map collection = (Map) collectionObject; - Object collectionName = collection.get( "name" ); - if ( collectionNameFromLandingPage.equals( collectionName ) ) - return collection; - } - return null; - } - private List> createCollectionsMap( List collections ) { List> collectionsMap = new ArrayList<>(); for ( Object collection : collections ) diff --git a/src/test/java/org/opengis/cite/wfs30/collections/FeatureCollectionsMetadataOperationIT.java b/src/test/java/org/opengis/cite/wfs30/collections/FeatureCollectionsMetadataOperationIT.java index 5cc57821..469589cf 100644 --- a/src/test/java/org/opengis/cite/wfs30/collections/FeatureCollectionsMetadataOperationIT.java +++ b/src/test/java/org/opengis/cite/wfs30/collections/FeatureCollectionsMetadataOperationIT.java @@ -50,7 +50,6 @@ public static void initTestFixture() public void testValidateFeatureCollectionsMetadataOperationResponse() { FeatureCollectionsMetadataOperation featureCollectionsMetadataOperation = new FeatureCollectionsMetadataOperation(); featureCollectionsMetadataOperation.initCommonFixture( testContext ); - featureCollectionsMetadataOperation.parseRequiredMetadata( testContext ); featureCollectionsMetadataOperation.openApiDocument( testContext ); UriTemplate conformanceUri = new UriTemplate( "https://www.ldproxy.nrw.de/kataster/collections" ); TestPoint testPoint = new TestPoint( conformanceUri, mediaTypes() );