diff --git a/application/src/main/java/org/opentripplanner/model/RealTimeTripUpdate.java b/application/src/main/java/org/opentripplanner/model/RealTimeTripUpdate.java index d369feaf620..28fc16a98ac 100644 --- a/application/src/main/java/org/opentripplanner/model/RealTimeTripUpdate.java +++ b/application/src/main/java/org/opentripplanner/model/RealTimeTripUpdate.java @@ -21,7 +21,7 @@ * data. * @param routeCreation true if an added trip cannot be registered under an existing route * and a new route must be created. - * @param provider the provider of the real-time update. + * @param producer the producer of the real-time update. */ public record RealTimeTripUpdate( TripPattern pattern, @@ -30,7 +30,7 @@ public record RealTimeTripUpdate( @Nullable TripOnServiceDate addedTripOnServiceDate, boolean tripCreation, boolean routeCreation, - String provider + @Nullable String producer ) { public RealTimeTripUpdate { Objects.requireNonNull(pattern); diff --git a/application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java b/application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java index 9f91c06bdc7..94b490c48a0 100644 --- a/application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java +++ b/application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java @@ -347,7 +347,7 @@ public Result update(RealTimeTripUpdate realTimeTrip } // The time tables are finished during the commit - return Result.success(UpdateSuccess.noWarnings(realTimeTripUpdate.provider())); + return Result.success(UpdateSuccess.noWarnings(realTimeTripUpdate.producer())); } /** diff --git a/application/src/main/java/org/opentripplanner/updater/spi/DataValidationExceptionMapper.java b/application/src/main/java/org/opentripplanner/updater/spi/DataValidationExceptionMapper.java index c376c70b832..c37660cf9bc 100644 --- a/application/src/main/java/org/opentripplanner/updater/spi/DataValidationExceptionMapper.java +++ b/application/src/main/java/org/opentripplanner/updater/spi/DataValidationExceptionMapper.java @@ -20,11 +20,11 @@ public static Result toResult(DataValidationException error) public static Result toResult( DataValidationException error, - String provider + String producer ) { if (error.error() instanceof TimetableValidationError tt) { return Result.failure( - new UpdateError(tt.trip().getId(), mapTimeTableError(tt.code()), tt.stopIndex(), provider) + new UpdateError(tt.trip().getId(), mapTimeTableError(tt.code()), tt.stopIndex(), producer) ); } // The mapper should handle all possible errors diff --git a/application/src/main/java/org/opentripplanner/updater/spi/UpdateError.java b/application/src/main/java/org/opentripplanner/updater/spi/UpdateError.java index ac723a0d1e3..4e81cf3c2a7 100644 --- a/application/src/main/java/org/opentripplanner/updater/spi/UpdateError.java +++ b/application/src/main/java/org/opentripplanner/updater/spi/UpdateError.java @@ -12,7 +12,7 @@ public record UpdateError( @Nullable FeedScopedId tripId, UpdateErrorType errorType, @Nullable Integer stopIndex, - @Nullable String provider + @Nullable String producer ) { public UpdateError(@Nullable FeedScopedId tripId, UpdateErrorType errorType) { this(tripId, errorType, null, null); @@ -21,8 +21,8 @@ public UpdateError(@Nullable FeedScopedId tripId, UpdateErrorType errorType) { public UpdateError(@Nullable FeedScopedId tripId, UpdateErrorType errorType, Integer stopIndex) { this(tripId, errorType, stopIndex, null); } - public UpdateError(@Nullable FeedScopedId tripId, UpdateErrorType errorType, String provider) { - this(tripId, errorType, null, provider); + public UpdateError(@Nullable FeedScopedId tripId, UpdateErrorType errorType, String producer) { + this(tripId, errorType, null, producer); } public String debugId() { @@ -67,9 +67,9 @@ public static Result result(FeedScopedId tripId, UpdateError public static Result result( FeedScopedId tripId, UpdateErrorType errorType, - String provider + String producer ) { - return Result.failure(new UpdateError(tripId, errorType, provider)); + return Result.failure(new UpdateError(tripId, errorType, producer)); } public static UpdateError noTripId(UpdateErrorType errorType) { diff --git a/application/src/main/java/org/opentripplanner/updater/spi/UpdateSuccess.java b/application/src/main/java/org/opentripplanner/updater/spi/UpdateSuccess.java index 385ae8eb17a..861f4c5edff 100644 --- a/application/src/main/java/org/opentripplanner/updater/spi/UpdateSuccess.java +++ b/application/src/main/java/org/opentripplanner/updater/spi/UpdateSuccess.java @@ -10,7 +10,7 @@ * ought to be looked at but didn't prevent the application of the update and the provider of the * update. */ -public record UpdateSuccess(List warnings, String provider) { +public record UpdateSuccess(List warnings, String producer) { /** * Create an instance with no warnings and no provider. */ @@ -21,15 +21,15 @@ public static UpdateSuccess noWarnings() { /** * Create an instance with no warnings, but a provider. */ - public static UpdateSuccess noWarnings(String provider) { - return new UpdateSuccess(List.of(), provider); + public static UpdateSuccess noWarnings(String producer) { + return new UpdateSuccess(List.of(), producer); } /** * Return a copy of the instance with the provided warnings added. */ public UpdateSuccess addWarnings(Collection addedWarnings) { - return new UpdateSuccess(ListUtils.combine(this.warnings, addedWarnings), this.provider); + return new UpdateSuccess(ListUtils.combine(this.warnings, addedWarnings), this.producer); } public enum WarningType { diff --git a/application/src/main/java/org/opentripplanner/updater/trip/metrics/StreamingTripUpdateMetrics.java b/application/src/main/java/org/opentripplanner/updater/trip/metrics/StreamingTripUpdateMetrics.java index b02a907d206..39c639f491a 100644 --- a/application/src/main/java/org/opentripplanner/updater/trip/metrics/StreamingTripUpdateMetrics.java +++ b/application/src/main/java/org/opentripplanner/updater/trip/metrics/StreamingTripUpdateMetrics.java @@ -96,7 +96,7 @@ private void setFailuresByTypeAndProvider(UpdateResult result) { .stream() .collect( Collectors.groupingBy( - error -> Pair.of(error.provider(), error.errorType()), + error -> Pair.of(error.producer(), error.errorType()), Collectors.counting() ) ); @@ -121,7 +121,7 @@ private void setSuccessesByProvider(UpdateResult result) { Map successCountByProvider = result .successes() .stream() - .collect(Collectors.groupingBy(UpdateSuccess::provider, Collectors.counting())); + .collect(Collectors.groupingBy(UpdateSuccess::producer, Collectors.counting())); for (var entry : successCountByProvider.entrySet()) { Counter counter = successesByProvider.get(entry.getKey()); @@ -129,8 +129,8 @@ private void setSuccessesByProvider(UpdateResult result) { counter = getCounter( "successes_by_provider", - "Total successful trip updates by provider", - Tag.of("provider", entry.getKey()) + "Total successful trip updates by producer", + Tag.of("producer", entry.getKey()) ); successesByProvider.put(entry.getKey(), counter); } diff --git a/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java b/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java index 0ca64a18aa1..abed2144982 100644 --- a/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java @@ -136,7 +136,7 @@ void testAddedTrip() { SHORT_NAME, HEADSIGN, List.of(), - "TST" + "DATASOURCE" ) .build(); @@ -249,7 +249,7 @@ void testAddedTripOnAddedRoute() { SHORT_NAME, HEADSIGN, List.of(), - "TST" + "DATASOURCE" ) .build(); @@ -278,7 +278,7 @@ void testAddedTripOnAddedRoute() { SHORT_NAME, HEADSIGN, List.of(), - "TST" + "DATASOURCE" ) .build(); @@ -321,7 +321,7 @@ void testAddedTripOnExistingRoute() { SHORT_NAME, HEADSIGN, List.of(), - "TST" + "DATASOURCE" ) .build(); @@ -356,7 +356,7 @@ void testAddedTripWithoutReplacedRoute() { SHORT_NAME, HEADSIGN, List.of(), - "TST" + "DATASOURCE" ) .build(); @@ -401,7 +401,7 @@ void testAddedTripFailOnMissingServiceId() { SHORT_NAME, HEADSIGN, List.of(), - "TST" + "DATASOURCE" ) .build(); @@ -457,7 +457,7 @@ void testAddedTripFailOnNonIncreasingDwellTime() { SHORT_NAME, HEADSIGN, List.of(), - "TST" + "DATASOURCE" ) .build(); @@ -497,7 +497,7 @@ void testAddedTripFailOnTooFewCalls() { SHORT_NAME, HEADSIGN, List.of(), - "TST" + "DATASOURCE" ) .build(); @@ -545,7 +545,7 @@ void testAddedTripFailOnUnknownStop() { SHORT_NAME, HEADSIGN, List.of(), - "TST" + "DATASOURCE" ) .build(); diff --git a/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java b/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java index 6923aa731c1..6c1797a24a2 100644 --- a/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java @@ -175,7 +175,7 @@ void testUpdateNoCalls() { false, null, false, - "TST" + "DATASOURCE" ) .build(); @@ -205,7 +205,7 @@ void testUpdateCancellation() { true, null, false, - "TST" + "DATASOURCE" ) .build(); @@ -250,7 +250,7 @@ void testUpdateSameStops() { false, null, false, - "TST" + "DATASOURCE" ) .build(); @@ -301,7 +301,7 @@ void testUpdateValidationFailure() { false, null, false, - "TST" + "DATASOURCE" ) .build(); @@ -350,7 +350,7 @@ void testUpdateSameStopsDepartEarly() { false, null, false, - "TST" + "DATASOURCE" ) .build(); @@ -401,7 +401,7 @@ void testUpdateUpdatedStop() { false, null, false, - "TST" + "DATASOURCE" ) .build(); @@ -458,7 +458,7 @@ void testUpdateCascading() { false, null, false, - "TST" + "DATASOURCE" ) .build(); @@ -504,7 +504,7 @@ void testUpdateCascading() { false, null, false, - "TST" + "DATASOURCE" ) .build(); diff --git a/application/src/test/java/org/opentripplanner/updater/siri/SiriEtBuilder.java b/application/src/test/java/org/opentripplanner/updater/siri/SiriEtBuilder.java index bc51ac0f9a7..3656d9da2f0 100644 --- a/application/src/test/java/org/opentripplanner/updater/siri/SiriEtBuilder.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/SiriEtBuilder.java @@ -39,7 +39,7 @@ public SiriEtBuilder(DateTimeHelper dateTimeHelper) { // Set default values evj.setMonitored(true); - evj.setDataSource("TST"); + evj.setDataSource("DATASOURCE"); } public List buildEstimatedTimetableDeliveries() {