diff --git a/here-naksha-app-service/src/main/java/com/here/naksha/app/service/http/tasks/ReadFeatureApiTask.java b/here-naksha-app-service/src/main/java/com/here/naksha/app/service/http/tasks/ReadFeatureApiTask.java index 73f4104c2..7982677e7 100644 --- a/here-naksha-app-service/src/main/java/com/here/naksha/app/service/http/tasks/ReadFeatureApiTask.java +++ b/here-naksha-app-service/src/main/java/com/here/naksha/app/service/http/tasks/ReadFeatureApiTask.java @@ -118,6 +118,7 @@ protected void init() {} final String spaceId = ApiParams.extractMandatoryPathParam(routingContext, SPACE_ID); final QueryParameterList queryParameters = queryParamsFromRequest(routingContext); final List featureIds = extractParamAsStringList(queryParameters, FEATURE_IDS); + final Set propPaths = PropertySelectionUtil.buildPropPathSetFromQueryParams(queryParameters); // Validate parameters if (featureIds == null || featureIds.isEmpty()) { @@ -127,8 +128,10 @@ protected void init() {} // Forward request to NH Space Storage reader instance try (Result result = executeReadRequestFromSpaceStorage(rdRequest)) { + final F1 preResponseProcessing = + standardReadFeaturesPreResponseProcessing(propPaths, false, null); // transform Result to Http FeatureCollection response - return transformReadResultToXyzCollectionResponse(result, XyzFeature.class); + return transformReadResultToXyzCollectionResponse(result, XyzFeature.class, preResponseProcessing); } } @@ -136,13 +139,17 @@ protected void init() {} // Parse and validate Path parameters final String spaceId = extractMandatoryPathParam(routingContext, SPACE_ID); final String featureId = extractMandatoryPathParam(routingContext, FEATURE_ID); + final QueryParameterList queryParameters = queryParamsFromRequest(routingContext); + final Set propPaths = PropertySelectionUtil.buildPropPathSetFromQueryParams(queryParameters); final ReadFeatures rdRequest = RequestHelper.readFeaturesByIdRequest(spaceId, featureId); // Forward request to NH Space Storage reader instance try (Result result = executeReadRequestFromSpaceStorage(rdRequest)) { + final F1 preResponseProcessing = + standardReadFeaturesPreResponseProcessing(propPaths, false, null); // transform Result to Http XyzFeature response - return transformReadResultToXyzFeatureResponse(result, XyzFeature.class); + return transformReadResultToXyzFeatureResponse(result, XyzFeature.class, preResponseProcessing); } } @@ -227,6 +234,7 @@ protected void init() {} routingContext, XyzError.ILLEGAL_ARGUMENT, "Missing mandatory query parameters"); } long limit = ApiParams.extractQueryParamAsLong(queryParams, LIMIT, false, DEF_FEATURE_LIMIT); + final Set propPaths = PropertySelectionUtil.buildPropPathSetFromQueryParams(queryParams); // validate values limit = (limit < 0 || limit > DEF_FEATURE_LIMIT) ? DEF_FEATURE_LIMIT : limit; @@ -242,8 +250,11 @@ protected void init() {} // Forward request to NH Space Storage reader instance final Result result = executeReadRequestFromSpaceStorage(rdRequest); + final F1 preResponseProcessing = + standardReadFeaturesPreResponseProcessing(propPaths, false, null); // transform Result to Http FeatureCollection response, restricted by given feature limit - return transformReadResultToXyzCollectionResponse(result, XyzFeature.class, limit); + return transformReadResultToXyzCollectionResponse( + result, XyzFeature.class, 0, limit, null, preResponseProcessing); } private @NotNull XyzResponse executeIterate() { @@ -253,6 +264,9 @@ protected void init() {} // Parse and validate Query parameters final QueryParameterList queryParams = queryParamsFromRequest(routingContext); + // Parse property selection + final Set propPaths = PropertySelectionUtil.buildPropPathSetFromQueryParams(queryParams); + // Note : subsequent steps need to support queryParams being null // extract limit parameter @@ -273,9 +287,12 @@ protected void init() {} // Forward request to NH Space Storage reader instance final Result result = executeReadRequestFromSpaceStorage(rdRequest); + final F1 preResponseProcessing = + standardReadFeaturesPreResponseProcessing(propPaths, false, null); // transform Result to Http FeatureCollection response, // restricted by given feature limit and by adding "handle" attribute to support subsequent iteration - return transformReadResultToXyzCollectionResponse(result, XyzFeature.class, offset, limit, handle); + return transformReadResultToXyzCollectionResponse( + result, XyzFeature.class, offset, limit, handle, preResponseProcessing); } private @NotNull XyzResponse executeFeaturesByRadius() { @@ -373,6 +390,8 @@ protected void init() {} // NOTE : queryParams can be null. Subsequent steps should respect the same. final long radius = ApiParams.extractQueryParamAsLong(queryParams, RADIUS, false, 0); long limit = ApiParams.extractQueryParamAsLong(queryParams, LIMIT, false, DEF_FEATURE_LIMIT); + final Set propPaths = PropertySelectionUtil.buildPropPathSetFromQueryParams(queryParams); + final boolean clip = ApiParams.extractQueryParamAsBoolean(queryParams, CLIP_GEO, false); // validate values limit = (limit < 0 || limit > DEF_FEATURE_LIMIT) ? DEF_FEATURE_LIMIT : limit; ApiParams.validateParamRange(RADIUS, radius, 0, Long.MAX_VALUE); @@ -390,7 +409,11 @@ protected void init() {} // Forward request to NH Space Storage reader instance final Result result = executeReadRequestFromSpaceStorage(rdRequest); + // TODO pass the correct transformed geometry into this method call, also use the boolean clip + final F1 preResponseProcessing = + standardReadFeaturesPreResponseProcessing(propPaths, false, radiusOp.getGeometry()); // transform Result to Http FeatureCollection response, restricted by given feature limit - return transformReadResultToXyzCollectionResponse(result, XyzFeature.class, limit); + return transformReadResultToXyzCollectionResponse( + result, XyzFeature.class, 0, limit, null, preResponseProcessing); } } diff --git a/here-naksha-app-service/src/main/resources/swagger/openapi.yaml b/here-naksha-app-service/src/main/resources/swagger/openapi.yaml index f9189a96a..7a2045ddc 100644 --- a/here-naksha-app-service/src/main/resources/swagger/openapi.yaml +++ b/here-naksha-app-service/src/main/resources/swagger/openapi.yaml @@ -476,6 +476,7 @@ paths: parameters: - $ref: '#/components/parameters/SpaceId' - $ref: '#/components/parameters/RequiredIds' + - $ref: '#/components/parameters/PropertiesSelection' responses: '200': $ref: '#/components/responses/FeatureCollectionResponse' @@ -627,6 +628,8 @@ paths: summary: Get a feature by ID description: Retrieves the feature with the provided identifier. operationId: getFeature + parameters: + - $ref: '#/components/parameters/PropertiesSelection' responses: '200': $ref: '#/components/responses/FeatureResponse' @@ -880,6 +883,8 @@ paths: - $ref: '#/components/parameters/TagList' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/PropertiesQuery' + - $ref: '#/components/parameters/PropertiesSelection' +# - $ref: '#/components/parameters/Clip' requestBody: $ref: '#/components/requestBodies/GeometryRequest' responses: @@ -917,6 +922,7 @@ paths: - $ref: '#/components/parameters/TagList' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/PropertiesQuery' + - $ref: '#/components/parameters/PropertiesSelection' responses: '200': $ref: '#/components/responses/FeatureCollectionResponse' @@ -951,6 +957,7 @@ paths: - $ref: '#/components/parameters/SpaceId' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Handle' + - $ref: '#/components/parameters/PropertiesSelection' responses: '200': $ref: '#/components/responses/IterateResponse' diff --git a/here-naksha-app-service/src/test/java/com/here/naksha/app/service/IterateFeaturesTest.java b/here-naksha-app-service/src/test/java/com/here/naksha/app/service/IterateFeaturesTest.java index 5b5718a6b..21c8e2ee3 100644 --- a/here-naksha-app-service/src/test/java/com/here/naksha/app/service/IterateFeaturesTest.java +++ b/here-naksha-app-service/src/test/java/com/here/naksha/app/service/IterateFeaturesTest.java @@ -170,4 +170,41 @@ void tc1103_testIterateWithInvalidHandle() throws URISyntaxException, Interrupte .hasJsonBody(expectedBodyPart, "Iterate Feature Error response body doesn't match"); } + @Test + void tc1104_testIterateInTwoPagesWithPropSelection() throws URISyntaxException, InterruptedException, IOException { + // Test API : GET /hub/spaces/{spaceId}/iterate + // Validate all features getting returned in two iterations, with: + // - first iteration returning features and nextPageToken, selecting: 1 normal prop, 1 URI encoded prop, 1 prop not existing + // - second iteration accepting handle but use the wrong selection delimiter (should return 400) + + // Given: iterate parameters for first request + final String limitQueryParam = "limit=3"; + final String firstStreamId = UUID.randomUUID().toString(); + final String firstExpectedBodyPart = loadFileOrFail("ReadFeatures/Iterate/TC1104_testIterateInTwoPagesWithPropSelection/iterate_response_1.json") + .replaceAll("\\{\\{streamId}}",firstStreamId); + final String selectionParams = "selection=p.speedLimit,p.unknown_prop,%s".formatted(urlEncoded("p.@ns:com:here:xyz.tags")); + + // When: First iterate Features request is submitted to NakshaHub + HttpResponse response = nakshaClient.get("hub/spaces/" + SPACE_ID + "/iterate" + "?" + limitQueryParam + "&" + selectionParams, firstStreamId); + // Then: Perform assertions + ResponseAssertions.assertThat(response) + .hasStatus(200) + .hasStreamIdHeader(firstStreamId) + .hasJsonBody(firstExpectedBodyPart, "First Iterate response body doesn't match", true); + + // Given: iterate parameters for second request + final String handleQueryParam = "handle=" + urlEncoded(parseJson(response.body(), XyzFeatureCollection.class).getNextPageToken()); + final String secondExpectedBodyPart = loadFileOrFail("ReadFeatures/Iterate/TC1104_testIterateInTwoPagesWithPropSelection/iterate_response_2.json"); + final String secondStreamId = UUID.randomUUID().toString(); + final String selectionWrongDelimiterParams = "selection=p.speedLimit+p.unknown_prop"; + + // When: Second iterate Features request is submitted to NakshaHub + response = nakshaClient.get("hub/spaces/" + SPACE_ID + "/iterate" + "?" + handleQueryParam + "&" + selectionWrongDelimiterParams, secondStreamId); + // Then: Perform assertions + ResponseAssertions.assertThat(response) + .hasStatus(400) + .hasStreamIdHeader(secondStreamId) + .hasJsonBody(secondExpectedBodyPart, "Final Iterate response body doesn't match"); + } + } diff --git a/here-naksha-app-service/src/test/java/com/here/naksha/app/service/ReadFeaturesByIdsTest.java b/here-naksha-app-service/src/test/java/com/here/naksha/app/service/ReadFeaturesByIdsTest.java index f49377852..494a097f1 100644 --- a/here-naksha-app-service/src/test/java/com/here/naksha/app/service/ReadFeaturesByIdsTest.java +++ b/here-naksha-app-service/src/test/java/com/here/naksha/app/service/ReadFeaturesByIdsTest.java @@ -18,24 +18,21 @@ */ package com.here.naksha.app.service; -import static com.here.naksha.app.common.CommonApiTestSetup.setupSpaceAndRelatedResources; -import static com.here.naksha.app.common.TestUtil.loadFileOrFail; -import static com.here.naksha.app.common.TestUtil.parseJson; -import static org.junit.jupiter.api.Assertions.assertNotNull; - import com.here.naksha.app.common.ApiTest; import com.here.naksha.app.common.NakshaTestWebClient; import com.here.naksha.app.common.assertions.ResponseAssertions; import com.here.naksha.lib.core.models.geojson.implementation.XyzFeature; -import com.here.naksha.lib.core.models.geojson.implementation.XyzFeatureCollection; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import java.io.IOException; import java.net.URISyntaxException; import java.net.http.HttpResponse; -import java.util.List; import java.util.UUID; -import org.jetbrains.annotations.NotNull; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; + +import static com.here.naksha.app.common.CommonApiTestSetup.setupSpaceAndRelatedResources; +import static com.here.naksha.app.common.TestUtil.*; +import static org.junit.jupiter.api.Assertions.assertNotNull; class ReadFeaturesByIdsTest extends ApiTest { @@ -61,7 +58,7 @@ void tc0400_testReadFeaturesByIds() throws Exception { loadFileOrFail("ReadFeatures/ByIds/TC0400_ExistingAndMissingIds/feature_response_part.json"); String streamId = UUID.randomUUID().toString(); - // When: Create Features request is submitted to NakshaHub Space Storage instance + // When: Get Features request is submitted to NakshaHub Space Storage instance HttpResponse response = getNakshaClient().get("hub/spaces/" + SPACE_ID + "/features?" + idsQueryParam, streamId); // Then: Perform assertions @@ -83,7 +80,7 @@ void tc0401_testReadFeaturesForMissingIds() throws Exception { loadFileOrFail("ReadFeatures/ByIds/TC0401_MissingIds/feature_response_part.json"); String streamId = UUID.randomUUID().toString(); - // When: Create Features request is submitted to NakshaHub Space Storage instance + // When: Get Features request is submitted to NakshaHub Space Storage instance HttpResponse response = getNakshaClient().get("hub/spaces/" + SPACE_ID + "/features" + idsQueryParam, streamId); // Then: Perform assertions @@ -102,7 +99,7 @@ void tc0402_testReadFeaturesWithoutIds() throws Exception { loadFileOrFail("ReadFeatures/ByIds/TC0402_WithoutIds/feature_response_part.json"); String streamId = UUID.randomUUID().toString(); - // When: Create Features request is submitted to NakshaHub Space Storage instance + // When: Get Features request is submitted to NakshaHub Space Storage instance HttpResponse response = getNakshaClient().get("hub/spaces/" + SPACE_ID + "/features", streamId); // Then: Perform assertions @@ -123,7 +120,7 @@ void tc0403_testReadFeaturesByIdsFromMissingSpace() throws Exception { loadFileOrFail("ReadFeatures/ByIds/TC0403_ByIdsFromMissingSpace/feature_response_part.json"); final String streamId = UUID.randomUUID().toString(); - // When: Create Features request is submitted to NakshaHub Space Storage instance + // When: Get Features request is submitted to NakshaHub Space Storage instance final HttpResponse response = getNakshaClient().get("hub/spaces/" + missingSpaceId + "/features?" + idsQueryParam, streamId); // Then: Perform assertions @@ -143,7 +140,7 @@ void tc0404_testReadFeatureById() throws Exception { loadFileOrFail("ReadFeatures/ByIds/TC0404_ExistingId/feature_response_part.json"); final String streamId = UUID.randomUUID().toString(); - // When: Create Features request is submitted to NakshaHub Space Storage instance + // When: Get Features request is submitted to NakshaHub Space Storage instance final HttpResponse response = getNakshaClient().get("hub/spaces/" + SPACE_ID + "/features/" + featureId, streamId); // Then: Perform assertions @@ -168,7 +165,7 @@ void tc0405_testReadFeatureForMissingId() throws Exception { loadFileOrFail("ReadFeatures/ByIds/TC0405_MissingId/feature_response_part.json"); final String streamId = UUID.randomUUID().toString(); - // When: Create Features request is submitted to NakshaHub Space Storage instance + // When: Get Features request is submitted to NakshaHub Space Storage instance final HttpResponse response = getNakshaClient().get("hub/spaces/" + SPACE_ID + "/features/" + featureId, streamId); // Then: Perform assertions @@ -189,7 +186,7 @@ void tc0406_testReadFeatureByIdFromMissingSpace() throws Exception { loadFileOrFail("ReadFeatures/ByIds/TC0406_ByIdFromMissingSpace/feature_response_part.json"); final String streamId = UUID.randomUUID().toString(); - // When: Create Features request is submitted to NakshaHub Space Storage instance + // When: Get Features request is submitted to NakshaHub Space Storage instance final HttpResponse response = getNakshaClient().get("hub/spaces/" + missingSpaceId + "/features/" + featureId, streamId); // Then: Perform assertions @@ -209,7 +206,7 @@ void tc0407_testReadFeaturesWithCommaSeparatedIds() throws Exception { loadFileOrFail("ReadFeatures/ByIds/TC0407_CommaSeparatedIds/feature_response_part.json"); final String streamId = UUID.randomUUID().toString(); - // When: Create Features request is submitted to NakshaHub Space Storage instance + // When: Get Features request is submitted to NakshaHub Space Storage instance final HttpResponse response = getNakshaClient().get("hub/spaces/" + SPACE_ID + "/features?" + idsQueryParam, streamId); // Then: Perform assertions @@ -221,4 +218,114 @@ void tc0407_testReadFeaturesWithCommaSeparatedIds() throws Exception { ; } + @Test + void tc0408_withPropSelection() throws Exception { + // Test API : GET /hub/spaces/{spaceId}/features + // Validate features getting returned for Ids provided, in which only selected properties are returned + // Given: Features By Ids request (against existing space) + final String idsQueryParam = "id=my-custom-id-400-1,my-custom-id-400-2"; + final String streamId = UUID.randomUUID().toString(); + final String expectedBodyPart = + loadFileOrFail("ReadFeatures/ByIds/TC0408_withPropSelection/feature_response_part.json") + .replaceAll("\\{\\{streamId}}",streamId); + final String selectionParams = "selection=p.speedLimit,%s".formatted(urlEncoded("p.@ns:com:here:xyz.tags")); + + // When: Get Features request is submitted to NakshaHub Space Storage instance + final HttpResponse response = getNakshaClient().get("hub/spaces/" + SPACE_ID + "/features?" + idsQueryParam + "&" + selectionParams, streamId); + + // Then: Perform assertions + ResponseAssertions.assertThat(response) + .hasStatus(200) + .hasJsonBody(expectedBodyPart, "Get Feature response body doesn't match",false) + ; + } + + @Test + void tc0409_withWrongPropSelection() throws Exception { + // Test API : GET /hub/spaces/{spaceId}/features + // Validate features getting returned for Ids provided, in which none of selected properties exist + // Given: Features By Ids request (against existing space) + final String idsQueryParam = "id=my-custom-id-400-1,my-custom-id-400-2"; + final String streamId = UUID.randomUUID().toString(); + final String expectedBodyPart = + loadFileOrFail("ReadFeatures/ByIds/TC0409_withWrongPropSelection/feature_response_part.json") + .replaceAll("\\{\\{streamId}}",streamId); + final String selectionParams = "selection=p.unknown_prop,p.not_existing_prop"; + + // When: Get Features request is submitted to NakshaHub Space Storage instance + final HttpResponse response = getNakshaClient().get("hub/spaces/" + SPACE_ID + "/features?" + idsQueryParam + "&" + selectionParams, streamId); + + // Then: Perform assertions + ResponseAssertions.assertThat(response) + .hasStatus(200) + .hasJsonBody(expectedBodyPart, "Get Feature response body doesn't match",false) + ; + } + + @Test + void tc0410_withWrongDelimiterPropSelection() throws Exception { + // Test API : GET /hub/spaces/{spaceId}/features + // Validate features getting returned for Ids provided, in which selection parameter is wrong + // Given: Features By Ids request (against existing space) + final String idsQueryParam = "id=my-custom-id-400-1,my-custom-id-400-2"; + final String streamId = UUID.randomUUID().toString(); + final String expectedBodyPart = + loadFileOrFail("ReadFeatures/ByIds/TC0410_withWrongDelimiterPropSelection/feature_response_part.json") + .replaceAll("\\{\\{streamId}}",streamId); + final String selectionParams = "selection=p.unknown_prop+p.not_existing_prop"; + + // When: Get Features request is submitted to NakshaHub Space Storage instance + final HttpResponse response = getNakshaClient().get("hub/spaces/" + SPACE_ID + "/features?" + idsQueryParam + "&" + selectionParams, streamId); + + // Then: Perform assertions + ResponseAssertions.assertThat(response) + .hasStatus(400) + .hasJsonBody(expectedBodyPart, "Get Feature response body doesn't match",false) + ; + } + + @Test + void tc0411_BySingleIdWithPropSelection() throws Exception { + // Test API : GET /hub/spaces/{spaceId}/features/{featureId} + // Validate feature getting returned for given Id, with property selection + // one prop in complicated URI encoded format, one not existing + // Given: Feature By Id request (against already existing space) + final String featureId = "my-custom-id-400-1"; + final String streamId = UUID.randomUUID().toString(); + final String expectedBodyPart = + loadFileOrFail("ReadFeatures/ByIds/TC0411_BySingleIdWithPropSelection/response.json"); + final String selectionParams = "selection=p.unknown_prop,%s".formatted(urlEncoded("p.@ns:com:here:xyz.tags")); + + + // When: Get Features request is submitted to NakshaHub Space Storage instance + final HttpResponse response = getNakshaClient().get("hub/spaces/" + SPACE_ID + "/features/" + featureId+"?"+selectionParams, streamId); + + // Then: Perform assertions + ResponseAssertions.assertThat(response) + .hasStatus(200) + .hasStreamIdHeader(streamId) + .hasJsonBody(expectedBodyPart, "Get Feature response body doesn't match",true); + } + + @Test + void tc0412_BySingleIdWithInvalidDelimiterPropSelection() throws Exception { + // Test API : GET /hub/spaces/{spaceId}/features/{featureId} + // Validate feature getting returned for given Id, with property selection and wrong delimiter + // Given: Feature By Id request (against already existing space) + final String featureId = "my-custom-id-400-1"; + final String streamId = UUID.randomUUID().toString(); + final String expectedBodyPart = + loadFileOrFail("ReadFeatures/ByIds/TC0412_BySingleIdWithInvalidDelimiterPropSelection/response.json"); + final String selectionParams = "selection=p.unknown_prop+%s".formatted(urlEncoded("p.@ns:com:here:xyz.tags")); + + + // When: Get Features request is submitted to NakshaHub Space Storage instance + final HttpResponse response = getNakshaClient().get("hub/spaces/" + SPACE_ID + "/features/" + featureId+"?"+selectionParams, streamId); + + // Then: Perform assertions + ResponseAssertions.assertThat(response) + .hasStatus(400) + .hasStreamIdHeader(streamId) + .hasJsonBody(expectedBodyPart, "Get Feature response body doesn't match"); + } } diff --git a/here-naksha-app-service/src/test/java/com/here/naksha/app/service/ReadFeaturesByRadiusPostTest.java b/here-naksha-app-service/src/test/java/com/here/naksha/app/service/ReadFeaturesByRadiusPostTest.java index 951afcad6..2160dccd8 100644 --- a/here-naksha-app-service/src/test/java/com/here/naksha/app/service/ReadFeaturesByRadiusPostTest.java +++ b/here-naksha-app-service/src/test/java/com/here/naksha/app/service/ReadFeaturesByRadiusPostTest.java @@ -36,6 +36,7 @@ import java.util.stream.Stream; import static com.here.naksha.app.common.CommonApiTestSetup.setupSpaceAndRelatedResources; import static com.here.naksha.app.common.TestUtil.loadFileOrFail; +import static com.here.naksha.app.common.TestUtil.urlEncoded; import static com.here.naksha.app.common.assertions.ResponseAssertions.assertThat; class ReadFeaturesByRadiusPostTest extends ApiTest { @@ -65,6 +66,10 @@ class ReadFeaturesByRadiusPostTest extends ApiTest { TC 8 - No Geometry (should return 400) TC 9 - Point1, radius=-1m (should return 400) TC 10 - LineString, radius=5 (should return features 1,2,3) + TC 11 - Point1, radius=5m, Prop-2 (should return features 2,3 with appropriate selected json prop) + TC 12 - Point1, radius=5m, Prop-2 (should return features 2,3 disregarding invalid prop selection) + TC 13 - Invalid delimiter of prop selection (should return 400) + */ @BeforeAll @@ -167,42 +172,101 @@ private static Stream standardTestParams() { ), "ReadFeatures/ByRadiusPost/TC10_withLineString/feature_response_part.json", 200 + ), + // TC 11 and 12 are in another params set strictJsonTestParams() + standardTestSpec( + "tc13_withInvalidDelimiterPropSelection", + "ReadFeatures/ByRadiusPost/TC13_withInvalidDelimiterPropSelection/request.json", + List.of( + "radius=5", + "p.length=10", + "selection=p.speedLimit+%s".formatted(urlEncoded("p.@ns:com:here:xyz.tags")), + "clip=false" + ), + "ReadFeatures/ByRadiusPost/TC13_withInvalidDelimiterPropSelection/response.json", + 400 ) ); } - @ParameterizedTest - @MethodSource("standardTestParams") - void commonTestExecution( - final @Nullable String fPathOfRequestBody, - final @Nullable List queryParamList, - final @NotNull String fPathOfExpectedResBody, - final int expectedResCode) throws Exception { - // Given: Request parameters - String urlQueryParams = ""; - if (queryParamList!=null && !queryParamList.isEmpty()) { - urlQueryParams += String.join("&", queryParamList); + private static Stream strictJsonTestParams() { + return Stream.of( + standardTestSpec( + "tc11_withPropSelection", + "ReadFeatures/ByRadiusPost/TC11_withPropSelection/request.json", + List.of( + "radius=5", + "p.length=10", + "selection=p.speedLimit,%s".formatted(urlEncoded("p.@ns:com:here:xyz.tags")), + "clip=false" + ), + "ReadFeatures/ByRadiusPost/TC11_withPropSelection/response.json", + 200 + ), + standardTestSpec( + "tc12_withInvalidPropSelection", + "ReadFeatures/ByRadiusPost/TC12_withInvalidPropSelection/request.json", + List.of( + "radius=5", + "p.length=10", + "selection=p.speedLimit,p.unknown_prop" + ), + "ReadFeatures/ByRadiusPost/TC12_withInvalidPropSelection/response.json", + 200 + ) + ); } - final String streamId = UUID.randomUUID().toString(); - // Given: Request body - final String requestBody = (fPathOfRequestBody!=null) ? loadFileOrFail(fPathOfRequestBody) : ""; + void baseTestExecution( + final @Nullable String fPathOfRequestBody, + final @Nullable List queryParamList, + final @NotNull String fPathOfExpectedResBody, + final int expectedResCode, + boolean strictChecking) throws Exception { + // Given: Request parameters + String urlQueryParams = ""; + if (queryParamList!=null && !queryParamList.isEmpty()) { + urlQueryParams += String.join("&", queryParamList); + } + final String streamId = UUID.randomUUID().toString(); - // Given: Expected response body - final String expectedBodyPart = loadFileOrFail(fPathOfExpectedResBody); + // Given: Request body + final String requestBody = (fPathOfRequestBody!=null) ? loadFileOrFail(fPathOfRequestBody) : ""; - // When: Get Features By Radius request is submitted to NakshaHub - final HttpResponse response = nakshaClient - .post("hub/spaces/" + SPACE_ID + "/spatial?" + urlQueryParams, requestBody, streamId); + // Given: Expected response body + final String loadedString = loadFileOrFail(fPathOfExpectedResBody); + final String expectedBodyPart = (strictChecking) ? loadedString.replaceAll("\\{\\{streamId}}",streamId) : loadedString; + // When: Get Features By Radius request is submitted to NakshaHub + final HttpResponse response = nakshaClient + .post("hub/spaces/" + SPACE_ID + "/spatial?" + urlQueryParams, requestBody, streamId); - // Then: Perform standard assertions - assertThat(response) - .hasStatus(expectedResCode) - .hasStreamIdHeader(streamId) - .hasJsonBody(expectedBodyPart, "Response body doesn't match"); - } + // Then: Perform standard assertions + assertThat(response) + .hasStatus(expectedResCode) + .hasStreamIdHeader(streamId) + .hasJsonBody(expectedBodyPart, "Response body doesn't match", strictChecking); + } + @ParameterizedTest + @MethodSource("strictJsonTestParams") + void strictResponseTestExecution( + final @Nullable String fPathOfRequestBody, + final @Nullable List queryParamList, + final @NotNull String fPathOfExpectedResBody, + final int expectedResCode) throws Exception { + baseTestExecution(fPathOfRequestBody,queryParamList,fPathOfExpectedResBody,expectedResCode,true); + } + + @ParameterizedTest + @MethodSource("standardTestParams") + void commonTestExecution( + final @Nullable String fPathOfRequestBody, + final @Nullable List queryParamList, + final @NotNull String fPathOfExpectedResBody, + final int expectedResCode) throws Exception { + baseTestExecution(fPathOfRequestBody,queryParamList,fPathOfExpectedResBody,expectedResCode,false); + } @Test void tc06_testGetByRadiusPostWithPointRadiusLimit() throws Exception { diff --git a/here-naksha-app-service/src/test/java/com/here/naksha/app/service/SearchFeaturesTest.java b/here-naksha-app-service/src/test/java/com/here/naksha/app/service/SearchFeaturesTest.java index 2867c0435..d78a7f1f1 100644 --- a/here-naksha-app-service/src/test/java/com/here/naksha/app/service/SearchFeaturesTest.java +++ b/here-naksha-app-service/src/test/java/com/here/naksha/app/service/SearchFeaturesTest.java @@ -20,6 +20,7 @@ import static com.here.naksha.app.common.CommonApiTestSetup.setupSpaceAndRelatedResources; import static com.here.naksha.app.common.TestUtil.loadFileOrFail; +import static com.here.naksha.app.common.TestUtil.urlEncoded; import com.here.naksha.app.common.ApiTest; import com.here.naksha.app.common.NakshaTestWebClient; @@ -46,7 +47,7 @@ static void setup() throws URISyntaxException, IOException, InterruptedException } @Test - void tc1000_testSearchFeatures() throws URISyntaxException, InterruptedException, JSONException, IOException { + void tc1000_testSearchFeatures() throws URISyntaxException, InterruptedException, IOException { // Test API : GET /hub/spaces/{spaceId}/search // Validate features getting returned for given Tag filter parameters // Given: search query @@ -65,7 +66,7 @@ void tc1000_testSearchFeatures() throws URISyntaxException, InterruptedException } @Test - void tc1001_testSearchNoResults() throws URISyntaxException, IOException, InterruptedException, JSONException { + void tc1001_testSearchNoResults() throws URISyntaxException, IOException, InterruptedException { // Given: search query not matching saved features final String tagsQueryParam = "tags=seven"; final String expectedBodyPart = @@ -84,7 +85,7 @@ void tc1001_testSearchNoResults() throws URISyntaxException, IOException, Interr } @Test - void tc1002_testSearchWrongSpace() throws URISyntaxException, IOException, InterruptedException, JSONException { + void tc1002_testSearchWrongSpace() throws URISyntaxException, IOException, InterruptedException { // Given: search query not matching saved features final String tagsQueryParam = "tags=one"; final String expectedBodyPart = @@ -104,28 +105,31 @@ void tc1002_testSearchWrongSpace() throws URISyntaxException, IOException, Inter } @Test - void tc1003_testSearchWithTagsAndProp() throws URISyntaxException, InterruptedException, JSONException, IOException { + void tc1003_testSearchWithTagsAndProp() throws URISyntaxException, InterruptedException, IOException { // Test API : GET /hub/spaces/{spaceId}/search // Validate features getting returned for given Tag and Property search conditions + // with response displaying only selected properties // Given: search query final String tagsQueryParam = "tags=one+four"; final String propQueryParam = "p.speedLimit='60'"; - final String expectedBodyPart = loadFileOrFail("ReadFeatures/Search/TC1003_searchWithTagsAndProp/search_response.json"); final String streamId = UUID.randomUUID().toString(); + final String selectionParam = "selection=p.speedLimit,%s".formatted(urlEncoded("p.@ns:com:here:xyz.tags")); + final String expectedBodyPart = loadFileOrFail("ReadFeatures/Search/TC1003_searchWithTagsAndProp/search_response.json") + .replaceAll("\\{\\{streamId}}",streamId); // When: Get Features By Tile request is submitted to NakshaHub - final HttpResponse response = nakshaClient.get("hub/spaces/" + SPACE_ID + "/search" + "?" + tagsQueryParam + "&" + propQueryParam, streamId); + final HttpResponse response = nakshaClient.get("hub/spaces/" + SPACE_ID + "/search" + "?" + tagsQueryParam + "&" + propQueryParam + "&" + selectionParam, streamId); // Then: Perform assertions ResponseAssertions.assertThat(response) .hasStatus(200) .hasStreamIdHeader(streamId) - .hasJsonBody(expectedBodyPart, "Get Feature response body doesn't match"); + .hasJsonBody(expectedBodyPart, "Get Feature response body doesn't match",true); } @Test - void tc1004_testSearchWithTagsMatchAndPropDoesNot() throws URISyntaxException, InterruptedException, JSONException, IOException { + void tc1004_testSearchWithTagsMatchAndPropDoesNot() throws URISyntaxException, InterruptedException, IOException { // Test API : GET /hub/spaces/{spaceId}/search // Validate No features returned when Tag filter matches but Property filters don't @@ -146,7 +150,7 @@ void tc1004_testSearchWithTagsMatchAndPropDoesNot() throws URISyntaxException, I } @Test - void tc1005_testSearchWithOnlyPropFilter() throws URISyntaxException, InterruptedException, JSONException, IOException { + void tc1005_testSearchWithOnlyPropFilter() throws URISyntaxException, InterruptedException, IOException { // Test API : GET /hub/spaces/{spaceId}/search // Validate features returned matches with Property filter (even when Tags filter not supplied) @@ -166,7 +170,7 @@ void tc1005_testSearchWithOnlyPropFilter() throws URISyntaxException, Interrupte } @Test - void tc1006_testSearchWithoutFilters() throws URISyntaxException, InterruptedException, JSONException, IOException { + void tc1006_testSearchWithoutFilters() throws URISyntaxException, InterruptedException, IOException { // Test API : GET /hub/spaces/{spaceId}/search // Validate API returns error when neither Tags nor Property filters provided @@ -184,5 +188,48 @@ void tc1006_testSearchWithoutFilters() throws URISyntaxException, InterruptedExc .hasJsonBody(expectedBodyPart, "Get Feature response body doesn't match"); } + @Test + void tc1007_testSearchInvalidPropSelection() throws URISyntaxException, InterruptedException, IOException { + // Test API : GET /hub/spaces/{spaceId}/search + // Validate features getting returned for given Tag and Property search conditions + // with response displaying no properties as the selection property does not exist + + // Given: search query + final String tagsQueryParam = "tags=one+four"; + final String propQueryParam = "p.speedLimit='60'"; + final String selectionParam = "selection=p.unknown_prop"; + final String expectedBodyPart = loadFileOrFail("ReadFeatures/Search/TC1007_testSearchInvalidPropSelection/search_response.json"); + final String streamId = UUID.randomUUID().toString(); + + // When: Get Features By Tile request is submitted to NakshaHub + final HttpResponse response = nakshaClient.get("hub/spaces/" + SPACE_ID + "/search" + "?" + tagsQueryParam + "&" + propQueryParam + "&" + selectionParam, streamId); + // Then: Perform assertions + ResponseAssertions.assertThat(response) + .hasStatus(200) + .hasStreamIdHeader(streamId) + .hasJsonBody(expectedBodyPart, "Get Feature response body doesn't match"); + } + + @Test + void tc1008_testSearchInvalidDelimiterPropSelection() throws URISyntaxException, InterruptedException, IOException { + // Test API : GET /hub/spaces/{spaceId}/search + // Return error result because of wrong delimiter in selection params + + // Given: search query + final String tagsQueryParam = "tags=one+four"; + final String propQueryParam = "p.speedLimit='60'"; + final String selectionParam = "selection=p.speedLimit+%s".formatted(urlEncoded("p.@ns:com:here:xyz.tags")); + final String expectedBodyPart = loadFileOrFail("ReadFeatures/Search/TC1008_testSearchInvalidDelimiterPropSelection/search_response.json"); + final String streamId = UUID.randomUUID().toString(); + + // When: Get Features By Tile request is submitted to NakshaHub + final HttpResponse response = nakshaClient.get("hub/spaces/" + SPACE_ID + "/search" + "?" + tagsQueryParam + "&" + propQueryParam + "&" + selectionParam, streamId); + + // Then: Perform assertions + ResponseAssertions.assertThat(response) + .hasStatus(400) + .hasStreamIdHeader(streamId) + .hasJsonBody(expectedBodyPart, "Get Feature response body doesn't match"); + } } diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0400_ExistingAndMissingIds/feature_response_part.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0400_ExistingAndMissingIds/feature_response_part.json index fd071e707..85e68dc08 100644 --- a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0400_ExistingAndMissingIds/feature_response_part.json +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0400_ExistingAndMissingIds/feature_response_part.json @@ -5,7 +5,11 @@ "id": "my-custom-id-400-1", "type": "Feature", "properties": { - "speedLimit": "60" + "speedLimit": "60", + "filteredOut": "yes", + "@ns:com:here:xyz": { + "tags": [ "selection-test" ] + } }, "geometry": { "type":"Point", @@ -16,7 +20,11 @@ "id": "my-custom-id-400-2", "type": "Feature", "properties": { - "speedLimit": "80" + "speedLimit": "80", + "filteredOut": "yes", + "@ns:com:here:xyz": { + "tags": [ "selection-test" ] + } }, "geometry": { "type":"Point", diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0404_ExistingId/feature_response_part.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0404_ExistingId/feature_response_part.json index 345c3943e..49d12c2a7 100644 --- a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0404_ExistingId/feature_response_part.json +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0404_ExistingId/feature_response_part.json @@ -2,7 +2,11 @@ "id": "my-custom-id-400-1", "type": "Feature", "properties": { - "speedLimit": "60" + "speedLimit": "60", + "filteredOut": "yes", + "@ns:com:here:xyz": { + "tags": [ "selection-test" ] + } }, "geometry": { "type":"Point", diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0407_CommaSeparatedIds/feature_response_part.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0407_CommaSeparatedIds/feature_response_part.json index fd071e707..85e68dc08 100644 --- a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0407_CommaSeparatedIds/feature_response_part.json +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0407_CommaSeparatedIds/feature_response_part.json @@ -5,7 +5,11 @@ "id": "my-custom-id-400-1", "type": "Feature", "properties": { - "speedLimit": "60" + "speedLimit": "60", + "filteredOut": "yes", + "@ns:com:here:xyz": { + "tags": [ "selection-test" ] + } }, "geometry": { "type":"Point", @@ -16,7 +20,11 @@ "id": "my-custom-id-400-2", "type": "Feature", "properties": { - "speedLimit": "80" + "speedLimit": "80", + "filteredOut": "yes", + "@ns:com:here:xyz": { + "tags": [ "selection-test" ] + } }, "geometry": { "type":"Point", diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0408_withPropSelection/feature_response_part.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0408_withPropSelection/feature_response_part.json new file mode 100644 index 000000000..d714daf50 --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0408_withPropSelection/feature_response_part.json @@ -0,0 +1,34 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "id": "my-custom-id-400-1", + "type": "Feature", + "properties": { + "speedLimit": "60", + "@ns:com:here:xyz": { + "tags": [ "selection-test" ] + } + }, + "geometry": { + "type":"Point", + "coordinates":[ 8.68872, 50.0561, 292.94377758] + } + }, + { + "id": "my-custom-id-400-2", + "type": "Feature", + "properties": { + "speedLimit": "80", + "@ns:com:here:xyz": { + "tags": [ "selection-test" ] + } + }, + "geometry": { + "type":"Point", + "coordinates":[ 9.68872, 51.0561, 293.94377758] + } + } + ], + "streamId": "{{streamId}}" +} diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0409_withWrongPropSelection/feature_response_part.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0409_withWrongPropSelection/feature_response_part.json new file mode 100644 index 000000000..e62be3e9d --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0409_withWrongPropSelection/feature_response_part.json @@ -0,0 +1,24 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "id": "my-custom-id-400-1", + "type": "Feature", + "properties": {}, + "geometry": { + "type":"Point", + "coordinates":[ 8.68872, 50.0561, 292.94377758] + } + }, + { + "id": "my-custom-id-400-2", + "type": "Feature", + "properties": {}, + "geometry": { + "type":"Point", + "coordinates":[ 9.68872, 51.0561, 293.94377758] + } + } + ], + "streamId": "{{streamId}}" +} diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0410_withWrongDelimiterPropSelection/feature_response_part.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0410_withWrongDelimiterPropSelection/feature_response_part.json new file mode 100644 index 000000000..d8a90f441 --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0410_withWrongDelimiterPropSelection/feature_response_part.json @@ -0,0 +1,4 @@ +{ + "type": "ErrorResponse", + "error": "IllegalArgument" +} \ No newline at end of file diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0411_BySingleIdWithPropSelection/response.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0411_BySingleIdWithPropSelection/response.json new file mode 100644 index 000000000..c7abb092a --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0411_BySingleIdWithPropSelection/response.json @@ -0,0 +1,13 @@ +{ + "id": "my-custom-id-400-1", + "type": "Feature", + "properties": { + "@ns:com:here:xyz": { + "tags": [ "selection-test" ] + } + }, + "geometry": { + "type":"Point", + "coordinates":[ 8.68872, 50.0561, 292.94377758] + } +} diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0412_BySingleIdWithInvalidDelimiterPropSelection/response.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0412_BySingleIdWithInvalidDelimiterPropSelection/response.json new file mode 100644 index 000000000..d8a90f441 --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/TC0412_BySingleIdWithInvalidDelimiterPropSelection/response.json @@ -0,0 +1,4 @@ +{ + "type": "ErrorResponse", + "error": "IllegalArgument" +} \ No newline at end of file diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/setup/create_features.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/setup/create_features.json index fd071e707..85e68dc08 100644 --- a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/setup/create_features.json +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByIds/setup/create_features.json @@ -5,7 +5,11 @@ "id": "my-custom-id-400-1", "type": "Feature", "properties": { - "speedLimit": "60" + "speedLimit": "60", + "filteredOut": "yes", + "@ns:com:here:xyz": { + "tags": [ "selection-test" ] + } }, "geometry": { "type":"Point", @@ -16,7 +20,11 @@ "id": "my-custom-id-400-2", "type": "Feature", "properties": { - "speedLimit": "80" + "speedLimit": "80", + "filteredOut": "yes", + "@ns:com:here:xyz": { + "tags": [ "selection-test" ] + } }, "geometry": { "type":"Point", diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC11_withPropSelection/request.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC11_withPropSelection/request.json new file mode 100644 index 000000000..89815401d --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC11_withPropSelection/request.json @@ -0,0 +1,4 @@ +{ + "type":"Point", + "coordinates":[ 8.6123, 50.1234, 0.0 ] +} \ No newline at end of file diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC11_withPropSelection/response.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC11_withPropSelection/response.json new file mode 100644 index 000000000..471b419fc --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC11_withPropSelection/response.json @@ -0,0 +1,33 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "id": "my-custom-id-2", + "type": "Feature", + "properties": { + "@ns:com:here:xyz": { + "tags": [ "tag-2", "tag-ref" ] + } + }, + "geometry": { + "type":"Point", + "coordinates":[ 8.61235, 50.1234, 0.0 ] + } + }, + { + "id": "my-custom-id-3", + "type": "Feature", + "properties": { + "speedLimit": "60", + "@ns:com:here:xyz": { + "tags": [ "tag-3", "tag-ref" ] + } + }, + "geometry": { + "type":"Point", + "coordinates":[ 8.61235, 50.1234, 0.0 ] + } + } + ], + "streamId": "{{streamId}}" +} diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC12_withInvalidPropSelection/request.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC12_withInvalidPropSelection/request.json new file mode 100644 index 000000000..89815401d --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC12_withInvalidPropSelection/request.json @@ -0,0 +1,4 @@ +{ + "type":"Point", + "coordinates":[ 8.6123, 50.1234, 0.0 ] +} \ No newline at end of file diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC12_withInvalidPropSelection/response.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC12_withInvalidPropSelection/response.json new file mode 100644 index 000000000..6959d619c --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC12_withInvalidPropSelection/response.json @@ -0,0 +1,26 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "id": "my-custom-id-2", + "type": "Feature", + "properties": {}, + "geometry": { + "type":"Point", + "coordinates":[ 8.61235, 50.1234, 0.0 ] + } + }, + { + "id": "my-custom-id-3", + "type": "Feature", + "properties": { + "speedLimit": "60" + }, + "geometry": { + "type":"Point", + "coordinates":[ 8.61235, 50.1234, 0.0 ] + } + } + ], + "streamId": "{{streamId}}" +} diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC13_withInvalidDelimiterPropSelection/request.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC13_withInvalidDelimiterPropSelection/request.json new file mode 100644 index 000000000..89815401d --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC13_withInvalidDelimiterPropSelection/request.json @@ -0,0 +1,4 @@ +{ + "type":"Point", + "coordinates":[ 8.6123, 50.1234, 0.0 ] +} \ No newline at end of file diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC13_withInvalidDelimiterPropSelection/response.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC13_withInvalidDelimiterPropSelection/response.json new file mode 100644 index 000000000..d8a90f441 --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/ByRadiusPost/TC13_withInvalidDelimiterPropSelection/response.json @@ -0,0 +1,4 @@ +{ + "type": "ErrorResponse", + "error": "IllegalArgument" +} \ No newline at end of file diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1100_allInSinglePage/iterate_response.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1100_allInSinglePage/iterate_response.json index a382cb75e..73f461bda 100644 --- a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1100_allInSinglePage/iterate_response.json +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1100_allInSinglePage/iterate_response.json @@ -6,6 +6,7 @@ "type": "Feature", "properties": { "speedLimit": "30", + "filteredOut": "yes", "@ns:com:here:xyz": { "tags": [ "one" ] } @@ -20,6 +21,7 @@ "type": "Feature", "properties": { "speedLimit": "40", + "filteredOut": "yes", "@ns:com:here:xyz": { "tags": [ "one", "two" ] } diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1101_inTwoPages/iterate_response_1.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1101_inTwoPages/iterate_response_1.json index f5358f0af..b79d182bf 100644 --- a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1101_inTwoPages/iterate_response_1.json +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1101_inTwoPages/iterate_response_1.json @@ -7,6 +7,7 @@ "type": "Feature", "properties": { "speedLimit": "30", + "filteredOut": "yes", "@ns:com:here:xyz": { "tags": [ "one" ] } @@ -21,6 +22,7 @@ "type": "Feature", "properties": { "speedLimit": "40", + "filteredOut": "yes", "@ns:com:here:xyz": { "tags": [ "one", "two" ] } diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1102_inThreePages/iterate_response_1.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1102_inThreePages/iterate_response_1.json index 5bcb915ea..300e7e79b 100644 --- a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1102_inThreePages/iterate_response_1.json +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1102_inThreePages/iterate_response_1.json @@ -7,6 +7,7 @@ "type": "Feature", "properties": { "speedLimit": "30", + "filteredOut": "yes", "@ns:com:here:xyz": { "tags": [ "one" ] } @@ -21,6 +22,7 @@ "type": "Feature", "properties": { "speedLimit": "40", + "filteredOut": "yes", "@ns:com:here:xyz": { "tags": [ "one", "two" ] } diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1104_testIterateInTwoPagesWithPropSelection/iterate_response_1.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1104_testIterateInTwoPagesWithPropSelection/iterate_response_1.json new file mode 100644 index 000000000..ad97f04cf --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1104_testIterateInTwoPagesWithPropSelection/iterate_response_1.json @@ -0,0 +1,49 @@ +{ + "type": "FeatureCollection", + "nextPageToken": "eyJsaW1pdCI6Mywib2Zmc2V0IjozfQ==", + "features": [ + { + "id": "feature_1", + "type": "Feature", + "properties": { + "speedLimit": "30", + "@ns:com:here:xyz": { + "tags": [ "one" ] + } + }, + "geometry": { + "type":"Point", + "coordinates":[ 8.6123, 50.1234, 0.0 ] + } + }, + { + "id": "feature_2", + "type": "Feature", + "properties": { + "speedLimit": "40", + "@ns:com:here:xyz": { + "tags": [ "one", "two" ] + } + }, + "geometry": { + "type":"Point", + "coordinates":[ 8.6123, 50.1234, 0.0 ] + } + }, + { + "id": "feature_3", + "type": "Feature", + "properties": { + "speedLimit": "50", + "@ns:com:here:xyz": { + "tags": [ "one", "two", "three" ] + } + }, + "geometry": { + "type":"Point", + "coordinates":[ 8.6578, 50.1234, 0.0 ] + } + } + ], + "streamId": "{{streamId}}" +} \ No newline at end of file diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1104_testIterateInTwoPagesWithPropSelection/iterate_response_2.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1104_testIterateInTwoPagesWithPropSelection/iterate_response_2.json new file mode 100644 index 000000000..d8a90f441 --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/TC1104_testIterateInTwoPagesWithPropSelection/iterate_response_2.json @@ -0,0 +1,4 @@ +{ + "type": "ErrorResponse", + "error": "IllegalArgument" +} \ No newline at end of file diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/setup/create_features.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/setup/create_features.json index ed0a93d56..8efd95bf6 100644 --- a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/setup/create_features.json +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Iterate/setup/create_features.json @@ -6,6 +6,7 @@ "type": "Feature", "properties": { "speedLimit": "30", + "filteredOut": "yes", "@ns:com:here:xyz": { "tags": [ "one" ] } @@ -19,6 +20,7 @@ "id": "feature_2", "type": "Feature", "properties": { + "filteredOut": "yes", "speedLimit": "40", "@ns:com:here:xyz": { "tags": [ "one", "two" ] diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1000_search/search_response.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1000_search/search_response.json index c6cccf484..c4484b529 100644 --- a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1000_search/search_response.json +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1000_search/search_response.json @@ -20,6 +20,7 @@ "type": "Feature", "properties": { "speedLimit": "60", + "filteredOut": "yes", "@ns:com:here:xyz": { "tags": [ "one", "two", "three", "four", "five", "six" ] } diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1003_searchWithTagsAndProp/search_response.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1003_searchWithTagsAndProp/search_response.json index ff23344d1..4ae50af30 100644 --- a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1003_searchWithTagsAndProp/search_response.json +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1003_searchWithTagsAndProp/search_response.json @@ -15,5 +15,6 @@ "coordinates":[ 8.6578, 50.1234, 0.0 ] } } - ] + ], + "streamId": "{{streamId}}" } \ No newline at end of file diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1007_testSearchInvalidPropSelection/search_response.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1007_testSearchInvalidPropSelection/search_response.json new file mode 100644 index 000000000..14b4537ca --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1007_testSearchInvalidPropSelection/search_response.json @@ -0,0 +1,14 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "id": "tc_900_feature_3", + "type": "Feature", + "properties": {}, + "geometry": { + "type":"Point", + "coordinates":[ 8.6578, 50.1234, 0.0 ] + } + } + ] +} \ No newline at end of file diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1008_testSearchInvalidDelimiterPropSelection/search_response.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1008_testSearchInvalidDelimiterPropSelection/search_response.json new file mode 100644 index 000000000..d8a90f441 --- /dev/null +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/TC1008_testSearchInvalidDelimiterPropSelection/search_response.json @@ -0,0 +1,4 @@ +{ + "type": "ErrorResponse", + "error": "IllegalArgument" +} \ No newline at end of file diff --git a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/setup/create_features.json b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/setup/create_features.json index a320d1638..1a0ae29f1 100644 --- a/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/setup/create_features.json +++ b/here-naksha-app-service/src/test/resources/unit_test_data/ReadFeatures/Search/setup/create_features.json @@ -34,6 +34,7 @@ "type": "Feature", "properties": { "speedLimit": "60", + "filteredOut": "yes", "@ns:com:here:xyz": { "tags": [ "one", "two", "three", "four", "five", "six" ] }