From a09793bd0f45381a8b1b464d514af4774c1ac791 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Mon, 9 Sep 2024 10:52:45 +0200 Subject: [PATCH] Regenerate APIs, update tests --- .../apis/gtfs/generated/GraphQLTypes.java | 40 +++++++++---------- .../PassThroughLocationMapper.java | 4 +- .../LegacyRouteRequestMapperTest.java | 2 +- .../PassThroughLocationMapperTest.java | 8 ++-- .../apis/gtfs/queries/plan-extended.graphql | 4 +- 5 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java b/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java index bd8a6cc465b..3744868d275 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java +++ b/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLTypes.java @@ -5073,51 +5073,51 @@ public enum GraphQLVertexType { TRANSIT, } - public static class GraphQLViaElementInput { + public static class GraphQLViaLocationInput { - private List placeIds; + private List locationIds; - public GraphQLViaElementInput(Map args) { + public GraphQLViaLocationInput(Map args) { if (args != null) { - this.placeIds = (List) args.get("placeIds"); + this.locationIds = (List) args.get("locationIds"); } } - public List getGraphQLPlaceIds() { - return this.placeIds; + public List getGraphQLLocationIds() { + return this.locationIds; } - public void setGraphQLPlaceIds(List placeIds) { - this.placeIds = placeIds; + public void setGraphQLLocationIds(List locationIds) { + this.locationIds = locationIds; } } public static class GraphQLViaPointInput { - private GraphQLViaElementInput element; - private String name; + private String label; + private GraphQLViaLocationInput place; public GraphQLViaPointInput(Map args) { if (args != null) { - this.element = new GraphQLViaElementInput((Map) args.get("element")); - this.name = (String) args.get("name"); + this.label = (String) args.get("label"); + this.place = new GraphQLViaLocationInput((Map) args.get("place")); } } - public GraphQLViaElementInput getGraphQLElement() { - return this.element; + public String getGraphQLLabel() { + return this.label; } - public String getGraphQLName() { - return this.name; + public GraphQLViaLocationInput getGraphQLPlace() { + return this.place; } - public void setGraphQLElement(GraphQLViaElementInput element) { - this.element = element; + public void setGraphQLLabel(String label) { + this.label = label; } - public void setGraphQLName(String name) { - this.name = name; + public void setGraphQLPlace(GraphQLViaLocationInput place) { + this.place = place; } } diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/PassThroughLocationMapper.java b/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/PassThroughLocationMapper.java index 5eb6a8b2e2c..370bc2c3917 100644 --- a/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/PassThroughLocationMapper.java +++ b/src/main/java/org/opentripplanner/apis/gtfs/mapping/routerequest/PassThroughLocationMapper.java @@ -22,8 +22,8 @@ private static PassThroughPoint handlePoint( final TransitService transitService, Map map ) { - Map element = (Map) map.get("element"); - List stops = (List) element.get("placeIds"); + Map element = (Map) map.get("place"); + List stops = (List) element.get("locationIds"); final String name = (String) element.get("name"); if (stops == null || stops.isEmpty()) { diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java b/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java index 52df026a3f8..385242a49d0 100644 --- a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java +++ b/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java @@ -265,7 +265,7 @@ void transferSlack() { void passThroughPoints() { Map arguments = Map.of( "viaPoints", - List.of(Map.of("element", Map.of("placeIds", List.of("F:stop1")))) + List.of(Map.of("place", Map.of("locationIds", List.of("F:stop1")))) ); var routeRequest = LegacyRouteRequestMapper.toRouteRequest( diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/PassThroughLocationMapperTest.java b/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/PassThroughLocationMapperTest.java index e26c728d4d0..fd2126496ac 100644 --- a/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/PassThroughLocationMapperTest.java +++ b/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/PassThroughLocationMapperTest.java @@ -16,11 +16,11 @@ class PassThroughLocationMapperTest { public static List>> failureCases() { return List.of( - List.of(Map.of("element", Map.of("placeIds", List.of("fantasy:id")))), - List.of(Map.of("element", Map.of("placeIds", List.of()))), + List.of(Map.of("place", Map.of("locationIds", List.of("fantasy:id")))), + List.of(Map.of("place", Map.of("locationIds", List.of()))), List.of( - Map.of("element", Map.of("placeIds", List.of())), - Map.of("element", Map.of("placeIds", List.of())) + Map.of("place", Map.of("locationIds", List.of())), + Map.of("place", Map.of("locationIds", List.of())) ) ); } diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-extended.graphql b/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-extended.graphql index bbb1d5f4a56..6970b59140c 100644 --- a/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-extended.graphql +++ b/src/test/resources/org/opentripplanner/apis/gtfs/queries/plan-extended.graphql @@ -10,7 +10,9 @@ filters: [{ select: [{ tags: ["e"] }] }] } transportModes: [{ mode: CAR, qualifier: HAIL }] - viaPoints: [{ name: "Flower shop", element: { placeIds: ["F:A", "F:B"] } }] + viaPoints: [ + { label: "Flower shop", place: { locationIds: ["F:A", "F:B"] } } + ] ) { itineraries { start