Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<!-- Dependencies versions -->
<aws-sdk-version>1.12.772</aws-sdk-version>
<aws-sdk2-version>2.25.8</aws-sdk2-version>
<vertx-version>4.4.9</vertx-version>
<vertx-version>4.5.14</vertx-version>
<geo-tools-version>30.1</geo-tools-version>
<jts-version>1.19.0</jts-version>
<jackson-version>2.15.2</jackson-version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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().
Expand Down
1 change: 1 addition & 0 deletions xyz-jobs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Loading