mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-06 15:18:49 +00:00
MVV: update API base
This commit is contained in:
parent
a2d429a89f
commit
1cb8b2298d
2 changed files with 14 additions and 17 deletions
|
@ -39,7 +39,7 @@ import okhttp3.HttpUrl;
|
||||||
* @author Andreas Schildbach
|
* @author Andreas Schildbach
|
||||||
*/
|
*/
|
||||||
public class MvvProvider extends AbstractEfaProvider {
|
public class MvvProvider extends AbstractEfaProvider {
|
||||||
private static final HttpUrl API_BASE = HttpUrl.parse("https://efa.mvv-muenchen.de/mobile/");
|
private static final HttpUrl API_BASE = HttpUrl.parse("https://efa.mvv-muenchen.de/ng/");
|
||||||
|
|
||||||
public MvvProvider() {
|
public MvvProvider() {
|
||||||
this(API_BASE);
|
this(API_BASE);
|
||||||
|
@ -50,7 +50,7 @@ public class MvvProvider extends AbstractEfaProvider {
|
||||||
setIncludeRegionId(false);
|
setIncludeRegionId(false);
|
||||||
setRequestUrlEncoding(Charsets.UTF_8);
|
setRequestUrlEncoding(Charsets.UTF_8);
|
||||||
setStyles(STYLES);
|
setStyles(STYLES);
|
||||||
setSessionCookieName("SIDefaalt"); // SIDefa
|
setSessionCookieName("SIDefa");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -46,7 +46,8 @@ public class MvvProviderLiveTest extends AbstractProviderLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void nearbyStations() throws Exception {
|
public void nearbyStations() throws Exception {
|
||||||
final NearbyLocationsResult result = queryNearbyStations(new Location(LocationType.STATION, "350"));
|
final NearbyLocationsResult result =
|
||||||
|
queryNearbyStations(new Location(LocationType.STATION, "91000350"));
|
||||||
print(result);
|
print(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,13 +69,9 @@ public class MvvProviderLiveTest extends AbstractProviderLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void queryDeparturesMarienplatz() throws Exception {
|
public void queryDeparturesMarienplatz() throws Exception {
|
||||||
final QueryDeparturesResult result1 = queryDepartures("2", false);
|
final QueryDeparturesResult result1 = queryDepartures("91000002", false);
|
||||||
assertEquals(QueryDeparturesResult.Status.OK, result1.status);
|
assertEquals(QueryDeparturesResult.Status.OK, result1.status);
|
||||||
print(result1);
|
print(result1);
|
||||||
|
|
||||||
final QueryDeparturesResult result2 = queryDepartures("1000002", false);
|
|
||||||
assertEquals(QueryDeparturesResult.Status.OK, result2.status);
|
|
||||||
print(result2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -99,14 +96,14 @@ public class MvvProviderLiveTest extends AbstractProviderLiveTest {
|
||||||
public void suggestLocationsWithUmlaut() throws Exception {
|
public void suggestLocationsWithUmlaut() throws Exception {
|
||||||
final SuggestLocationsResult result = suggestLocations("Grüntal");
|
final SuggestLocationsResult result = suggestLocations("Grüntal");
|
||||||
print(result);
|
print(result);
|
||||||
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "1000619")));
|
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "91000619")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void suggestLocationsFraunhofer() throws Exception {
|
public void suggestLocationsFraunhofer() throws Exception {
|
||||||
final SuggestLocationsResult result = suggestLocations("fraunhofer");
|
final SuggestLocationsResult result = suggestLocations("fraunhofer");
|
||||||
print(result);
|
print(result);
|
||||||
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "1000150")));
|
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "91000150")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -135,7 +132,7 @@ public class MvvProviderLiveTest extends AbstractProviderLiveTest {
|
||||||
final SuggestLocationsResult result = suggestLocations("München, Maximilianstr. 1");
|
final SuggestLocationsResult result = suggestLocations("München, Maximilianstr. 1");
|
||||||
print(result);
|
print(result);
|
||||||
assertThat(result.getLocations(), hasItem(new Location(LocationType.ADDRESS,
|
assertThat(result.getLocations(), hasItem(new Location(LocationType.ADDRESS,
|
||||||
"streetID:3239:1:9162000:9162000:Maximilianstraße:München:Maximilianstraße::Maximilianstraße:80539:ANY:DIVA_ADDRESS:4468763:826437:MVTT:MVV")));
|
"streetID:1500000561::9162000:-1:Maximilianstraße:München:Maximilianstraße::Maximilianstraße: 80539 80538:ANY:DIVA_STREET:1289507:5870064:MRCV:BAY")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -143,13 +140,13 @@ public class MvvProviderLiveTest extends AbstractProviderLiveTest {
|
||||||
final SuggestLocationsResult result = suggestLocations("München, Maximilianstr.");
|
final SuggestLocationsResult result = suggestLocations("München, Maximilianstr.");
|
||||||
print(result);
|
print(result);
|
||||||
assertThat(result.getLocations(), hasItem(new Location(LocationType.ADDRESS,
|
assertThat(result.getLocations(), hasItem(new Location(LocationType.ADDRESS,
|
||||||
"streetID:3239::9162000:-1:Maximilianstraße:München:Maximilianstraße::Maximilianstraße: 80539 80538:ANY:DIVA_STREET:4469138:826553:MVTT:MVV")));
|
"streetID:1500000561::9162000:-1:Maximilianstraße:München:Maximilianstraße::Maximilianstraße: 80539 80538:ANY:DIVA_STREET:1289507:5870064:MRCV:BAY")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shortTrip() throws Exception {
|
public void shortTrip() throws Exception {
|
||||||
final Location from = new Location(LocationType.STATION, "2", "München", "Marienplatz");
|
final Location from = new Location(LocationType.STATION, "91000002", "München", "Marienplatz");
|
||||||
final Location to = new Location(LocationType.STATION, "10", "München", "Pasing");
|
final Location to = new Location(LocationType.STATION, "91000010", "München", "Pasing");
|
||||||
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
|
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
|
||||||
print(result);
|
print(result);
|
||||||
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
final QueryTripsResult laterResult = queryMoreTrips(result.context, true);
|
||||||
|
@ -162,7 +159,7 @@ public class MvvProviderLiveTest extends AbstractProviderLiveTest {
|
||||||
public void longTrip() throws Exception {
|
public void longTrip() throws Exception {
|
||||||
final Location from = new Location(LocationType.STATION, "1005530", Point.from1E6(48002924, 11340144),
|
final Location from = new Location(LocationType.STATION, "1005530", Point.from1E6(48002924, 11340144),
|
||||||
"Starnberg", "Agentur für Arbeit");
|
"Starnberg", "Agentur für Arbeit");
|
||||||
final Location to = new Location(LocationType.STATION, null, null, "Ackermannstraße");
|
final Location to = new Location(LocationType.STATION, "91000309", null, "Ackermannstraße");
|
||||||
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
|
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
|
||||||
print(result);
|
print(result);
|
||||||
}
|
}
|
||||||
|
@ -217,7 +214,7 @@ public class MvvProviderLiveTest extends AbstractProviderLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void tripBetweenStationAndAddress() throws Exception {
|
public void tripBetweenStationAndAddress() throws Exception {
|
||||||
final Location from = new Location(LocationType.STATION, "1220", null, "Josephsburg");
|
final Location from = new Location(LocationType.STATION, "91001220", null, "Josephsburg");
|
||||||
final Location to = new Location(LocationType.ADDRESS, null, Point.from1E6(48188018, 11574239), null,
|
final Location to = new Location(LocationType.ADDRESS, null, Point.from1E6(48188018, 11574239), null,
|
||||||
"München Frankfurter Ring 35");
|
"München Frankfurter Ring 35");
|
||||||
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
|
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
|
||||||
|
@ -228,7 +225,7 @@ public class MvvProviderLiveTest extends AbstractProviderLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void tripInvalidStation() throws Exception {
|
public void tripInvalidStation() throws Exception {
|
||||||
final Location valid = new Location(LocationType.STATION, "2", "München", "Marienplatz");
|
final Location valid = new Location(LocationType.STATION, "91000002", "München", "Marienplatz");
|
||||||
final Location invalid = new Location(LocationType.STATION, "99999", null, null);
|
final Location invalid = new Location(LocationType.STATION, "99999", null, null);
|
||||||
final QueryTripsResult result1 = queryTrips(valid, null, invalid, new Date(), true, null);
|
final QueryTripsResult result1 = queryTrips(valid, null, invalid, new Date(), true, null);
|
||||||
assertEquals(QueryTripsResult.Status.UNKNOWN_TO, result1.status);
|
assertEquals(QueryTripsResult.Status.UNKNOWN_TO, result1.status);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue