diff --git a/server/src/test/java/au/org/aodn/ogcapi/server/features/RestApiTest.java b/server/src/test/java/au/org/aodn/ogcapi/server/features/RestApiTest.java index c357e1f5..e1960270 100644 --- a/server/src/test/java/au/org/aodn/ogcapi/server/features/RestApiTest.java +++ b/server/src/test/java/au/org/aodn/ogcapi/server/features/RestApiTest.java @@ -480,146 +480,4 @@ public void verifyBBoxCorrect() throws IOException { assertEquals(154.0, bbox.get(0).get(2).doubleValue(), "Overall bounding box coor 3"); assertEquals(-9.0, bbox.get(0).get(3).doubleValue(), "Overall bounding box coor 4"); } - /** - * Verify the function correctly sum up the values for feature id summary - * @throws IOException - Not expect to throw - */ - @Disabled("Skipping this test temporarily") - @Test - public void verifyAggregationFeatureSummaryCorrect() throws IOException { - super.insertJsonToElasticCODataIndex( - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.0.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.1.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.2.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample2.0.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.0.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.1.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.2.json" - ); - - // Call rest api directly and get query result - ResponseEntity collection = testRestTemplate.getForEntity( - getBasePath() + "/collections/35234913-aa3c-48ec-b9a4-77f822f66ef8/items/summary", - FeatureCollectionGeoJSON.class); - - assertNotNull(collection.getBody(), "Body not null"); - - FeatureCollectionGeoJSON json = collection.getBody(); - assertEquals(3, json.getFeatures().size(), "Features correct"); - - // Sort make sure compare always same order - List sf = json.getFeatures().stream() - .sorted((a,b) -> b.getGeometry().hashCode() - a.getGeometry().hashCode()) - .toList(); - // Sample1 - FeatureGeoJSON featureGeoJSON1 = new FeatureGeoJSON(); - featureGeoJSON1.setType(FeatureGeoJSON.TypeEnum.FEATURE); - featureGeoJSON1.setGeometry(new PointGeoJSON() - .type(PointGeoJSON.TypeEnum.POINT) - .coordinates(List.of(BigDecimal.valueOf(159.26), BigDecimal.valueOf(-24.72))) - ); - featureGeoJSON1.setProperties(Map.of( - FeatureProperty.COUNT.getValue(), 42.0, - FeatureProperty.START_TIME.getValue(), "2023-02-01T00:00:00.000Z", - FeatureProperty.END_TIME.getValue(), "2023-02-01T00:00:00.000Z" - - )); - assertEquals(featureGeoJSON1, sf.get(0), "featureGeoJSON1"); - - // Sample3 - FeatureGeoJSON featureGeoJSON2 = new FeatureGeoJSON(); - featureGeoJSON2.setType(FeatureGeoJSON.TypeEnum.FEATURE); - featureGeoJSON2.setGeometry(new PointGeoJSON() - .type(PointGeoJSON.TypeEnum.POINT) - .coordinates(List.of(BigDecimal.valueOf(154.81), BigDecimal.valueOf(-26.2))) - ); - featureGeoJSON2.setProperties(Map.of( - FeatureProperty.COUNT.getValue(), 48.0, - FeatureProperty.START_TIME.getValue(), "2023-02-01T00:00:00.000Z", - FeatureProperty.END_TIME.getValue(), "2024-03-01T00:00:00.000Z" - - )); - assertEquals(featureGeoJSON2, sf.get(1), "featureGeoJSON2"); - - FeatureGeoJSON featureGeoJSON3 = new FeatureGeoJSON(); - featureGeoJSON3.setType(FeatureGeoJSON.TypeEnum.FEATURE); - featureGeoJSON3.setGeometry(new PointGeoJSON() - .type(PointGeoJSON.TypeEnum.POINT) - .coordinates(List.of(BigDecimal.valueOf(153.56), BigDecimal.valueOf(-26.59))) - ); - featureGeoJSON3.setProperties(Map.of( - FeatureProperty.COUNT.getValue(), 14.0, - FeatureProperty.START_TIME.getValue(), "2023-02-01T00:00:00.000Z", - FeatureProperty.END_TIME.getValue(), "2023-02-01T00:00:00.000Z" - - )); - assertEquals(featureGeoJSON3, sf.get(2), "featureGeoJSON3"); - } - /** - * We add more sample data and will trigger page load. - * @throws IOException - Not expect to throw - */ - @Disabled("Skipping this test temporarily") - @Test - public void verifyAggregationFeatureSummaryWithPageCorrect() throws IOException { - assertEquals(4, pageSize, "This test only works with small page"); - - super.insertJsonToElasticCODataIndex( - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.0.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.1.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.2.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample2.0.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.0.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.1.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.2.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample4.0.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample5.0.json", - "cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample5.1.json" - ); - - // Call rest api directly and get query result - ResponseEntity collection = testRestTemplate.getForEntity( - getBasePath() + "/collections/35234913-aa3c-48ec-b9a4-77f822f66ef8/items/summary", - FeatureCollectionGeoJSON.class); - - assertNotNull(collection.getBody(), "Body not null"); - - FeatureCollectionGeoJSON json = collection.getBody(); - assertEquals(5, json.getFeatures().size(), "Features correct"); - - // Sort make sure compare always same order - List sf = json.getFeatures().stream() - .sorted((a,b) -> b.getGeometry().hashCode() - a.getGeometry().hashCode()) - .toList(); - - // Sample1 - FeatureGeoJSON featureGeoJSON1 = new FeatureGeoJSON(); - featureGeoJSON1.setType(FeatureGeoJSON.TypeEnum.FEATURE); - featureGeoJSON1.setGeometry(new PointGeoJSON() - .type(PointGeoJSON.TypeEnum.POINT) - .coordinates(List.of(BigDecimal.valueOf(163.56), BigDecimal.valueOf(-26.59))) - ); - featureGeoJSON1.setProperties(Map.of( - FeatureProperty.COUNT.getValue(), 14.0, - FeatureProperty.START_TIME.getValue(), "2023-02-01T00:00:00.000Z", - FeatureProperty.END_TIME.getValue(), "2023-02-01T00:00:00.000Z" - - )); - assertEquals(featureGeoJSON1, sf.get(0), "featureGeoJSON1"); - - // Sample5 - FeatureGeoJSON featureGeoJSON2 = new FeatureGeoJSON(); - featureGeoJSON2.setType(FeatureGeoJSON.TypeEnum.FEATURE); - featureGeoJSON2.setGeometry(new PointGeoJSON() - .type(PointGeoJSON.TypeEnum.POINT) - .coordinates(List.of(BigDecimal.valueOf(163.56), BigDecimal.valueOf(-126.59))) - ); - featureGeoJSON2.setProperties(Map.of( - FeatureProperty.COUNT.getValue(), 20.0, - FeatureProperty.START_TIME.getValue(), "2022-12-01T00:00:00.000Z", - FeatureProperty.END_TIME.getValue(), "2023-02-01T00:00:00.000Z" - - )); - assertEquals(featureGeoJSON2, sf.get(1), "featureGeoJSON2"); - } } diff --git a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.0.json b/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.0.json deleted file mode 100644 index f4e3a328..00000000 --- a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.0.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "id": "35234913-aa3c-48ec-b9a4-77f822f66ef8|2023-02|159.26|-24.72|150.00", - "geometry": { - "geometries": [{ - "coordinates": [ - 159.26, - -24.72 - ], - "type": "Point" - }], - "type": "GeometryCollection" - }, - "properties": { - "depth": 150, - "lng": 159.26, - "lat": -24.72, - "time": "2023-02-01T00:00:00Z", - "count": 14 - }, - "collection": "35234913-aa3c-48ec-b9a4-77f822f66ef8", - "stac_version": "1.0.0", - "stac_extensions": [ - "https://stac-extensions.github.io/scientific/v1.0.0/schema.json", - "https://stac-extensions.github.io/contacts/v0.1.1/schema.json", - "https://stac-extensions.github.io/projection/v1.1.0/schema.json", - "https://stac-extensions.github.io/language/v1.0.0/schema.json", - "https://stac-extensions.github.io/themes/v1.0.0/schema.json", - "https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json" - ], - "type": "Feature" -} diff --git a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.1.json b/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.1.json deleted file mode 100644 index 985967bf..00000000 --- a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.1.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "id": "35234913-aa3c-48ec-b9a4-77f822f66ef8|2023-02|159.26|-24.72|940.00", - "geometry": { - "geometries": [{ - "coordinates": [ - 159.26, - -24.72 - ], - "type": "Point" - }], - "type": "GeometryCollection" - }, - "properties": { - "depth": 940, - "lng": 159.26, - "lat": -24.72, - "time": "2023-02-01T00:00:00Z", - "count": 13 - }, - "collection": "35234913-aa3c-48ec-b9a4-77f822f66ef8", - "stac_version": "1.0.0", - "stac_extensions": [ - "https://stac-extensions.github.io/scientific/v1.0.0/schema.json", - "https://stac-extensions.github.io/contacts/v0.1.1/schema.json", - "https://stac-extensions.github.io/projection/v1.1.0/schema.json", - "https://stac-extensions.github.io/language/v1.0.0/schema.json", - "https://stac-extensions.github.io/themes/v1.0.0/schema.json", - "https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json" - ], - "type": "Feature" -} diff --git a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.2.json b/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.2.json deleted file mode 100644 index 1c004c5b..00000000 --- a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample1.2.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "id": "35234913-aa3c-48ec-b9a4-77f822f66ef8|2023-02|159.26|-24.72|570.00", - "geometry": { - "geometries": [{ - "coordinates": [ - 159.26, - -24.72 - ], - "type": "Point" - }], - "type": "GeometryCollection" - }, - "properties": { - "depth": 570, - "lng": 159.26, - "lat": -24.72, - "time": "2023-02-01T00:00:00Z", - "count": 15 - }, - "collection": "35234913-aa3c-48ec-b9a4-77f822f66ef8", - "stac_version": "1.0.0", - "stac_extensions": [ - "https://stac-extensions.github.io/scientific/v1.0.0/schema.json", - "https://stac-extensions.github.io/contacts/v0.1.1/schema.json", - "https://stac-extensions.github.io/projection/v1.1.0/schema.json", - "https://stac-extensions.github.io/language/v1.0.0/schema.json", - "https://stac-extensions.github.io/themes/v1.0.0/schema.json", - "https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json" - ], - "type": "Feature" -} diff --git a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample2.0.json b/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample2.0.json deleted file mode 100644 index e9bf727e..00000000 --- a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample2.0.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "id": "35234913-aa3c-48ec-b9a4-77f822f66ef8|2023-02|153.56|-26.59|760.00", - "geometry": { - "geometries": [{ - "coordinates": [ - 153.56, - -26.59 - ], - "type": "Point" - }], - "type": "GeometryCollection" - }, - "properties": { - "depth": 760, - "lng": 153.56, - "lat": -26.59, - "time": "2023-02-01T00:00:00Z", - "count": 14 - }, - "collection": "35234913-aa3c-48ec-b9a4-77f822f66ef8", - "stac_version": "1.0.0", - "stac_extensions": [ - "https://stac-extensions.github.io/scientific/v1.0.0/schema.json", - "https://stac-extensions.github.io/contacts/v0.1.1/schema.json", - "https://stac-extensions.github.io/projection/v1.1.0/schema.json", - "https://stac-extensions.github.io/language/v1.0.0/schema.json", - "https://stac-extensions.github.io/themes/v1.0.0/schema.json", - "https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json" - ], - "type": "Feature" -} diff --git a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.0.json b/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.0.json deleted file mode 100644 index 1653dbf4..00000000 --- a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.0.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "id": "35234913-aa3c-48ec-b9a4-77f822f66ef8|2023-02|154.81|-26.20|260.00", - "geometry": { - "geometries": [{ - "coordinates": [ - 154.81, - -26.2 - ], - "type": "Point" - }], - "type": "GeometryCollection" - }, - "properties": { - "depth": 260, - "lng": 154.81, - "lat": -26.2, - "time": "2023-02-01T00:00:00Z", - "count": 14 - }, - "collection": "35234913-aa3c-48ec-b9a4-77f822f66ef8", - "stac_version": "1.0.0", - "stac_extensions": [ - "https://stac-extensions.github.io/scientific/v1.0.0/schema.json", - "https://stac-extensions.github.io/contacts/v0.1.1/schema.json", - "https://stac-extensions.github.io/projection/v1.1.0/schema.json", - "https://stac-extensions.github.io/language/v1.0.0/schema.json", - "https://stac-extensions.github.io/themes/v1.0.0/schema.json", - "https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json" - ], - "type": "Feature" -} diff --git a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.1.json b/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.1.json deleted file mode 100644 index b32c7662..00000000 --- a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.1.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "id": "35234913-aa3c-48ec-b9a4-77f822f66ef8|2024-03|154.81|-26.20|260.00", - "geometry": { - "geometries": [{ - "coordinates": [ - 154.81, - -26.2 - ], - "type": "Point" - }], - "type": "GeometryCollection" - }, - "properties": { - "depth": 260, - "lng": 154.81, - "lat": -26.2, - "time": "2024-03-01T00:00:00Z", - "count": 20 - }, - "collection": "35234913-aa3c-48ec-b9a4-77f822f66ef8", - "stac_version": "1.0.0", - "stac_extensions": [ - "https://stac-extensions.github.io/scientific/v1.0.0/schema.json", - "https://stac-extensions.github.io/contacts/v0.1.1/schema.json", - "https://stac-extensions.github.io/projection/v1.1.0/schema.json", - "https://stac-extensions.github.io/language/v1.0.0/schema.json", - "https://stac-extensions.github.io/themes/v1.0.0/schema.json", - "https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json" - ], - "type": "Feature" -} diff --git a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.2.json b/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.2.json deleted file mode 100644 index 071b94d8..00000000 --- a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample3.2.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "id": "35234913-aa3c-48ec-b9a4-77f822f66ef8|2023-02|154.81|-26.20|260.00", - "geometry": { - "geometries": [{ - "coordinates": [ - 154.81, - -26.2 - ], - "type": "Point" - }], - "type": "GeometryCollection" - }, - "properties": { - "depth": 260, - "lng": 154.81, - "lat": -26.2, - "time": "2023-02-01T00:00:00Z", - "count": 14 - }, - "collection": "35234913-aa3c-48ec-b9a4-77f822f66ef8", - "stac_version": "1.0.0", - "stac_extensions": [ - "https://stac-extensions.github.io/scientific/v1.0.0/schema.json", - "https://stac-extensions.github.io/contacts/v0.1.1/schema.json", - "https://stac-extensions.github.io/projection/v1.1.0/schema.json", - "https://stac-extensions.github.io/language/v1.0.0/schema.json", - "https://stac-extensions.github.io/themes/v1.0.0/schema.json", - "https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json" - ], - "type": "Feature" -} diff --git a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample4.0.json b/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample4.0.json deleted file mode 100644 index cc8e5756..00000000 --- a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample4.0.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "id": "35234913-aa3c-48ec-b9a4-77f822f66ef8|2023-02|163.56|-26.59|760.00", - "geometry": { - "geometries": [{ - "coordinates": [ - 163.56, - -26.59 - ], - "type": "Point" - }], - "type": "GeometryCollection" - }, - "properties": { - "depth": 760, - "lng": 163.56, - "lat": -26.59, - "time": "2023-02-01T00:00:00Z", - "count": 14 - }, - "collection": "35234913-aa3c-48ec-b9a4-77f822f66ef8", - "stac_version": "1.0.0", - "stac_extensions": [ - "https://stac-extensions.github.io/scientific/v1.0.0/schema.json", - "https://stac-extensions.github.io/contacts/v0.1.1/schema.json", - "https://stac-extensions.github.io/projection/v1.1.0/schema.json", - "https://stac-extensions.github.io/language/v1.0.0/schema.json", - "https://stac-extensions.github.io/themes/v1.0.0/schema.json", - "https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json" - ], - "type": "Feature" -} diff --git a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample5.0.json b/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample5.0.json deleted file mode 100644 index 1b05f1e4..00000000 --- a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample5.0.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "id": "35234913-aa3c-48ec-b9a4-77f822f66ef8|2023-02|163.56|-126.59|760.00", - "geometry": { - "geometries": [{ - "coordinates": [ - 163.56, - -126.59 - ], - "type": "Point" - }], - "type": "GeometryCollection" - }, - "properties": { - "depth": 760, - "lng": 163.56, - "lat": -126.59, - "time": "2023-02-01T00:00:00Z", - "count": 10 - }, - "collection": "35234913-aa3c-48ec-b9a4-77f822f66ef8", - "stac_version": "1.0.0", - "stac_extensions": [ - "https://stac-extensions.github.io/scientific/v1.0.0/schema.json", - "https://stac-extensions.github.io/contacts/v0.1.1/schema.json", - "https://stac-extensions.github.io/projection/v1.1.0/schema.json", - "https://stac-extensions.github.io/language/v1.0.0/schema.json", - "https://stac-extensions.github.io/themes/v1.0.0/schema.json", - "https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json" - ], - "type": "Feature" -} diff --git a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample5.1.json b/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample5.1.json deleted file mode 100644 index f2e946f5..00000000 --- a/server/src/test/resources/databag/cloudoptimized/35234913-aa3c-48ec-b9a4-77f822f66ef8/sample5.1.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "id": "35234913-aa3c-48ec-b9a4-77f822f66ef8|2023-02|163.56|-126.59|760.00", - "geometry": { - "geometries": [{ - "coordinates": [ - 163.56, - -126.59 - ], - "type": "Point" - }], - "type": "GeometryCollection" - }, - "properties": { - "depth": 760, - "lng": 163.56, - "lat": -126.59, - "time": "2022-12-01T00:00:00Z", - "count": 10 - }, - "collection": "35234913-aa3c-48ec-b9a4-77f822f66ef8", - "stac_version": "1.0.0", - "stac_extensions": [ - "https://stac-extensions.github.io/scientific/v1.0.0/schema.json", - "https://stac-extensions.github.io/contacts/v0.1.1/schema.json", - "https://stac-extensions.github.io/projection/v1.1.0/schema.json", - "https://stac-extensions.github.io/language/v1.0.0/schema.json", - "https://stac-extensions.github.io/themes/v1.0.0/schema.json", - "https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json" - ], - "type": "Feature" -}