|
26 | 26 | import static io.restassured.RestAssured.given; |
27 | 27 | import static org.hamcrest.Matchers.equalTo; |
28 | 28 |
|
| 29 | +import com.here.xyz.jobs.steps.impl.transport.ImportFilesToSpace; |
29 | 30 | import io.restassured.response.ValidatableResponse; |
| 31 | +import org.apache.commons.lang3.RandomStringUtils; |
30 | 32 | import org.junit.After; |
31 | 33 | import org.junit.Before; |
32 | 34 | import org.junit.BeforeClass; |
33 | 35 | import org.junit.Test; |
34 | 36 |
|
| 37 | +import java.util.Random; |
| 38 | + |
35 | 39 | public class LimitsTestIT extends TestSpaceWithFeature { |
36 | 40 |
|
37 | 41 | private String cleanUpId; |
@@ -94,6 +98,38 @@ public void addMultipleFeatures() throws InterruptedException { |
94 | 98 | statusCode(FORBIDDEN.code()); |
95 | 99 | } |
96 | 100 |
|
| 101 | + @Test |
| 102 | + public void addMoreThen10Mb() throws InterruptedException { |
| 103 | + int featureCount = 1024*12; // around 12 megabytes |
| 104 | + var content = generateFeatureCollection(featureCount); |
| 105 | + var headers = getAuthHeaders(AuthProfile.ACCESS_ALL); |
| 106 | + var response = given(). |
| 107 | + accept(APPLICATION_GEO_JSON). |
| 108 | + contentType(APPLICATION_GEO_JSON). |
| 109 | + headers(headers). |
| 110 | + body(content). |
| 111 | + when().post("/spaces/x-psql-test/features"); |
| 112 | + response.then().statusCode(OK.code()); |
| 113 | + } |
| 114 | + |
| 115 | + private String generateFeatureCollection(int count) { |
| 116 | + String content = "{\"type\":\"FeatureCollection\",\"features\":["; |
| 117 | + for (int i = 0; i < count; i++) { |
| 118 | + content += generateContentLine(i); |
| 119 | + if (i < count - 1) { |
| 120 | + content += ","; |
| 121 | + } |
| 122 | + } |
| 123 | + content += "]}"; |
| 124 | + return content; |
| 125 | + } |
| 126 | + |
| 127 | + private String generateContentLine(int id) { |
| 128 | + Random rd = new Random(); |
| 129 | + String randomString = RandomStringUtils.randomAlphanumeric(900); |
| 130 | + return "{\"id\":\""+id+"\",\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":["+(rd.nextInt(179))+"."+(rd.nextInt(100))+","+(rd.nextInt(79))+"."+(rd.nextInt(100))+"]},\"properties\":{\"test\":\""+ randomString+"\"}}"; |
| 131 | + } |
| 132 | + |
97 | 133 | @Test |
98 | 134 | public void add1Feature() { |
99 | 135 | given(). |
|
0 commit comments