AbstractNavitiaProvider: remove all providers based on Navitia

This commit is contained in:
Andreas Schildbach 2021-09-17 16:11:41 +02:00
parent 7913f0cc1a
commit f2617c20a6
45 changed files with 6 additions and 5227 deletions

View file

@ -12,7 +12,7 @@ Copy the `secrets.properties.template` file to `secrets.properties` like so:
$ cp test/de/schildbach/pte/live/secrets.properties.template test/de/schildbach/pte/live/secrets.properties $ cp test/de/schildbach/pte/live/secrets.properties.template test/de/schildbach/pte/live/secrets.properties
You need to request the secrets directly from the provider. For Navitia based providers, you can [request a secret here](https://www.navitia.io/register). You need to request the secrets directly from the provider.
How to run live tests? How to run live tests?
---------------------- ----------------------
@ -25,7 +25,7 @@ If you prefer to run tests from the command line, you can comment out the test e
[build.gradle](https://github.com/schildbach/public-transport-enabler/blob/master/build.gradle#L30) [build.gradle](https://github.com/schildbach/public-transport-enabler/blob/master/build.gradle#L30)
and use this command to only execute a test for a single provider: and use this command to only execute a test for a single provider:
$ gradle -Dtest.single=ParisProviderLive test $ gradle -Dtest.single=BvgProviderLive test
This uses the `ParisProvider` as an example. This uses the `BvgProvider` as an example.
Just replace it with the provider you want to test. Just replace it with the provider you want to test.

File diff suppressed because it is too large Load diff

View file

@ -1,165 +0,0 @@
/*
* Copyright 2017 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import java.util.HashMap;
import java.util.Map;
import de.schildbach.pte.dto.Product;
import de.schildbach.pte.dto.Style;
import okhttp3.HttpUrl;
public class AustraliaProvider extends AbstractNavitiaProvider {
public static final String NETWORK_PTV = "PTV - Public Transport Victoria";
public static final String NETWORK_TAS = "Metro Tasmania";
public static final String NETWORK_QLD = "TransLink";
public static final String NETWORK_SA = "Adelaide Metro";
public static final String NETWORK_WA = "Transperth";
private static final Map<String, Style> STYLES = new HashMap<>();
static {
// Melbourne train networks.
// https://static.ptv.vic.gov.au/Maps/1482457134/PTV_Train-Network-Map_2017.pdf
STYLES.put(NETWORK_PTV + "|SBelgrave", new Style(Style.Shape.RECT, Style.parseColor("#094B8D"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|SLilydale", new Style(Style.Shape.RECT, Style.parseColor("#094B8D"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|SAlamein", new Style(Style.Shape.RECT, Style.parseColor("#094B8D"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|SGlen Waverly",
new Style(Style.Shape.RECT, Style.parseColor("#094B8D"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|SSunbury", new Style(Style.Shape.RECT, Style.parseColor("#FFB531"), Style.BLACK));
STYLES.put(NETWORK_PTV + "|SCraigieburn",
new Style(Style.Shape.RECT, Style.parseColor("#FFB531"), Style.BLACK));
STYLES.put(NETWORK_PTV + "|SUpfield", new Style(Style.Shape.RECT, Style.parseColor("#FFB531"), Style.BLACK));
STYLES.put(NETWORK_PTV + "|SSouth Morang",
new Style(Style.Shape.RECT, Style.parseColor("#E42B23"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|SHurstbridge",
new Style(Style.Shape.RECT, Style.parseColor("#E42B23"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|SPakenham", new Style(Style.Shape.RECT, Style.parseColor("#16B4E8"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|SCranbourne", new Style(Style.Shape.RECT, Style.parseColor("#16B4E8"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|SFrankston", new Style(Style.Shape.RECT, Style.parseColor("#149943"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|SWerribee", new Style(Style.Shape.RECT, Style.parseColor("#149943"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|SWilliamstown",
new Style(Style.Shape.RECT, Style.parseColor("#149943"), Style.WHITE));
// Truncated version of "Sandringham". Not sure if this is a bug/limitation in either Navitia or the
// GTFS feed from PTV.
STYLES.put(NETWORK_PTV + "|SSandringha", new Style(Style.Shape.RECT, Style.parseColor("#FC7EBB"), Style.BLACK));
// Difficult to test this, because the line is open only for select periods of the year (e.g. for the
// Melbourne Show in September) and at time of writing, the GTFS feed did not have data up until then.
STYLES.put(NETWORK_PTV + "|SFlemington Racecourse",
new Style(Style.Shape.RECT, Style.parseColor("#9A9B9F"), Style.BLACK));
// Melbourne Trams.
// https://static.ptv.vic.gov.au/Maps/1493356745/PTV_Tram-Network-Map_2017.pdf
STYLES.put(NETWORK_PTV + "|T1", new Style(Style.Shape.RECT, Style.parseColor("#B8C53A"), Style.BLACK));
// The GTFS feed seems to combine 3 + 3a like this, but for completeness we include 3 and 3a
// separately too.
STYLES.put(NETWORK_PTV + "|T3", new Style(Style.Shape.RECT, Style.parseColor("#87D9F2"), Style.BLACK));
STYLES.put(NETWORK_PTV + "|T3a", new Style(Style.Shape.RECT, Style.parseColor("#87D9F2"), Style.BLACK));
STYLES.put(NETWORK_PTV + "|T3/3a", new Style(Style.Shape.RECT, Style.parseColor("#87D9F2"), Style.BLACK));
STYLES.put(NETWORK_PTV + "|T5", new Style(Style.Shape.RECT, Style.parseColor("#F44131"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|T6", new Style(Style.Shape.RECT, Style.parseColor("#004969"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|T11", new Style(Style.Shape.RECT, Style.parseColor("#7ECBA4"), Style.BLACK));
STYLES.put(NETWORK_PTV + "|T12", new Style(Style.Shape.RECT, Style.parseColor("#008A99"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|T16", new Style(Style.Shape.RECT, Style.parseColor("#FFD86C"), Style.BLACK));
STYLES.put(NETWORK_PTV + "|T19", new Style(Style.Shape.RECT, Style.parseColor("#87457A"), Style.WHITE)); // Night
STYLES.put(NETWORK_PTV + "|T30", new Style(Style.Shape.RECT, Style.parseColor("#3343A3"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|T35", new Style(Style.Shape.RECT, Style.parseColor("#6E351C"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|T48", new Style(Style.Shape.RECT, Style.parseColor("#45474C"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|T57", new Style(Style.Shape.RECT, Style.parseColor("#45C6CE"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|T58", new Style(Style.Shape.RECT, Style.parseColor("#878E94"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|T59", new Style(Style.Shape.RECT, Style.parseColor("#438459"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|T64", new Style(Style.Shape.RECT, Style.parseColor("#2EB070"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|T67", new Style(Style.Shape.RECT, Style.parseColor("#B47962"), Style.WHITE)); // Night
STYLES.put(NETWORK_PTV + "|T70", new Style(Style.Shape.RECT, Style.parseColor("#FC8BC1"), Style.BLACK));
STYLES.put(NETWORK_PTV + "|T72", new Style(Style.Shape.RECT, Style.parseColor("#97BAA6"), Style.BLACK));
STYLES.put(NETWORK_PTV + "|T75", new Style(Style.Shape.RECT, Style.parseColor("#00A8DF"), Style.WHITE)); // Night
STYLES.put(NETWORK_PTV + "|T78", new Style(Style.Shape.RECT, Style.parseColor("#7B7EC0"), Style.WHITE));
STYLES.put(NETWORK_PTV + "|T82", new Style(Style.Shape.RECT, Style.parseColor("#BCD649"), Style.BLACK));
STYLES.put(NETWORK_PTV + "|T86", new Style(Style.Shape.RECT, Style.parseColor("#FFB730"), Style.BLACK)); // Night
STYLES.put(NETWORK_PTV + "|T96", new Style(Style.Shape.RECT, Style.parseColor("#F2428F"), Style.WHITE)); // Night
STYLES.put(NETWORK_PTV + "|T109", new Style(Style.Shape.RECT, Style.parseColor("#FF7B24"), Style.WHITE)); // Night
STYLES.put(NETWORK_PTV + "|B", new Style(Style.Shape.RECT, Style.parseColor("#EA8D1E"), Style.WHITE));
// NOTE: This is a work around for poor GTFS data. We should instead say "All REGIONAL_TRAINs are
// purple", but the GTFS feed from Navitia instead returns rural trains as SUBURBAN_TRAINs. Given we
// have already provided colours for all suburban trains above, this more general statement about
// suburban trains results in all regional trains being coloured purple, as intented.
STYLES.put(NETWORK_PTV + "|S", new Style(Style.Shape.RECT, Style.parseColor("#782F9A"), Style.WHITE));
// Sydney train networks.
// http://www.sydneytrains.info/stations/pdf/suburban_map.pdf
// Navitia is not returning enough info in "display_informations" to colourise correctly.
// Specifically, they are not returning "code" which usually is the display name of the line.
// At any rate, the EFA provider for Sydney is likely going to be better than this Navitia provider
// anyway.
// Adelaide train/tram networks.
// These are already colourised correctly by the GTFS data given to Navitia.
// But for reference, the map is available at https://www.adelaidemetro.com.au/Timetables-Maps/Maps.
// Brisbane train/tram/bus/ferry networks.
// These are already colourised correctly by the GTFS data given to Navitia.
// But for reference, the maps are available at https://translink.com.au/plan-your-journey/maps.
// Perth train/bus/ferry networks.
// These are already colourised correctly by the GTFS data given to Navitia.
// The styles do not include "display_informations" with a proper "code" though, so the names are not
// displayed. But for reference, the maps are available at
// http://www.transperth.wa.gov.au/Journey-Planner/Network-Maps.
// Tasmania bus networks.
// Somewhat colourised in Navitia (e.g. Launceston has green buses), but it is incorrect (e.g.
// Launceston should have all sorts of different coloured buses). Maps are available at
// https://www.metrotas.com.au/timetables/.
}
public AustraliaProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.AUSTRALIA, apiBase, authorization);
setTimeZone("Australia/Melbourne");
setStyles(STYLES);
}
public AustraliaProvider(final String authorization) {
super(NetworkId.AUSTRALIA, authorization);
setTimeZone("Australia/Melbourne");
setStyles(STYLES);
}
@Override
public String region() {
return "au";
}
@Override
protected Style getLineStyle(String network, Product product, String code, String backgroundColor,
String foregroundColor) {
final Style overridenStyle = lineStyle(network, product, code);
if (overridenStyle != Standard.STYLES.get(product))
return overridenStyle;
else
return super.getLineStyle(network, product, code, backgroundColor, foregroundColor);
}
}

View file

@ -1,67 +0,0 @@
/*
* 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
* 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 de.schildbach.pte.dto.Product;
import de.schildbach.pte.dto.Style;
import de.schildbach.pte.dto.Style.Shape;
/**
* @author Torsten Grote
*/
public class BrazilProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "br";
public BrazilProvider(final String authorization) {
super(NetworkId.BRAZIL, authorization);
setTimeZone("America/Sao_Paulo");
}
@Override
public String region() {
return API_REGION;
}
@Override
protected Style getLineStyle(final String network, final Product product, final String code, final String color) {
final Style defaultStyle = Standard.STYLES.get(product);
int bc = defaultStyle.backgroundColor;
int fc = defaultStyle.foregroundColor;
if (color != null) {
bc = Style.parseColor(color);
fc = computeForegroundColor(color);
}
switch (product) {
case SUBURBAN_TRAIN: {
return new Style(Shape.CIRCLE, bc, fc);
}
case SUBWAY: {
return new Style(Shape.CIRCLE, bc, fc);
}
case TRAM: {
return new Style(Shape.RECT, bc, fc);
}
case BUS: {
return new Style(Shape.RECT, bc, fc);
}
default:
return new Style(bc, fc);
}
}
}

View file

@ -1,42 +0,0 @@
/*
* 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
* 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import okhttp3.HttpUrl;
/**
* @author Stephane Berube
*/
public class BritishColumbiaProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "ca-bc";
public BritishColumbiaProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.BRITISHCOLUMBIA, apiBase, authorization);
setTimeZone("America/Vancouver");
}
public BritishColumbiaProvider(final String authorization) {
super(NetworkId.BRITISHCOLUMBIA, authorization);
setTimeZone("America/Vancouver");
}
@Override
public String region() {
return API_REGION;
}
}

View file

@ -1,42 +0,0 @@
/*
* Copyright 2019 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import okhttp3.HttpUrl;
/**
* @author Filip Hejsek
*/
public class CzechRepublicProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "cz";
public CzechRepublicProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.CZECH_REPUBLIC, apiBase, authorization);
setTimeZone("Europe/Prague");
}
public CzechRepublicProvider(final String authorization) {
super(NetworkId.CZECH_REPUBLIC, authorization);
setTimeZone("Europe/Prague");
}
@Override
public String region() {
return API_REGION;
}
}

View file

@ -1,49 +0,0 @@
/*
* 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
* 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import de.schildbach.pte.util.WordUtils;
import okhttp3.HttpUrl;
/**
* @author Adrian Perez de Castro <aperez@igalia.com>
*/
public class FinlandProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "fi";
public FinlandProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.FINLAND, apiBase, authorization);
setTimeZone("Europe/Helsinki");
}
public FinlandProvider(final String authorization) {
super(NetworkId.FINLAND, authorization);
setTimeZone("Europe/Helsinki");
}
@Override
public String region() {
return API_REGION;
}
@Override
protected String getLocationName(final String name) {
return WordUtils.capitalizeFully(name);
}
}

View file

@ -1,50 +0,0 @@
/*
* Copyright 2016 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import de.schildbach.pte.dto.Product;
import de.schildbach.pte.dto.Style;
import de.schildbach.pte.dto.Style.Shape;
import okhttp3.HttpUrl;
/**
* @author Nicolas Derive
* @author Stéphane Guillou
*/
public class FranceNorthEastProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "fr-ne";
// dataset available at: https://navitia.opendatasoft.com/explore/dataset/fr-ne/
public FranceNorthEastProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.FRANCENORTHEAST, apiBase, authorization);
setTimeZone("Europe/Paris");
}
public FranceNorthEastProvider(final String authorization) {
super(NetworkId.FRANCENORTHEAST, authorization);
setTimeZone("Europe/Paris");
}
@Override
public String region() {
return API_REGION;
}
}

View file

@ -1,49 +0,0 @@
/*
* Copyright 2016 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import okhttp3.HttpUrl;
/**
* @author Patrick Kanzler
*/
public class FranceNorthWestProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "fr-nw";
public FranceNorthWestProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.FRANCENORTHWEST, apiBase, authorization);
setTimeZone("Europe/Paris");
}
public FranceNorthWestProvider(final String authorization) {
super(NetworkId.FRANCENORTHWEST, authorization);
setTimeZone("Europe/Paris");
}
@Override
public String region() {
return API_REGION;
}
@Override
protected String getAddressName(final String name, final String houseNumber) {
return houseNumber + " " + name;
}
}

View file

@ -1,48 +0,0 @@
/*
* Copyright 2016 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import de.schildbach.pte.dto.Product;
import de.schildbach.pte.dto.Style;
import de.schildbach.pte.dto.Style.Shape;
import okhttp3.HttpUrl;
/**
* @author Anthony Chaput
*/
public class FranceSouthEastProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "fr-se";
public FranceSouthEastProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.FRANCESOUTHEAST, apiBase, authorization);
setTimeZone("Europe/Paris");
}
public FranceSouthEastProvider(final String authorization) {
super(NetworkId.FRANCESOUTHEAST, authorization);
setTimeZone("Europe/Paris");
}
@Override
public String region() {
return API_REGION;
}
}

View file

@ -1,48 +0,0 @@
/*
* Copyright 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import de.schildbach.pte.dto.Product;
import de.schildbach.pte.dto.Style;
import de.schildbach.pte.dto.Style.Shape;
import okhttp3.HttpUrl;
/**
* @author Nicolas Derive
*/
public class FranceSouthWestProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "fr-sw";
public FranceSouthWestProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.FRANCESOUTHWEST, apiBase, authorization);
setTimeZone("Europe/Paris");
}
public FranceSouthWestProvider(final String authorization) {
super(NetworkId.FRANCESOUTHWEST, authorization);
setTimeZone("Europe/Paris");
}
@Override
public String region() {
return API_REGION;
}
}

View file

@ -1,39 +0,0 @@
/*
* Copyright 2017 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import okhttp3.HttpUrl;
public class GhanaProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "gh";
public GhanaProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.GHANA, apiBase, authorization);
setTimeZone("UTC");
}
public GhanaProvider(final String authorization) {
super(NetworkId.GHANA, authorization);
setTimeZone("UTC");
}
@Override
public String region() {
return API_REGION;
}
}

View file

@ -1,51 +0,0 @@
/*
* Copyright 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import de.schildbach.pte.util.WordUtils;
import okhttp3.HttpUrl;
/**
* @author Antonio El Khoury
*/
public class ItalyProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "it";
public ItalyProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.IT, apiBase, authorization);
setTimeZone("Europe/Rome");
}
public ItalyProvider(final String authorization) {
super(NetworkId.IT, authorization);
setTimeZone("Europe/Rome");
}
@Override
public String region() {
return API_REGION;
}
@Override
protected String getLocationName(String name) {
return WordUtils.capitalizeFully(name);
}
}

View file

@ -1,42 +0,0 @@
/*
* Copyright 2018 Erik Uhlmann.
*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import okhttp3.HttpUrl;
/**
* @author Erik Uhlmann
*/
public class MassachusettsProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "us-ma";
public MassachusettsProvider(HttpUrl apiBase, String authorization) {
super(NetworkId.MASSACHUSETTS, apiBase, authorization);
setTimeZone("America/New_York");
}
public MassachusettsProvider(final String authorization) {
super(NetworkId.MASSACHUSETTS, authorization);
setTimeZone("America/New_York");
}
@Override
protected String region() {
return API_REGION;
}
}

View file

@ -30,18 +30,9 @@ public enum NetworkId {
// Austria // Austria
OEBB, VAO, VOR, WIEN, OOEVV, LINZ, SVV, VVT, STV, VMOBIL, OEBB, VAO, VOR, WIEN, OOEVV, LINZ, SVV, VVT, STV, VMOBIL,
// Czech Republic
CZECH_REPUBLIC,
// Switzerland // Switzerland
VBL, ZVV, VBL, ZVV,
// France
PARIS, FRANCESOUTHWEST, FRANCESOUTHEAST, FRANCENORTHWEST, FRANCENORTHEAST,
// Spain
SPAIN,
// Netherlands // Netherlands
NS, NEGENTWEE, NS, NEGENTWEE,
@ -51,9 +42,6 @@ public enum NetworkId {
// Sweden // Sweden
SE, SE,
// Finland
FINLAND,
// Luxembourg // Luxembourg
LU, LU,
@ -64,32 +52,14 @@ public enum NetworkId {
EIREANN, EIREANN,
// Poland // Poland
PL, PLNAVITIA, PL,
// Italy
IT,
// United Arab Emirates // United Arab Emirates
DUB, DUB,
// United States // United States
BART, RTACHICAGO, OREGON, MASSACHUSETTS, CMTA, BART, RTACHICAGO, CMTA,
// Canada
ONTARIO, QUEBEC, BRITISHCOLUMBIA,
// Australia // Australia
SYDNEY, AUSTRALIA, SYDNEY,
// New Zealand
NZ,
// Africa
GHANA,
// Nicaragua
NICARAGUA,
// Brazil
BRAZIL,
} }

View file

@ -1,35 +0,0 @@
/*
* 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
* 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
/**
* @author ialokim
*/
public class NicaraguaProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "ni";
public NicaraguaProvider(final String authorization) {
super(NetworkId.NICARAGUA, authorization);
setTimeZone("America/Managua");
}
@Override
public String region() {
return API_REGION;
}
}

View file

@ -1,152 +0,0 @@
/*
* Copyright 2014-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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import java.util.HashMap;
import java.util.Map;
import de.schildbach.pte.dto.Product;
import de.schildbach.pte.dto.Style;
import de.schildbach.pte.dto.Style.Shape;
/**
* @author Torsten Grote
*/
public class NzProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "nz";
public NzProvider(final String authorization) {
super(NetworkId.NZ, authorization);
setTimeZone("Pacific/Auckland");
setStyles(STYLES);
}
@Override
public String region() {
return API_REGION;
}
@Override
protected Style getLineStyle(final String network, final Product product, final String code, final String color) {
if (color != null) {
return lineStyle(this.network.name(), product, code);
} else {
return super.getLineStyle(network, product, code, null);
}
}
private static final Map<String, Style> STYLES = new HashMap<>();
static {
// Wellington buses
STYLES.put("B1", new Style(Shape.ROUNDED, Style.parseColor("#A10082"), Style.WHITE));
STYLES.put("B2", new Style(Shape.ROUNDED, Style.parseColor("#cf142b"), Style.WHITE));
STYLES.put("B3", new Style(Shape.ROUNDED, Style.parseColor("#61bf1a"), Style.WHITE));
STYLES.put("B4", new Style(Shape.ROUNDED, Style.parseColor("#52006b"), Style.WHITE));
STYLES.put("B5", new Style(Shape.ROUNDED, Style.parseColor("#f54029"), Style.WHITE));
STYLES.put("B6", new Style(Shape.ROUNDED, Style.parseColor("#009970"), Style.WHITE));
STYLES.put("B7", new Style(Shape.ROUNDED, Style.parseColor("#b35408"), Style.WHITE));
STYLES.put("B8", new Style(Shape.ROUNDED, Style.parseColor("#703824"), Style.WHITE));
STYLES.put("B9", new Style(Shape.ROUNDED, Style.parseColor("#d42e12"), Style.WHITE));
STYLES.put("B10", new Style(Shape.ROUNDED, Style.parseColor("#703824"), Style.WHITE));
STYLES.put("B11", new Style(Shape.ROUNDED, Style.parseColor("#b35408"), Style.WHITE));
STYLES.put("B13", new Style(Shape.ROUNDED, Style.parseColor("#974e18"), Style.WHITE));
STYLES.put("B14", new Style(Shape.ROUNDED, Style.parseColor("#8599a8"), Style.WHITE));
STYLES.put("B17", new Style(Shape.ROUNDED, Style.parseColor("#61bf1a"), Style.WHITE));
STYLES.put("B18", new Style(Shape.ROUNDED, Style.parseColor("#00b8e0"), Style.WHITE));
STYLES.put("B20", new Style(Shape.ROUNDED, Style.parseColor("#f266b5"), Style.WHITE));
STYLES.put("B21", new Style(Shape.ROUNDED, Style.parseColor("#70752b"), Style.WHITE));
STYLES.put("B22", new Style(Shape.ROUNDED, Style.parseColor("#d97300"), Style.WHITE));
STYLES.put("B23", new Style(Shape.ROUNDED, Style.parseColor("#e6b012"), Style.WHITE));
STYLES.put("B24", new Style(Shape.ROUNDED, Style.parseColor("#214230"), Style.WHITE));
STYLES.put("B25", new Style(Shape.ROUNDED, Style.parseColor("#002a42"), Style.WHITE));
STYLES.put("B28", new Style(Shape.ROUNDED, Style.parseColor("#bd9065"), Style.WHITE));
STYLES.put("B29", new Style(Shape.ROUNDED, Style.parseColor("#006973"), Style.WHITE));
STYLES.put("B30", new Style(Shape.ROUNDED, Style.parseColor("#703824"), Style.WHITE));
STYLES.put("B31", new Style(Shape.ROUNDED, Style.parseColor("#cf142b"), Style.WHITE));
STYLES.put("B32", new Style(Shape.ROUNDED, Style.parseColor("#a10082"), Style.WHITE));
STYLES.put("B43", new Style(Shape.ROUNDED, Style.parseColor("#8599a8"), Style.WHITE));
STYLES.put("B44", new Style(Shape.ROUNDED, Style.parseColor("#57b5e0"), Style.WHITE));
STYLES.put("B45", new Style(Shape.ROUNDED, Style.parseColor("#00b0c7"), Style.WHITE));
STYLES.put("B46", new Style(Shape.ROUNDED, Style.parseColor("#005ec4"), Style.WHITE));
STYLES.put("B47", new Style(Shape.ROUNDED, Style.parseColor("#9F6614"), Style.WHITE));
STYLES.put("B50", new Style(Shape.ROUNDED, Style.parseColor("#008542"), Style.WHITE));
STYLES.put("B52", new Style(Shape.ROUNDED, Style.parseColor("#4f8c0d"), Style.WHITE));
STYLES.put("B53", new Style(Shape.ROUNDED, Style.parseColor("#c25e03"), Style.WHITE));
STYLES.put("B54", new Style(Shape.ROUNDED, Style.parseColor("#a8034f"), Style.WHITE));
STYLES.put("B55", new Style(Shape.ROUNDED, Style.parseColor("#703824"), Style.WHITE));
STYLES.put("B56", new Style(Shape.ROUNDED, Style.parseColor("#f58025"), Style.WHITE));
STYLES.put("B57", new Style(Shape.ROUNDED, Style.parseColor("#eba96b"), Style.WHITE));
STYLES.put("B58", new Style(Shape.ROUNDED, Style.parseColor("#a8034f"), Style.WHITE));
STYLES.put("B80", new Style(Shape.ROUNDED, Style.parseColor("#002b45"), Style.WHITE));
STYLES.put("B81", new Style(Shape.ROUNDED, Style.parseColor("#5c2624"), Style.WHITE));
STYLES.put("B83", new Style(Shape.ROUNDED, Style.parseColor("#ad2624"), Style.WHITE));
STYLES.put("B84", new Style(Shape.ROUNDED, Style.parseColor("#f27d00"), Style.WHITE));
STYLES.put("B85", new Style(Shape.ROUNDED, Style.parseColor("#781496"), Style.WHITE));
STYLES.put("B90", new Style(Shape.ROUNDED, Style.parseColor("#9278d1"), Style.WHITE));
STYLES.put("B91", new Style(Shape.ROUNDED, Style.parseColor("#f27d00"), Style.WHITE));
STYLES.put("B92", new Style(Shape.ROUNDED, Style.parseColor("#6e0a78"), Style.WHITE));
STYLES.put("B93", new Style(Shape.ROUNDED, Style.parseColor("#a87cb6"), Style.WHITE));
STYLES.put("B110", new Style(Shape.ROUNDED, Style.parseColor("#9c1a87"), Style.WHITE));
STYLES.put("B111", new Style(Shape.ROUNDED, Style.parseColor("#00599c"), Style.WHITE));
STYLES.put("B112", new Style(Shape.ROUNDED, Style.parseColor("#85c7e3"), Style.WHITE));
STYLES.put("B114", new Style(Shape.ROUNDED, Style.parseColor("#9eab05"), Style.WHITE));
STYLES.put("B115", new Style(Shape.ROUNDED, Style.parseColor("#006647"), Style.WHITE));
STYLES.put("B120", new Style(Shape.ROUNDED, Style.parseColor("#0db02b"), Style.WHITE));
STYLES.put("B121", new Style(Shape.ROUNDED, Style.parseColor("#00599c"), Style.WHITE));
STYLES.put("B130", new Style(Shape.ROUNDED, Style.parseColor("#00a6d6"), Style.WHITE));
STYLES.put("B145", new Style(Shape.ROUNDED, Style.parseColor("#2ec7d6"), Style.WHITE));
STYLES.put("B150", new Style(Shape.ROUNDED, Style.parseColor("#8f2140"), Style.WHITE));
STYLES.put("B154", new Style(Shape.ROUNDED, Style.parseColor("#e0457a"), Style.WHITE));
STYLES.put("B160", new Style(Shape.ROUNDED, Style.parseColor("#cf142b"), Style.WHITE));
STYLES.put("B170", new Style(Shape.ROUNDED, Style.parseColor("#7d7805"), Style.WHITE));
STYLES.put("B200", new Style(Shape.ROUNDED, Style.parseColor("#e0457a"), Style.WHITE));
STYLES.put("B201", new Style(Shape.ROUNDED, Style.parseColor("#007073"), Style.WHITE));
STYLES.put("B202", new Style(Shape.ROUNDED, Style.parseColor("#e6b012"), Style.WHITE));
STYLES.put("B203", new Style(Shape.ROUNDED, Style.parseColor("#9c70cc"), Style.WHITE));
STYLES.put("B204", new Style(Shape.ROUNDED, Style.parseColor("#b3c98c"), Style.WHITE));
STYLES.put("B205", new Style(Shape.ROUNDED, Style.parseColor("#85c7e3"), Style.WHITE));
STYLES.put("B206", new Style(Shape.ROUNDED, Style.parseColor("#DD0A61"), Style.WHITE));
STYLES.put("B210", new Style(Shape.ROUNDED, Style.parseColor("#7A1600"), Style.WHITE));
STYLES.put("B211", new Style(Shape.ROUNDED, Style.parseColor("#F47836"), Style.WHITE));
STYLES.put("B220", new Style(Shape.ROUNDED, Style.parseColor("#008952"), Style.WHITE));
STYLES.put("B226", new Style(Shape.ROUNDED, Style.parseColor("#007FB1"), Style.WHITE));
STYLES.put("B230", new Style(Shape.ROUNDED, Style.parseColor("#D31145"), Style.WHITE));
STYLES.put("B236", new Style(Shape.ROUNDED, Style.parseColor("#862175"), Style.WHITE));
STYLES.put("B250", new Style(Shape.ROUNDED, Style.parseColor("#00679D"), Style.WHITE));
STYLES.put("B260", new Style(Shape.ROUNDED, Style.parseColor("#570861"), Style.WHITE));
STYLES.put("B261", new Style(Shape.ROUNDED, Style.parseColor("#ED1C24"), Style.WHITE));
STYLES.put("B262", new Style(Shape.ROUNDED, Style.parseColor("#5D9732"), Style.WHITE));
STYLES.put("B270", new Style(Shape.ROUNDED, Style.parseColor("#d95121"), Style.WHITE));
STYLES.put("B280", new Style(Shape.ROUNDED, Style.parseColor("#2526a9"), Style.WHITE));
STYLES.put("B289", new Style(Shape.ROUNDED, Style.parseColor("#2526a9"), Style.WHITE));
STYLES.put("B290", new Style(Shape.ROUNDED, Style.parseColor("#00a6de"), Style.WHITE));
// Wellington suburban trains
STYLES.put("SHVL", new Style(Shape.ROUNDED, Style.parseColor("#de7008"), Style.WHITE));
STYLES.put("SWRL", new Style(Shape.ROUNDED, Style.parseColor("#003f8d"), Style.WHITE));
STYLES.put("SJVL", new Style(Shape.ROUNDED, Style.parseColor("#29c2ce"), Style.WHITE));
STYLES.put("SKPL", new Style(Shape.ROUNDED, Style.parseColor("#d4d152"), Style.WHITE));
STYLES.put("SMEL", new Style(Shape.ROUNDED, Style.parseColor("#00885f"), Style.WHITE));
STYLES.put("SNEX", new Style(Shape.ROUNDED, Style.parseColor("#00354d"), Style.WHITE));
STYLES.put("SPNL", new Style(Shape.ROUNDED, Style.parseColor("#00354d"), Style.WHITE));
// Wellington other
STYLES.put("CCCL", new Style(Shape.ROUNDED, Style.parseColor("#CC0000"), Style.WHITE));
STYLES.put("FWHF", new Style(Shape.ROUNDED, Style.parseColor("#004b38"), Style.WHITE));
}
}

View file

@ -1,44 +0,0 @@
/*
* Copyright 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import okhttp3.HttpUrl;
/**
* @author Stephane Berube
*/
public class OntarioProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "ca-on";
public OntarioProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.ONTARIO, apiBase, authorization);
setTimeZone("America/Toronto");
}
public OntarioProvider(final String authorization) {
super(NetworkId.ONTARIO, authorization);
setTimeZone("America/Toronto");
}
@Override
public String region() {
return API_REGION;
}
}

View file

@ -1,41 +0,0 @@
/*
* Copyright 2016 Clayton Craft.
*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import okhttp3.HttpUrl;
public class OregonProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "us-or";
public OregonProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.OREGON, apiBase, authorization);
setTimeZone("America/Los_Angeles");
}
public OregonProvider(final String authorization) {
super(NetworkId.OREGON, authorization);
setTimeZone("America/Los_Angeles");
}
@Override
public String region() {
return API_REGION;
}
}

View file

@ -1,98 +0,0 @@
/*
* Copyright 2014-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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import de.schildbach.pte.dto.Product;
import de.schildbach.pte.dto.Style;
import de.schildbach.pte.dto.Style.Shape;
import de.schildbach.pte.util.WordUtils;
import okhttp3.HttpUrl;
/**
* @author Antonio El Khoury
*/
public class ParisProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "fr-idf";
public ParisProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.PARIS, apiBase, authorization);
setTimeZone("Europe/Paris");
}
public ParisProvider(final String authorization) {
super(NetworkId.PARIS, authorization);
setTimeZone("Europe/Paris");
}
@Override
public String region() {
return API_REGION;
}
@Override
protected Style getLineStyle(final String network, final Product product, final String code, final String color) {
switch (product) {
case SUBURBAN_TRAIN: {
// RER
if (code.compareTo("F") < 0) {
return new Style(Shape.CIRCLE, Style.TRANSPARENT, Style.parseColor(color), Style.parseColor(color));
}
// Transilien
else {
return new Style(Shape.ROUNDED, Style.TRANSPARENT, Style.parseColor(color), Style.parseColor(color));
}
}
case REGIONAL_TRAIN: {
// TER + Intercités
return new Style(Style.parseColor(color), computeForegroundColor(color));
}
case SUBWAY: {
// Metro
return new Style(Shape.CIRCLE, Style.parseColor(color), computeForegroundColor(color));
}
case TRAM: {
// Tram
return new Style(Shape.RECT, Style.parseColor(color), computeForegroundColor(color));
}
case BUS: {
// Bus + Noctilien
return new Style(Shape.RECT, Style.parseColor(color), computeForegroundColor(color));
}
case CABLECAR: {
// Orlyval
return new Style(Shape.ROUNDED, Style.parseColor(color), computeForegroundColor(color));
}
default:
return super.getLineStyle(network, product, code, color);
}
}
@Override
protected String getLocationName(String name) {
return WordUtils.capitalizeFully(name);
}
@Override
protected String getAddressName(final String name, final String houseNumber) {
return houseNumber + " " + name;
}
}

View file

@ -1,44 +0,0 @@
/*
* Copyright 2018 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import okhttp3.HttpUrl;
/**
* @author Michel Le Bihan
*/
public class PlNavitiaProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "pl";
public PlNavitiaProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.PLNAVITIA, apiBase, authorization);
setTimeZone("Europe/Warsaw");
}
public PlNavitiaProvider(final String authorization) {
super(NetworkId.PLNAVITIA, authorization);
setTimeZone("Europe/Warsaw");
}
@Override
public String region() {
return API_REGION;
}
}

View file

@ -1,44 +0,0 @@
/*
* Copyright 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
import okhttp3.HttpUrl;
/**
* @author Stephane Berube
*/
public class QuebecProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "ca-qc";
public QuebecProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.QUEBEC, apiBase, authorization);
setTimeZone("America/Montreal");
}
public QuebecProvider(final String authorization) {
super(NetworkId.QUEBEC, authorization);
setTimeZone("America/Montreal");
}
@Override
public String region() {
return API_REGION;
}
}

View file

@ -1,32 +0,0 @@
/*
* Copyright 2014-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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte;
public class SpainProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "es";
public SpainProvider(final String authorization) {
super(NetworkId.SPAIN, authorization);
setTimeZone("Europe/Spain");
}
@Override
public String region() {
return API_REGION;
}
}

View file

@ -1,297 +0,0 @@
/*
* 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
* 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Date;
import java.util.EnumSet;
import java.util.List;
import de.schildbach.pte.NetworkProvider;
import de.schildbach.pte.NetworkProvider.Accessibility;
import de.schildbach.pte.NetworkProvider.WalkSpeed;
import de.schildbach.pte.dto.LineDestination;
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.QueryTripsContext;
import de.schildbach.pte.dto.QueryTripsResult;
import de.schildbach.pte.dto.StationDepartures;
import de.schildbach.pte.dto.SuggestLocationsResult;
import de.schildbach.pte.dto.TripOptions;
/**
* @author Antonio El Khoury
*/
public abstract class AbstractNavitiaProviderLiveTest extends AbstractProviderLiveTest {
public AbstractNavitiaProviderLiveTest(final NetworkProvider provider) {
super(provider);
}
protected final void nearbyStationsAddress(final int lat, final int lon) throws IOException {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION),
Location.coord(lat, lon), 700, 10);
assertEquals(NearbyLocationsResult.Status.OK, result.status);
print(result);
}
protected final void nearbyStationsStation(final String stationId) throws IOException {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION),
new Location(LocationType.STATION, stationId), 700, 10);
assertEquals(NearbyLocationsResult.Status.OK, result.status);
print(result);
}
protected final void nearbyStationsPoi(final String poiId) throws IOException {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION),
new Location(LocationType.POI, poiId), 700, 10);
assertEquals(NearbyLocationsResult.Status.OK, result.status);
print(result);
}
protected final void nearbyStationsAny(final int lat, final int lon) throws IOException {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION),
Location.coord(lat, lon), 700, 10);
assertEquals(NearbyLocationsResult.Status.OK, result.status);
print(result);
}
protected final void nearbyStationsStationDistance(final String stationId) throws IOException {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION),
new Location(LocationType.STATION, stationId), 0, 10);
assertEquals(NearbyLocationsResult.Status.OK, result.status);
assertTrue(result.locations.size() > 1);
print(result);
}
protected final void nearbyStationsInvalidStation(final String stationId) throws IOException {
final NearbyLocationsResult result = queryNearbyLocations(EnumSet.of(LocationType.STATION),
new Location(LocationType.STATION, stationId), 700, 10);
assertEquals(NearbyLocationsResult.Status.INVALID_ID, result.status);
print(result);
}
protected final void queryDeparturesEquivsFalse(final String stationId) throws IOException {
final int maxDepartures = 5;
final QueryDeparturesResult result = queryDepartures(stationId, maxDepartures, false);
assertEquals(QueryDeparturesResult.Status.OK, result.status);
assertEquals(1, result.stationDepartures.size());
assertTrue(result.stationDepartures.get(0).departures.size() <= maxDepartures);
final List<LineDestination> lines = result.stationDepartures.get(0).lines;
assertNotNull(lines);
assertTrue(lines.size() >= 1);
print(result);
}
protected final void queryDeparturesStopArea(final String stationId) throws IOException {
final int maxDepartures = 5;
final QueryDeparturesResult result = queryDepartures(stationId, maxDepartures, true);
assertEquals(QueryDeparturesResult.Status.OK, result.status);
assertTrue(result.stationDepartures.size() > 1);
int nbDepartures = 0;
int nbLines = 0;
for (final StationDepartures stationDepartures : result.stationDepartures) {
nbDepartures += stationDepartures.departures.size();
final List<LineDestination> lines = stationDepartures.lines;
if (lines != null)
nbLines += lines.size();
}
assertTrue(nbDepartures <= maxDepartures);
assertTrue(nbLines >= 2);
print(result);
}
protected final void queryDeparturesEquivsTrue(final String stationId) throws IOException {
final int maxDepartures = 5;
final QueryDeparturesResult result = queryDepartures(stationId, maxDepartures, true);
assertEquals(QueryDeparturesResult.Status.OK, result.status);
assertTrue(result.stationDepartures.size() > 1);
int nbDepartures = 0;
int nbLines = 0;
for (StationDepartures stationDepartures : result.stationDepartures) {
nbDepartures += stationDepartures.departures.size();
final List<LineDestination> lines = stationDepartures.lines;
assertNotNull(lines);
nbLines += lines.size();
}
assertTrue(nbDepartures <= maxDepartures);
assertTrue(nbLines >= 2);
print(result);
}
protected final void queryDeparturesInvalidStation(final String stationId) throws IOException {
final QueryDeparturesResult result = queryDepartures(stationId, false);
assertEquals(QueryDeparturesResult.Status.INVALID_STATION, result.status);
}
protected final void suggestLocationsFromName(final CharSequence constraint) throws IOException {
final SuggestLocationsResult result = suggestLocations(constraint);
assertTrue(result.getLocations().size() > 0);
print(result);
}
protected final void suggestLocationsFromAddress(final CharSequence constraint) throws IOException {
final SuggestLocationsResult result = suggestLocations(constraint);
assertTrue(result.getLocations().size() > 0);
print(result);
}
protected final void suggestLocationsNoLocation(final CharSequence constraint) throws IOException {
final SuggestLocationsResult result = suggestLocations(constraint);
assertEquals(result.getLocations().size(), 0);
print(result);
}
protected final void queryTrip(final CharSequence from, final CharSequence to) throws IOException {
final SuggestLocationsResult fromResult = suggestLocations(from);
assertTrue(fromResult.getLocations().size() > 0);
final SuggestLocationsResult toResult = suggestLocations(to);
assertTrue(toResult.getLocations().size() > 0);
final QueryTripsResult result = queryTrips(fromResult.getLocations().get(0), null,
toResult.getLocations().get(0), new Date(), true, null);
assertEquals(QueryTripsResult.Status.OK, result.status);
print(result);
}
protected final void queryTripNoSolution(final CharSequence from, final CharSequence to) throws IOException {
final SuggestLocationsResult fromResult = suggestLocations(from);
assertTrue(fromResult.getLocations().size() > 0);
final SuggestLocationsResult toResult = suggestLocations(to);
assertTrue(toResult.getLocations().size() > 0);
final TripOptions options = new TripOptions(EnumSet.noneOf(Product.class), null, WalkSpeed.NORMAL,
Accessibility.NEUTRAL, null);
final QueryTripsResult result = queryTrips(fromResult.getLocations().get(0), null,
toResult.getLocations().get(0), new Date(), true, options);
assertEquals(QueryTripsResult.Status.NO_TRIPS, result.status);
print(result);
}
protected final void queryTripUnknownFrom(final CharSequence to) throws IOException {
final SuggestLocationsResult toResult = suggestLocations(to);
assertTrue(toResult.getLocations().size() > 0);
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "stop_area:RTP:SA:999999"), null,
toResult.getLocations().get(0), new Date(), true, null);
assertEquals(QueryTripsResult.Status.UNKNOWN_FROM, result.status);
print(result);
}
protected final void queryTripUnknownTo(final CharSequence from) throws IOException {
final SuggestLocationsResult fromResult = suggestLocations(from);
assertTrue(fromResult.getLocations().size() > 0);
final QueryTripsResult result = queryTrips(fromResult.getLocations().get(0), null,
new Location(LocationType.STATION, "stop_area:RTP:SA:999999"), new Date(), true, null);
assertEquals(QueryTripsResult.Status.UNKNOWN_TO, result.status);
print(result);
}
protected final void queryTripAmbiguousFrom(final Location from, final CharSequence to) throws IOException {
final SuggestLocationsResult toResult = suggestLocations(to);
assertTrue(toResult.getLocations().size() > 0);
final QueryTripsResult result = queryTrips(from, null, toResult.getLocations().get(0), new Date(), true, null);
assertEquals(QueryTripsResult.Status.AMBIGUOUS, result.status);
assertTrue(result.ambiguousFrom != null);
assertTrue(result.ambiguousFrom.size() > 0);
print(result);
}
protected final void queryTripAmbiguousTo(final CharSequence from, final Location to) throws IOException {
final SuggestLocationsResult fromResult = suggestLocations(from);
assertTrue(fromResult.getLocations().size() > 0);
final QueryTripsResult result = queryTrips(fromResult.getLocations().get(0), null, to, new Date(), true, null);
assertEquals(QueryTripsResult.Status.AMBIGUOUS, result.status);
assertTrue(result.ambiguousTo != null);
assertTrue(result.ambiguousTo.size() > 0);
print(result);
}
protected final void queryTripSlowWalk(final CharSequence from, final CharSequence to) throws IOException {
final SuggestLocationsResult fromResult = suggestLocations(from);
assertTrue(fromResult.getLocations().size() > 0);
final SuggestLocationsResult toResult = suggestLocations(to);
assertTrue(toResult.getLocations().size() > 0);
final TripOptions options = new TripOptions(Product.ALL, null, WalkSpeed.SLOW, Accessibility.NEUTRAL, null);
final QueryTripsResult result = queryTrips(fromResult.getLocations().get(0), null,
toResult.getLocations().get(0), new Date(), true, options);
assertEquals(QueryTripsResult.Status.OK, result.status);
print(result);
}
protected final void queryTripFastWalk(final CharSequence from, final CharSequence to) throws IOException {
final SuggestLocationsResult fromResult = suggestLocations(from);
assertTrue(fromResult.getLocations().size() > 0);
final SuggestLocationsResult toResult = suggestLocations(to);
assertTrue(toResult.getLocations().size() > 0);
final TripOptions options = new TripOptions(Product.ALL, null, WalkSpeed.FAST, Accessibility.NEUTRAL, null);
final QueryTripsResult result = queryTrips(fromResult.getLocations().get(0), null,
toResult.getLocations().get(0), new Date(), true, options);
assertEquals(QueryTripsResult.Status.OK, result.status);
print(result);
}
protected final void queryTripFromAdminToPoi(final CharSequence from, final CharSequence to) throws IOException {
final SuggestLocationsResult fromResult = suggestLocations(from);
assertTrue(fromResult.getLocations().size() > 0);
Location fromLocation = fromResult.getLocations().get(0);
assertEquals(fromLocation.type, LocationType.POI);
print(fromResult);
final SuggestLocationsResult toResult = suggestLocations(to);
assertTrue(toResult.getLocations().size() > 0);
Location toLocation = toResult.getLocations().get(0);
assertEquals(toLocation.type, LocationType.POI);
print(toResult);
final QueryTripsResult tripsResult = queryTrips(fromLocation, null, toLocation, new Date(), true, null);
assertEquals(QueryTripsResult.Status.OK, tripsResult.status);
print(tripsResult);
}
protected final void queryMoreTrips(final CharSequence from, final CharSequence to) throws IOException {
final SuggestLocationsResult fromResult = suggestLocations(from);
assertTrue(fromResult.getLocations().size() > 0);
final SuggestLocationsResult toResult = suggestLocations(to);
assertTrue(toResult.getLocations().size() > 0);
final QueryTripsResult result = queryTrips(fromResult.getLocations().get(0), null,
toResult.getLocations().get(0), new Date(), true, null);
assertEquals(QueryTripsResult.Status.OK, result.status);
final QueryTripsContext context = result.context;
final QueryTripsResult nextResult = queryMoreTrips(context, true);
assertEquals(QueryTripsResult.Status.OK, nextResult.status);
print(nextResult);
final QueryTripsResult prevResult = queryMoreTrips(context, false);
assertEquals(QueryTripsResult.Status.OK, prevResult.status);
print(prevResult);
}
}

View file

@ -1,305 +0,0 @@
/*
* 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
* 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import java.io.IOException;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import org.junit.Ignore;
import org.junit.Test;
import de.schildbach.pte.AustraliaProvider;
import de.schildbach.pte.dto.Location;
import de.schildbach.pte.dto.QueryTripsResult;
import de.schildbach.pte.dto.SuggestLocationsResult;
import de.schildbach.pte.dto.Trip;
/**
* Test basic from/to directions for each mode of transport, in each state of Australia supported by Navitia.
* This is mainly to test whether or not the coverage is still in date or not. For example, at time of writing
* Cambera, Alice Springs, and Darwin were all present on Navitia, but out of date so were unable to provide
* journey planning.
*
* These tests work by taking the next Monday at 08:45 (a random peak hour time where you'd expect there to be
* a lot of public transport available). If they are unable to find a route for a specific mode of transport,
* then you should further investigate to see if the data is out of date or not in Navitia.
*
* Note that by default, only Melbourne is tested comprehensively to prevent running into API limits
* ({@see #RUN_EXPENSIVE_TESTS}).
*/
public class AustraliaProviderLiveTest extends AbstractNavitiaProviderLiveTest {
/**
* If enabled, the entire set of tests will run, resulting in over 30 API calls to Navitia. Given this
* test may or may not be run under, e.g. continuous integration, or run frequently while working on the
* Australian API, it could end up using up your API limit unneccesarily. Thus, the default value is to
* only perform a proper test of Melbourne, and the rest of the coverage is disabled until this flag is
* true.
*/
private static final boolean RUN_EXPENSIVE_TESTS = false;
public AustraliaProviderLiveTest() {
super(new AustraliaProvider(secretProperty("navitia.authorization")));
}
/**
* Ensures that each of the suburban/rural trains, trams, and buses are represented in the journey
* planning and location suggestion API. Based on travelling around the Camberwell area:
* http://www.openstreetmap.org/#map=15/-37.8195/145.0586&layers=T
*/
@Test
public void melbourne() throws IOException {
final Location suburbanTrainStation = assertAndGetLocation("Camberwell Railway Station (Camberwell)");
final Location ruralTrainStation = assertAndGetLocation("Geelong Railway Station (Geelong)");
assertJourneyExists(AustraliaProvider.NETWORK_PTV, new String[] { "Lilydale", "Belgrave", "Alamein" },
suburbanTrainStation, ruralTrainStation);
final Location tramStop = assertAndGetLocation("70-Cotham Rd/Burke Rd (Kew)");
assertJourneyExists(AustraliaProvider.NETWORK_PTV, "72", suburbanTrainStation, tramStop);
final Location busStop = assertAndGetLocation("Lawrence St/Burke Rd (Kew East)");
assertJourneyExists(AustraliaProvider.NETWORK_PTV, "548", tramStop, busStop);
}
@Test
public void adelaideRail() throws IOException {
assumeTrue(RUN_EXPENSIVE_TESTS);
final Location railwayStation = assertAndGetLocation("Woodville Park Railway Station");
final Location railwayStation2 = assertAndGetLocation("Unley Park Railway Station");
assertJourneyExists(AustraliaProvider.NETWORK_SA, new String[] { "GRNG", "BEL", "OUTHA" }, railwayStation,
railwayStation2);
}
@Test
public void adelaideBus() throws IOException {
assumeTrue(RUN_EXPENSIVE_TESTS);
final Location busStation = assertAndGetLocation("Stop 137 Portrush Rd - East side");
final Location busStation2 = assertAndGetLocation("Stop 144 Portrush Rd - East side");
assertJourneyExists(AustraliaProvider.NETWORK_SA, "300", busStation, busStation2);
}
@Test
public void adelaideTram() throws IOException {
assumeTrue(RUN_EXPENSIVE_TESTS);
final Location tramStation = assertAndGetLocation("Stop 15 Dunbar Tce - Brighton Rd");
final Location tramStation2 = assertAndGetLocation("Stop 5 Black Forest");
assertJourneyExists(AustraliaProvider.NETWORK_SA, "Tram", tramStation, tramStation2);
}
@Test
public void perthTrain() throws IOException {
assumeTrue(RUN_EXPENSIVE_TESTS);
final Location railwayStation = assertAndGetLocation("Kenwick Stn");
final Location railwayStation2 = assertAndGetLocation("Warwick Stn");
assertJourneyExists(AustraliaProvider.NETWORK_WA, "", railwayStation, railwayStation2);
}
@Test
public void perthBus() throws IOException {
assumeTrue(RUN_EXPENSIVE_TESTS);
final Location bus = assertAndGetLocation("Curtin University");
final Location bus2 = assertAndGetLocation("Murdoch Stn");
assertJourneyExists(AustraliaProvider.NETWORK_WA, "", bus, bus2);
}
@Test
public void perthFerry() throws IOException {
assumeTrue(RUN_EXPENSIVE_TESTS);
final Location ferry = assertAndGetLocation("Elizabeth Quay Stn");
final Location ferry2 = assertAndGetLocation("Ferry Route Mends St Jetty");
assertJourneyExists(AustraliaProvider.NETWORK_WA, "", ferry, ferry2);
}
@Test
public void brisbaneRail() throws IOException {
assumeTrue(RUN_EXPENSIVE_TESTS);
final Location railwayStation = assertAndGetLocation("Beenleigh station");
final Location railwayStation2 = assertAndGetLocation("Ipswich station");
assertJourneyExists(AustraliaProvider.NETWORK_QLD, "BNFG", railwayStation, railwayStation2);
}
@Test
public void brisbaneFerry() throws IOException {
assumeTrue(RUN_EXPENSIVE_TESTS);
final Location ferry = assertAndGetLocation("Broadbeach South");
final Location ferry2 = assertAndGetLocation("Southport");
assertJourneyExists(AustraliaProvider.NETWORK_QLD, "GLKN", ferry, ferry2);
}
@Test
public void brisbaneTram() throws IOException {
assumeTrue(RUN_EXPENSIVE_TESTS);
final Location tram = assertAndGetLocation("South Bank 2 ferry terminal");
final Location tram2 = assertAndGetLocation("Guyatt Park ferry terminal");
assertJourneyExists(AustraliaProvider.NETWORK_QLD, "UQSL", tram, tram2);
}
@Test
public void hobartBus() throws IOException {
assumeTrue(RUN_EXPENSIVE_TESTS);
final Location bus = assertAndGetLocation("Stop 15, No.237 New Town Rd");
final Location bus2 = assertAndGetLocation("Stop 2, No.131 Elizabeth St");
assertJourneyExists(AustraliaProvider.NETWORK_TAS, "504", bus, bus2);
}
@Test
public void launcestonBus() throws IOException {
assumeTrue(RUN_EXPENSIVE_TESTS);
final Location bus = assertAndGetLocation("Riverside Dr / Rannoch Ave");
final Location bus2 = assertAndGetLocation("Trevallyn Shops");
assertJourneyExists(AustraliaProvider.NETWORK_TAS, "90", bus, bus2);
}
@Test
public void bernieBus() throws IOException {
assumeTrue(RUN_EXPENSIVE_TESTS);
final Location bus = assertAndGetLocation("Stop 31, 197 Mount St");
final Location bus2 = assertAndGetLocation("Burnie Park opposite 55 West Park Gr");
assertJourneyExists(AustraliaProvider.NETWORK_TAS, "12", bus, bus2);
}
// Although Navitia has a GTFS feed for ACT, Darwin, and Alice Springs, they were out of date at time of
// writing.
@Test
@Ignore
public void act() {
}
@Test
@Ignore
public void darwin() {
}
@Test
@Ignore
public void aliceSprings() {
}
/**
* Suggests locations similar to {@param locationName}, but then ensures that one matches exactly and then
* returns it. Try not to use an ambiguous name such as "Central Station", because it may exist in several
* datasets on Navitia.
*/
private Location assertAndGetLocation(String locationName) throws IOException {
SuggestLocationsResult locations = suggestLocations(locationName);
assertEquals(SuggestLocationsResult.Status.OK, locations.status);
assertTrue(locations.getLocations().size() > 0);
StringBuilder nonMatching = new StringBuilder();
for (Location location : locations.getLocations()) {
if (locationName.equals(location.name)) {
return location;
}
nonMatching.append('[').append(location.name).append("] ");
}
throw new AssertionError(
"suggestLocations() did not find \"" + locationName + "\". Options were: " + nonMatching);
}
/**
* @see #assertJourneyExists(String, String[], Location, Location)
*/
private void assertJourneyExists(String network, String eligibleLine, Location from, Location to)
throws IOException {
assertJourneyExists(network, new String[] { eligibleLine }, from, to);
}
private Date getNextMondayMorning() {
Calendar date = Calendar.getInstance();
date.setTime(new Date());
date.set(Calendar.HOUR_OF_DAY, 8);
date.set(Calendar.MINUTE, 45);
while (date.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
date.add(Calendar.DATE, 1);
}
return date.getTime();
}
private void assertJourneyExists(String network, String[] eligibleLines, Location from, Location to)
throws IOException {
QueryTripsResult trips = queryTrips(from, null, to, getNextMondayMorning(), true, null);
assertNull(trips.ambiguousFrom);
assertNull(trips.ambiguousTo);
assertEquals(QueryTripsResult.Status.OK, trips.status);
assertNotNull(trips.trips);
assertTrue(trips.trips.size() > 0);
Set<String> eligibleLineSet = new HashSet<>();
Collections.addAll(eligibleLineSet, eligibleLines);
for (Trip trip : trips.trips) {
boolean hasPublicTransport = false;
boolean matchesCode = false;
for (Trip.Leg leg : trip.legs) {
if (leg instanceof Trip.Public) {
hasPublicTransport = true;
Trip.Public publicLeg = (Trip.Public) leg;
assertEquals(network, publicLeg.line.network);
if (eligibleLineSet.contains(publicLeg.line.label)) {
matchesCode = true;
}
}
}
if (hasPublicTransport && matchesCode) {
return;
}
}
StringBuilder sb = new StringBuilder();
for (Trip trip : trips.trips) {
sb.append("\n ");
for (Trip.Leg leg : trip.legs) {
String via = leg instanceof Trip.Public ? " (via " + ((Trip.Public) leg).line.label + ") " : " -> ";
sb.append('[').append(leg.arrival.name).append(']').append(via).append('[').append(leg.departure.name)
.append(']').append(" ... ");
}
}
fail("No public trip found between [" + from.name + "] and [" + to.name
+ "] using appropriate line. Found trips:" + sb);
}
}

View file

@ -1,86 +0,0 @@
/*
* 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
* 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 de.schildbach.pte.BrazilProvider;
import de.schildbach.pte.dto.Point;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
/**
* @author Torsten Grote
*/
public class BrazilProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public BrazilProviderLiveTest() {
super(new BrazilProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
// Sao Paulo
nearbyStationsAddress(-23547900, -46635200);
}
@Test
public void nearbyStationsAddress2() throws Exception {
// Rio de Janeiro
nearbyStationsAddress(-22905300, -43179500);
}
@Test
public void nearbyStationsStation() throws Exception {
nearbyStationsStation("stop_point:OIO:SP:18255914");
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
nearbyStationsInvalidStation("stop_point:OIO:SPX:18255914");
}
@Test
public void queryDeparturesEquivsFalse() throws Exception {
queryDeparturesEquivsFalse("stop_point:OSA:SP:800016608");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDeparturesInvalidStation("stop_point:OWX:SP:6911");
}
@Test
public void suggestLocations() throws Exception {
suggestLocationsFromName("Republica");
}
@Test
public void queryTripStations() throws Exception {
queryTrip("Benjamim Constant", "Avenida Paulista");
}
@Test
public void queryMoreTrips() throws Exception {
queryMoreTrips("Republica", "Avenida Paulista");
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,57 +0,0 @@
/*
* 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
* 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import org.junit.Test;
import de.schildbach.pte.BritishColumbiaProvider;
import de.schildbach.pte.dto.Location;
/**
* @author Stephane Berube
*/
public class BritishColumbiaProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public BritishColumbiaProviderLiveTest() {
super(new BritishColumbiaProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsStation() throws Exception {
nearbyStationsStation("stop_point:VTA:SP:100084");
}
@Test
public void nearbyStationsByCoordinate() throws Exception {
queryNearbyStations(Location.coord(48428611, -123365556));
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDepartures("stop_point:VTA:SP:xxxxxx", false);
}
@Test
public void queryDepartures() throws Exception {
queryDepartures("VTA:SP:100084", false);
}
@Test
public void suggestLocations() throws Exception {
suggestLocations("Airport");
}
}

View file

@ -1,175 +0,0 @@
/*
* Copyright 2019 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.schildbach.pte.CzechRepublicProvider;
import de.schildbach.pte.dto.Location;
import de.schildbach.pte.dto.LocationType;
import de.schildbach.pte.dto.Point;
/**
* @author Filip Hejsek
*/
public class CzechRepublicProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public CzechRepublicProviderLiveTest() {
super(new CzechRepublicProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
nearbyStationsAddress(50062956, 14430641);
}
@Test
public void nearbyStationsAddress2() throws Exception {
nearbyStationsAddress(50083373, 14423001);
}
@Test
public void nearbyStationsStation() throws Exception {
nearbyStationsStation("stop_point:OCZPRA:U527Z102P");
}
@Test
public void nearbyStationsPoi() throws Exception {
nearbyStationsPoi("poi:osm:way:141756627");
}
@Test
public void nearbyStationsAny() throws Exception {
nearbyStationsAny(50062956, 14430641);
}
@Test
public void nearbyStationsDistance() throws Exception {
nearbyStationsStationDistance("stop_point:OCZPRA:U527Z102P");
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
nearbyStationsInvalidStation("stop_point:RTP:SP:392");
}
@Test
public void queryDeparturesEquivsFalse() throws Exception {
queryDeparturesEquivsFalse("stop_point:OCZPRA:U1072Z121P");
}
@Test
public void queryDeparturesStopArea() throws Exception {
queryDeparturesStopArea("stop_area:OCZPRA:U527S1");
}
@Test
public void queryDeparturesEquivsTrue() throws Exception {
queryDeparturesEquivsTrue("stop_point:OCZPRA:U527Z101P");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDeparturesInvalidStation("stop_point:RTP:SP:999999");
}
@Test
public void suggestLocations() throws Exception {
suggestLocationsFromName("Vyšehr");
}
@Test
public void suggestLocationsFromAddress() throws Exception {
suggestLocationsFromAddress("This doesn't work");
// Address search doesn't work for Czech Republic in Navitia
}
@Test
public void suggestLocationsNoLocation() throws Exception {
suggestLocationsNoLocation("bellevilleadasdjkaskd");
}
@Test
public void queryTripAddresses() throws Exception {
queryTrip("This doesn't work", "This doesn't work");
// Address search doesn't work for Czech Republic in Navitia
}
@Test
public void queryTripAddressStation() throws Exception {
queryTrip("This doesn't work", "Muzeum");
// Address search doesn't work for Czech Republic in Navitia
}
@Test
public void queryTripStations() throws Exception {
queryTrip("Vyšehrad", "Muzeum");
}
@Test
public void queryTripStations2() throws Exception {
queryTrip("Sídliště Písnice", "Modřanská rokle");
}
@Test
public void queryTripStations3() throws Exception {
queryTrip("Modřanská rokle", "Českomoravská");
}
@Test
public void queryTripUnknownFrom() throws Exception {
queryTripUnknownFrom("Muzeum");
}
@Test
public void queryTripUnknownTo() throws Exception {
queryTripUnknownTo("Vyšehrad");
}
@Test
public void queryTripAmbiguousFrom() throws Exception {
queryTripAmbiguousFrom(new Location(LocationType.ANY, null, null, "Sídliště"), "Muzeum");
}
@Test
public void queryTripAmbiguousTo() throws Exception {
queryTripAmbiguousTo("Vyšehrad", new Location(LocationType.ANY, null, null, "Sídliště"));
}
@Test
public void queryTripSlowWalk() throws Exception {
queryTripSlowWalk("Nemocnice Krč", "Budějovická");
}
@Test
public void queryTripFastWalk() throws Exception {
queryTripFastWalk("Nemocnice Krč", "Budějovická");
}
@Test
public void queryMoreTrips() throws Exception {
queryMoreTrips("Nemocnice Krč", "Budějovická");
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,145 +0,0 @@
/*
* 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
* 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.schildbach.pte.FinlandProvider;
import de.schildbach.pte.dto.Point;
/**
* @author Adrian Perez de Castro <aperez@igalia.com>
*/
public class FinlandProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public FinlandProviderLiveTest() {
super(new FinlandProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
nearbyStationsAddress(60160920, 24941870);
}
@Test
public void nearbyStationsStation() throws Exception {
nearbyStationsStation("stop_point:OFI:SP:1050412");
}
@Test
public void nearbyStationsPoi() throws Exception {
nearbyStationsPoi("poi:osm:way:29071686");
}
@Test
public void nearbyStationsAny() throws Exception {
nearbyStationsAny(60160920, 24941870);
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
nearbyStationsInvalidStation("stop_point:9999999999");
}
@Test
public void queryDeparturesStopArea() throws Exception {
queryDeparturesStopArea("stop_area:OFI:SA:1000201");
}
@Test
public void queryDeparturesEquivsFalse() throws Exception {
queryDeparturesEquivsFalse("stop_point:OFI:SP:1050412");
}
@Test
public void queryDeparturesEquivsTrue() throws Exception {
queryDeparturesEquivsTrue("stop_area:OFI:SA:1000201");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDeparturesInvalidStation("stop_point:OFI:SP:999999");
}
@Test
public void suggestLocations() throws Exception {
suggestLocationsFromName("postitalo");
}
@Test
public void suggestLocationsFromAddress() throws Exception {
suggestLocationsFromAddress("10 yrjönkatu");
}
@Test
public void suggestLocationsNoLocation() throws Exception {
suggestLocationsNoLocation("fontana di trevi blah blah");
}
@Test
public void queryTripAddresses() throws Exception {
queryTrip("Yrjönkatu, 10, Helsinki", "Kolmas Linja, 5, Helsinki");
}
@Test
public void queryTripAddressStation() throws Exception {
queryTrip("Viides Linja, 3, Helsinki", "Kapylän asema");
}
@Test
public void queryTripStations() throws Exception {
queryTrip("Kapylän asema", "Päärautatieasema");
}
@Test
public void queryTripNoSolution() throws Exception {
queryTripNoSolution("Steissi, Helsinki", "Keskuskatu 1, Kuopio");
}
@Test
public void queryTripUnknownFrom() throws Exception {
queryTripUnknownFrom("Rautatieasema");
}
@Test
public void queryTripUnknownTo() throws Exception {
queryTripUnknownTo("Rautatieasema");
}
@Test
public void queryTripSlowWalk() throws Exception {
queryTripSlowWalk("Rautatieasema", "Postitalo");
}
@Test
public void queryTripFastWalk() throws Exception {
queryTripFastWalk("Rautatieasema", "Postitalo");
}
@Test
public void queryMoreTrips() throws Exception {
queryMoreTrips("Steissi", "Töölöntori");
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,198 +0,0 @@
/*
* Copyright 2015-2016 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.schildbach.pte.FranceNorthEastProvider;
import de.schildbach.pte.dto.Point;
/**
* @author Nicolas Derive
* @author Stéphane Guillou
*/
public class FranceNorthEastProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public FranceNorthEastProviderLiveTest() {
super(new FranceNorthEastProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
// stations close to those coordinates (lat, lon)
// no decimal point, has to include 6 decimal places
nearbyStationsAddress(48573410, 7752110);
}
@Test
public void nearbyStationsAddress2() throws Exception {
// different test case for stations close to coordinates (lat, lon)
// no decimal point, has to include 6 decimal places
nearbyStationsAddress(48598480, 7761790);
}
@Test
public void nearbyStationsStation() throws Exception {
// station to find other stations around
// look in NTFS file for a stop_id (that contains "SP") and apend to "stop_point:"
nearbyStationsStation("stop_point:OST:SP:HOFER_11");
}
@Test
public void nearbyStationsPoi() throws Exception {
// POI to find stations around
// search OSM for a node, use identifier after
// "https://www.openstreetmap.org/node/" and apend it to "poi:n"
nearbyStationsPoi("poi:n39224822");
}
@Test
public void nearbyStationsAny() throws Exception {
// coordinates to find stations around
nearbyStationsAny(48573410, 7752110);
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
// station that does not exist?
nearbyStationsInvalidStation("stop_point:RTP:SP:392");
}
@Test
public void queryDeparturesEquivsFalse() throws Exception {
// what is it for??
queryDeparturesEquivsFalse("stop_point:OST:SP:HOFER_11");
}
@Test
public void queryDeparturesStopArea() throws Exception {
// what is it for??
// has to be an existing stop area (i.e. ID contains "SA")
queryDeparturesStopArea("stop_area:OST:SA:CTPHOFER_04");
}
@Test
public void queryDeparturesEquivsTrue() throws Exception {
// what is it for??
// can be the same to queryDeparturesEquivsFalse
queryDeparturesEquivsTrue("stop_point:OST:SP:HOFER_11");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
// station that does not exist
queryDeparturesInvalidStation("stop_point:OBO:SP:999999");
}
@Test
public void suggestLocations() throws Exception {
// start of a place name that should return something
suggestLocationsFromName("Observat");
}
@Test
public void suggestLocationsFromAddress() throws Exception {
// start of an address that should return something
suggestLocationsFromAddress("16 quai Saint");
}
@Test
public void suggestLocationsNoLocation() throws Exception {
// fake place that will not return results
suggestLocationsNoLocation("quinconcesadasdjkaskd");
}
@Test
public void queryTripAddresses() throws Exception {
// two existing addresses to define a trip
queryTrip("16 quai Saint-Nicolas Strasbourg", "37 rue Voltaire Vendenheim");
}
@Test
public void queryTripAddressStation() throws Exception {
// one existing address and one existing station to define a trip
queryTrip("16 quai Saint-Nicolas Strasbourg", "Illkirch Lixenbuhl");
}
@Test
public void queryTripStations() throws Exception {
// two existing stops to define a trip
queryTrip("Mathieu Zell", "Illkirch Lixenbuhl");
}
@Test
public void queryTripStations2() throws Exception {
// two existing stations for a trip, second test case
queryTrip("Homme de Fer", "Général Lejeune");
}
@Test
public void queryTripStations3() throws Exception {
// two existing stations for a trip, third test case
queryTrip("Eurofret", "Gare aux Marchandises");
}
@Test
public void queryTripStationsRapidTransit() throws Exception {
// two existing stations for "rapid transit"... ?
queryTrip("Observatoire Strasbourg", "Porte de l'Hôpital Strasbourg");
}
@Test
public void queryTripNoSolution() throws Exception {
// two existing stations that are not connected
queryTripNoSolution("Homme de Fer Strasbourg", "Villers Mairie Villers-Les-Nancy");
}
@Test
public void queryTripUnknownFrom() throws Exception {
// existing station for end of trip, don't know where from
queryTripUnknownFrom("Homme de Fer Strasbourg");
}
@Test
public void queryTripUnknownTo() throws Exception {
// existing station to start from, don't know where to
queryTripUnknownTo("Homme de Fer Strasbourg");
}
@Test
public void queryTripSlowWalk() throws Exception {
// two addresses for a "slow walk"
queryTripSlowWalk("16 quai Saint-Nicolas Strasbourg", "5 rue du Travail Strasbourg");
}
@Test
public void queryTripFastWalk() throws Exception {
// two addresses for a "fast walk", can be same as above
queryTripFastWalk("16 quai Saint-Nicolas Strasbourg", "5 rue du Travail Strasbourg");
}
@Test
public void queryMoreTrips() throws Exception {
// two addresses to show more trip options, can be same as above
queryMoreTrips("16 quai Saint-Nicolas Strasbourg", "5 rue du Travail Strasbourg");
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,70 +0,0 @@
/*
* Copyright 2010-2016 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.schildbach.pte.FranceNorthWestProvider;
import de.schildbach.pte.dto.Location;
import de.schildbach.pte.dto.LocationType;
import de.schildbach.pte.dto.NearbyLocationsResult;
import de.schildbach.pte.dto.Point;
import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.SuggestLocationsResult;
/**
* @author Patrick Kanzler
*/
public class FranceNorthWestProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public FranceNorthWestProviderLiveTest() {
super(new FranceNorthWestProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStations() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(
new Location(LocationType.STATION, "stop_point:ORE:SP:1016"));
print(result);
}
@Test
public void nearbyStationsByCoordinate() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(Location.coord(48109710, -16793391));
print(result);
}
@Test
public void queryDepartures() throws Exception {
final QueryDeparturesResult result = queryDepartures("stop_point:ORE:SP:1016", 10, false);
print(result);
}
@Test
public void suggestLocations() throws Exception {
final SuggestLocationsResult result = suggestLocations("Anne");
print(result);
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,169 +0,0 @@
/*
* Copyright 2016 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import org.junit.Assert;
import org.junit.Test;
import de.schildbach.pte.FranceSouthEastProvider;
import de.schildbach.pte.dto.Point;
/**
* @author Anthony Chaput
*/
public class FranceSouthEastProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public FranceSouthEastProviderLiveTest() {
super(new FranceSouthEastProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
nearbyStationsAddress(45185260, 5737800);
}
@Test
public void nearbyStationsAddress2() throws Exception {
nearbyStationsAddress(45184620, 5779780);
}
@Test
public void nearbyStationsStation() throws Exception {
nearbyStationsStation("stop_point:OGR:SP:2021");
}
@Test
public void nearbyStationsPoi() throws Exception {
nearbyStationsPoi("poi:n1245491811");
}
@Test
public void nearbyStationsAny() throws Exception {
nearbyStationsAny(45184630, 5779790);
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
nearbyStationsInvalidStation("stop_point:OGR:SP:S99999");
}
@Test
public void queryDeparturesEquivsFalse() throws Exception {
queryDeparturesEquivsFalse("stop_point:OGR:SP:2021");
}
@Test
public void queryDeparturesStopArea() throws Exception {
queryDeparturesStopArea("stop_area:OGR:SA:S3105");
}
@Test
public void queryDeparturesEquivsTrue() throws Exception {
queryDeparturesEquivsTrue("stop_point:OGR:SP:2021");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDeparturesInvalidStation("stop_point:OBO:SP:999999");
}
@Test
public void suggestLocations() throws Exception {
suggestLocationsFromName("condil");
}
@Test
public void suggestLocationsFromAddress() throws Exception {
suggestLocationsFromAddress("360 rue des res");
}
@Test
public void suggestLocationsNoLocation() throws Exception {
suggestLocationsNoLocation("quinconcesadasdjkaskd");
}
@Test
public void queryTripAddresses() throws Exception {
queryTrip("360 rue des résidences", "2 rue Charles Michels");
}
@Test
public void queryTripAddressStation() throws Exception {
queryTrip("78 Quai Pierre Scize", "Bellecour");
}
@Test
public void queryTripTowns() throws Exception {
queryTrip("Annecy", "Lyon");
}
@Test
public void queryTripStations() throws Exception {
queryTrip("Victor Hugo", "Les Bauches");
}
@Test
public void queryTripStations2() throws Exception {
queryTrip("Chavant", "Louise Michel");
}
@Test
public void queryTripStations3() throws Exception {
queryTrip("Fontaine", "Vallier Libération");
}
@Test
public void queryTripStationsRapidTransit() throws Exception {
queryTrip("Alsace-Lorraine", "Vallier Libération");
}
@Test
public void queryTripNoSolution() throws Exception {
queryTripNoSolution("Robespierre", "Les Bauches");
}
@Test
public void queryTripUnknownFrom() throws Exception {
queryTripUnknownFrom("Chavant");
}
@Test
public void queryTripUnknownTo() throws Exception {
queryTripUnknownTo("Chavant");
}
@Test
public void queryTripSlowWalk() throws Exception {
queryTripSlowWalk("360 rue des résidences", "15 rue de la chimie");
}
@Test
public void queryTripFastWalk() throws Exception {
queryTripFastWalk("360 rue des résidences", "15 rue de la chimie");
}
@Test
public void queryMoreTrips() throws Exception {
queryMoreTrips("360 rue des résidences", "15 rue de la chimie");
}
@Test
public void getArea() throws Exception {
Point[] polygon = this.provider.getArea();
Assert.assertTrue(polygon.length > 0);
}
}

View file

@ -1,165 +0,0 @@
/*
* Copyright 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.schildbach.pte.FranceSouthWestProvider;
import de.schildbach.pte.dto.Point;
/**
* @author Nicolas Derive
*/
public class FranceSouthWestProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public FranceSouthWestProviderLiveTest() {
super(new FranceSouthWestProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
nearbyStationsAddress(44826434, -557312);
}
@Test
public void nearbyStationsAddress2() throws Exception {
nearbyStationsAddress(44841225, -580036);
}
@Test
public void nearbyStationsStation() throws Exception {
nearbyStationsStation("stop_point:STE:SP:OCETrainTER-87581538");
}
@Test
public void nearbyStationsPoi() throws Exception {
nearbyStationsPoi("poi:n849494949");
}
@Test
public void nearbyStationsAny() throws Exception {
nearbyStationsAny(44826434, -557312);
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
nearbyStationsInvalidStation("stop_point:OBO:SP:7");
}
@Test
public void queryDeparturesEquivsFalse() throws Exception {
queryDeparturesEquivsFalse("stop_point:OBO:SP:732");
}
@Test
public void queryDeparturesStopArea() throws Exception {
queryDeparturesStopArea("stop_area:OBO:SA:AEROG");
}
@Test
public void queryDeparturesEquivsTrue() throws Exception {
queryDeparturesEquivsTrue("stop_point:OBO:SP:732");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDeparturesInvalidStation("stop_point:OBO:SP:999999");
}
@Test
public void suggestLocations() throws Exception {
suggestLocationsFromName("quinco");
}
@Test
public void suggestLocationsFromAddress() throws Exception {
suggestLocationsFromAddress("78 rue cam");
}
@Test
public void suggestLocationsNoLocation() throws Exception {
suggestLocationsNoLocation("quinconcesadasdjkaskd");
}
@Test
public void queryTripAddresses() throws Exception {
queryTrip("98 rue Jean-Renaud Dandicolle Bordeaux", "78 rue Camena d'Almeida Bordeaux");
}
@Test
public void queryTripAddressStation() throws Exception {
queryTrip("98, rue Jean-Renaud Dandicolle Bordeaux", "Saint-Augustin");
}
@Test
public void queryTripStations() throws Exception {
queryTrip("Hôpital Pellegrin", "Avenue de l'Université");
}
@Test
public void queryTripStations2() throws Exception {
queryTrip("Pelletan", "Barrière de Pessac");
}
@Test
public void queryTripStations3() throws Exception {
queryTrip("Barrière de Pessac", "Hôpital Pellegrin");
}
@Test
public void queryTripStationsRapidTransit() throws Exception {
queryTrip("Gaviniès Bordeaux", "Saint-Augustin Bordeaux");
}
@Test
public void queryTripNoSolution() throws Exception {
queryTripNoSolution("Patinoire Mériadeck Bordeaux", "Mérignac Centre");
}
@Test
public void queryTripUnknownFrom() throws Exception {
queryTripUnknownFrom("Patinoire Mériadeck Bordeaux");
}
@Test
public void queryTripUnknownTo() throws Exception {
queryTripUnknownTo("Patinoire Mériadeck Bordeaux");
}
@Test
public void queryTripSlowWalk() throws Exception {
queryTripSlowWalk("98 rue Jean-Renaud Dandicolle Bordeaux", "78 rue Camena d'Almeida Bordeaux");
}
@Test
public void queryTripFastWalk() throws Exception {
queryTripFastWalk("98 rue Jean-Renaud Dandicolle Bordeaux", "78 rue Camena d'Almeida Bordeaux");
}
@Test
public void queryMoreTrips() throws Exception {
queryMoreTrips("98 rue Jean-Renaud Dandicolle Bordeaux", "78 rue Camena d'Almeida Bordeaux");
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,107 +0,0 @@
/*
* Copyright 2017 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.schildbach.pte.GhanaProvider;
import de.schildbach.pte.dto.Point;
public class GhanaProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public GhanaProviderLiveTest() {
super(new GhanaProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
nearbyStationsAddress(5553473, -190438);
}
@Test
public void nearbyStationsStation() throws Exception {
nearbyStationsStation("stop_area:SA4980974759");
}
@Test
public void nearbyStationsDistance() throws Exception {
nearbyStationsStationDistance("stop_area:SA5036738888");
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
nearbyStationsInvalidStation("stop_area:SC5031328601");
}
@Test
public void queryDeparturesEquivsFalse() throws Exception {
queryDeparturesEquivsFalse("stop_point:5005030178");
}
@Test
public void queryDeparturesStopArea() throws Exception {
queryDeparturesStopArea("stop_area:SA5031328607");
}
@Test
public void queryDeparturesEquivsTrue() throws Exception {
queryDeparturesEquivsTrue("stop_area:SA5031328607");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDeparturesInvalidStation("stop_point:RTP:5005030178");
}
@Test
public void suggestLocations() throws Exception {
suggestLocationsFromName("mark");
}
@Test
public void suggestLocationsNoLocation() throws Exception {
suggestLocationsNoLocation("bellevilleadasdjkaskd");
}
@Test
public void queryTripStations() throws Exception {
queryTrip("College", "Market");
}
@Test
public void queryTripUnknownFrom() throws Exception {
queryTripUnknownFrom("Market");
}
@Test
public void queryTripUnknownTo() throws Exception {
queryTripUnknownTo("Market");
}
@Test
public void queryMoreTrips() throws Exception {
queryMoreTrips("College", "Market");
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,190 +0,0 @@
/*
* Copyright 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.schildbach.pte.ItalyProvider;
import de.schildbach.pte.dto.Point;
/**
* @author Antonio El Khoury
*/
public class ItalyProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public ItalyProviderLiveTest() {
super(new ItalyProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
nearbyStationsAddress(38143607, 13336346);
}
@Test
public void nearbyStationsStation() throws Exception {
nearbyStationsStation("stop_point:OPO:SP:100");
}
@Test
public void nearbyStationsPoi() throws Exception {
nearbyStationsPoi("poi:w300581846");
}
@Test
public void nearbyStationsAny() throws Exception {
nearbyStationsAny(38096070, 13400204);
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
nearbyStationsInvalidStation("stop_point:9999999999");
}
@Test
public void queryDeparturesEquivsFalsePalermo() throws Exception {
queryDeparturesEquivsFalse("stop_point:OTO:SP:54673002");
}
@Test
public void queryDeparturesStopAreaPalermo() throws Exception {
queryDeparturesStopArea("stop_area:OPO:SA:1974");
}
@Test
public void queryDeparturesEquivsTruePalermo() throws Exception {
queryDeparturesEquivsTrue("stop_point:OTO:SP:54673002");
}
@Test
public void queryDeparturesEquivsFalseRome() throws Exception {
queryDeparturesEquivsFalse("stop_point:ORA:SP:AD10");
}
@Test
public void queryDeparturesStopAreaRome() throws Exception {
queryDeparturesStopArea("stop_area:ORA:SA:50003");
}
@Test
public void queryDeparturesEquivsTrueRome() throws Exception {
queryDeparturesEquivsTrue("stop_point:ORA:SP:AD10");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDeparturesInvalidStation("stop_point:RTP:SP:999999");
}
@Test
public void suggestLocations() throws Exception {
suggestLocationsFromName("fontana trevi");
}
@Test
public void suggestLocationsFromAddress() throws Exception {
suggestLocationsFromAddress("12 via ferrata");
}
@Test
public void suggestLocationsNoLocation() throws Exception {
suggestLocationsNoLocation("bellevilleadasdjkaskd");
}
@Test
public void queryTripAddressesPalermo() throws Exception {
queryTrip("Via Giuseppe Lanza di Scalea, 2703, 90147 Palermo", "Via Eugenio Montale, 12, Palermo");
}
@Test
public void queryTripAddressStationPalermo() throws Exception {
queryTrip("Via Giuseppe Lanza di Scalea, 2703, 90147 Palermo", "Galletti - Zita");
}
@Test
public void queryTripStationsPalermo() throws Exception {
queryTrip("Palermo Centrale", "Galletti Zita");
}
@Test
public void queryTripAddressesRome() throws Exception {
queryTrip("Via Anton Giulio Barrili, 44-46, Roma", "Via delle Cave di Pietralata, 103, Roma");
}
@Test
public void queryTripAddressStationRome() throws Exception {
queryTrip("Via Anton Giulio Barrili, 44-46, Roma", "Policlinico");
}
@Test
public void queryTripStationsRome() throws Exception {
queryTrip("Ottaviano", "Policlinico");
}
@Test
public void queryTripNoSolution() throws Exception {
queryTripNoSolution("Palermo Centrale", "Galletti Zita");
}
@Test
public void queryTripUnknownFrom() throws Exception {
queryTripUnknownFrom("Palermo Centrale");
}
@Test
public void queryTripUnknownTo() throws Exception {
queryTripUnknownTo("Palermo Centrale");
}
@Test
public void queryTripSlowWalkPalermo() throws Exception {
queryTripSlowWalk("Palermo Centrale", "Galletti Zita");
}
@Test
public void queryTripFastWalkPalermo() throws Exception {
queryTripFastWalk("Palermo Centrale", "Galletti Zita");
}
@Test
public void queryMoreTripsPalermo() throws Exception {
queryMoreTrips("Palermo Centrale", "Galletti Zita");
}
@Test
public void queryTripSlowWalkRome() throws Exception {
queryTripSlowWalk("Ottaviano", "Policlinico");
}
@Test
public void queryTripFastWalkRome() throws Exception {
queryTripFastWalk("Ottaviano", "Policlinico");
}
@Test
public void queryMoreTripsRome() throws Exception {
queryMoreTrips("Ottaviano", "Policlinico");
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,56 +0,0 @@
/*
* Copyright 2018 Erik Uhlmann.
*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import org.junit.Test;
import de.schildbach.pte.MassachusettsProvider;
/**
* @author Erik Uhlmann
*/
public class MassachusettsProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public MassachusettsProviderLiveTest() {
super(new MassachusettsProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStations() throws Exception {
nearbyStationsStation("stop_point:OUB:SP:70243");
}
@Test
public void nearbyStationsByCoordinate() throws Exception {
nearbyStationsAny(42353187, -71067045);
}
@Test
public void queryDepartures() throws Exception {
queryDeparturesEquivsFalse("stop_point:OUB:SP:70198");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDeparturesInvalidStation("stop_point:OUB:SP:xxxx");
}
@Test
public void suggestLocations() throws Exception {
suggestLocationsFromName("Airport");
}
}

View file

@ -1,84 +0,0 @@
/*
* 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
* 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.schildbach.pte.NicaraguaProvider;
import de.schildbach.pte.dto.Point;
public class NicaraguaProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public NicaraguaProviderLiveTest() {
super(new NicaraguaProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
// Managua
nearbyStationsAddress(13090080, -86356250);
}
@Test
public void nearbyStationsAddress2() throws Exception {
// Esteli
nearbyStationsAddress(12146120, -86274660);
}
@Test
public void nearbyStationsStation() throws Exception {
nearbyStationsStation("stop_point:MNI:SP:node3230617621");
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
nearbyStationsInvalidStation("stop_point:MNIX:SP:node3230617621");
}
@Test
public void queryDeparturesEquivsFalse() throws Exception {
queryDeparturesEquivsFalse("stop_point:MNI:SP:node3230617621");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDeparturesInvalidStation("stop_point:MNIX:SP:node3230617621");
}
@Test
public void suggestLocations() throws Exception {
suggestLocationsFromName("Hospital");
}
@Test
public void queryTripStations() throws Exception {
queryTrip("27 de Mayo", "San Miguel Arcángel");
}
@Test
public void queryMoreTrips() throws Exception {
queryMoreTrips("Hospital", "Super Las Segovias");
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,89 +0,0 @@
/*
* Copyright 2014-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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.schildbach.pte.NzProvider;
import de.schildbach.pte.dto.Point;
/**
* @author Torsten Grote
*/
public class NzProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public NzProviderLiveTest() {
super(new NzProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
// Auckland
nearbyStationsAddress(-36852200, 174763000);
}
@Test
public void nearbyStationsAddress2() throws Exception {
// Wellington
nearbyStationsAddress(-41292500, 174777000);
}
@Test
public void nearbyStationsStation() throws Exception {
// Ghuznee Street at Cuba Street (Wellington)
nearbyStationsStation("stop_point:OWT:SP:6909");
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
nearbyStationsInvalidStation("stop_point:OWX:SP:6909");
}
@Test
public void queryDeparturesEquivsFalse() throws Exception {
queryDeparturesEquivsFalse("stop_point:OWT:SP:6911");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDeparturesInvalidStation("stop_point:OWX:SP:6911");
}
@Test
public void suggestLocations() throws Exception {
suggestLocationsFromName("Cuba St");
}
@Test
public void queryTripStations() throws Exception {
queryTrip("Cuba Street at Weltec", "Petone");
}
@Test
public void queryMoreTrips() throws Exception {
queryMoreTrips("Manners Street", "Lower Hutt");
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,69 +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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import de.schildbach.pte.OntarioProvider;
import de.schildbach.pte.dto.Location;
import de.schildbach.pte.dto.LocationType;
import de.schildbach.pte.dto.NearbyLocationsResult;
import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.SuggestLocationsResult;
/**
* @author Stephane Berube
*/
public class OntarioProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public OntarioProviderLiveTest() {
super(new OntarioProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStations() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(
new Location(LocationType.STATION, "stop_point:OAW:SP:CH240"));
print(result);
}
@Test
public void nearbyStationsByCoordinate() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(Location.coord(45416667, -75683333));
print(result);
}
@Test
public void queryDepartures() throws Exception {
final QueryDeparturesResult result = queryDepartures("OAW:SP:CH240", false);
print(result);
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
final QueryDeparturesResult result = queryDepartures("OAW:SP:CHxxx", false);
assertEquals(QueryDeparturesResult.Status.INVALID_STATION, result.status);
}
@Test
public void suggestLocations() throws Exception {
final SuggestLocationsResult result = suggestLocations("Airport");
print(result);
}
}

View file

@ -1,68 +0,0 @@
/*
* Copyright 2016 Clayton Craft.
*
* 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import de.schildbach.pte.OregonProvider;
import de.schildbach.pte.dto.Location;
import de.schildbach.pte.dto.LocationType;
import de.schildbach.pte.dto.NearbyLocationsResult;
import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.SuggestLocationsResult;
/**
* @author Stephane Berube
*/
public class OregonProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public OregonProviderLiveTest() {
super(new OregonProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStations() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "OTP:SP:5017"));
print(result);
}
@Test
public void nearbyStationsByCoordinate() throws Exception {
final NearbyLocationsResult result = queryNearbyStations(Location.coord(45514998, -122673334));
print(result);
}
@Test
public void queryDepartures() throws Exception {
final QueryDeparturesResult result = queryDepartures("OTP:SP:5017", false);
print(result);
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
final QueryDeparturesResult result = queryDepartures("OTP:SP:xxxx", false);
assertEquals(QueryDeparturesResult.Status.INVALID_STATION, result.status);
}
@Test
public void suggestLocations() throws Exception {
final SuggestLocationsResult result = suggestLocations("Airport");
print(result);
}
}

View file

@ -1,197 +0,0 @@
/*
* Copyright 2014-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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.schildbach.pte.ParisProvider;
import de.schildbach.pte.dto.Location;
import de.schildbach.pte.dto.LocationType;
import de.schildbach.pte.dto.Point;
/**
* @author Antonio El Khoury
*/
public class ParisProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public ParisProviderLiveTest() {
super(new ParisProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
nearbyStationsAddress(48877523, 2378353);
}
@Test
public void nearbyStationsAddress2() throws Exception {
nearbyStationsAddress(48785420, 2212050);
}
@Test
public void nearbyStationsStation() throws Exception {
nearbyStationsStation("stop_point:OIF:SP:59:5657291");
}
@Test
public void nearbyStationsPoi() throws Exception {
nearbyStationsPoi("poi:n668579722");
}
@Test
public void nearbyStationsAny() throws Exception {
nearbyStationsAny(48877523, 2378353);
}
@Test
public void nearbyStationsDistance() throws Exception {
nearbyStationsStationDistance("stop_point:OIF:SP:80:137");
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
nearbyStationsInvalidStation("stop_point:RTP:SP:392");
}
@Test
public void queryDeparturesEquivsFalse() throws Exception {
queryDeparturesEquivsFalse("stop_point:OIF:SP:59:5657291");
}
@Test
public void queryDeparturesStopArea() throws Exception {
queryDeparturesStopArea("stop_area:OIF:SA:59864");
}
@Test
public void queryDeparturesEquivsTrue() throws Exception {
queryDeparturesEquivsTrue("stop_point:OIF:SP:59:5657291");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDeparturesInvalidStation("stop_point:RTP:SP:999999");
}
@Test
public void suggestLocations() throws Exception {
suggestLocationsFromName("bellevi");
}
@Test
public void suggestLocationsFromAddress() throws Exception {
suggestLocationsFromAddress("13 rue man");
}
@Test
public void suggestLocationsNoLocation() throws Exception {
suggestLocationsNoLocation("bellevilleadasdjkaskd");
}
@Test
public void queryTripAddresses() throws Exception {
queryTrip("5 rue Manin Paris", "10 rue Elanger Paris");
}
@Test
public void queryTripAddressStation() throws Exception {
queryTrip("155 bd hopital paris", "Gare St-Lazare");
}
@Test
public void queryTripStations() throws Exception {
queryTrip("Campo Formio", "Gare St-Lazare");
}
@Test
public void queryTripCablecar() throws Exception {
queryTrip("Campo Formio", "Aéroport Orly Sud");
}
@Test
public void queryTripStations2() throws Exception {
queryTrip("Tour Eiffel", "Orsay Ville");
}
@Test
public void queryTripStations3() throws Exception {
queryTrip("Tour Eiffel", "Campo Formio");
}
@Test
public void queryTripStationsOrlyval() throws Exception {
queryTrip("Orly Sud", "Gare De Lyon");
}
@Test
public void queryTripStationsRapidTransit() throws Exception {
queryTrip("Luxembourg Paris", "Antony Antony");
}
@Test
public void queryTripFromAdministrativeRegionToPoi() throws Exception {
queryTripFromAdminToPoi("Paris 10e Arrondissement", "Paris Tour Eiffel");
}
@Test
public void queryTripNoSolution() throws Exception {
queryTripNoSolution("secretan buttes chaumont paris", "Antony Antony");
}
@Test
public void queryTripUnknownFrom() throws Exception {
queryTripUnknownFrom("secretan buttes chaumont paris");
}
@Test
public void queryTripUnknownTo() throws Exception {
queryTripUnknownTo("secretan buttes chaumont paris");
}
@Test
public void queryTripAmbiguousFrom() throws Exception {
queryTripAmbiguousFrom(new Location(LocationType.ANY, "ambiguous", null, "Eiffel"), "Gare St-Lazare");
}
@Test
public void queryTripAmbiguousTo() throws Exception {
queryTripAmbiguousTo("Gare St-Lazare", new Location(LocationType.ANY, "ambiguous", null, "Eiffel"));
}
@Test
public void queryTripSlowWalk() throws Exception {
queryTripSlowWalk("5 rue manin paris", "10 rue marcel dassault velizy");
}
@Test
public void queryTripFastWalk() throws Exception {
queryTripFastWalk("5 rue manin paris", "10 rue marcel dassault velizy");
}
@Test
public void queryMoreTrips() throws Exception {
queryMoreTrips("5 rue manin paris", "10 rue marcel dassault velizy");
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,197 +0,0 @@
/*
* Copyright 2018 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.schildbach.pte.PlNavitiaProvider;
import de.schildbach.pte.dto.Point;
/**
* @author Michel Le Bihan
*/
public class PlNavitiaProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public PlNavitiaProviderLiveTest() {
super(new PlNavitiaProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
// stations close to those coordinates (lat, lon)
// no decimal point, has to include 6 decimal places
nearbyStationsAddress(52231160, 21010740);
}
@Test
public void nearbyStationsAddress2() throws Exception {
// different test case for stations close to coordinates (lat, lon)
// no decimal point, has to include 6 decimal places
nearbyStationsAddress(52244700, 21001260);
}
@Test
public void nearbyStationsStation() throws Exception {
// station to find other stations around
// look in NTFS file for a stop_id (that contains "SP") and append to "stop_point:"
nearbyStationsStation("stop_point:OWW:SP:ctr");
}
@Test
public void nearbyStationsPoi() throws Exception {
// POI to find stations around
// search OSM for a node, use identifier after
// "https://www.openstreetmap.org/node/" and append it to "poi:n"
nearbyStationsPoi("poi:n35121252");
}
@Test
public void nearbyStationsAny() throws Exception {
// coordinates to find stations around
nearbyStationsAny(52231160, 21010740);
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
// station that does not exist?
nearbyStationsInvalidStation("stop_point:RTP:SP:392");
}
@Test
public void queryDeparturesEquivsFalse() throws Exception {
// what is it for??
queryDeparturesEquivsFalse("stop_point:OWW:SP:ctr");
}
@Test
public void queryDeparturesStopArea() throws Exception {
// what is it for??
// has to be an existing stop area (i.e. ID contains "SA")
queryDeparturesStopArea("stop_area:OWW:SA:709003");
}
@Test
public void queryDeparturesEquivsTrue() throws Exception {
// what is it for??
// can be the same to queryDeparturesEquivsFalse
queryDeparturesEquivsTrue("stop_point:OWW:SP:709003");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
// station that does not exist
queryDeparturesInvalidStation("stop_point:OBO:SP:999999");
}
@Test
public void suggestLocations() throws Exception {
// start of a place name that should return something
suggestLocationsFromName("Pałac");
}
@Test
public void suggestLocationsFromAddress() throws Exception {
// start of an address that should return something
suggestLocationsFromAddress("Radarowa 1");
}
@Test
public void suggestLocationsNoLocation() throws Exception {
// fake place that will not return results
suggestLocationsNoLocation("quinconcesadasdjkaskd");
}
@Test
public void queryTripAddresses() throws Exception {
// two existing addresses to define a trip
queryTrip("Radarowa 1, Warszawa", "Nowowiejska 37a, Warszawa");
}
@Test
public void queryTripAddressStation() throws Exception {
// one existing address and one existing station to define a trip
queryTrip("Nowowiejska 37a, Warszawa", "Centrum 01, Warszawa");
}
@Test
public void queryTripStations() throws Exception {
// two existing stops to define a trip
queryTrip("Radarowa 01", "Centrum 01");
}
@Test
public void queryTripStations2() throws Exception {
// two existing stations for a trip, second test case
queryTrip("Ratuszowa - ZOO 01", "Nowowiejska 01");
}
@Test
public void queryTripStations3() throws Exception {
// two existing stations for a trip, third test case
queryTrip("Warszawa Zoo", "Politechnika");
}
@Test
public void queryTripStationsRapidTransit() throws Exception {
// two existing stations for "rapid transit"... ?
queryTrip("Politechnika", "Centrum");
}
@Test
public void queryTripNoSolution() throws Exception {
// two existing stations that are not connected
queryTripNoSolution("Centrum", "Sródmiescie SKM");
}
@Test
public void queryTripUnknownFrom() throws Exception {
// existing station for end of trip, don't know where from
queryTripUnknownFrom("Centrum");
}
@Test
public void queryTripUnknownTo() throws Exception {
// existing station to start from, don't know where to
queryTripUnknownTo("Politechnika");
}
@Test
public void queryTripSlowWalk() throws Exception {
// two addresses for a "slow walk"
queryTripSlowWalk("Nowowiejska 37a, Warszawa", "Centrum 01, Warszawa");
}
@Test
public void queryTripFastWalk() throws Exception {
// two addresses for a "fast walk", can be same as above
queryTripFastWalk("Nowowiejska 37a, Warszawa", "Centrum 01, Warszawa");
}
@Test
public void queryMoreTrips() throws Exception {
// two addresses to show more trip options, can be same as above
queryMoreTrips("Nowowiejska 37a, Warszawa", "Centrum 01, Warszawa");
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,51 +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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import org.junit.Test;
import de.schildbach.pte.QuebecProvider;
/**
* @author Stephane Berube
*/
public class QuebecProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public QuebecProviderLiveTest() {
super(new QuebecProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsStation() throws Exception {
nearbyStationsStation("stop_area:OML:SA:CTP3102842");
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
nearbyStationsInvalidStation("stop_area:OML:SA:CTPxxxxxxx");
}
@Test
public void queryDeparturesStopArea() throws Exception {
queryDeparturesStopArea("stop_area:OML:SA:CTP3102842");
}
@Test
public void suggestLocations() throws Exception {
suggestLocations("Airport");
}
}

View file

@ -1,85 +0,0 @@
/*
* Copyright 2015-2016 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 <https://www.gnu.org/licenses/>.
*/
package de.schildbach.pte.live;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import de.schildbach.pte.SpainProvider;
import de.schildbach.pte.dto.Point;
public class SpainProviderLiveTest extends AbstractNavitiaProviderLiveTest {
public SpainProviderLiveTest() {
super(new SpainProvider(secretProperty("navitia.authorization")));
}
@Test
public void nearbyStationsAddress() throws Exception {
// Valencia
nearbyStationsAddress(39473600, -371100);
}
@Test
public void nearbyStationsAddress2() throws Exception {
// Madrid
nearbyStationsAddress(40410400, -3702400);
}
@Test
public void nearbyStationsStation() throws Exception {
nearbyStationsStation("stop_point:E38:SP:2223");
}
@Test
public void nearbyStationsInvalidStation() throws Exception {
nearbyStationsInvalidStation("stop_point:EX38:SP:2223");
}
@Test
public void queryDeparturesEquivsFalse() throws Exception {
queryDeparturesEquivsFalse("stop_point:E38:SP:2223");
}
@Test
public void queryDeparturesInvalidStation() throws Exception {
queryDeparturesInvalidStation("stop_point:OWX:SP:6911");
}
@Test
public void suggestLocations() throws Exception {
suggestLocationsFromName("Turia");
}
@Test
public void queryTripStations() throws Exception {
queryTrip("Benimaclet", "Nou d'Octubre");
}
@Test
public void queryMoreTrips() throws Exception {
queryMoreTrips("Valencia Sud", "Faitanar");
}
@Test
public void getArea() throws Exception {
final Point[] polygon = provider.getArea();
assertTrue(polygon.length > 0);
}
}

View file

@ -1,5 +1,4 @@
# Secrets are needed to run some of the live tests. # Secrets are needed to run some of the live tests.
navitia.authorization =
hci.salt_encryption_key = hci.salt_encryption_key =
db.api_authorization = db.api_authorization =
db.encrypted_salt = db.encrypted_salt =