mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-20 01:10:02 +00:00
Migrate Göttingen & South Lower Saxony and Rostock into Bremen, Bremerhaven & Osnabrück. Also switch to JSON API and adapt Rostock styles.
This commit is contained in:
parent
b70a3c5258
commit
6e03763192
9 changed files with 320 additions and 591 deletions
|
@ -1,131 +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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.schildbach.pte.live;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.hasItem;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import de.schildbach.pte.NetworkProvider.Accessibility;
|
||||
import de.schildbach.pte.NetworkProvider.WalkSpeed;
|
||||
import de.schildbach.pte.RsagProvider;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyLocationsResult;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||
import de.schildbach.pte.dto.QueryTripsResult;
|
||||
import de.schildbach.pte.dto.SuggestLocationsResult;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
*/
|
||||
public class RsagProviderLiveTest extends AbstractProviderLiveTest
|
||||
{
|
||||
public RsagProviderLiveTest()
|
||||
{
|
||||
super(new RsagProvider());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStations() throws Exception
|
||||
{
|
||||
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "8010304"));
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStationsByCoordinate() throws Exception
|
||||
{
|
||||
final NearbyLocationsResult result = queryNearbyStations(Location.coord(54078314, 12131715));
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDepartures() throws Exception
|
||||
{
|
||||
final QueryDeparturesResult result = queryDepartures("8010304", false);
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDeparturesInvalidStation() throws Exception
|
||||
{
|
||||
final QueryDeparturesResult result = queryDepartures("999999", false);
|
||||
assertEquals(QueryDeparturesResult.Status.INVALID_STATION, result.status);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void suggestLocations() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("Rostock");
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void suggestLocationsUmlaut() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("Lütten Klein");
|
||||
print(result);
|
||||
assertEquals("Lütten Klein", result.getLocations().get(0).name);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void suggestLocationsCoverage() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult rostockResult = suggestLocations("Rostock");
|
||||
print(rostockResult);
|
||||
assertThat(rostockResult.getLocations(), hasItem(new Location(LocationType.STATION, "8010304")));
|
||||
|
||||
final SuggestLocationsResult warnemuendeResult = suggestLocations("Warnemünde");
|
||||
print(warnemuendeResult);
|
||||
assertThat(warnemuendeResult.getLocations(), hasItem(new Location(LocationType.STATION, "8013236")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void suggestLocationsLocality() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("lange");
|
||||
assertEquals("Rostock", result.getLocations().get(0).place);
|
||||
assertEquals("Lange Straße", result.getLocations().get(0).name);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortTrip() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8096109", null, "Oldenburg"), null, new Location(
|
||||
LocationType.STATION, "625398", null, "Bremerhaven"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
assertEquals(QueryTripsResult.Status.OK, result.status);
|
||||
print(result);
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tripDateOutsideTimetablePeriod() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8096109", null, "Oldenburg"), null, new Location(
|
||||
LocationType.STATION, "625398", null, "Bremerhaven"), new Date(1155822689759l), true, Product.ALL, WalkSpeed.NORMAL,
|
||||
Accessibility.NEUTRAL);
|
||||
assertEquals(QueryTripsResult.Status.INVALID_DATE, result.status);
|
||||
}
|
||||
}
|
|
@ -24,5 +24,6 @@ public final class Secrets
|
|||
{
|
||||
public static final String VGN_API_BASE = "insert vgn base here";
|
||||
public static final String NAVITIA_AUTHORIZATION = "insert navitia authorization here";
|
||||
public static final String VBN_JSON_API_AUTHORIZATION = "insert vao authorization here";
|
||||
public static final String VAO_JSON_API_AUTHORIZATION = "insert vao authorization here";
|
||||
}
|
||||
|
|
|
@ -17,7 +17,10 @@
|
|||
|
||||
package de.schildbach.pte.live;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.hasItem;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -41,28 +44,33 @@ public class VbnProviderLiveTest extends AbstractProviderLiveTest
|
|||
{
|
||||
public VbnProviderLiveTest()
|
||||
{
|
||||
super(new VbnProvider());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStations() throws Exception
|
||||
{
|
||||
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "8000110"));
|
||||
print(result);
|
||||
super(new VbnProvider(Secrets.VBN_JSON_API_AUTHORIZATION));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStationsByCoordinate() throws Exception
|
||||
{
|
||||
final NearbyLocationsResult result = queryNearbyStations(Location.coord(51318447, 9496250));
|
||||
print(result);
|
||||
final NearbyLocationsResult result1 = queryNearbyStations(Location.coord(53086421, 8806388));
|
||||
print(result1);
|
||||
|
||||
final NearbyLocationsResult result2 = queryNearbyStations(Location.coord(51536614, 9925673));
|
||||
print(result2);
|
||||
|
||||
final NearbyLocationsResult result3 = queryNearbyStations(Location.coord(54078314, 12131715));
|
||||
print(result3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDepartures() throws Exception
|
||||
{
|
||||
final QueryDeparturesResult result = queryDepartures("8000110", false);
|
||||
print(result);
|
||||
final QueryDeparturesResult result1 = queryDepartures("8000110", false);
|
||||
print(result1);
|
||||
|
||||
final QueryDeparturesResult result2 = queryDepartures("8000128", false);
|
||||
print(result2);
|
||||
|
||||
final QueryDeparturesResult result3 = queryDepartures("8010304", false);
|
||||
print(result3);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -75,25 +83,97 @@ public class VbnProviderLiveTest extends AbstractProviderLiveTest
|
|||
@Test
|
||||
public void suggestLocations() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("Coppengrave");
|
||||
print(result);
|
||||
final SuggestLocationsResult result1 = suggestLocations("Bremen");
|
||||
print(result1);
|
||||
|
||||
final SuggestLocationsResult result2 = suggestLocations("Hannover");
|
||||
print(result2);
|
||||
|
||||
final SuggestLocationsResult result3 = suggestLocations("Rostock");
|
||||
print(result3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void suggestLocationsUmlaut() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("Göttingen Hauptbahnhof");
|
||||
final SuggestLocationsResult result1 = suggestLocations("Göttingen Hauptbahnhof");
|
||||
print(result1);
|
||||
assertEquals("Göttingen", result1.getLocations().get(0).name);
|
||||
|
||||
final SuggestLocationsResult result2 = suggestLocations("Lütten Klein");
|
||||
print(result2);
|
||||
assertEquals("Lütten Klein", result2.getLocations().get(0).name);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void suggestLocationsCoverage() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult rostockResult = suggestLocations("Rostock");
|
||||
print(rostockResult);
|
||||
assertThat(rostockResult.getLocations(), hasItem(new Location(LocationType.STATION, "8010304")));
|
||||
|
||||
final SuggestLocationsResult warnemuendeResult = suggestLocations("Warnemünde");
|
||||
print(warnemuendeResult);
|
||||
assertThat(warnemuendeResult.getLocations(), hasItem(new Location(LocationType.STATION, "8013236")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void suggestLocationsLocality() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("lange straße");
|
||||
print(result);
|
||||
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "708425", "Rostock", "Lange Straße")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void suggestLocationsWithoutCoordinatesInResult() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("aachen");
|
||||
print(result);
|
||||
assertEquals("Göttingen", result.getLocations().get(0).place);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortTrip() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8096109", null, "Oldenburg"), null, new Location(
|
||||
LocationType.STATION, "625398", null, "Bremerhaven"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8096109", null, "Oldenburg"), null,
|
||||
new Location(LocationType.STATION, "625398", null, "Bremerhaven"), new Date(), true, Product.ALL, WalkSpeed.NORMAL,
|
||||
Accessibility.NEUTRAL);
|
||||
assertEquals(QueryTripsResult.Status.OK, result.status);
|
||||
assertTrue(result.trips.size() > 0);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
|
||||
if (!laterResult.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryTripsResult later2Result = queryMoreTrips(laterResult.context, true);
|
||||
print(later2Result);
|
||||
|
||||
if (!later2Result.context.canQueryEarlier())
|
||||
return;
|
||||
|
||||
final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false);
|
||||
print(earlierResult);
|
||||
|
||||
if (!earlierResult.context.canQueryEarlier())
|
||||
return;
|
||||
|
||||
final QueryTripsResult earlier2Result = queryMoreTrips(earlierResult.context, false);
|
||||
print(earlier2Result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortTripGoettingen() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8000128", null, "Göttingen"), null,
|
||||
new Location(LocationType.STATION, "1140061", null, "Göttingen Nikolausberger Weg"), new Date(), true, Product.ALL, WalkSpeed.NORMAL,
|
||||
Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
|
@ -101,8 +181,8 @@ public class VbnProviderLiveTest extends AbstractProviderLiveTest
|
|||
@Test
|
||||
public void tripDateOutsideTimetablePeriod() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8096109", null, "Oldenburg"), null, new Location(
|
||||
LocationType.STATION, "625398", null, "Bremerhaven"), new Date(1155822689759l), true, Product.ALL, WalkSpeed.NORMAL,
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8096109", null, "Oldenburg"), null,
|
||||
new Location(LocationType.STATION, "625398", null, "Bremerhaven"), new Date(1155822689759l), true, Product.ALL, WalkSpeed.NORMAL,
|
||||
Accessibility.NEUTRAL);
|
||||
assertEquals(QueryTripsResult.Status.INVALID_DATE, result.status);
|
||||
}
|
||||
|
|
|
@ -1,107 +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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.schildbach.pte.live;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import de.schildbach.pte.NetworkProvider.Accessibility;
|
||||
import de.schildbach.pte.NetworkProvider.WalkSpeed;
|
||||
import de.schildbach.pte.VsnProvider;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyLocationsResult;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||
import de.schildbach.pte.dto.QueryTripsResult;
|
||||
import de.schildbach.pte.dto.SuggestLocationsResult;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
*/
|
||||
public class VsnProviderLiveTest extends AbstractProviderLiveTest
|
||||
{
|
||||
public VsnProviderLiveTest()
|
||||
{
|
||||
super(new VsnProvider());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStations() throws Exception
|
||||
{
|
||||
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "8000128"));
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStationsByCoordinate() throws Exception
|
||||
{
|
||||
final NearbyLocationsResult result = queryNearbyStations(Location.coord(51536614, 9925673));
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDepartures() throws Exception
|
||||
{
|
||||
final QueryDeparturesResult result = queryDepartures("8000128", false);
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDeparturesInvalidStation() throws Exception
|
||||
{
|
||||
final QueryDeparturesResult result = queryDepartures("999999", false);
|
||||
assertEquals(QueryDeparturesResult.Status.INVALID_STATION, result.status);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void suggestLocations() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("Hannover");
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void suggestLocationsUmlaut() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("Göttingen");
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void suggestLocationsWithoutCoordinatesInResult() throws Exception
|
||||
{
|
||||
final SuggestLocationsResult result = suggestLocations("aachen");
|
||||
print(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortTrip() throws Exception
|
||||
{
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "8000128", null, "Göttingen"), null, new Location(
|
||||
LocationType.STATION, "1140061", null, "Göttingen Nikolausberger Weg"), new Date(), true, Product.ALL, WalkSpeed.NORMAL,
|
||||
Accessibility.NEUTRAL);
|
||||
print(result);
|
||||
|
||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||
print(laterResult);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue