Merge Trier into Rhineland-Palatinate, Rhine-Neckar & Baden-Württemberg.

This commit is contained in:
Andreas Schildbach 2015-01-15 10:23:11 +01:00
parent 3db5c27153
commit 64366b4d3e
5 changed files with 43 additions and 156 deletions

View file

@ -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,

View file

@ -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);

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View file

@ -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);
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}