AbstractHafasClientInterfaceProvider: Fix handling of TETA (Tele Taxi) section type.

This commit is contained in:
Andreas Schildbach 2019-10-29 08:52:24 +01:00
parent 0f6862f87a
commit 939b4fcbc3
2 changed files with 15 additions and 3 deletions

View file

@ -674,7 +674,7 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
final Stop arrivalStop = parseJsonStop(secArr, locList, crdSysList, c, baseDate);
final Trip.Leg leg;
if (SECTION_TYPE_JOURNEY.equals(secType)) {
if (SECTION_TYPE_JOURNEY.equals(secType) || SECTION_TYPE_TELE_TAXI.equals(secType)) {
final JSONObject jny = sec.getJSONObject("jny");
final Line line = lines.get(jny.getInt("prodX"));
final String dirTxt = jny.optString("dirTxt", null);
@ -741,7 +741,7 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
leg = new Trip.Individual(Trip.Individual.Type.WALK, departureStop.location,
departureStop.getDepartureTime(), arrivalStop.location, arrivalStop.getArrivalTime(),
null, distance);
} else if (SECTION_TYPE_TRANSFER.equals(secType) || SECTION_TYPE_DEVI.equals(secType) || SECTION_TYPE_TELE_TAXI.equals(secType)) {
} else if (SECTION_TYPE_TRANSFER.equals(secType) || SECTION_TYPE_DEVI.equals(secType)) {
final JSONObject gis = sec.optJSONObject("gis");
final int distance = gis != null ? gis.optInt("dist", 0) : 0;
leg = new Trip.Individual(Trip.Individual.Type.TRANSFER, departureStop.location,

View file

@ -77,7 +77,7 @@ public class OebbProviderLiveTest extends AbstractProviderLiveTest {
}
@Test
public void shortTrip() throws Exception {
public void shortTripLinzWien() throws Exception {
final Location from = new Location(LocationType.STATION, "1140101", null, "Linz");
final Location to = new Location(LocationType.STATION, "1190100", null, "Wien");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
@ -88,6 +88,18 @@ public class OebbProviderLiveTest extends AbstractProviderLiveTest {
print(laterResult);
}
@Test
public void shortTripBregenzBezau() throws Exception {
final Location from = new Location(LocationType.STATION, "1180207", null, "Bregenz");
final Location to = new Location(LocationType.STATION, "1180204", null, "Bezau");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
assertEquals(QueryTripsResult.Status.OK, result.status);
assertTrue(result.trips.size() > 0);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
}
@Test
public void slowTrip() throws Exception {
final Location from = new Location(LocationType.ANY, null, null, "Ramsen Zoll!");