diff --git a/application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoaderTest.java b/application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoaderTest.java new file mode 100644 index 00000000000..3886d90309a --- /dev/null +++ b/application/src/test/java/org/opentripplanner/updater/siri/updater/light/SiriLightHttpLoaderTest.java @@ -0,0 +1,33 @@ +package org.opentripplanner.updater.siri.updater.light; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.time.Duration; +import java.util.List; +import org.junit.jupiter.api.Test; +import org.opentripplanner.test.support.ResourceLoader; +import org.opentripplanner.updater.spi.HttpHeaders; +import uk.org.siri.siri20.NaturalLanguageStringStructure; + +class SiriLightHttpLoaderTest { + + private static final Duration ONE_MIN = Duration.ofMinutes(1); + + @Test + void test() { + var uri = ResourceLoader.of(this).uri("siri-sx.xml"); + var loader = new SiriLightHttpLoader(uri, ONE_MIN, HttpHeaders.empty()); + var siri = loader.fetchETFeed("OTP"); + var delivery = siri.get().getServiceDelivery().getSituationExchangeDeliveries().getFirst(); + var element = delivery.getSituations().getPtSituationElements().getFirst(); + assertEquals( + List.of( + "Hindernis auf Strecke", + "Obstacle on the route", + "Ostacolo sul percorso", + "Ostacul su la via" + ), + element.getReasonNames().stream().map(NaturalLanguageStringStructure::getValue).toList() + ); + } +} diff --git a/application/src/test/resources/org/opentripplanner/updater/siri/updater/light/siri-sx.xml b/application/src/test/resources/org/opentripplanner/updater/siri/updater/light/siri-sx.xml new file mode 100644 index 00000000000..be63b158bc6 --- /dev/null +++ b/application/src/test/resources/org/opentripplanner/updater/siri/updater/light/siri-sx.xml @@ -0,0 +1,243 @@ + + + + 2024-11-27T11:48:04.308988Z + DDIP-M + + 2024-11-27T11:48:04.308988Z + + + 2024-10-04T13:11:34.547+02:00 + STA + 2024-3443167 + 6 + + directReport + + published + + 2024-10-04T13:08:00+02:00 + 2024-11-30T13:08:00+01:00 + + + 2024-10-04T00:00:00+02:00 + 2024-11-30T23:59:00+01:00 + + routeBlockage + Hindernis auf Strecke + Obstacle on the route + Ostacolo sul percorso + Ostacul su la via + 3 + line + de + Straßen-/Streckenhindernis + The busroute: 120 obstacle on the track + 120 Linea 120 . Ostacolo su strada/pista + + + + + it:apb:Line:80120_.24a + 120 + + 28554 + Salorno, Autostazione + + + + + + + + + 2024-10-04T13:08:00+02:00 + 2024-11-30T13:08:00+01:00 + + tripCancellation + normal + + + + + it:apb:Line:80120_.24a + 120 + + 28554 + Salorno, Autostazione + + + + + + + + + + + + line + + + + + it:apb:Line:80120_.24a + 120 + + 28554 + Salorno, Autostazione + + + + + + + + + published + 2024-3443167 + 2024-10-04T13:11:34.547+02:00 + 6 + ControlCenter + STA + general + 3 + + L + + Straßen-/Streckenhindernis + + The busroute: 120 obstacle on the + track + + 120 Linea 120 . Ostacolo su + strada/pista + + + + Hindernis auf Strecke + Obstacle on the route + Ostacolo sul percorso + Ostacul su la via + + + Freitext + Free text + Testo libero + + + + Umsteigen auf andere + Linie + + Change to another line + + Cambiare linea + + + + Dauer der Beeinträchtigung bis + vsl. 2024-11-30 13:08:00 + + + + + + M + + Straßen-/Streckenhindernis + + The busroute: 120 obstacle on the + track + + 120 Linea 120 . Ostacolo su + strada/pista + + + + Hindernis auf Strecke + Obstacle on the route + Ostacolo sul percorso + Ostacul su la via + + + Freitext + Free text + Testo libero + + + + Umsteigen auf andere + Linie + + Change to another line + + Cambiare linea + + + + Dauer der Beeinträchtigung bis + vsl. 2024-11-30 13:08:00 + + + + + + S + + Straßen-/Streckenhindernis + + The busroute: 120 obstacle on the + track + + 120 Linea 120 . Ostacolo su + strada/pista + + + + Hindernis auf Strecke + Obstacle on the route + Ostacolo sul percorso + Ostacul su la via + + + Aufgrund Stand: 04.10.2024 - + 30.11.2024 ; 13:08 + + Due to Update: 04.10.2024 ; + 13:08 + + A causa di Aggiornamento: + 04.10.2024 ; 13:08 + + + + Freitext + Free text + Testo libero + + + + Umsteigen auf andere + Linie + + Change to another line + + Cambiare linea + + + + Dauer der Beeinträchtigung bis + vsl. 2024-11-30 13:08:00 + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/templates/sandbox/siri/SiriUpdater.md b/doc/templates/sandbox/siri/SiriUpdater.md index a9ef179c7c6..d1999e04f7d 100644 --- a/doc/templates/sandbox/siri/SiriUpdater.md +++ b/doc/templates/sandbox/siri/SiriUpdater.md @@ -39,7 +39,8 @@ for GTFS-RT TripUpdates. ### SIRI-SX Light -This updater follows the same definition of SIRI light +This updater follows the same definition of SIRI Light as the SIRI-ET one: it downloads the entire +feed in a single HTTP GET request. diff --git a/doc/user/RouterConfiguration.md b/doc/user/RouterConfiguration.md index 6bf00fb6629..d72cdab3d6f 100644 --- a/doc/user/RouterConfiguration.md +++ b/doc/user/RouterConfiguration.md @@ -881,6 +881,11 @@ Used to group requests when monitoring OTP. "feedId" : "sta", "url" : "https://example.com/siri-lite/estimated-timetable/xml", "fuzzyTripMatching" : true + }, + { + "type" : "siri-sx-light", + "feedId" : "sta", + "url" : "https://example.com/siri-lite/situation-exchange/xml" } ], "rideHailingServices" : [ diff --git a/doc/user/sandbox/siri/SiriAzureUpdater.md b/doc/user/sandbox/siri/SiriAzureUpdater.md index 5dabd8e6c20..76018ffbc7c 100644 --- a/doc/user/sandbox/siri/SiriAzureUpdater.md +++ b/doc/user/sandbox/siri/SiriAzureUpdater.md @@ -198,5 +198,5 @@ Has to be present for authenticationMethod SharedAccessKey. This should be Prima - Initial version (April 2022) - Minor changes in logging (November 2022) - Retry fetch from history endpoint if it failed (February 2023) -- Solve a bug in SIRIAzureETUpdater and improve error logging (March 2023) +- Solve a bug in SiriAzureETUpdater and improve error logging (March 2023) - Add support with federated identity authentication (February 2024) \ No newline at end of file diff --git a/doc/user/sandbox/siri/SiriUpdater.md b/doc/user/sandbox/siri/SiriUpdater.md index 0ce0af57b55..5cc2221289c 100644 --- a/doc/user/sandbox/siri/SiriUpdater.md +++ b/doc/user/sandbox/siri/SiriUpdater.md @@ -174,30 +174,19 @@ for GTFS-RT TripUpdates. -| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | -|----------------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:| -| type = "siri-et-light" | `enum` | The type of the updater. | *Required* | | 1.5 | -| [earlyStart](#u__15__earlyStart) | `duration` | This value is subtracted from the actual validity defined in the message. | *Optional* | `"PT0S"` | 2.0 | -| feedId | `string` | The ID of the feed to apply the updates to. | *Required* | | 2.7 | -| frequency | `duration` | How often the updates should be retrieved. | *Optional* | `"PT1M"` | 2.7 | -| timeout | `duration` | The HTTP timeout to download the updates. | *Optional* | `"PT15S"` | 2.7 | -| [url](#u__15__url) | `uri` | The URL to send the HTTP requests to. | *Required* | | 2.7 | -| [headers](#u__15__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.7 | +| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since | +|----------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:| +| type = "siri-et-light" | `enum` | The type of the updater. | *Required* | | 1.5 | +| feedId | `string` | The ID of the feed to apply the updates to. | *Required* | | 2.7 | +| frequency | `duration` | How often the updates should be retrieved. | *Optional* | `"PT1M"` | 2.7 | +| fuzzyTripMatching | `boolean` | If the fuzzy trip matcher should be used to match trips. | *Optional* | `false` | 2.7 | +| timeout | `duration` | The HTTP timeout to download the updates. | *Optional* | `"PT15S"` | 2.7 | +| [url](#u__15__url) | `uri` | The URL to send the HTTP requests to. | *Required* | | 2.7 | +| [headers](#u__15__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.7 | ##### Parameter details -

earlyStart

- -**Since version:** `2.0` ∙ **Type:** `duration` ∙ **Cardinality:** `Optional` ∙ **Default value:** `"PT0S"` -**Path:** /updaters/[15] - -This value is subtracted from the actual validity defined in the message. - -Normally the planned departure time is used, so setting this to 10s will cause the -SX-message to be included in trip-results 10 seconds before the the planned departure -time. -

url

**Since version:** `2.7` ∙ **Type:** `uri` ∙ **Cardinality:** `Required` @@ -242,6 +231,9 @@ HTTP headers to add to the request. Any header key, value can be inserted. ### SIRI-SX Light +This updater follows the same definition of SIRI Light as the SIRI-ET one: it downloads the entire +feed in a single HTTP GET request. +