diff --git a/pom.xml b/pom.xml index 3513273629..3d90533157 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,7 @@ 1.12.772 2.25.8 - 4.4.9 + 4.5.14 30.1 1.19.0 2.15.2 diff --git a/xyz-hub-service/src/main/java/io/vertx/openapi/contract/MediaType.java b/xyz-hub-service/src/main/java/io/vertx/openapi/contract/MediaType.java index 8302ef1902..8d2289f6ab 100644 --- a/xyz-hub-service/src/main/java/io/vertx/openapi/contract/MediaType.java +++ b/xyz-hub-service/src/main/java/io/vertx/openapi/contract/MediaType.java @@ -6,19 +6,17 @@ import java.util.Arrays; import java.util.List; -/** - * This interface represents the most important attributes of an OpenAPI Operation. - *
- * Operation V3.1 - *
- * Operation V3.0 - */ public interface MediaType extends OpenAPIObject { + String APPLICATION_HAL_JSON = "application/hal+json"; String APPLICATION_JSON = HttpHeaderValues.APPLICATION_JSON.toString(); String APPLICATION_JSON_UTF8 = APPLICATION_JSON + "; charset=utf-8"; - List SUPPORTED_MEDIA_TYPES = Arrays.asList(APPLICATION_JSON, + String MULTIPART_FORM_DATA = HttpHeaderValues.MULTIPART_FORM_DATA.toString(); + List SUPPORTED_MEDIA_TYPES = Arrays.asList( + APPLICATION_JSON, APPLICATION_JSON_UTF8, + MULTIPART_FORM_DATA, + APPLICATION_HAL_JSON, "application/vnd.here.changeset-collection", "application/vnd.here.changeset", "application/vnd.here.compact-changeset", diff --git a/xyz-hub-test/src/test/java/com/here/xyz/hub/rest/LimitsTestIT.java b/xyz-hub-test/src/test/java/com/here/xyz/hub/rest/LimitsTestIT.java index edd2c825a1..d4c39c6272 100644 --- a/xyz-hub-test/src/test/java/com/here/xyz/hub/rest/LimitsTestIT.java +++ b/xyz-hub-test/src/test/java/com/here/xyz/hub/rest/LimitsTestIT.java @@ -26,12 +26,16 @@ import static io.restassured.RestAssured.given; import static org.hamcrest.Matchers.equalTo; +import com.here.xyz.jobs.steps.impl.transport.ImportFilesToSpace; import io.restassured.response.ValidatableResponse; +import org.apache.commons.lang3.RandomStringUtils; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import java.util.Random; + public class LimitsTestIT extends TestSpaceWithFeature { private String cleanUpId; @@ -94,6 +98,38 @@ public void addMultipleFeatures() throws InterruptedException { statusCode(FORBIDDEN.code()); } + @Test + public void addMoreThen10Mb() throws InterruptedException { + int featureCount = 1024*12; // around 12 megabytes + var content = generateFeatureCollection(featureCount); + var headers = getAuthHeaders(AuthProfile.ACCESS_ALL); + var response = given(). + accept(APPLICATION_GEO_JSON). + contentType(APPLICATION_GEO_JSON). + headers(headers). + body(content). + when().post("/spaces/x-psql-test/features"); + response.then().statusCode(OK.code()); + } + + private String generateFeatureCollection(int count) { + String content = "{\"type\":\"FeatureCollection\",\"features\":["; + for (int i = 0; i < count; i++) { + content += generateContentLine(i); + if (i < count - 1) { + content += ","; + } + } + content += "]}"; + return content; + } + + private String generateContentLine(int id) { + Random rd = new Random(); + String randomString = RandomStringUtils.randomAlphanumeric(900); + return "{\"id\":\""+id+"\",\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":["+(rd.nextInt(179))+"."+(rd.nextInt(100))+","+(rd.nextInt(79))+"."+(rd.nextInt(100))+"]},\"properties\":{\"test\":\""+ randomString+"\"}}"; + } + @Test public void add1Feature() { given(). diff --git a/xyz-jobs/README.md b/xyz-jobs/README.md index f5ed831550..98a1e8e716 100644 --- a/xyz-jobs/README.md +++ b/xyz-jobs/README.md @@ -8,5 +8,6 @@ A framework that can be used to perform long-running jobs (e.g., bulk import / e 2. Build & deploy the Job Step Lambda into the localstack by running the run-config `xyz-job-steps [install]` 3. Start the XYZ Hub Service by running the run-config `HubService` 4. Start the XYZ Job Service by running the run-config `JobService` +5. Optional run `CService` Optionally: Start the JobPlayground by running `JobPlayground#main()` \ No newline at end of file diff --git a/xyz-util/src/main/java/com/here/xyz/util/service/BaseHttpServerVerticle.java b/xyz-util/src/main/java/com/here/xyz/util/service/BaseHttpServerVerticle.java index 45642a5e5d..1b71289e27 100644 --- a/xyz-util/src/main/java/com/here/xyz/util/service/BaseHttpServerVerticle.java +++ b/xyz-util/src/main/java/com/here/xyz/util/service/BaseHttpServerVerticle.java @@ -338,10 +338,12 @@ else if (t instanceof BadRequestException) protected void addDefaultHandlers(Router router) { //Add additional handler to the router router.route().failureHandler(createFailureHandler()); + var bodyHandler = BodyHandler.create(); + bodyHandler.setBodyLimit(-1); // set for unlime by body size, default value 10 megabytes // starts at the 2nd route, since the first one is automatically added from openapi's RouterBuilder.createRouter router.route().order(1) .handler(createCorsHandler()) - .handler(BodyHandler.create()) + .handler(bodyHandler) .handler(createReceiveHandler()) .handler(createMaxRequestSizeHandler()); }