OOEVV, SVV, VAO, VMOBIL, VOR, VVT: Increase API version to 1.15 to fix spurious PARSE errors when querying for trips.

Bring related LiveTests up to speed too.
This commit is contained in:
Andreas Schildbach 2018-11-17 22:24:50 +01:00
parent 874198b621
commit 05d1a5826b
12 changed files with 110 additions and 234 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -36,7 +36,7 @@ public class OoevvProvider extends AbstractHafasClientInterfaceProvider {
public OoevvProvider(final String apiAuthorization) {
super(NetworkId.OOEVV, API_BASE, PRODUCTS_MAP);
setApiVersion("1.14");
setApiVersion("1.15");
setApiClient("{\"id\":\"VAO\",\"l\":\"vs_ooevv\",\"type\":\"AND\"}");
setApiAuthorization(apiAuthorization);
httpClient.setSslAcceptAllHostnames(true);
@ -54,7 +54,6 @@ public class OoevvProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_ONE_COMMA.matcher(name);
if (m.matches())
return new String[] { m.group(2), m.group(1) };
return super.splitStationName(name);
}
@ -63,7 +62,6 @@ public class OoevvProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_ONE_COMMA.matcher(poi);
if (m.matches())
return new String[] { m.group(2), m.group(1) };
return super.splitPOI(poi);
}
@ -72,7 +70,6 @@ public class OoevvProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_FIRST_COMMA.matcher(address);
if (m.matches())
return new String[] { m.group(1), m.group(2) };
return super.splitAddress(address);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 the original author or authors.
* Copyright the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -39,7 +39,7 @@ public class SvvProvider extends AbstractHafasClientInterfaceProvider {
public SvvProvider(final String apiAuthorization) {
super(NetworkId.SVV, API_BASE, PRODUCTS_MAP);
setApiVersion("1.14");
setApiVersion("1.15");
setApiClient("{\"id\":\"VAO\",\"l\":\"vs_svv\",\"type\":\"AND\"}");
setApiAuthorization(apiAuthorization);
setStyles(STYLES);
@ -58,7 +58,6 @@ public class SvvProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_ONE_COMMA.matcher(name);
if (m.matches())
return new String[] { m.group(2), m.group(1) };
return super.splitStationName(name);
}
@ -67,7 +66,6 @@ public class SvvProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_ONE_COMMA.matcher(poi);
if (m.matches())
return new String[] { m.group(2), m.group(1) };
return super.splitPOI(poi);
}
@ -76,7 +74,6 @@ public class SvvProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_FIRST_COMMA.matcher(address);
if (m.matches())
return new String[] { m.group(1), m.group(2) };
return super.splitAddress(address);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -39,7 +39,7 @@ public class VaoProvider extends AbstractHafasClientInterfaceProvider {
public VaoProvider(final String apiAuthorization) {
super(NetworkId.VAO, API_BASE, PRODUCTS_MAP);
setApiVersion("1.14");
setApiVersion("1.15");
setApiClient("{\"id\":\"VAO\",\"l\":\"vs_vvv\",\"type\":\"AND\"}");
setApiAuthorization(apiAuthorization);
setStyles(STYLES);

View file

@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -36,7 +36,7 @@ public class VmobilProvider extends AbstractHafasClientInterfaceProvider {
public VmobilProvider(final String apiAuthorization) {
super(NetworkId.VMOBIL, API_BASE, PRODUCTS_MAP);
setApiVersion("1.14");
setApiVersion("1.15");
setApiClient("{\"id\":\"VAO\",\"l\":\"vs_vvv\",\"type\":\"AND\"}");
setApiAuthorization(apiAuthorization);
}
@ -53,7 +53,6 @@ public class VmobilProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_ONE_COMMA.matcher(name);
if (m.matches())
return new String[] { m.group(2), m.group(1) };
return super.splitStationName(name);
}
@ -62,7 +61,6 @@ public class VmobilProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_ONE_COMMA.matcher(poi);
if (m.matches())
return new String[] { m.group(2), m.group(1) };
return super.splitPOI(poi);
}
@ -71,7 +69,6 @@ public class VmobilProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_FIRST_COMMA.matcher(address);
if (m.matches())
return new String[] { m.group(1), m.group(2) };
return super.splitAddress(address);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 the original author or authors.
* Copyright the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -39,7 +39,7 @@ public class VorProvider extends AbstractHafasClientInterfaceProvider {
public VorProvider(final String apiAuthorization) {
super(NetworkId.VOR, API_BASE, PRODUCTS_MAP);
setApiVersion("1.14");
setApiVersion("1.15");
setApiClient("{\"id\":\"VAO\",\"l\":\"vs_anachb\",\"type\":\"AND\"}");
setApiAuthorization(apiAuthorization);
setStyles(STYLES);
@ -57,7 +57,6 @@ public class VorProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_ONE_COMMA.matcher(name);
if (m.matches())
return new String[] { m.group(2), m.group(1) };
return super.splitStationName(name);
}
@ -66,7 +65,6 @@ public class VorProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_ONE_COMMA.matcher(poi);
if (m.matches())
return new String[] { m.group(2), m.group(1) };
return super.splitPOI(poi);
}
@ -75,7 +73,6 @@ public class VorProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_FIRST_COMMA.matcher(address);
if (m.matches())
return new String[] { m.group(1), m.group(2) };
return super.splitAddress(address);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 the original author or authors.
* Copyright the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -36,7 +36,7 @@ public class VvtProvider extends AbstractHafasClientInterfaceProvider {
public VvtProvider(final String apiAuthorization) {
super(NetworkId.VVT, API_BASE, PRODUCTS_MAP);
setApiVersion("1.14");
setApiVersion("1.15");
setApiClient("{\"id\":\"VAO\",\"l\":\"vs_vvt\",\"type\":\"AND\"}");
setApiAuthorization(apiAuthorization);
}
@ -53,7 +53,6 @@ public class VvtProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_ONE_COMMA.matcher(name);
if (m.matches())
return new String[] { m.group(2), m.group(1) };
return super.splitStationName(name);
}
@ -62,7 +61,6 @@ public class VvtProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_ONE_COMMA.matcher(poi);
if (m.matches())
return new String[] { m.group(2), m.group(1) };
return super.splitPOI(poi);
}
@ -71,7 +69,6 @@ public class VvtProvider extends AbstractHafasClientInterfaceProvider {
final Matcher m = P_SPLIT_NAME_FIRST_COMMA.matcher(address);
if (m.matches())
return new String[] { m.group(1), m.group(2) };
return super.splitAddress(address);
}
}

View file

@ -43,12 +43,6 @@ public class OoevvProviderLiveTest extends AbstractProviderLiveTest {
super(new OoevvProvider(secretProperty("ooevv.api_authorization")));
}
@Test
public void nearbyStations() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "490132007"));
print(result);
}
@Test
public void nearbyStationsByCoordinate() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(Location.coord(48207355, 16370602));
@ -101,41 +95,35 @@ public class OoevvProviderLiveTest extends AbstractProviderLiveTest {
@Test
public void suggestLocationsCoverage() throws Exception {
final SuggestLocationsResult linzResult = suggestLocations("Linz Hauptbahnhof");
print(linzResult);
assertThat(linzResult.getLocations(), hasItem(new Location(LocationType.STATION, "444116400")));
final SuggestLocationsResult result = suggestLocations("Linz Hauptbahnhof");
print(result);
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "444116400")));
}
@Test
public void shortTripFeldkirch() throws Exception {
final QueryTripsResult result = queryTrips(
new Location(LocationType.STATION, "480082200", null, "Feldkirch Katzenturm"), null,
new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof"), new Date(), true, null);
final Location from = new Location(LocationType.STATION, "480082200", null, "Feldkirch Katzenturm");
final Location to = new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
final QueryTripsResult laterResult2 = queryMoreTrips(laterResult.context, true);
print(laterResult2);
final QueryTripsResult earlierResult = queryMoreTrips(result.context, false);
print(earlierResult);
}
@Test
public void shortTripWien() throws Exception {
final QueryTripsResult result = queryTrips(
new Location(LocationType.STATION, "490132000", null, "Wien Stephansplatz"), null,
new Location(LocationType.STATION, "490024500", null, "Wien Stubentor"), new Date(), true, null);
final Location from = new Location(LocationType.STATION, "490132000", null, "Wien Stephansplatz");
final Location to = new Location(LocationType.STATION, "490024500", null, "Wien Stubentor");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
final QueryTripsResult laterResult2 = queryMoreTrips(laterResult.context, true);
print(laterResult2);
final QueryTripsResult earlierResult = queryMoreTrips(result.context, false);
print(earlierResult);
}
@ -150,41 +138,29 @@ public class OoevvProviderLiveTest extends AbstractProviderLiveTest {
print(result);
assertEquals(QueryTripsResult.Status.OK, result.status);
assertTrue(result.trips.size() > 0);
if (!result.context.canQueryLater())
return;
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
if (!laterResult.context.canQueryLater())
return;
final QueryTripsResult later2Result = queryMoreTrips(laterResult.context, true);
print(later2Result);
if (!later2Result.context.canQueryEarlier())
return;
final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false);
print(earlierResult);
}
@Test
public void tripAddressToStation() throws Exception {
final QueryTripsResult result = queryTrips(
new Location(LocationType.ADDRESS,
"A=2@O=6800 Feldkirch, Kapfweg 6@X=9585539@Y=47239257@U=103@L=980092305@B=1@p=1437727591@",
"6800 Feldkirch", "Kapfweg 6"),
null, new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof"), new Date(), true,
null);
final Location from = new Location(LocationType.ADDRESS,
"A=2@O=6800 Feldkirch, Kapfweg 6@X=9585539@Y=47239257@U=103@L=980092305@B=1@p=1437727591@",
"6800 Feldkirch", "Kapfweg 6");
final Location to = new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
}
@Test
public void tripCoordinateToStation() throws Exception {
final QueryTripsResult result = queryTrips(Location.coord(47238096, 9585581), null,
new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof"), new Date(), true, null);
final Location from = Location.coord(47238096, 9585581);
final Location to = new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
}
}

View file

@ -43,12 +43,6 @@ public class SvvProviderLiveTest extends AbstractProviderLiveTest {
super(new SvvProvider(secretProperty("svv.api_authorization")));
}
@Test
public void nearbyStations() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "455000200"));
print(result);
}
@Test
public void nearbyStationsByCoordinate() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(Location.coord(47813093, 13045065));
@ -84,7 +78,7 @@ public class SvvProviderLiveTest extends AbstractProviderLiveTest {
public void suggestLocationsWithUmlaut() throws Exception {
final SuggestLocationsResult result = suggestLocations("Südstadt");
print(result);
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "900015650")));
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "900017135")));
}
@Test
@ -95,9 +89,9 @@ public class SvvProviderLiveTest extends AbstractProviderLiveTest {
@Test
public void suggestLocationsCoverage() throws Exception {
final SuggestLocationsResult salzburgResult = suggestLocations("Salzburg Hauptbahnhof");
print(salzburgResult);
assertThat(salzburgResult.getLocations(), hasItem(new Location(LocationType.STATION, "455000200")));
final SuggestLocationsResult result = suggestLocations("Salzburg Hauptbahnhof");
print(result);
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "455000200")));
}
@Test
@ -110,22 +104,10 @@ public class SvvProviderLiveTest extends AbstractProviderLiveTest {
print(result);
assertEquals(QueryTripsResult.Status.OK, result.status);
assertTrue(result.trips.size() > 0);
if (!result.context.canQueryLater())
return;
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
if (!laterResult.context.canQueryLater())
return;
final QueryTripsResult later2Result = queryMoreTrips(laterResult.context, true);
print(later2Result);
if (!later2Result.context.canQueryEarlier())
return;
final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false);
print(earlierResult);
}

View file

@ -43,12 +43,6 @@ public class VaoProviderLiveTest extends AbstractProviderLiveTest {
super(new VaoProvider(secretProperty("vao.api_authorization")));
}
@Test
public void nearbyStations() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "490132007"));
print(result);
}
@Test
public void nearbyStationsByCoordinate() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(Location.coord(48207355, 16370602));
@ -95,59 +89,62 @@ public class VaoProviderLiveTest extends AbstractProviderLiveTest {
@Test
public void suggestLocationsEncoding() throws Exception {
final SuggestLocationsResult result = suggestLocations("Schönbrunn");
assertEquals("Schönbrunn", result.getLocations().get(0).name);
assertEquals("Wien Schönbrunn", result.getLocations().get(0).name);
print(result);
}
@Test
public void suggestLocationsCoverage() throws Exception {
final SuggestLocationsResult salzburgResult = suggestLocations("Salzburg Süd");
print(salzburgResult);
assertThat(salzburgResult.getLocations(), hasItem(new Location(LocationType.STATION, "60650458")));
public void suggestLocationsCoverageSalzburg() throws Exception {
final SuggestLocationsResult result = suggestLocations("Salzburg Süd");
print(result);
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "900022177")));
}
final SuggestLocationsResult strasswalchenResult = suggestLocations("Straßwalchen West");
print(strasswalchenResult);
assertThat(strasswalchenResult.getLocations(), hasItem(new Location(LocationType.STATION, "60656483")));
@Test
public void suggestLocationsCoverageStrasswalchen() throws Exception {
final SuggestLocationsResult result = suggestLocations("Straßwalchen West");
print(result);
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "455648300")));
}
final SuggestLocationsResult schwarzachResult = suggestLocations("Schwarzach Abtsdorf");
print(schwarzachResult);
assertThat(schwarzachResult.getLocations(), hasItem(new Location(LocationType.STATION, "60656614")));
@Test
public void suggestLocationsCoverageSchwarzach() throws Exception {
final SuggestLocationsResult result = suggestLocations("Schwarzach Abtsdorf");
print(result);
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "455661400")));
}
final SuggestLocationsResult trimmelkamResult = suggestLocations("Trimmelkam");
print(trimmelkamResult);
assertThat(trimmelkamResult.getLocations(), hasItem(new Location(LocationType.STATION, "60640776")));
@Test
public void suggestLocationsCoverageTrimmelkam() throws Exception {
final SuggestLocationsResult result = suggestLocations("Trimmelkam");
print(result);
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "900018413")));
}
@Test
public void shortTripFeldkirch() throws Exception {
final QueryTripsResult result = queryTrips(
new Location(LocationType.STATION, "480082200", null, "Feldkirch Katzenturm"), null,
new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof"), new Date(), true, null);
final Location from = new Location(LocationType.STATION, "480082200", null, "Feldkirch Katzenturm");
final Location to = new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
final QueryTripsResult laterResult2 = queryMoreTrips(laterResult.context, true);
print(laterResult2);
final QueryTripsResult earlierResult = queryMoreTrips(result.context, false);
print(earlierResult);
}
@Test
public void shortTripWien() throws Exception {
final QueryTripsResult result = queryTrips(
new Location(LocationType.STATION, "490132000", null, "Wien Stephansplatz"), null,
new Location(LocationType.STATION, "490024500", null, "Wien Stubentor"), new Date(), true, null);
final Location from = new Location(LocationType.STATION, "490132000", null, "Wien Stephansplatz");
final Location to = new Location(LocationType.STATION, "490024500", null, "Wien Stubentor");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
final QueryTripsResult laterResult2 = queryMoreTrips(laterResult.context, true);
print(laterResult2);
final QueryTripsResult earlierResult = queryMoreTrips(result.context, false);
print(earlierResult);
}
@ -162,41 +159,29 @@ public class VaoProviderLiveTest extends AbstractProviderLiveTest {
print(result);
assertEquals(QueryTripsResult.Status.OK, result.status);
assertTrue(result.trips.size() > 0);
if (!result.context.canQueryLater())
return;
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
if (!laterResult.context.canQueryLater())
return;
final QueryTripsResult later2Result = queryMoreTrips(laterResult.context, true);
print(later2Result);
if (!later2Result.context.canQueryEarlier())
return;
final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false);
print(earlierResult);
}
@Test
public void tripAddressToStation() throws Exception {
final QueryTripsResult result = queryTrips(
new Location(LocationType.ADDRESS,
"A=2@O=6800 Feldkirch, Kapfweg 6@X=9585539@Y=47239257@U=103@L=980092305@B=1@p=1437727591@",
"6800 Feldkirch", "Kapfweg 6"),
null, new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof"), new Date(), true,
null);
final Location from = new Location(LocationType.ADDRESS,
"A=2@O=6800 Feldkirch, Kapfweg 6@X=9585539@Y=47239257@U=103@L=980092305@B=1@p=1437727591@",
"6800 Feldkirch", "Kapfweg 6");
final Location to = new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
}
@Test
public void tripCoordinateToStation() throws Exception {
final QueryTripsResult result = queryTrips(Location.coord(47238096, 9585581), null,
new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof"), new Date(), true, null);
final Location from = Location.coord(47238096, 9585581);
final Location to = new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
}
}

View file

@ -43,12 +43,6 @@ public class VmobilProviderLiveTest extends AbstractProviderLiveTest {
super(new VmobilProvider(secretProperty("vmobil.api_authorization")));
}
@Test
public void nearbyStations() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "490132007"));
print(result);
}
@Test
public void nearbyStationsByCoordinate() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(Location.coord(48207355, 16370602));
@ -100,54 +94,57 @@ public class VmobilProviderLiveTest extends AbstractProviderLiveTest {
}
@Test
public void suggestLocationsCoverage() throws Exception {
final SuggestLocationsResult feldkirchResult = suggestLocations("Feldkirch Bahnhof");
print(feldkirchResult);
assertThat(feldkirchResult.getLocations(), hasItem(new Location(LocationType.STATION, "480081700")));
public void suggestLocationsCoverageFeldkirch() throws Exception {
final SuggestLocationsResult result = suggestLocations("Feldkirch Bahnhof");
print(result);
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "480081700")));
}
final SuggestLocationsResult strasswalchenResult = suggestLocations("Straßwalchen West");
print(strasswalchenResult);
assertThat(strasswalchenResult.getLocations(), hasItem(new Location(LocationType.STATION, "455648300")));
@Test
public void suggestLocationsCoverageStrasswalchen() throws Exception {
final SuggestLocationsResult result = suggestLocations("Straßwalchen West");
print(result);
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "455648300")));
}
final SuggestLocationsResult schwarzachResult = suggestLocations("Schwarzach Abtsdorf");
print(schwarzachResult);
assertThat(schwarzachResult.getLocations(), hasItem(new Location(LocationType.STATION, "455661400")));
@Test
public void suggestLocationsCoverageSchwarzach() throws Exception {
final SuggestLocationsResult result = suggestLocations("Schwarzach Abtsdorf");
print(result);
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "455661400")));
}
final SuggestLocationsResult trimmelkamResult = suggestLocations("Trimmelkam");
print(trimmelkamResult);
assertThat(trimmelkamResult.getLocations(), hasItem(new Location(LocationType.STATION, "900016933")));
@Test
public void suggestLocationsCoverageTrimmelkam() throws Exception {
final SuggestLocationsResult result = suggestLocations("Trimmelkam");
print(result);
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "900018413")));
}
@Test
public void shortTripFeldkirch() throws Exception {
final QueryTripsResult result = queryTrips(
new Location(LocationType.STATION, "480082200", null, "Feldkirch Katzenturm"), null,
new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof"), new Date(), true, null);
final Location from = new Location(LocationType.STATION, "480082200", null, "Feldkirch Katzenturm");
final Location to = new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
final QueryTripsResult laterResult2 = queryMoreTrips(laterResult.context, true);
print(laterResult2);
final QueryTripsResult earlierResult = queryMoreTrips(result.context, false);
print(earlierResult);
}
@Test
public void shortTripWien() throws Exception {
final QueryTripsResult result = queryTrips(
new Location(LocationType.STATION, "490132000", null, "Wien Stephansplatz"), null,
new Location(LocationType.STATION, "490024500", null, "Wien Stubentor"), new Date(), true, null);
final Location from = new Location(LocationType.STATION, "490132000", null, "Wien Stephansplatz");
final Location to = new Location(LocationType.STATION, "490024500", null, "Wien Stubentor");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
final QueryTripsResult laterResult2 = queryMoreTrips(laterResult.context, true);
print(laterResult2);
final QueryTripsResult earlierResult = queryMoreTrips(result.context, false);
print(earlierResult);
}
@ -162,41 +159,29 @@ public class VmobilProviderLiveTest extends AbstractProviderLiveTest {
print(result);
assertEquals(QueryTripsResult.Status.OK, result.status);
assertTrue(result.trips.size() > 0);
if (!result.context.canQueryLater())
return;
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
if (!laterResult.context.canQueryLater())
return;
final QueryTripsResult later2Result = queryMoreTrips(laterResult.context, true);
print(later2Result);
if (!later2Result.context.canQueryEarlier())
return;
final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false);
print(earlierResult);
}
@Test
public void tripAddressToStation() throws Exception {
final QueryTripsResult result = queryTrips(
new Location(LocationType.ADDRESS,
"A=2@O=6800 Feldkirch, Kapfweg 6@X=9585539@Y=47239257@U=103@L=980092305@B=1@p=1437727591@",
"6800 Feldkirch", "Kapfweg 6"),
null, new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof"), new Date(), true,
null);
final Location from = new Location(LocationType.ADDRESS,
"A=2@O=6800 Feldkirch, Kapfweg 6@X=9585539@Y=47239257@U=103@L=980092305@B=1@p=1437727591@",
"6800 Feldkirch", "Kapfweg 6");
final Location to = new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
}
@Test
public void tripCoordinateToStation() throws Exception {
final QueryTripsResult result = queryTrips(Location.coord(47238096, 9585581), null,
new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof"), new Date(), true, null);
final Location from = Location.coord(47238096, 9585581);
final Location to = new Location(LocationType.STATION, "480081700", null, "Feldkirch Bahnhof");
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
}
}

View file

@ -43,12 +43,6 @@ public class VorProviderLiveTest extends AbstractProviderLiveTest {
super(new VorProvider(secretProperty("vor.api_authorization")));
}
@Test
public void nearbyStations() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "490134900"));
print(result);
}
@Test
public void nearbyStationsByCoordinate() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(Location.coord(48207355, 16370602));
@ -83,7 +77,7 @@ public class VorProviderLiveTest extends AbstractProviderLiveTest {
public void suggestLocationsWithUmlaut() throws Exception {
final SuggestLocationsResult result = suggestLocations("Längenfeld");
print(result);
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "900018107")));
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "900019683")));
}
@Test
@ -107,22 +101,10 @@ public class VorProviderLiveTest extends AbstractProviderLiveTest {
print(result);
assertEquals(QueryTripsResult.Status.OK, result.status);
assertTrue(result.trips.size() > 0);
if (!result.context.canQueryLater())
return;
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
if (!laterResult.context.canQueryLater())
return;
final QueryTripsResult later2Result = queryMoreTrips(laterResult.context, true);
print(later2Result);
if (!later2Result.context.canQueryEarlier())
return;
final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false);
print(earlierResult);
}
@ -141,10 +123,9 @@ public class VorProviderLiveTest extends AbstractProviderLiveTest {
@Test
public void tripBetweenCoordinates() throws Exception {
final QueryTripsResult result = queryTrips(Location.coord(48180281, 16333551), null,
Location.coord(48240452, 16444788), new Date(), true, null);
final Location from = Location.coord(48180281, 16333551);
final Location to = Location.coord(48240452, 16444788);
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
print(result);
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
}
}

View file

@ -43,12 +43,6 @@ public class VvtProviderLiveTest extends AbstractProviderLiveTest {
super(new VvtProvider(secretProperty("vvt.api_authorization")));
}
@Test
public void nearbyStations() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "470118700"));
print(result);
}
@Test
public void nearbyStationsByCoordinate() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(Location.coord(47271228, 11402063));
@ -96,22 +90,10 @@ public class VvtProviderLiveTest extends AbstractProviderLiveTest {
print(result);
assertEquals(QueryTripsResult.Status.OK, result.status);
assertTrue(result.trips.size() > 0);
if (!result.context.canQueryLater())
return;
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
print(laterResult);
if (!laterResult.context.canQueryLater())
return;
final QueryTripsResult later2Result = queryMoreTrips(laterResult.context, true);
print(later2Result);
if (!later2Result.context.canQueryEarlier())
return;
final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false);
print(earlierResult);
}