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

@ -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.
navitia.authorization =
hci.salt_encryption_key =
db.api_authorization =
db.encrypted_salt =