From 72eb53817cd4a3ff173242f8465806c554f3005f Mon Sep 17 00:00:00 2001 From: js0ny Date: Fri, 28 Nov 2025 03:45:06 +0000 Subject: [PATCH] test: calcDeliveryPathByGeoJson --- .../Bypass Bayes Centre.bru | 39 ++++++++++++++ .../Bypass RestrictedArea.bru | 39 ++++++++++++++ .../From Appleton Tower.bru | 39 ++++++++++++++ .../Simple- Path.bru} | 4 +- .../Simple.bru} | 2 +- .../Two Points from two service points.bru | 53 +++++++++++++++++++ .../[400] DeliveryPoint in RestrictedArea.bru | 39 ++++++++++++++ .../folder.bru | 8 +++ .../controller/GeoJsonDataController.java | 4 +- 9 files changed, 222 insertions(+), 5 deletions(-) create mode 100644 ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Bypass Bayes Centre.bru create mode 100644 ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Bypass RestrictedArea.bru create mode 100644 ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/From Appleton Tower.bru rename ilp-cw-api/{[POST] queryAvailableDrones/Complex copy copy.bru => [POST] calcDeliveryPath(AsGeoJson)/Simple- Path.bru} (92%) rename ilp-cw-api/{[POST] queryAvailableDrones/Complex copy.bru => [POST] calcDeliveryPath(AsGeoJson)/Simple.bru} (95%) create mode 100644 ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Two Points from two service points.bru create mode 100644 ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/[400] DeliveryPoint in RestrictedArea.bru create mode 100644 ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/folder.bru diff --git a/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Bypass Bayes Centre.bru b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Bypass Bayes Centre.bru new file mode 100644 index 0000000..7084eb7 --- /dev/null +++ b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Bypass Bayes Centre.bru @@ -0,0 +1,39 @@ +meta { + name: Bypass Bayes Centre + type: http + seq: 10 +} + +post { + url: {{API_BASE}}/calcDeliveryPathAsGeoJson + body: json + auth: inherit +} + +body:json { + [ + { + "id": 123, + "date": "2025-12-22", + "time": "14:30", + "requirements": { + "capacity": 0.75, + "heating": true, + "maxCost": 13.5 + }, + "delivery": { + "lng": -3.187543601324762, + "lat":55.94524469728245 + } + } + ] +} + +assert { + res.status: eq 200 +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Bypass RestrictedArea.bru b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Bypass RestrictedArea.bru new file mode 100644 index 0000000..ef4b750 --- /dev/null +++ b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Bypass RestrictedArea.bru @@ -0,0 +1,39 @@ +meta { + name: Bypass RestrictedArea + type: http + seq: 9 +} + +post { + url: {{API_BASE}}/calcDeliveryPathAsGeoJson + body: json + auth: inherit +} + +body:json { + [ + { + "id": 123, + "date": "2025-12-22", + "time": "14:30", + "requirements": { + "capacity": 0.75, + "heating": true, + "maxCost": 13.5 + }, + "delivery": { + "lng": -3.1878363275002357, + "lat":55.94302147870653 + } + } + ] +} + +assert { + res.status: eq 200 +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/From Appleton Tower.bru b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/From Appleton Tower.bru new file mode 100644 index 0000000..32154f1 --- /dev/null +++ b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/From Appleton Tower.bru @@ -0,0 +1,39 @@ +meta { + name: From Appleton Tower + type: http + seq: 6 +} + +post { + url: {{API_BASE}}/calcDeliveryPathAsGeoJson + body: json + auth: inherit +} + +body:json { + [ + { + "id": 123, + "date": "2025-12-22", + "time": "14:30", + "requirements": { + "capacity": 0.75, + "heating": true, + "maxCost": 13.5 + }, + "delivery": { + "lng": -3.186979243145231, + "lat":55.94230336036327 + } + } + ] +} + +assert { + res.status: eq 200 +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/ilp-cw-api/[POST] queryAvailableDrones/Complex copy copy.bru b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Simple- Path.bru similarity index 92% rename from ilp-cw-api/[POST] queryAvailableDrones/Complex copy copy.bru rename to ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Simple- Path.bru index ee46799..976fb1f 100644 --- a/ilp-cw-api/[POST] queryAvailableDrones/Complex copy copy.bru +++ b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Simple- Path.bru @@ -1,7 +1,7 @@ meta { - name: Complex copy copy + name: Simple: Path type: http - seq: 5 + seq: 4 } post { diff --git a/ilp-cw-api/[POST] queryAvailableDrones/Complex copy.bru b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Simple.bru similarity index 95% rename from ilp-cw-api/[POST] queryAvailableDrones/Complex copy.bru rename to ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Simple.bru index 77eba58..27ebae3 100644 --- a/ilp-cw-api/[POST] queryAvailableDrones/Complex copy.bru +++ b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Simple.bru @@ -1,5 +1,5 @@ meta { - name: Complex copy + name: Simple type: http seq: 4 } diff --git a/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Two Points from two service points.bru b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Two Points from two service points.bru new file mode 100644 index 0000000..fe0167e --- /dev/null +++ b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/Two Points from two service points.bru @@ -0,0 +1,53 @@ +meta { + name: Two Points from two service points + type: http + seq: 8 +} + +post { + url: {{API_BASE}}/calcDeliveryPathAsGeoJson + body: json + auth: inherit +} + +body:json { + [ + { + "id": 123, + "date": "2025-12-22", + "time": "14:30", + "requirements": { + "capacity": 0.75, + "heating": true, + "maxCost": 13.5 + }, + "delivery": { + "lng": -3.1878363275002357, + "lat":55.94302147870653 + } + }, + { + "id": 456, + "date": "2025-12-25", + "time": "11:30", + "requirements": { + "capacity": 0.75, + "heating": true, + "maxCost": 13.5 + }, + "delivery": { + "lng": -3.187986659939753, + "lat": 55.97157210129231 + } + } + ] +} + +assert { + res.status: eq 200 +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/[400] DeliveryPoint in RestrictedArea.bru b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/[400] DeliveryPoint in RestrictedArea.bru new file mode 100644 index 0000000..0bde63d --- /dev/null +++ b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/[400] DeliveryPoint in RestrictedArea.bru @@ -0,0 +1,39 @@ +meta { + name: [400] DeliveryPoint in RestrictedArea + type: http + seq: 7 +} + +post { + url: {{API_BASE}}/calcDeliveryPathAsGeoJson + body: json + auth: inherit +} + +body:json { + [ + { + "id": 123, + "date": "2025-12-22", + "time": "14:30", + "requirements": { + "capacity": 0.75, + "heating": true, + "maxCost": 13.5 + }, + "delivery": { + "lng": -3.188779987281663, + "lat": 55.943652825016414 + } + } + ] +} + +assert { + res.status: eq 400 +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/folder.bru b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/folder.bru new file mode 100644 index 0000000..00dfbc8 --- /dev/null +++ b/ilp-cw-api/[POST] calcDeliveryPath(AsGeoJson)/folder.bru @@ -0,0 +1,8 @@ +meta { + name: [POST] calcDeliveryPath(AsGeoJson) + seq: 7 +} + +auth { + mode: inherit +} diff --git a/src/main/java/io/github/js0ny/ilp_coursework/controller/GeoJsonDataController.java b/src/main/java/io/github/js0ny/ilp_coursework/controller/GeoJsonDataController.java index 4002fd5..0f750f2 100644 --- a/src/main/java/io/github/js0ny/ilp_coursework/controller/GeoJsonDataController.java +++ b/src/main/java/io/github/js0ny/ilp_coursework/controller/GeoJsonDataController.java @@ -18,8 +18,8 @@ public class GeoJsonDataController { this.droneInfoService = droneInfoService; } - @GetMapping("/getRestrictedAreaByGeoJson") - public String getRestrictedAreaGeoJson() throws JsonProcessingException { + @GetMapping("/getAllRestrictedAreaByGeoJson") + public String getAllRestrictedAreaGeoJson() throws JsonProcessingException { return droneInfoService.fetchRestrictedAreasInGeoJson().stream().reduce("", String::concat); } }