Skip to content

Commit

Permalink
Method createStopEstimate sets targetedStopId
Browse files Browse the repository at this point in the history
  • Loading branch information
thjarvin committed Mar 12, 2024
1 parent 03b5efc commit 91fa9ea
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,26 @@ public static InternalMessages.StopEstimate mockStopEstimate(long dvjId,
stopId, startTimeEpochMs);
return PubtransFactory.createStopEstimate(common, mockTripInfo, eventType);
}

public static InternalMessages.StopEstimate mockStopEstimate(String routeName,
InternalMessages.StopEstimate.Type eventType,
long stopId,
long targetedStopId,
int stopSequence,
int directionId) throws Exception {
long dvjId = generateValidJoreId();
PubtransTableProtos.Common common = MockDataUtils.mockCommon(dvjId, stopSequence).build();
PubtransTableProtos.DOITripInfo mockTripInfo = mockDOITripInfo(dvjId, routeName, stopId, targetedStopId, directionId);
return PubtransFactory.createStopEstimate(common, mockTripInfo, eventType);
}

public static PubtransTableProtos.DOITripInfo mockDOITripInfo(long dvjId, String routeName) throws Exception {
return mockDOITripInfo(dvjId, routeName, generateValidJoreId());
}

public static PubtransTableProtos.DOITripInfo mockDOITripInfo(long dvjId, String routeName, long stopId, long targetedStopId, int directionId) throws Exception {
return mockDOITripInfo(dvjId, routeName, stopId, targetedStopId, directionId, MOCK_START_DATE, MOCK_START_TIME);
}

public static PubtransTableProtos.DOITripInfo mockDOITripInfo(long dvjId, String routeName, int joreDirection) throws Exception {
long stopId = generateValidJoreId();
Expand Down Expand Up @@ -243,6 +259,11 @@ public static PubtransTableProtos.DOITripInfo mockDOITripInfo(long dvjId, String
int joreDirection, String startDate, String startTime) throws Exception {
return mockDOITripInfoBuilder(dvjId, routeName, stopId, joreDirection, startDate, startTime).build();
}

public static PubtransTableProtos.DOITripInfo mockDOITripInfo(long dvjId, String routeName, long stopId, long targetedStopId,
int joreDirection, String startDate, String startTime) throws Exception {
return mockDOITripInfoBuilder(dvjId, routeName, stopId, targetedStopId, joreDirection, startDate, startTime).build();
}

public static PubtransTableProtos.DOITripInfo.Builder mockDOITripInfoBuilder(long dvjId, String routeName, long stopId,
int joreDirection, String startDate,
Expand All @@ -256,6 +277,20 @@ public static PubtransTableProtos.DOITripInfo.Builder mockDOITripInfoBuilder(lon
builder.setDvjId(dvjId);
return builder;
}

public static PubtransTableProtos.DOITripInfo.Builder mockDOITripInfoBuilder(long dvjId, String routeName, long stopId,
long targetedStopId, int joreDirection,
String startDate, String startTime) {
PubtransTableProtos.DOITripInfo.Builder builder = PubtransTableProtos.DOITripInfo.newBuilder();
builder.setStopId(Long.toString(stopId));
builder.setTargetedStopId(Long.toString(targetedStopId));
builder.setDirectionId(joreDirection);
builder.setRouteId(routeName);
builder.setStartTime(startTime);
builder.setOperatingDay(startDate);
builder.setDvjId(dvjId);
return builder;
}

public static InternalMessages.TripCancellation mockTripCancellation(String routeId) throws Exception {
return mockTripCancellation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public static InternalMessages.StopEstimate createStopEstimate(@NotNull Pubtrans
builder.setTripInfo(tripInfo);

builder.setStopId(doiTripInfo.getStopId()); //Use to be Long in old internal model
builder.setTargetedStopId(doiTripInfo.getTargetedStopId());
builder.setStopSequence(common.getJourneyPatternSequenceNumber());

InternalMessages.StopEstimate.Status scheduledStatus = (common.getState() == PUBTRANS_SKIPPED_STATE) ?
Expand Down

0 comments on commit 91fa9ea

Please sign in to comment.