mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 08:10:46 +00:00
Merge London and South West England into East of England.
This commit is contained in:
parent
fdf1a6ca2a
commit
b7f1fda768
7 changed files with 91 additions and 484 deletions
|
@ -56,7 +56,7 @@ public enum NetworkId
|
|||
LU,
|
||||
|
||||
// United Kingdom
|
||||
TFL, TLEM, TLWM, TLSW,
|
||||
TLEM, TLWM,
|
||||
|
||||
// Ireland
|
||||
TFI, EIREANN,
|
||||
|
|
|
@ -1,154 +0,0 @@
|
|||
/*
|
||||
* Copyright 2010-2014 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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import de.schildbach.pte.dto.Style;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
*/
|
||||
public class TflProvider extends AbstractEfaProvider
|
||||
{
|
||||
public static final NetworkId NETWORK_ID = NetworkId.TFL;
|
||||
private static final String API_BASE = "http://journeyplanner.tfl.gov.uk/user/";
|
||||
|
||||
public TflProvider()
|
||||
{
|
||||
super(API_BASE);
|
||||
|
||||
setTimeZone("Europe/London");
|
||||
setUseLineRestriction(false);
|
||||
setStyles(STYLES);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
{
|
||||
return NETWORK_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String parseLine(final String mot, final String symbol, final String name, final String longName, final String trainType,
|
||||
final String trainNum, final String trainName)
|
||||
{
|
||||
if ("0".equals(mot))
|
||||
{
|
||||
if ("First Hull Trains".equals(trainName) || "=HT".equals(trainType))
|
||||
return "IHT" + trainNum;
|
||||
|
||||
else if ("Southern".equals(trainName) || "=SN".equals(trainType))
|
||||
return "RSN" + trainNum;
|
||||
else if ("Southeastern".equals(trainName) || "=SE".equals(trainType))
|
||||
return "RSE" + trainNum;
|
||||
else if ("South West Trains".equals(trainName) || "=SW".equals(trainType))
|
||||
return "RSW" + trainNum;
|
||||
else if ("Greater Anglia".equals(trainName) || "=LE".equals(trainType))
|
||||
return "RLE" + trainNum;
|
||||
else if ("First Great Western".equals(trainName) || "=GW".equals(trainType))
|
||||
return "RGW" + trainNum;
|
||||
else if ("First Capital Connect".equals(trainName) || "=FC".equals(trainType))
|
||||
return "RFC" + trainNum;
|
||||
else if ("Northern Rail".equals(trainName) || "=NT".equals(trainType))
|
||||
return "RNT" + trainNum;
|
||||
else if ("Heathrow Connect".equals(trainName) || "=HC".equals(trainType))
|
||||
return "RHC" + trainNum;
|
||||
else if ("Heathrow Express".equals(trainName) || "=HX".equals(trainType))
|
||||
return "RHX" + trainNum;
|
||||
else if ("Gatwick Express".equals(trainName) || "=GX".equals(trainType))
|
||||
return "RGX" + trainNum;
|
||||
else if ("Merseyrail".equals(trainName) || "=ME".equals(trainType))
|
||||
return "RME" + trainNum;
|
||||
else if ("East Coast".equals(trainName) || "=GR".equals(trainType))
|
||||
return "RGR" + trainNum;
|
||||
else if ("Cross Country".equals(trainName) || "=XC".equals(trainType))
|
||||
return "RXC" + trainNum;
|
||||
else if ("East Midlands Trains".equals(trainName) || "=EM".equals(trainType))
|
||||
return "REM" + trainNum;
|
||||
else if ("Arriva Trains Wales".equals(trainName) || "=AW".equals(trainType))
|
||||
return "RAW" + trainNum;
|
||||
else if ("First TransPennine Express".equals(trainName) || "=TP".equals(trainType))
|
||||
return "RTP" + trainNum;
|
||||
else if ("ScotRail".equals(trainName) || "=SR".equals(trainType))
|
||||
return "RSR" + trainNum;
|
||||
else if ("London Midland".equals(trainName) || "=LM".equals(trainType))
|
||||
return "RLM" + trainNum;
|
||||
else if ("c2c".equals(trainName) || "=CC".equals(trainType))
|
||||
return "RCC" + trainNum;
|
||||
else if ("Grand Central".equals(trainName) || "=GC".equals(trainType))
|
||||
return "RGC" + trainNum;
|
||||
else if ("Virgin Trains".equals(trainName) || "=VT".equals(trainType))
|
||||
return "RVT" + trainNum;
|
||||
else if ("Island Line".equals(trainName) || "=IL".equals(trainType))
|
||||
return "RIL" + trainNum;
|
||||
else if ("Chiltern Railways".equals(trainName) || "=CH".equals(trainType))
|
||||
return "RCH" + trainNum;
|
||||
|
||||
else if ("London Overground".equals(trainName) || "=LO".equals(trainType))
|
||||
return "SLO" + trainNum;
|
||||
else if ("LO".equals(trainNum) && trainType == null && trainName == null)
|
||||
return "SLO";
|
||||
|
||||
else if ("Underground".equals(trainName) && trainType == null && name != null)
|
||||
return "U" + name;
|
||||
}
|
||||
else if ("3".equals(mot))
|
||||
{
|
||||
if ("London Overground".equals(trainName) || "=LO".equals(trainType))
|
||||
return "SLO" + (trainNum != null ? trainNum : "");
|
||||
}
|
||||
|
||||
return super.parseLine(mot, symbol, name, longName, trainType, trainNum, trainName);
|
||||
}
|
||||
|
||||
private static final Map<String, Style> STYLES = new HashMap<String, Style>();
|
||||
|
||||
static
|
||||
{
|
||||
// London
|
||||
STYLES.put("UBakerloo", new Style(Style.parseColor("#9D5324"), Style.WHITE));
|
||||
STYLES.put("UCentral", new Style(Style.parseColor("#D52B1E"), Style.WHITE));
|
||||
STYLES.put("UCircle", new Style(Style.parseColor("#FECB00"), Style.BLACK));
|
||||
STYLES.put("UDistrict", new Style(Style.parseColor("#007934"), Style.WHITE));
|
||||
STYLES.put("UEast London", new Style(Style.parseColor("#FFA100"), Style.WHITE));
|
||||
STYLES.put("UHammersmith & City", new Style(Style.parseColor("#C5858F"), Style.BLACK));
|
||||
STYLES.put("UJubilee", new Style(Style.parseColor("#818A8F"), Style.WHITE));
|
||||
STYLES.put("UMetropolitan", new Style(Style.parseColor("#850057"), Style.WHITE));
|
||||
STYLES.put("UNorthern", new Style(Style.BLACK, Style.WHITE));
|
||||
STYLES.put("UPiccadilly", new Style(Style.parseColor("#0018A8"), Style.WHITE));
|
||||
STYLES.put("UVictoria", new Style(Style.parseColor("#00A1DE"), Style.WHITE));
|
||||
STYLES.put("UWaterloo & City", new Style(Style.parseColor("#76D2B6"), Style.BLACK));
|
||||
|
||||
STYLES.put("SDLR", new Style(Style.parseColor("#00B2A9"), Style.WHITE));
|
||||
STYLES.put("SLO", new Style(Style.parseColor("#f46f1a"), Style.WHITE));
|
||||
|
||||
STYLES.put("TTramlink 1", new Style(Style.rgb(193, 215, 46), Style.WHITE));
|
||||
STYLES.put("TTramlink 2", new Style(Style.rgb(193, 215, 46), Style.WHITE));
|
||||
STYLES.put("TTramlink 3", new Style(Style.rgb(124, 194, 66), Style.BLACK));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style lineStyle(final String network, final String line)
|
||||
{
|
||||
if (line.startsWith("SLO"))
|
||||
return super.lineStyle(network, "SLO");
|
||||
|
||||
return super.lineStyle(network, line);
|
||||
}
|
||||
}
|
|
@ -18,8 +18,11 @@
|
|||
package de.schildbach.pte;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.dto.Style;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
|
@ -29,6 +32,8 @@ public class TlemProvider extends AbstractEfaProvider
|
|||
public static final NetworkId NETWORK_ID = NetworkId.TLEM;
|
||||
private final static String API_BASE = "http://www.travelineeastmidlands.co.uk/em/";
|
||||
|
||||
// http://www.travelineeastmidlands.co.uk/em/
|
||||
// http://www.travelinesw.com/swe/
|
||||
// http://www.travelinesoutheast.org.uk/se/
|
||||
// http://www.travelineeastanglia.org.uk/ea/
|
||||
|
||||
|
@ -37,6 +42,7 @@ public class TlemProvider extends AbstractEfaProvider
|
|||
super(API_BASE);
|
||||
|
||||
setTimeZone("Europe/London");
|
||||
setStyles(STYLES);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
@ -54,22 +60,35 @@ public class TlemProvider extends AbstractEfaProvider
|
|||
return normalizedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String parseLine(final String mot, final String symbol, final String name, final String longName, final String trainType,
|
||||
final String trainNum, final String trainName)
|
||||
{
|
||||
if ("0".equals(mot))
|
||||
{
|
||||
if ("Underground".equals(trainName) && trainType == null && name != null)
|
||||
return "U" + name;
|
||||
}
|
||||
|
||||
return super.parseLine(mot, symbol, name, longName, trainType, trainNum, trainName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Product> defaultProducts()
|
||||
{
|
||||
return Product.ALL;
|
||||
}
|
||||
|
||||
private static final Map<String, Style> STYLES = new HashMap<String, Style>();
|
||||
|
||||
static
|
||||
{
|
||||
// London
|
||||
STYLES.put("UBakerloo", new Style(Style.parseColor("#9D5324"), Style.WHITE));
|
||||
STYLES.put("UCentral", new Style(Style.parseColor("#D52B1E"), Style.WHITE));
|
||||
STYLES.put("UCircle", new Style(Style.parseColor("#FECB00"), Style.BLACK));
|
||||
STYLES.put("UDistrict", new Style(Style.parseColor("#007934"), Style.WHITE));
|
||||
STYLES.put("UEast London", new Style(Style.parseColor("#FFA100"), Style.WHITE));
|
||||
STYLES.put("UHammersmith & City", new Style(Style.parseColor("#C5858F"), Style.BLACK));
|
||||
STYLES.put("UJubilee", new Style(Style.parseColor("#818A8F"), Style.WHITE));
|
||||
STYLES.put("UMetropolitan", new Style(Style.parseColor("#850057"), Style.WHITE));
|
||||
STYLES.put("UNorthern", new Style(Style.BLACK, Style.WHITE));
|
||||
STYLES.put("UPiccadilly", new Style(Style.parseColor("#0018A8"), Style.WHITE));
|
||||
STYLES.put("UVictoria", new Style(Style.parseColor("#00A1DE"), Style.WHITE));
|
||||
STYLES.put("UWaterloo & City", new Style(Style.parseColor("#76D2B6"), Style.BLACK));
|
||||
|
||||
STYLES.put("SDLR", new Style(Style.parseColor("#00B2A9"), Style.WHITE));
|
||||
STYLES.put("SLO", new Style(Style.parseColor("#f46f1a"), Style.WHITE));
|
||||
|
||||
STYLES.put("TTramlink 1", new Style(Style.rgb(193, 215, 46), Style.WHITE));
|
||||
STYLES.put("TTramlink 2", new Style(Style.rgb(193, 215, 46), Style.WHITE));
|
||||
STYLES.put("TTramlink 3", new Style(Style.rgb(124, 194, 66), Style.BLACK));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* Copyright 2010-2014 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;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import de.schildbach.pte.dto.Product;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
*/
|
||||
public class TlswProvider extends AbstractEfaProvider
|
||||
{
|
||||
public static final NetworkId NETWORK_ID = NetworkId.TLSW;
|
||||
private final static String API_BASE = "http://www.travelinesw.com/swe/";
|
||||
|
||||
public TlswProvider()
|
||||
{
|
||||
super(API_BASE);
|
||||
|
||||
setTimeZone("Europe/London");
|
||||
setUseRouteIndexAsTripId(false);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
{
|
||||
return NETWORK_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String normalizeLocationName(final String name)
|
||||
{
|
||||
final String normalizedName = super.normalizeLocationName(name);
|
||||
if (normalizedName != null && normalizedName.endsWith(" ()"))
|
||||
return normalizedName.substring(0, normalizedName.length() - 3);
|
||||
else
|
||||
return normalizedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Product> defaultProducts()
|
||||
{
|
||||
return Product.ALL;
|
||||
}
|
||||
}
|
|
@ -1,144 +0,0 @@
|
|||
/*
|
||||
* Copyright 2010-2014 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.TflProvider;
|
||||
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 TflProviderLiveTest extends AbstractProviderLiveTest
|
||||
{
|
||||
public TflProviderLiveTest()
|
||||
{
|
||||
super(new TflProvider());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStations() throws Exception
|
||||
{
|
||||
final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.STATION, "1000086"), 0, 0);
|
||||
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStationsByCoordinate() throws Exception
|
||||
{
|
||||
final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.ADDRESS, 51507161, -0127144), 0, 0);
|
||||
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDepartures() throws Exception
|
||||
{
|
||||
final QueryDeparturesResult result = queryDepartures("1000086", 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, "1008730", null, "King & Queen Wharf"), null, new Location(
|
||||
LocationType.STATION, "1006433", null, "Edinburgh Court"), 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);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void postcodeTrip() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.ANY, null, null, "sw19 8ta"), null, new Location(LocationType.STATION,
|
||||
"1016019", 51655903, -397249, null, "Watford (Herts), Watford Town Centre"), new Date(), true, Product.ALL, WalkSpeed.NORMAL,
|
||||
Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tripItdMessageList() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.ADDRESS, null, 51446072, -239417, "Wandsworth",
|
||||
"Timsbury Walk, Wandsworth"), null, new Location(LocationType.STATION, "90046985", 53225140, -1472433, "Chesterfield (Derbys)",
|
||||
"Walton (Chesterfield), Netherfield Road (on Somersall Lane)"), new Date(), true, Product.ALL, WalkSpeed.NORMAL,
|
||||
Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -48,23 +48,48 @@ public class TlemProviderLiveTest extends AbstractProviderLiveTest
|
|||
@Test
|
||||
public void nearbyStations() throws Exception
|
||||
{
|
||||
final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.STATION, "1001003"), 0, 0);
|
||||
final NearbyStationsResult result1 = provider.queryNearbyStations(new Location(LocationType.STATION, "1001003"), 0, 0);
|
||||
print(result1);
|
||||
|
||||
print(result);
|
||||
final NearbyStationsResult result2 = provider.queryNearbyStations(new Location(LocationType.STATION, "1000086"), 0, 0);
|
||||
print(result2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStationsByCoordinate() throws Exception
|
||||
{
|
||||
final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.ADDRESS, 51507161, -0127144), 0, 0);
|
||||
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDepartures() throws Exception
|
||||
{
|
||||
final QueryDeparturesResult result = queryDepartures("1001003", false);
|
||||
final QueryDeparturesResult result1 = queryDepartures("1001003", false);
|
||||
print(result1);
|
||||
|
||||
final QueryDeparturesResult result3 = queryDepartures("1000086", false);
|
||||
print(result3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDeparturesEquivs() throws Exception
|
||||
{
|
||||
final QueryDeparturesResult result = queryDepartures("1001003", true);
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDeparturesInvalidStation() throws Exception
|
||||
{
|
||||
final QueryDeparturesResult resultLive = queryDepartures("999999", false);
|
||||
assertEquals(QueryDeparturesResult.Status.INVALID_STATION, resultLive.status);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void suggestLocations() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = provider.suggestLocations("Lower Arncott The Plough");
|
||||
|
||||
print(result);
|
||||
}
|
||||
|
@ -104,4 +129,33 @@ public class TlemProviderLiveTest extends AbstractProviderLiveTest
|
|||
final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false);
|
||||
print(earlierResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tripArncott() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "60011202", 51850168, -1094302, "Upper Arncott",
|
||||
"Bullingdon Prison"), null, new Location(LocationType.STATION, "60006013", 51856612, -1112904, "Lower Arncott", "The Plough E"),
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
/*
|
||||
* Copyright 2010-2014 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.TlswProvider;
|
||||
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 TlswProviderLiveTest extends AbstractProviderLiveTest
|
||||
{
|
||||
public TlswProviderLiveTest()
|
||||
{
|
||||
super(new TlswProvider());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStations() throws Exception
|
||||
{
|
||||
final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.STATION, "247616"), 0, 0);
|
||||
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStationsByCoordinate() throws Exception
|
||||
{
|
||||
final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.ADDRESS, 51507161, -0127144), 0, 0);
|
||||
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDepartures() throws Exception
|
||||
{
|
||||
final QueryDeparturesResult result = queryDepartures("247616", 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, "60011202", 51850168, -1094302, "Upper Arncott",
|
||||
"Bullingdon Prison"), null, new Location(LocationType.STATION, "60006576", 51856352, -1113127, "Lower Arncott", "The Plough"),
|
||||
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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue