From bbfc0dfc28a73836ce70e8703fcae485443a3203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Pro=C3=9F?= Date: Wed, 26 Apr 2023 16:19:22 +0200 Subject: [PATCH 1/2] Add try catch blocks and checks for null values --- .../AbstractDiscoveryCollection.java | 10 ++-- .../collection/DiscoveryCollectionCrsUri.java | 44 ++++++++++------ .../crs/query/bboxcrs/BBoxCrsParameter.java | 44 ++++++++++------ .../query/crs/feature/AbstractFeatureCrs.java | 18 ++++--- .../crs/feature/FeatureCrsParameter.java | 21 +++++--- .../feature/FeatureCrsParameterDefault.java | 3 ++ .../feature/FeatureCrsParameterInvalid.java | 3 ++ .../feature/FeatureCrsParameterTransform.java | 26 +++++++--- .../crs/features/AbstractFeaturesCrs.java | 52 ++++++++++++------- .../crs/features/FeaturesCrsParameter.java | 3 ++ .../features/FeaturesCrsParameterDefault.java | 3 ++ .../features/FeaturesCrsParameterInvalid.java | 3 ++ .../FeaturesCrsParameterTransform.java | 6 +++ 13 files changed, 161 insertions(+), 75 deletions(-) diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/AbstractDiscoveryCollection.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/AbstractDiscoveryCollection.java index 79bb5d56..bd33a1d4 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/AbstractDiscoveryCollection.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/AbstractDiscoveryCollection.java @@ -20,9 +20,13 @@ public Iterator collectionIdAndJson( ITestContext testContext ) { Map collectionsResponses = (Map) testContext.getSuite().getAttribute( SuiteAttribute.COLLECTION_BY_ID.getName() ); List collectionsData = new ArrayList<>(); - for ( Map.Entry collection : collectionsResponses.entrySet() ) { - collectionsData.add( new Object[] { collection.getKey(), collection.getValue() } ); - } + try { + for ( Map.Entry collection : collectionsResponses.entrySet() ) { + collectionsData.add( new Object[] { collection.getKey(), collection.getValue() } ); + } + } catch (Exception e) { + collectionsData.add( new Object[] { null, null } ); + } return collectionsData.iterator(); } diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/DiscoveryCollectionCrsUri.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/DiscoveryCollectionCrsUri.java index 82921f7b..c27b6b18 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/DiscoveryCollectionCrsUri.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/DiscoveryCollectionCrsUri.java @@ -42,27 +42,35 @@ public class DiscoveryCollectionCrsUri { private Map> collectionIdAndValidCrs = new HashMap<>(); @DataProvider(name = "collectionIdAndJsonAndCrs") - public Iterator collectionIdAndJsonAndCrs( ITestContext testContext ) { - Map collectionsResponses = (Map) testContext.getSuite().getAttribute( SuiteAttribute.COLLECTION_BY_ID.getName() ); - List collectionsData = new ArrayList<>(); - for ( Map.Entry collection : collectionsResponses.entrySet() ) { - List crs = parseCrs( collection.getValue() ); - for ( CoordinateSystem coordinateSystem : crs ) { - collectionsData.add( new Object[] { collection.getKey(), coordinateSystem } ); + public Iterator collectionIdAndJsonAndCrs( ITestContext testContext ) throws AssertionError { + List collectionsData = new ArrayList<>(); + try { + Map collectionsResponses = (Map) testContext.getSuite().getAttribute( SuiteAttribute.COLLECTION_BY_ID.getName() ); + for ( Map.Entry collection : collectionsResponses.entrySet() ) { + List crs = parseCrs( collection.getValue() ); + for ( CoordinateSystem coordinateSystem : crs ) { + collectionsData.add( new Object[] { collection.getKey(), coordinateSystem } ); + } } - } + } catch (Exception e) { + collectionsData.add( new Object[] { null, null } ); + } return collectionsData.iterator(); } @DataProvider(name = "collectionIdAndJsonAndStorageCrs") public Iterator collectionIdAndJsonAndStorageCrs( ITestContext testContext ) { - Map collectionsResponses = (Map) testContext.getSuite().getAttribute( SuiteAttribute.COLLECTION_BY_ID.getName() ); - List collectionsData = new ArrayList<>(); - for ( Map.Entry collection : collectionsResponses.entrySet() ) { - CoordinateSystem storageCrs = parseStorageCrs( collection.getValue() ); - if ( storageCrs != null ) - collectionsData.add( new Object[] { collection.getKey(), storageCrs } ); - } + List collectionsData = new ArrayList<>(); + try { + Map collectionsResponses = (Map) testContext.getSuite().getAttribute( SuiteAttribute.COLLECTION_BY_ID.getName() ); + for ( Map.Entry collection : collectionsResponses.entrySet() ) { + CoordinateSystem storageCrs = parseStorageCrs( collection.getValue() ); + if ( storageCrs != null ) + collectionsData.add( new Object[] { collection.getKey(), storageCrs } ); + } + } catch (Exception e) { + collectionsData.add( new Object[] { null, null } ); + } return collectionsData.iterator(); } @@ -82,6 +90,9 @@ public void storeCollectionInTestContext( ITestContext testContext ) { @Test(description = "Implements A.1 Discovery, Abstract Test 1 (Requirement /req/crs/crs-uri, /req/crs/fc-md-crs-list A, /req/crs/fc-md-storageCrs, /req/crs/fc-md-crs-list-global), " + "crs property in the collection object in the path /collection", dataProvider = "collectionIdAndJsonAndCrs", dependsOnGroups = "crs-conformance", groups = "crs-discovery") public void verifyCollectionCrsIdentifierOfCrsProperty( String collectionId, CoordinateSystem crs ) { + if((collectionId == null) & (crs == null)) { + throw new AssertionError("No crs information for collection available."); + } addCrs( collectionId, crs ); assertValidCrsIdentifier( crs, String.format( "Collection with id '%s' contains invalid CRS identifier property 'crs': '%s'", @@ -99,6 +110,9 @@ public void verifyCollectionCrsIdentifierOfCrsProperty( String collectionId, Coo @Test(description = "Implements A.1 Discovery, Abstract Test 1 (Requirement /req/crs/crs-uri, /req/crs/fc-md-crs-list A, /req/crs/fc-md-storageCrs, /req/crs/fc-md-crs-list-global), " + "storageCrs property in the collection object in the path /collection", dataProvider = "collectionIdAndJsonAndStorageCrs", dependsOnGroups = "crs-conformance", groups = "crs-discovery") public void verifyCollectionCrsIdentifierOfStorageCrsProperty( String collectionId, CoordinateSystem storageCrs ) { + if((collectionId == null) & (storageCrs == null)) { + throw new AssertionError("No crs data for collection available."); + } assertValidCrsIdentifier( storageCrs, String.format( "Collection with id '%s' contains invalid CRS identifier property 'storageCrs': '%s'", collectionId, storageCrs ) ); diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/bboxcrs/BBoxCrsParameter.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/bboxcrs/BBoxCrsParameter.java index 7e0077bd..7d076824 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/bboxcrs/BBoxCrsParameter.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/bboxcrs/BBoxCrsParameter.java @@ -44,30 +44,38 @@ public class BBoxCrsParameter extends AbstractBBoxCrs { @DataProvider(name = "collectionDefaultCrs") public Iterator collectionDefaultCrs( ITestContext testContext ) { List collectionsData = new ArrayList<>(); - for ( Map.Entry collection : collectionsResponses.entrySet() ) { - String collectionId = collection.getKey(); - JsonPath json = collection.getValue(); - CoordinateSystem defaultCrs = collectionIdToDefaultCrs.get( collectionId ); - if ( defaultCrs != null ) { - collectionsData.add( new Object[] { collectionId, json, defaultCrs } ); + try { + for ( Map.Entry collection : collectionsResponses.entrySet() ) { + String collectionId = collection.getKey(); + JsonPath json = collection.getValue(); + CoordinateSystem defaultCrs = collectionIdToDefaultCrs.get( collectionId ); + if ( defaultCrs != null ) { + collectionsData.add( new Object[] { collectionId, json, defaultCrs } ); + } } - } + } catch (Exception e) { + collectionsData.add( new Object[] { null, null, null } ); + } return collectionsData.iterator(); } @DataProvider(name = "collectionCrsAndDefaultCrs") public Iterator collectionCrs( ITestContext testContext ) { List collectionsData = new ArrayList<>(); - for ( Map.Entry collection : collectionsResponses.entrySet() ) { - String collectionId = collection.getKey(); - JsonPath json = collection.getValue(); - CoordinateSystem defaultCrs = collectionIdToDefaultCrs.get( collectionId ); - if ( defaultCrs != null ) { - for ( CoordinateSystem crs : collectionIdToCrs.get( collectionId ) ) { - collectionsData.add( new Object[] { collectionId, json, crs, defaultCrs } ); + try { + for ( Map.Entry collection : collectionsResponses.entrySet() ) { + String collectionId = collection.getKey(); + JsonPath json = collection.getValue(); + CoordinateSystem defaultCrs = collectionIdToDefaultCrs.get( collectionId ); + if ( defaultCrs != null ) { + for ( CoordinateSystem crs : collectionIdToCrs.get( collectionId ) ) { + collectionsData.add( new Object[] { collectionId, json, crs, defaultCrs } ); + } } } - } + } catch (Exception e) { + collectionsData.add( new Object[] { null, null, null, null } ); + } return collectionsData.iterator(); } @@ -82,6 +90,9 @@ public Iterator collectionCrs( ITestContext testContext ) { @Test(description = "Implements A.2.2 Query, Parameter bbox-crs, Abstract Test 8 (Requirement /req/crs/fc-bbox-crs-definition, /req/crs/bbox-crs-action)", dataProvider = "collectionDefaultCrs", dependsOnGroups = "crs-conformance", priority = 1) public void verifyBboxCrsParameterWithDefaultCrs( String collectionId, JsonPath collection, CoordinateSystem defaultCrs ) { + if((collectionId == null) & (collection == null) & (defaultCrs == null)) { + throw new AssertionError("No crs information for collection available."); + } String featuredUrl = JsonUtils.findFeaturesUrlForGeoJson( rootUri, collection ); if ( featuredUrl == null ) throw new SkipException( String.format( "Could not find url for collection with id %s supporting GeoJson (type 5s)", @@ -114,6 +125,9 @@ public void verifyBboxCrsParameterWithDefaultCrs( String collectionId, JsonPath @Test(description = "Implements A.2.2 Query, Parameter bbox-crs, Abstract Test 8 (Requirement /req/crs/fc-bbox-crs-definition, /req/crs/bbox-crs-action)", dataProvider = "collectionCrsAndDefaultCrs", dependsOnGroups = "crs-conformance", dependsOnMethods = "verifyBboxCrsParameterWithDefaultCrs", priority = 1) public void verifyBboxCrsParameter( String collectionId, JsonPath collection, CoordinateSystem crs, CoordinateSystem defaultCrs ) { + if((collectionId == null) & (collection == null) & (crs == null) & (defaultCrs == null)) { + throw new AssertionError("No crs information for collection available."); + } if ( !collectionIdToResponseWithDefaultCRs.containsKey( collectionId ) ) throw new SkipException( String.format( "Collection with id %s could not be requested with bbox in default crs", collectionId ) ); diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/AbstractFeatureCrs.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/AbstractFeatureCrs.java index 301e9a0e..b84f5679 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/AbstractFeatureCrs.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/AbstractFeatureCrs.java @@ -38,14 +38,18 @@ public void retrieveRequiredInformationFromTestContext( ITestContext testContext @DataProvider(name = "collectionFeatureId") public Iterator collectionFeatureId( ITestContext testContext ) { List collectionsData = new ArrayList<>(); - for ( Map.Entry collection : collectionsResponses.entrySet() ) { - String collectionId = collection.getKey(); - if ( collectionIdToFeatureId != null && collectionIdToFeatureId.containsKey( collectionId ) ) { - String featureId = collectionIdToFeatureId.get( collectionId ); - JsonPath json = collection.getValue(); - collectionsData.add( new Object[] { collectionId, json, featureId } ); + try { + for ( Map.Entry collection : collectionsResponses.entrySet() ) { + String collectionId = collection.getKey(); + if ( collectionIdToFeatureId != null && collectionIdToFeatureId.containsKey( collectionId ) ) { + String featureId = collectionIdToFeatureId.get( collectionId ); + JsonPath json = collection.getValue(); + collectionsData.add( new Object[] { collectionId, json, featureId } ); + } } - } + } catch (Exception e) { + collectionsData.add( new Object[] { null, null, null } ); + } return collectionsData.iterator(); } } diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameter.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameter.java index 8245fc25..18c9bc04 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameter.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameter.java @@ -49,14 +49,18 @@ public class FeatureCrsParameter extends AbstractFeatureCrs { @DataProvider(name = "collectionFeatureIdCrs") public Iterator collectionFeatureIdCrs( ITestContext testContext ) { List collectionsData = new ArrayList<>(); - for ( Map.Entry collection : collectionsResponses.entrySet() ) { - String collectionId = collection.getKey(); - String featureId = collectionIdToFeatureId.get( collectionId ); - JsonPath json = collection.getValue(); - for ( CoordinateSystem crs : collectionIdToCrs.get( collectionId ) ) { - collectionsData.add( new Object[] { collectionId, json, featureId, crs } ); + try { + for ( Map.Entry collection : collectionsResponses.entrySet() ) { + String collectionId = collection.getKey(); + String featureId = collectionIdToFeatureId.get( collectionId ); + JsonPath json = collection.getValue(); + for ( CoordinateSystem crs : collectionIdToCrs.get( collectionId ) ) { + collectionsData.add( new Object[] { collectionId, json, featureId, crs } ); + } } - } + } catch (Exception e) { + collectionsData.add( new Object[] { null, null, null, null } ); + } return collectionsData.iterator(); } @@ -76,6 +80,9 @@ public Iterator collectionFeatureIdCrs( ITestContext testContext ) { + "Content-Crs header in the path /collections/{collectionId}/items/{featureId}", dataProvider = "collectionFeatureIdCrs", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeatureCrsParameter( String collectionId, JsonPath collection, String featureId, CoordinateSystem crs ) { + if((collectionId == null) & (collection == null) & (featureId == null) & (crs == null)) { + throw new AssertionError("No crs information for collection available."); + } String featureUrl = findFeatureUrlForGeoJson( rootUri, collection, featureId ); if ( featureUrl == null ) throw new SkipException( "Could not find url for collection with id " + collectionId diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterDefault.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterDefault.java index 5bf62f7b..f2f90a13 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterDefault.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterDefault.java @@ -43,6 +43,9 @@ public class FeatureCrsParameterDefault extends AbstractFeatureCrs { @Test(description = "Implements A.2.1 Query, Parameter crs, Abstract Test 6 (Requirement /req/crs/fc-crs-default-value, /req/crs/ogc-crs-header, /req/crs/ogc-crs-header-value), " + "Default CRS requesting path /collections/{collectionId}/items/{featureId}", dataProvider = "collectionFeatureId", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeatureCrsParameterDefault( String collectionId, JsonPath collection, String featureId ) { + if((collectionId == null) & (collection == null) & (featureId == null)) { + throw new AssertionError("No crs information for collection available."); + } String featureUrl = findFeatureUrlForGeoJson( rootUri, collection, featureId ); if ( featureUrl == null ) throw new SkipException( "Could not find url for collection with id " + collectionId diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterInvalid.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterInvalid.java index c9c6c1ec..99510fee 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterInvalid.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterInvalid.java @@ -47,6 +47,9 @@ public class FeatureCrsParameterInvalid extends AbstractFeatureCrs { @Test(description = "Implements A.2.1 Query, Parameter crs, Abstract Test 1 (Requirement /req/crs/fc-crs-valid-value), " + "Invalid CRS requesting path /collections/{collectionId}/items/{featureId}", dataProvider = "collectionFeatureId", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeatureCrsParameterInvalid( String collectionId, JsonPath collection, String featureId ) { + if((collectionId == null) & (collection == null) & (featureId == null)) { + throw new AssertionError("No crs information for collection available."); + } String featureUrl = findFeatureUrlForGeoJson( rootUri, collection, featureId ); if ( featureUrl == null ) throw new SkipException( String.format( "Could not find url for collection with id %s supporting GeoJson (type %s)", diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterTransform.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterTransform.java index d16f6779..a819cada 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterTransform.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterTransform.java @@ -58,15 +58,19 @@ public class FeatureCrsParameterTransform extends AbstractFeatureCrs { @DataProvider(name = "collectionFeatureIdCrsAndDefaultCrs") public Iterator collectionFeatureIdCrsAndDefaultCrs( ITestContext testContext ) { List collectionsData = new ArrayList<>(); - for ( Map.Entry collection : collectionsResponses.entrySet() ) { - String collectionId = collection.getKey(); - String featureId = collectionIdToFeatureId.get( collectionId ); - CoordinateSystem defaultCrs = collectionIdToDefaultCrs.get( collectionId ); - JsonPath json = collection.getValue(); - for ( CoordinateSystem crs : collectionIdToCrs.get( collectionId ) ) { - collectionsData.add( new Object[] { collectionId, json, featureId, crs, defaultCrs } ); + try { + for ( Map.Entry collection : collectionsResponses.entrySet() ) { + String collectionId = collection.getKey(); + String featureId = collectionIdToFeatureId.get( collectionId ); + CoordinateSystem defaultCrs = collectionIdToDefaultCrs.get( collectionId ); + JsonPath json = collection.getValue(); + for ( CoordinateSystem crs : collectionIdToCrs.get( collectionId ) ) { + collectionsData.add( new Object[] { collectionId, json, featureId, crs, defaultCrs } ); + } } - } + } catch (Exception e) { + collectionsData.add( new Object[] { null, null, null, null, null } ); + } return collectionsData.iterator(); } @@ -87,6 +91,9 @@ public Iterator collectionFeatureIdCrsAndDefaultCrs( ITestContext test public void verifyFeatureCrsParameterTransformWithCrsParameter( String collectionId, JsonPath collection, String featureId ) throws ParseException { + if((collectionId == null) & (collection == null) & (featureId == null)) { + throw new AssertionError("No crs information for collection available."); + } String featureUrl = findFeatureUrlForGeoJson( rootUri, collection, featureId ); if ( featureUrl == null ) throw new SkipException( String.format( "Could not find url for collection with id %s supporting GeoJson (type %s)", @@ -131,6 +138,9 @@ public void verifyFeatureCrsParameterTransformWithoutCrsParameter( String collec String featureId, CoordinateSystem crs, CoordinateSystem defaultCRS ) throws ParseException { + if((collectionId == null) & (collection == null) & (featureId == null) & (crs == null) & (defaultCRS == null)) { + throw new AssertionError("No crs information for collection available."); + } String featureUrl = findFeatureUrlForGeoJson( rootUri, collection, featureId ); if ( featureUrl == null ) throw new SkipException( String.format( "Could not find url for collection with id %s supporting GeoJson (type %s)", diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/AbstractFeaturesCrs.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/AbstractFeaturesCrs.java index 1620e1a3..7c8d63e8 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/AbstractFeaturesCrs.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/AbstractFeaturesCrs.java @@ -35,40 +35,52 @@ public void retrieveRequiredInformationFromTestContext( ITestContext testContext @DataProvider(name = "collectionIdAndJson") public Iterator collectionIdAndJson( ITestContext testContext ) { List collectionsData = new ArrayList<>(); - for ( Map.Entry collection : collectionsResponses.entrySet() ) { - String collectionId = collection.getKey(); - JsonPath json = collection.getValue(); - collectionsData.add( new Object[] { collectionId, json } ); - } + try { + for ( Map.Entry collection : collectionsResponses.entrySet() ) { + String collectionId = collection.getKey(); + JsonPath json = collection.getValue(); + collectionsData.add( new Object[] { collectionId, json } ); + } + } catch (Exception e) { + collectionsData.add( new Object[] { null, null } ); + } return collectionsData.iterator(); } @DataProvider(name = "collectionIdAndJsonAndCrs") public Iterator collectionIdAndJsonAndCrs( ITestContext testContext ) { List collectionsData = new ArrayList<>(); - for ( Map.Entry collection : collectionsResponses.entrySet() ) { - String collectionId = collection.getKey(); - JsonPath json = collection.getValue(); - for ( CoordinateSystem crs : collectionIdToCrs.get( collectionId ) ) { - collectionsData.add( new Object[] { collectionId, json, crs } ); + try { + for ( Map.Entry collection : collectionsResponses.entrySet() ) { + String collectionId = collection.getKey(); + JsonPath json = collection.getValue(); + for ( CoordinateSystem crs : collectionIdToCrs.get( collectionId ) ) { + collectionsData.add( new Object[] { collectionId, json, crs } ); + } } - } + } catch (Exception e) { + collectionsData.add( new Object[] { null, null, null } ); + } return collectionsData.iterator(); } @DataProvider(name = "collectionIdAndJsonAndCrsAndDefaultCrs") public Iterator collectionIdAndJsonAndCrsAndDefaultCrs( ITestContext testContext ) { List collectionsData = new ArrayList<>(); - for ( Map.Entry collection : collectionsResponses.entrySet() ) { - String collectionId = collection.getKey(); - JsonPath json = collection.getValue(); - CoordinateSystem defaultCrs = collectionIdToDefaultCrs.get( collectionId ); - if ( defaultCrs != null ) { - for ( CoordinateSystem crs : collectionIdToCrs.get( collectionId ) ) { - collectionsData.add( new Object[] { collectionId, json, crs, defaultCrs } ); + try { + for ( Map.Entry collection : collectionsResponses.entrySet() ) { + String collectionId = collection.getKey(); + JsonPath json = collection.getValue(); + CoordinateSystem defaultCrs = collectionIdToDefaultCrs.get( collectionId ); + if ( defaultCrs != null ) { + for ( CoordinateSystem crs : collectionIdToCrs.get( collectionId ) ) { + collectionsData.add( new Object[] { collectionId, json, crs, defaultCrs } ); + } } - } - } + } + } catch (Exception e) { + collectionsData.add( new Object[] { null, null, null, null } ); + } return collectionsData.iterator(); } diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameter.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameter.java index 8198d4c0..c32a8591 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameter.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameter.java @@ -52,6 +52,9 @@ public class FeaturesCrsParameter extends AbstractFeaturesCrs { @Test(description = "Implements A.2.1 Query, Parameter crs, Abstract Test 4 (Requirement /req/crs/fc-crs-definition, /req/crs/fc-crs-valid-value B, /req/crs/ogc-crs-header, /req/crs/ogc-crs-header-value, /req/crs/geojson), " + "Content-Crs header in the path /collections/{collectionId}/items", dataProvider = "collectionIdAndJsonAndCrs", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeaturesCrsParameter( String collectionId, JsonPath collection, CoordinateSystem crs ) { + if((collectionId == null) & (collection == null) & (crs == null)) { + throw new AssertionError("No crs information for collection available."); + } String featuresUrl = findFeaturesUrlForGeoJson( rootUri, collection ); if ( featuresUrl == null ) throw new SkipException( "Could not find url for collection with id " + collectionId diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterDefault.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterDefault.java index d6b6c827..41a3829b 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterDefault.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterDefault.java @@ -41,6 +41,9 @@ public class FeaturesCrsParameterDefault extends AbstractFeaturesCrs { @Test(description = "Implements A.2.1 Query, Parameter crs, Abstract Test 6 (Requirement /req/crs/fc-crs-default-value, /req/crs/ogc-crs-header, /req/crs/ogc-crs-header-value), " + "Default CRS requesting path /collections/{collectionId}/items", dataProvider = "collectionIdAndJson", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeaturesCrsParameterDefault( String collectionId, JsonPath collection ) { + if((collectionId == null) & (collection == null)) { + throw new AssertionError("No crs information for collection available."); + } String featuresUrl = findFeaturesUrlForGeoJson( rootUri, collection ); if ( featuresUrl == null ) throw new SkipException( "Could not find url for collection with id " + collectionId diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterInvalid.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterInvalid.java index 3873aeca..e5b9ef64 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterInvalid.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterInvalid.java @@ -45,6 +45,9 @@ public class FeaturesCrsParameterInvalid extends AbstractFeaturesCrs { @Test(description = "Implements A.2.1 Query, Parameter crs, Abstract Test 5 (Requirement /req/crs/fc-crs-valid-value), " + "Invalid CRS requesting path /collections/{collectionId}/items", dataProvider = "collectionIdAndJson", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeaturesCrsParameterInvalid( String collectionId, JsonPath collection ) { + if((collectionId == null) & (collection == null)) { + throw new AssertionError("No crs information for collection available."); + } String featuresUrl = findFeaturesUrlForGeoJson( rootUri, collection ); if ( featuresUrl == null ) throw new SkipException( String.format( "Could not find url for collection with id %s supporting GeoJson (type %s)", diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterTransform.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterTransform.java index 30995a64..7abccfab 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterTransform.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterTransform.java @@ -64,6 +64,9 @@ public class FeaturesCrsParameterTransform extends AbstractFeaturesCrs { + "Geometries in the path /collections/{collectionId}/items", dataProvider = "collectionIdAndJson", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeaturesCrsParameterTransformWithoutCrsParameter( String collectionId, JsonPath collection ) throws ParseException { + if((collectionId == null) & (collection == null)) { + throw new AssertionError("No crs information for collection available."); + } String featuresUrl = findFeaturesUrlForGeoJson( rootUri, collection ); if ( featuresUrl == null ) throw new SkipException( "Could not find url for collection with id " + collectionId @@ -109,6 +112,9 @@ public void verifyFeaturesCrsParameterTransformWithoutCrsParameter( String colle public void verifyFeaturesCrsParameterTransformWithCrsParameter( String collectionId, JsonPath collection, CoordinateSystem crs, CoordinateSystem defaultCRS ) throws ParseException { + if((collectionId == null) & (collection == null) & (crs == null) & (defaultCRS == null)) { + throw new AssertionError("No crs information for collection available."); + } String featuresUrl = findFeaturesUrlForGeoJson( rootUri, collection ); if ( featuresUrl == null ) throw new SkipException( String.format( "Could not find url for collection with id %s supporting GeoJson (type %s)", From 97715fcdba15f952b44bd0f480f9a1afe2b8c9b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Pro=C3=9F?= Date: Thu, 4 May 2023 11:40:32 +0200 Subject: [PATCH 2/2] Fix formatting --- .../AbstractDiscoveryCollection.java | 4 +-- .../collection/DiscoveryCollectionCrsUri.java | 28 +++++++++---------- .../crs/query/bboxcrs/BBoxCrsParameter.java | 20 ++++++------- .../query/crs/feature/AbstractFeatureCrs.java | 4 +-- .../crs/feature/FeatureCrsParameter.java | 10 +++---- .../feature/FeatureCrsParameterDefault.java | 6 ++-- .../feature/FeatureCrsParameterInvalid.java | 6 ++-- .../feature/FeatureCrsParameterTransform.java | 16 +++++------ .../crs/features/AbstractFeaturesCrs.java | 16 +++++------ .../crs/features/FeaturesCrsParameter.java | 6 ++-- .../features/FeaturesCrsParameterDefault.java | 6 ++-- .../features/FeaturesCrsParameterInvalid.java | 6 ++-- .../FeaturesCrsParameterTransform.java | 12 ++++---- 13 files changed, 70 insertions(+), 70 deletions(-) diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/AbstractDiscoveryCollection.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/AbstractDiscoveryCollection.java index bd33a1d4..11b92bfa 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/AbstractDiscoveryCollection.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/AbstractDiscoveryCollection.java @@ -24,9 +24,9 @@ public Iterator collectionIdAndJson( ITestContext testContext ) { for ( Map.Entry collection : collectionsResponses.entrySet() ) { collectionsData.add( new Object[] { collection.getKey(), collection.getValue() } ); } - } catch (Exception e) { + } catch (Exception e) { collectionsData.add( new Object[] { null, null } ); - } + } return collectionsData.iterator(); } diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/DiscoveryCollectionCrsUri.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/DiscoveryCollectionCrsUri.java index c27b6b18..9e6a4f20 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/DiscoveryCollectionCrsUri.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/discovery/collection/DiscoveryCollectionCrsUri.java @@ -43,8 +43,8 @@ public class DiscoveryCollectionCrsUri { @DataProvider(name = "collectionIdAndJsonAndCrs") public Iterator collectionIdAndJsonAndCrs( ITestContext testContext ) throws AssertionError { - List collectionsData = new ArrayList<>(); - try { + List collectionsData = new ArrayList<>(); + try { Map collectionsResponses = (Map) testContext.getSuite().getAttribute( SuiteAttribute.COLLECTION_BY_ID.getName() ); for ( Map.Entry collection : collectionsResponses.entrySet() ) { List crs = parseCrs( collection.getValue() ); @@ -52,25 +52,25 @@ public Iterator collectionIdAndJsonAndCrs( ITestContext testContext ) collectionsData.add( new Object[] { collection.getKey(), coordinateSystem } ); } } - } catch (Exception e) { + } catch (Exception e) { collectionsData.add( new Object[] { null, null } ); - } + } return collectionsData.iterator(); } @DataProvider(name = "collectionIdAndJsonAndStorageCrs") public Iterator collectionIdAndJsonAndStorageCrs( ITestContext testContext ) { - List collectionsData = new ArrayList<>(); - try { + List collectionsData = new ArrayList<>(); + try { Map collectionsResponses = (Map) testContext.getSuite().getAttribute( SuiteAttribute.COLLECTION_BY_ID.getName() ); for ( Map.Entry collection : collectionsResponses.entrySet() ) { CoordinateSystem storageCrs = parseStorageCrs( collection.getValue() ); if ( storageCrs != null ) collectionsData.add( new Object[] { collection.getKey(), storageCrs } ); } - } catch (Exception e) { + } catch (Exception e) { collectionsData.add( new Object[] { null, null } ); - } + } return collectionsData.iterator(); } @@ -90,9 +90,9 @@ public void storeCollectionInTestContext( ITestContext testContext ) { @Test(description = "Implements A.1 Discovery, Abstract Test 1 (Requirement /req/crs/crs-uri, /req/crs/fc-md-crs-list A, /req/crs/fc-md-storageCrs, /req/crs/fc-md-crs-list-global), " + "crs property in the collection object in the path /collection", dataProvider = "collectionIdAndJsonAndCrs", dependsOnGroups = "crs-conformance", groups = "crs-discovery") public void verifyCollectionCrsIdentifierOfCrsProperty( String collectionId, CoordinateSystem crs ) { - if((collectionId == null) & (crs == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (crs == null)) { + throw new AssertionError("No crs information for collection available."); + } addCrs( collectionId, crs ); assertValidCrsIdentifier( crs, String.format( "Collection with id '%s' contains invalid CRS identifier property 'crs': '%s'", @@ -110,9 +110,9 @@ public void verifyCollectionCrsIdentifierOfCrsProperty( String collectionId, Coo @Test(description = "Implements A.1 Discovery, Abstract Test 1 (Requirement /req/crs/crs-uri, /req/crs/fc-md-crs-list A, /req/crs/fc-md-storageCrs, /req/crs/fc-md-crs-list-global), " + "storageCrs property in the collection object in the path /collection", dataProvider = "collectionIdAndJsonAndStorageCrs", dependsOnGroups = "crs-conformance", groups = "crs-discovery") public void verifyCollectionCrsIdentifierOfStorageCrsProperty( String collectionId, CoordinateSystem storageCrs ) { - if((collectionId == null) & (storageCrs == null)) { - throw new AssertionError("No crs data for collection available."); - } + if((collectionId == null) & (storageCrs == null)) { + throw new AssertionError("No crs information for collection available."); + } assertValidCrsIdentifier( storageCrs, String.format( "Collection with id '%s' contains invalid CRS identifier property 'storageCrs': '%s'", collectionId, storageCrs ) ); diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/bboxcrs/BBoxCrsParameter.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/bboxcrs/BBoxCrsParameter.java index 7d076824..c4fc53ed 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/bboxcrs/BBoxCrsParameter.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/bboxcrs/BBoxCrsParameter.java @@ -53,9 +53,9 @@ public Iterator collectionDefaultCrs( ITestContext testContext ) { collectionsData.add( new Object[] { collectionId, json, defaultCrs } ); } } - } catch (Exception e) { + } catch (Exception e) { collectionsData.add( new Object[] { null, null, null } ); - } + } return collectionsData.iterator(); } @@ -73,9 +73,9 @@ public Iterator collectionCrs( ITestContext testContext ) { } } } - } catch (Exception e) { + } catch (Exception e) { collectionsData.add( new Object[] { null, null, null, null } ); - } + } return collectionsData.iterator(); } @@ -90,9 +90,9 @@ public Iterator collectionCrs( ITestContext testContext ) { @Test(description = "Implements A.2.2 Query, Parameter bbox-crs, Abstract Test 8 (Requirement /req/crs/fc-bbox-crs-definition, /req/crs/bbox-crs-action)", dataProvider = "collectionDefaultCrs", dependsOnGroups = "crs-conformance", priority = 1) public void verifyBboxCrsParameterWithDefaultCrs( String collectionId, JsonPath collection, CoordinateSystem defaultCrs ) { - if((collectionId == null) & (collection == null) & (defaultCrs == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (collection == null) & (defaultCrs == null)) { + throw new AssertionError("No crs information for collection available."); + } String featuredUrl = JsonUtils.findFeaturesUrlForGeoJson( rootUri, collection ); if ( featuredUrl == null ) throw new SkipException( String.format( "Could not find url for collection with id %s supporting GeoJson (type 5s)", @@ -125,9 +125,9 @@ public void verifyBboxCrsParameterWithDefaultCrs( String collectionId, JsonPath @Test(description = "Implements A.2.2 Query, Parameter bbox-crs, Abstract Test 8 (Requirement /req/crs/fc-bbox-crs-definition, /req/crs/bbox-crs-action)", dataProvider = "collectionCrsAndDefaultCrs", dependsOnGroups = "crs-conformance", dependsOnMethods = "verifyBboxCrsParameterWithDefaultCrs", priority = 1) public void verifyBboxCrsParameter( String collectionId, JsonPath collection, CoordinateSystem crs, CoordinateSystem defaultCrs ) { - if((collectionId == null) & (collection == null) & (crs == null) & (defaultCrs == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (collection == null) & (crs == null) & (defaultCrs == null)) { + throw new AssertionError("No crs information for collection available."); + } if ( !collectionIdToResponseWithDefaultCRs.containsKey( collectionId ) ) throw new SkipException( String.format( "Collection with id %s could not be requested with bbox in default crs", collectionId ) ); diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/AbstractFeatureCrs.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/AbstractFeatureCrs.java index b84f5679..36a48bf6 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/AbstractFeatureCrs.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/AbstractFeatureCrs.java @@ -47,9 +47,9 @@ public Iterator collectionFeatureId( ITestContext testContext ) { collectionsData.add( new Object[] { collectionId, json, featureId } ); } } - } catch (Exception e) { + } catch (Exception e) { collectionsData.add( new Object[] { null, null, null } ); - } + } return collectionsData.iterator(); } } diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameter.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameter.java index 18c9bc04..22a8b45f 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameter.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameter.java @@ -58,9 +58,9 @@ public Iterator collectionFeatureIdCrs( ITestContext testContext ) { collectionsData.add( new Object[] { collectionId, json, featureId, crs } ); } } - } catch (Exception e) { + } catch (Exception e) { collectionsData.add( new Object[] { null, null, null, null } ); - } + } return collectionsData.iterator(); } @@ -80,9 +80,9 @@ public Iterator collectionFeatureIdCrs( ITestContext testContext ) { + "Content-Crs header in the path /collections/{collectionId}/items/{featureId}", dataProvider = "collectionFeatureIdCrs", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeatureCrsParameter( String collectionId, JsonPath collection, String featureId, CoordinateSystem crs ) { - if((collectionId == null) & (collection == null) & (featureId == null) & (crs == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (collection == null) & (featureId == null) & (crs == null)) { + throw new AssertionError("No crs information for collection available."); + } String featureUrl = findFeatureUrlForGeoJson( rootUri, collection, featureId ); if ( featureUrl == null ) throw new SkipException( "Could not find url for collection with id " + collectionId diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterDefault.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterDefault.java index f2f90a13..ed26e1b2 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterDefault.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterDefault.java @@ -43,9 +43,9 @@ public class FeatureCrsParameterDefault extends AbstractFeatureCrs { @Test(description = "Implements A.2.1 Query, Parameter crs, Abstract Test 6 (Requirement /req/crs/fc-crs-default-value, /req/crs/ogc-crs-header, /req/crs/ogc-crs-header-value), " + "Default CRS requesting path /collections/{collectionId}/items/{featureId}", dataProvider = "collectionFeatureId", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeatureCrsParameterDefault( String collectionId, JsonPath collection, String featureId ) { - if((collectionId == null) & (collection == null) & (featureId == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (collection == null) & (featureId == null)) { + throw new AssertionError("No crs information for collection available."); + } String featureUrl = findFeatureUrlForGeoJson( rootUri, collection, featureId ); if ( featureUrl == null ) throw new SkipException( "Could not find url for collection with id " + collectionId diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterInvalid.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterInvalid.java index 99510fee..8b36914b 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterInvalid.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterInvalid.java @@ -47,9 +47,9 @@ public class FeatureCrsParameterInvalid extends AbstractFeatureCrs { @Test(description = "Implements A.2.1 Query, Parameter crs, Abstract Test 1 (Requirement /req/crs/fc-crs-valid-value), " + "Invalid CRS requesting path /collections/{collectionId}/items/{featureId}", dataProvider = "collectionFeatureId", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeatureCrsParameterInvalid( String collectionId, JsonPath collection, String featureId ) { - if((collectionId == null) & (collection == null) & (featureId == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (collection == null) & (featureId == null)) { + throw new AssertionError("No crs information for collection available."); + } String featureUrl = findFeatureUrlForGeoJson( rootUri, collection, featureId ); if ( featureUrl == null ) throw new SkipException( String.format( "Could not find url for collection with id %s supporting GeoJson (type %s)", diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterTransform.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterTransform.java index a819cada..c46bb5e5 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterTransform.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/feature/FeatureCrsParameterTransform.java @@ -68,9 +68,9 @@ public Iterator collectionFeatureIdCrsAndDefaultCrs( ITestContext test collectionsData.add( new Object[] { collectionId, json, featureId, crs, defaultCrs } ); } } - } catch (Exception e) { + } catch (Exception e) { collectionsData.add( new Object[] { null, null, null, null, null } ); - } + } return collectionsData.iterator(); } @@ -91,9 +91,9 @@ public Iterator collectionFeatureIdCrsAndDefaultCrs( ITestContext test public void verifyFeatureCrsParameterTransformWithCrsParameter( String collectionId, JsonPath collection, String featureId ) throws ParseException { - if((collectionId == null) & (collection == null) & (featureId == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (collection == null) & (featureId == null)) { + throw new AssertionError("No crs information for collection available."); + } String featureUrl = findFeatureUrlForGeoJson( rootUri, collection, featureId ); if ( featureUrl == null ) throw new SkipException( String.format( "Could not find url for collection with id %s supporting GeoJson (type %s)", @@ -138,9 +138,9 @@ public void verifyFeatureCrsParameterTransformWithoutCrsParameter( String collec String featureId, CoordinateSystem crs, CoordinateSystem defaultCRS ) throws ParseException { - if((collectionId == null) & (collection == null) & (featureId == null) & (crs == null) & (defaultCRS == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (collection == null) & (featureId == null) & (crs == null) & (defaultCRS == null)) { + throw new AssertionError("No crs information for collection available."); + } String featureUrl = findFeatureUrlForGeoJson( rootUri, collection, featureId ); if ( featureUrl == null ) throw new SkipException( String.format( "Could not find url for collection with id %s supporting GeoJson (type %s)", diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/AbstractFeaturesCrs.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/AbstractFeaturesCrs.java index 7c8d63e8..68139649 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/AbstractFeaturesCrs.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/AbstractFeaturesCrs.java @@ -40,10 +40,10 @@ public Iterator collectionIdAndJson( ITestContext testContext ) { String collectionId = collection.getKey(); JsonPath json = collection.getValue(); collectionsData.add( new Object[] { collectionId, json } ); - } - } catch (Exception e) { + } + } catch (Exception e) { collectionsData.add( new Object[] { null, null } ); - } + } return collectionsData.iterator(); } @@ -58,9 +58,9 @@ public Iterator collectionIdAndJsonAndCrs( ITestContext testContext ) collectionsData.add( new Object[] { collectionId, json, crs } ); } } - } catch (Exception e) { + } catch (Exception e) { collectionsData.add( new Object[] { null, null, null } ); - } + } return collectionsData.iterator(); } @@ -77,10 +77,10 @@ public Iterator collectionIdAndJsonAndCrsAndDefaultCrs( ITestContext t collectionsData.add( new Object[] { collectionId, json, crs, defaultCrs } ); } } - } - } catch (Exception e) { + } + } catch (Exception e) { collectionsData.add( new Object[] { null, null, null, null } ); - } + } return collectionsData.iterator(); } diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameter.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameter.java index c32a8591..8e89b146 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameter.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameter.java @@ -52,9 +52,9 @@ public class FeaturesCrsParameter extends AbstractFeaturesCrs { @Test(description = "Implements A.2.1 Query, Parameter crs, Abstract Test 4 (Requirement /req/crs/fc-crs-definition, /req/crs/fc-crs-valid-value B, /req/crs/ogc-crs-header, /req/crs/ogc-crs-header-value, /req/crs/geojson), " + "Content-Crs header in the path /collections/{collectionId}/items", dataProvider = "collectionIdAndJsonAndCrs", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeaturesCrsParameter( String collectionId, JsonPath collection, CoordinateSystem crs ) { - if((collectionId == null) & (collection == null) & (crs == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (collection == null) & (crs == null)) { + throw new AssertionError("No crs information for collection available."); + } String featuresUrl = findFeaturesUrlForGeoJson( rootUri, collection ); if ( featuresUrl == null ) throw new SkipException( "Could not find url for collection with id " + collectionId diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterDefault.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterDefault.java index 41a3829b..6ce4fed3 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterDefault.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterDefault.java @@ -41,9 +41,9 @@ public class FeaturesCrsParameterDefault extends AbstractFeaturesCrs { @Test(description = "Implements A.2.1 Query, Parameter crs, Abstract Test 6 (Requirement /req/crs/fc-crs-default-value, /req/crs/ogc-crs-header, /req/crs/ogc-crs-header-value), " + "Default CRS requesting path /collections/{collectionId}/items", dataProvider = "collectionIdAndJson", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeaturesCrsParameterDefault( String collectionId, JsonPath collection ) { - if((collectionId == null) & (collection == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (collection == null)) { + throw new AssertionError("No crs information for collection available."); + } String featuresUrl = findFeaturesUrlForGeoJson( rootUri, collection ); if ( featuresUrl == null ) throw new SkipException( "Could not find url for collection with id " + collectionId diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterInvalid.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterInvalid.java index e5b9ef64..7bd759b7 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterInvalid.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterInvalid.java @@ -45,9 +45,9 @@ public class FeaturesCrsParameterInvalid extends AbstractFeaturesCrs { @Test(description = "Implements A.2.1 Query, Parameter crs, Abstract Test 5 (Requirement /req/crs/fc-crs-valid-value), " + "Invalid CRS requesting path /collections/{collectionId}/items", dataProvider = "collectionIdAndJson", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeaturesCrsParameterInvalid( String collectionId, JsonPath collection ) { - if((collectionId == null) & (collection == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (collection == null)) { + throw new AssertionError("No crs information for collection available."); + } String featuresUrl = findFeaturesUrlForGeoJson( rootUri, collection ); if ( featuresUrl == null ) throw new SkipException( String.format( "Could not find url for collection with id %s supporting GeoJson (type %s)", diff --git a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterTransform.java b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterTransform.java index 7abccfab..b1c653ff 100644 --- a/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterTransform.java +++ b/src/main/java/org/opengis/cite/ogcapifeatures10/conformance/crs/query/crs/features/FeaturesCrsParameterTransform.java @@ -64,9 +64,9 @@ public class FeaturesCrsParameterTransform extends AbstractFeaturesCrs { + "Geometries in the path /collections/{collectionId}/items", dataProvider = "collectionIdAndJson", dependsOnGroups = "crs-conformance", priority = 1) public void verifyFeaturesCrsParameterTransformWithoutCrsParameter( String collectionId, JsonPath collection ) throws ParseException { - if((collectionId == null) & (collection == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (collection == null)) { + throw new AssertionError("No crs information for collection available."); + } String featuresUrl = findFeaturesUrlForGeoJson( rootUri, collection ); if ( featuresUrl == null ) throw new SkipException( "Could not find url for collection with id " + collectionId @@ -112,9 +112,9 @@ public void verifyFeaturesCrsParameterTransformWithoutCrsParameter( String colle public void verifyFeaturesCrsParameterTransformWithCrsParameter( String collectionId, JsonPath collection, CoordinateSystem crs, CoordinateSystem defaultCRS ) throws ParseException { - if((collectionId == null) & (collection == null) & (crs == null) & (defaultCRS == null)) { - throw new AssertionError("No crs information for collection available."); - } + if((collectionId == null) & (collection == null) & (crs == null) & (defaultCRS == null)) { + throw new AssertionError("No crs information for collection available."); + } String featuresUrl = findFeaturesUrlForGeoJson( rootUri, collection ); if ( featuresUrl == null ) throw new SkipException( String.format( "Could not find url for collection with id %s supporting GeoJson (type %s)",