From 05d1a5826be41d7d70a0e3eb15d80db322b7e983 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Sat, 17 Nov 2018 22:24:50 +0100 Subject: [PATCH] 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. --- .../src/de/schildbach/pte/OoevvProvider.java | 7 +- .../src/de/schildbach/pte/SvvProvider.java | 7 +- .../src/de/schildbach/pte/VaoProvider.java | 4 +- .../src/de/schildbach/pte/VmobilProvider.java | 7 +- .../src/de/schildbach/pte/VorProvider.java | 7 +- .../src/de/schildbach/pte/VvtProvider.java | 7 +- .../pte/live/OoevvProviderLiveTest.java | 58 ++++-------- .../pte/live/SvvProviderLiveTest.java | 26 +----- .../pte/live/VaoProviderLiveTest.java | 89 ++++++++----------- .../pte/live/VmobilProviderLiveTest.java | 87 ++++++++---------- .../pte/live/VorProviderLiveTest.java | 27 +----- .../pte/live/VvtProviderLiveTest.java | 18 ---- 12 files changed, 110 insertions(+), 234 deletions(-) diff --git a/enabler/src/de/schildbach/pte/OoevvProvider.java b/enabler/src/de/schildbach/pte/OoevvProvider.java index f553eb44..d85eb174 100644 --- a/enabler/src/de/schildbach/pte/OoevvProvider.java +++ b/enabler/src/de/schildbach/pte/OoevvProvider.java @@ -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); } } diff --git a/enabler/src/de/schildbach/pte/SvvProvider.java b/enabler/src/de/schildbach/pte/SvvProvider.java index 9fdacab6..2073acae 100644 --- a/enabler/src/de/schildbach/pte/SvvProvider.java +++ b/enabler/src/de/schildbach/pte/SvvProvider.java @@ -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); } diff --git a/enabler/src/de/schildbach/pte/VaoProvider.java b/enabler/src/de/schildbach/pte/VaoProvider.java index 75cbf602..654c5cba 100644 --- a/enabler/src/de/schildbach/pte/VaoProvider.java +++ b/enabler/src/de/schildbach/pte/VaoProvider.java @@ -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); diff --git a/enabler/src/de/schildbach/pte/VmobilProvider.java b/enabler/src/de/schildbach/pte/VmobilProvider.java index 40b2ea96..d08d0570 100644 --- a/enabler/src/de/schildbach/pte/VmobilProvider.java +++ b/enabler/src/de/schildbach/pte/VmobilProvider.java @@ -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); } } diff --git a/enabler/src/de/schildbach/pte/VorProvider.java b/enabler/src/de/schildbach/pte/VorProvider.java index 806560a2..ac5af4dc 100644 --- a/enabler/src/de/schildbach/pte/VorProvider.java +++ b/enabler/src/de/schildbach/pte/VorProvider.java @@ -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); } diff --git a/enabler/src/de/schildbach/pte/VvtProvider.java b/enabler/src/de/schildbach/pte/VvtProvider.java index 5a133650..2da77cf0 100644 --- a/enabler/src/de/schildbach/pte/VvtProvider.java +++ b/enabler/src/de/schildbach/pte/VvtProvider.java @@ -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); } } diff --git a/enabler/test/de/schildbach/pte/live/OoevvProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/OoevvProviderLiveTest.java index 26682be5..23cbe59b 100644 --- a/enabler/test/de/schildbach/pte/live/OoevvProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/OoevvProviderLiveTest.java @@ -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); } } diff --git a/enabler/test/de/schildbach/pte/live/SvvProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/SvvProviderLiveTest.java index 04c67ee0..2386d5e5 100644 --- a/enabler/test/de/schildbach/pte/live/SvvProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/SvvProviderLiveTest.java @@ -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); } diff --git a/enabler/test/de/schildbach/pte/live/VaoProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/VaoProviderLiveTest.java index 6b4288e6..2c490159 100644 --- a/enabler/test/de/schildbach/pte/live/VaoProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/VaoProviderLiveTest.java @@ -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); } } diff --git a/enabler/test/de/schildbach/pte/live/VmobilProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/VmobilProviderLiveTest.java index 46585953..610b6a8c 100644 --- a/enabler/test/de/schildbach/pte/live/VmobilProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/VmobilProviderLiveTest.java @@ -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); } } diff --git a/enabler/test/de/schildbach/pte/live/VorProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/VorProviderLiveTest.java index a9f7924c..e4c77eff 100644 --- a/enabler/test/de/schildbach/pte/live/VorProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/VorProviderLiveTest.java @@ -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); } } diff --git a/enabler/test/de/schildbach/pte/live/VvtProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/VvtProviderLiveTest.java index fb5d2181..6fad30c9 100644 --- a/enabler/test/de/schildbach/pte/live/VvtProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/VvtProviderLiveTest.java @@ -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); }