stopF.setId(new AgencyAndId("agency", "F"));
table.addTransferTime(stopK, stopF, null, null, null, null, StopTransfer.TIMED_TRANSFER);
// Don't forget to also add a TimedTransferEdge
Vertex fromVertex = graph.getVertex("agency:K_arrive");
Vertex toVertex = graph.getVertex("agency:F_depart");
TimedTransferEdge timedTransferEdge = new TimedTransferEdge(fromVertex, toVertex);
// Plan journey
path = planJourney(options);
trips = extractTrips(path);
// Check whether the trips are still the same
assertEquals("8.1", trips.get(0).getId().getId());
assertEquals("4.2", trips.get(1).getId().getId());
// Now apply a real-time update: let the to-trip be early by 27600 seconds,
// resulting in a transfer time of 0 seconds
Trip trip = graph.index.tripForId.get(new AgencyAndId("agency", "4.2"));
TripPattern pattern = graph.index.patternForTrip.get(trip);
applyUpdateToTripPattern(pattern, "4.2", "F", 1, 55200, 55200,
ScheduleRelationship.SCHEDULED, 0, serviceDate);
// Plan journey
path = planJourney(options);
trips = extractTrips(path);
// Check whether the trips are still the same
assertEquals("8.1", trips.get(0).getId().getId());
assertEquals("4.2", trips.get(1).getId().getId());
// Now apply a real-time update: let the to-trip be early by 27601 seconds,
// resulting in a transfer time of -1 seconds
applyUpdateToTripPattern(pattern, "4.2", "F", 1, 55199, 55199,
ScheduleRelationship.SCHEDULED, 0, serviceDate);
// Plan journey
path = planJourney(options);
trips = extractTrips(path);
// Check whether a later second trip was taken
assertEquals("8.1", trips.get(0).getId().getId());
assertEquals("4.3", trips.get(1).getId().getId());
// "Revert" the real-time update
applyUpdateToTripPattern(pattern, "4.2", "F", 1, 82800, 82800,
ScheduleRelationship.SCHEDULED, 0, serviceDate);
// Remove the timed transfer from the graph
timedTransferEdge.detach(graph);
// Revert the graph, thus using the original transfer table again
reset(graph);
}