diff --git a/enabler/src/de/schildbach/pte/NetworkId.java b/enabler/src/de/schildbach/pte/NetworkId.java index aff61dd9..c2155bd8 100644 --- a/enabler/src/de/schildbach/pte/NetworkId.java +++ b/enabler/src/de/schildbach/pte/NetworkId.java @@ -26,7 +26,7 @@ public enum NetworkId RT, // Germany - DB, BVG, VBB, NVV, BAYERN, MVV, INVG, AVV, VGN, VVM, VMV, RSAG, HVV, SH, GVH, VSN, BSVAG, VBN, NASA, VVO, VMS, VGS, VRR, VRS, MVG, NPH, VRN, VRT, VVS, NALDO, DING, KVV, VAGFR, NVBW, VVV, + DB, BVG, VBB, NVV, BAYERN, MVV, INVG, AVV, VGN, VVM, VMV, RSAG, HVV, SH, GVH, VSN, BSVAG, VBN, NASA, VVO, VMS, VGS, VRR, VRS, MVG, NPH, VRN, VVS, NALDO, DING, KVV, VAGFR, NVBW, VVV, // Austria OEBB, VOR, WIEN, LINZ, SVV, VVT, VMOBIL, IVB, STV, diff --git a/enabler/src/de/schildbach/pte/VrnProvider.java b/enabler/src/de/schildbach/pte/VrnProvider.java index 19d90768..1c311df4 100644 --- a/enabler/src/de/schildbach/pte/VrnProvider.java +++ b/enabler/src/de/schildbach/pte/VrnProvider.java @@ -25,6 +25,8 @@ public class VrnProvider extends AbstractEfaProvider public static final NetworkId NETWORK_ID = NetworkId.VRN; private static final String API_BASE = "http://fahrplanauskunft.vrn.de/vrn_mobile/"; + // http://efa9.vrn.de/vrt/ + public VrnProvider() { super(API_BASE); diff --git a/enabler/src/de/schildbach/pte/VrtProvider.java b/enabler/src/de/schildbach/pte/VrtProvider.java deleted file mode 100644 index da22e931..00000000 --- a/enabler/src/de/schildbach/pte/VrtProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2010-2015 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package de.schildbach.pte; - -/** - * @author Andreas Schildbach - */ -public class VrtProvider extends AbstractEfaProvider -{ - public static final NetworkId NETWORK_ID = NetworkId.VRT; - private final static String API_BASE = "http://efa9.vrn.de/vrt/"; - - public VrtProvider() - { - super(API_BASE); - } - - public NetworkId id() - { - return NETWORK_ID; - } -} diff --git a/enabler/test/de/schildbach/pte/live/VrnProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/VrnProviderLiveTest.java index 9a151a20..a49c1c41 100644 --- a/enabler/test/de/schildbach/pte/live/VrnProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/VrnProviderLiveTest.java @@ -48,32 +48,37 @@ public class VrnProviderLiveTest extends AbstractProviderLiveTest @Test public void nearbyStations() throws Exception { - final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.STATION, "6032236"), 0, 0); + final NearbyStationsResult result1 = provider.queryNearbyStations(new Location(LocationType.STATION, "6032236"), 0, 0); + print(result1); - print(result); + final NearbyStationsResult result2 = provider.queryNearbyStations(new Location(LocationType.STATION, "17001301"), 0, 0); + print(result2); } @Test public void nearbyStationsByCoordinate() throws Exception { - final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.ADDRESS, 49486561, 8477297), 0, 0); + final NearbyStationsResult result1 = provider.queryNearbyStations(new Location(LocationType.ADDRESS, 49486561, 8477297), 0, 0); + print(result1); - print(result); + final NearbyStationsResult result2 = provider.queryNearbyStations(new Location(LocationType.ADDRESS, 49757571, 6639147), 0, 0); + print(result2); } @Test public void queryDepartures() throws Exception { - final QueryDeparturesResult result = queryDepartures("6032236", false); + final QueryDeparturesResult result1 = queryDepartures("6032236", false); + print(result1); - print(result); + final QueryDeparturesResult result2 = queryDepartures("17001301", false); + print(result2); } @Test public void suggestLocationsIncomplete() throws Exception { final SuggestLocationsResult result = provider.suggestLocations("Kur"); - print(result); } @@ -81,7 +86,6 @@ public class VrnProviderLiveTest extends AbstractProviderLiveTest public void suggestLocationsWithUmlaut() throws Exception { final SuggestLocationsResult result = provider.suggestLocations("grĂ¼n"); - print(result); } @@ -89,7 +93,6 @@ public class VrnProviderLiveTest extends AbstractProviderLiveTest public void suggestLocationsIdentified() throws Exception { final SuggestLocationsResult result = provider.suggestLocations("Bremen, KUR"); - print(result); } @@ -97,7 +100,6 @@ public class VrnProviderLiveTest extends AbstractProviderLiveTest public void suggestLocationsLocality() throws Exception { final SuggestLocationsResult result = provider.suggestLocations("Bremen"); - print(result); } @@ -105,7 +107,6 @@ public class VrnProviderLiveTest extends AbstractProviderLiveTest public void suggestLocationsCity() throws Exception { final SuggestLocationsResult result = provider.suggestLocations("Mannheim"); - print(result); } @@ -137,4 +138,32 @@ public class VrnProviderLiveTest extends AbstractProviderLiveTest final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false); print(earlierResult); } + + @Test + public void shortTrip2() throws Exception + { + final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "17002402", null, "Bahnhof"), null, new Location( + LocationType.STATION, "17009001", null, "Bahnhof"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); + 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/VrtProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/VrtProviderLiveTest.java deleted file mode 100644 index ad0369ae..00000000 --- a/enabler/test/de/schildbach/pte/live/VrtProviderLiveTest.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2010-2015 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package de.schildbach.pte.live; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.Date; - -import org.junit.Test; - -import de.schildbach.pte.NetworkProvider.Accessibility; -import de.schildbach.pte.NetworkProvider.WalkSpeed; -import de.schildbach.pte.VrtProvider; -import de.schildbach.pte.dto.Location; -import de.schildbach.pte.dto.LocationType; -import de.schildbach.pte.dto.NearbyStationsResult; -import de.schildbach.pte.dto.Product; -import de.schildbach.pte.dto.QueryDeparturesResult; -import de.schildbach.pte.dto.QueryTripsResult; -import de.schildbach.pte.dto.SuggestLocationsResult; - -/** - * @author Andreas Schildbach - */ -public class VrtProviderLiveTest extends AbstractProviderLiveTest -{ - public VrtProviderLiveTest() - { - super(new VrtProvider()); - } - - @Test - public void nearbyStations() throws Exception - { - final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.STATION, "17001301"), 0, 0); - - print(result); - } - - @Test - public void nearbyStationsByCoordinate() throws Exception - { - final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.ADDRESS, 49757571, 6639147), 0, 0); - - print(result); - } - - @Test - public void queryDepartures() throws Exception - { - final QueryDeparturesResult result = queryDepartures("17001301", false); - - print(result); - } - - @Test - public void suggestLocationsIncomplete() throws Exception - { - final SuggestLocationsResult result = provider.suggestLocations("Kur"); - - print(result); - } - - @Test - public void shortTrip() throws Exception - { - final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "17002402", null, "Bahnhof"), null, new Location( - LocationType.STATION, "17009001", null, "Bahnhof"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); - 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); - } -}