mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-10 13:18:49 +00:00
Remove Melbourne. PTV has shut or locked down their EFA.
This commit is contained in:
parent
e965593be9
commit
dee663ea54
3 changed files with 1 additions and 200 deletions
|
@ -1,82 +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;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
|
|
||||||
import de.schildbach.pte.dto.Line;
|
|
||||||
import de.schildbach.pte.dto.Product;
|
|
||||||
import de.schildbach.pte.dto.Style;
|
|
||||||
|
|
||||||
import okhttp3.HttpUrl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Has been renamed to PTV (Public Transport Vicoria).
|
|
||||||
*
|
|
||||||
* @author Andreas Schildbach
|
|
||||||
*/
|
|
||||||
public class MetProvider extends AbstractEfaProvider {
|
|
||||||
private static final HttpUrl API_BASE = HttpUrl.parse("http://jp.ptv.vic.gov.au/ptv/");
|
|
||||||
|
|
||||||
public MetProvider() {
|
|
||||||
super(NetworkId.MET, API_BASE);
|
|
||||||
|
|
||||||
setLanguage("en");
|
|
||||||
setTimeZone("Australia/Melbourne");
|
|
||||||
setUseRouteIndexAsTripId(false);
|
|
||||||
setStyles(STYLES);
|
|
||||||
setSessionCookieName("BIGipServerpl_ptv_jp_lbvsvr");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Line parseLine(final @Nullable String id, final @Nullable String network, final @Nullable String mot,
|
|
||||||
final @Nullable String symbol, final @Nullable String name, final @Nullable String longName,
|
|
||||||
final @Nullable String trainType, final @Nullable String trainNum, final @Nullable String trainName) {
|
|
||||||
if ("0".equals(mot)) {
|
|
||||||
if ("Regional Train :".equals(longName))
|
|
||||||
return new Line(id, network, Product.REGIONAL_TRAIN, symbol);
|
|
||||||
if ("Regional Train".equals(trainName))
|
|
||||||
return new Line(id, network, Product.REGIONAL_TRAIN, null);
|
|
||||||
if ("vPK".equals(symbol) && "Regional Train Pakenham".equals(longName))
|
|
||||||
return new Line(id, network, Product.REGIONAL_TRAIN, "V/Line");
|
|
||||||
} else if ("1".equals(mot)) {
|
|
||||||
if (trainType == null && trainNum != null)
|
|
||||||
return new Line(id, network, Product.SUBURBAN_TRAIN, trainNum);
|
|
||||||
if ("Metropolitan Train".equals(trainName) && trainNum == null)
|
|
||||||
return new Line(id, network, Product.SUBURBAN_TRAIN, Strings.nullToEmpty(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.parseLine(id, network, mot, symbol, name, longName, trainType, trainNum, trainName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<String, Style> STYLES = new HashMap<String, Style>();
|
|
||||||
|
|
||||||
static {
|
|
||||||
STYLES.put("R", new Style(Style.parseColor("#a24ba3"), Style.WHITE));
|
|
||||||
STYLES.put("S", new Style(Style.parseColor("#3a75c4"), Style.WHITE));
|
|
||||||
STYLES.put("T", new Style(Style.parseColor("#5bbf21"), Style.WHITE));
|
|
||||||
STYLES.put("B", new Style(Style.parseColor("#f77f00"), Style.WHITE));
|
|
||||||
|
|
||||||
// TODO NightRider buses (buses with numbers > 940): #f26522
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -79,5 +79,5 @@ public enum NetworkId {
|
||||||
ONTARIO, QUEBEC,
|
ONTARIO, QUEBEC,
|
||||||
|
|
||||||
// Australia
|
// Australia
|
||||||
SYDNEY, MET
|
SYDNEY
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,117 +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.MetProvider;
|
|
||||||
import de.schildbach.pte.NetworkProvider.Accessibility;
|
|
||||||
import de.schildbach.pte.NetworkProvider.WalkSpeed;
|
|
||||||
import de.schildbach.pte.dto.Location;
|
|
||||||
import de.schildbach.pte.dto.LocationType;
|
|
||||||
import de.schildbach.pte.dto.NearbyLocationsResult;
|
|
||||||
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 MetProviderLiveTest extends AbstractProviderLiveTest {
|
|
||||||
public MetProviderLiveTest() {
|
|
||||||
super(new MetProvider());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void nearbyStations() throws Exception {
|
|
||||||
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "10001167"));
|
|
||||||
print(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void nearbyStationsByCoordinate() throws Exception {
|
|
||||||
final NearbyLocationsResult result = queryNearbyStations(Location.coord(-37800941, 144966545));
|
|
||||||
print(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void queryDepartures() throws Exception {
|
|
||||||
final QueryDeparturesResult result = queryDepartures("10001167", false);
|
|
||||||
print(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void queryDeparturesInvalidStation() throws Exception {
|
|
||||||
final QueryDeparturesResult result = queryDepartures("999999", false);
|
|
||||||
assertEquals(QueryDeparturesResult.Status.INVALID_STATION, result.status);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void suggestLocationsIncomplete() throws Exception {
|
|
||||||
final SuggestLocationsResult result = suggestLocations("Kur");
|
|
||||||
print(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void shortTrip() throws Exception {
|
|
||||||
final QueryTripsResult result = queryTrips(
|
|
||||||
new Location(LocationType.STATION, "10001181", -37818664, 144952784, "Melbourne City",
|
|
||||||
"Southern Cross Railway Station (Melbourne City)"),
|
|
||||||
null,
|
|
||||||
new Location(LocationType.STATION, "10002204", -37818248, 144967824, "Melbourne City",
|
|
||||||
"13-Federation Square/Swanston St"),
|
|
||||||
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 tripToAny() throws Exception {
|
|
||||||
final QueryTripsResult result = queryTrips(
|
|
||||||
new Location(LocationType.ADDRESS, null, -37903445, 145102109, null,
|
|
||||||
"16 Burlington St, Oakleigh Victoria 3166, Australien"),
|
|
||||||
null, new Location(LocationType.ANY, null, 0, 0, null, "elizabeth st kensingtin"), new Date(), true,
|
|
||||||
Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
|
||||||
print(result);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue