product selection for directions

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@241 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach 2010-10-05 14:26:30 +00:00
parent 89da3a9bba
commit dcd673d6f7
21 changed files with 172 additions and 59 deletions

View file

@ -556,6 +556,35 @@ public abstract class AbstractEfaProvider implements NetworkProvider
return (double) value / 1000000;
}
protected final String productParams(final String products)
{
if (products == null)
return "";
final StringBuilder params = new StringBuilder("&includedMeans=checkbox");
for (final char p : products.toCharArray())
{
if (p == 'I' || p == 'R')
params.append("&inclMOT_0=on");
if (p == 'S')
params.append("&inclMOT_1=on");
if (p == 'U')
params.append("&inclMOT_2=on");
if (p == 'T')
params.append("&inclMOT_3=on&inclMOT_4=on");
if (p == 'B')
params.append("&inclMOT_5=on&inclMOT_6=on&inclMOT_7=on&inclMOT_10=on");
if (p == 'F')
params.append("&inclMOT_9=on");
if (p == 'C')
params.append("&inclMOT_8=on");
params.append("&inclMOT_11=on"); // TODO always show 'others', for now
}
return params.toString();
}
private static final Map<Character, int[]> LINES = new HashMap<Character, int[]>();
static

View file

@ -176,7 +176,8 @@ public final class BahnProvider implements NetworkProvider
.compile("(zu dicht beieinander|mehrfach vorhanden oder identisch)|(leider konnte zu Ihrer Anfrage keine Verbindung gefunden werden)|(derzeit nur Ausk&#252;nfte vom)");
public QueryConnectionsResult queryConnections(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep, final WalkSpeed walkSpeed) throws IOException
final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed)
throws IOException
{
final String uri = connectionsQueryUri(fromType, from, viaType, via, toType, to, date, dep);
final CharSequence page = ParserUtils.scrape(uri);

View file

@ -85,7 +85,7 @@ public class GvhProvider extends AbstractEfaProvider
}
public QueryConnectionsResult queryConnections(LocationType fromType, String from, LocationType viaType, String via, LocationType toType,
String to, Date date, boolean dep, WalkSpeed walkSpeed) throws IOException
String to, Date date, boolean dep, String products, WalkSpeed walkSpeed) throws IOException
{
throw new UnsupportedOperationException();
}

View file

@ -79,7 +79,8 @@ public class LinzProvider extends AbstractEfaProvider
}
public QueryConnectionsResult queryConnections(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep, final WalkSpeed walkSpeed) throws IOException
final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed)
throws IOException
{
throw new UnsupportedOperationException();
}

View file

@ -189,7 +189,7 @@ public class MvvProvider extends AbstractEfaProvider
}
private String connectionsQueryUri(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep, final WalkSpeed walkSpeed)
final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed)
{
final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMdd");
final DateFormat YEAR_FORMAT = new SimpleDateFormat("yyyy");
@ -305,6 +305,7 @@ public class MvvProvider extends AbstractEfaProvider
uri.append("&itdTimeMinute=").append(ParserUtils.urlEncode(MINUTE_FORMAT.format(date)));
uri.append("&itdDate=").append(ParserUtils.urlEncode(DATE_FORMAT.format(date)));
uri.append("&changeSpeed=").append(WALKSPEED_MAP.get(walkSpeed));
uri.append(productParams(products));
return uri.toString();
}
@ -342,9 +343,11 @@ public class MvvProvider extends AbstractEfaProvider
"(Start und Ziel sind identisch)|(konnte keine Verbindung gefunden werden)", Pattern.CASE_INSENSITIVE);
public QueryConnectionsResult queryConnections(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep, final WalkSpeed walkSpeed) throws IOException
final LocationType toType, final String to, final Date date, final boolean dep, String products, final WalkSpeed walkSpeed)
throws IOException
{
final String uri = connectionsQueryUri(fromType, from, viaType, via, toType, to, date, dep, walkSpeed);
final String uri = connectionsQueryUri(fromType, from, viaType, via, toType, to, date, dep, products, walkSpeed);
System.out.println(uri);
final CharSequence page = ParserUtils.scrape(uri);
final Matcher mError = P_CHECK_CONNECTIONS_ERROR.matcher(page);

View file

@ -251,7 +251,7 @@ public class NasaProvider extends AbstractHafasProvider
}
public QueryConnectionsResult queryConnections(LocationType fromType, String from, LocationType viaType, String via, LocationType toType,
String to, Date date, boolean dep, WalkSpeed walkSpeed) throws IOException
String to, Date date, boolean dep, String products, WalkSpeed walkSpeed) throws IOException
{
throw new UnsupportedOperationException();
}

View file

@ -109,13 +109,16 @@ public interface NetworkProvider
* desired date for departing, mandatory
* @param dep
* date is departure date? {@code true} for departure, {@code false} for arrival
* @param products TODO
* @param walkSpeed
* how fast can you walk?
* @param products
* products to take into account
* @return result object that can contain alternatives to clear up ambiguousnesses, or contains possible connections
* @throws IOException
*/
QueryConnectionsResult queryConnections(LocationType fromType, String from, LocationType viaType, String via, LocationType toType, String to,
Date date, boolean dep, WalkSpeed walkSpeed) throws IOException;
Date date, boolean dep, String products, WalkSpeed walkSpeed) throws IOException;
/**
* Query more connections (e.g. earlier or later)

View file

@ -152,7 +152,8 @@ public class OebbProvider extends AbstractHafasProvider
}
private String connectionsQuery(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep, final WalkSpeed walkSpeed) throws IOException
final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed)
throws IOException
{
final DateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yy");
final DateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm");
@ -179,11 +180,30 @@ public class OebbProvider extends AbstractHafasProvider
uri.append("&REQ0JourneyTime=").append(ParserUtils.urlEncode(TIME_FORMAT.format(date)));
uri.append("&REQ0HafasSearchForw=").append(dep ? "1" : "0");
uri.append("&existHafasDemo3=yes");
uri.append("&REQ0JourneyProduct_list=").append(ParserUtils.urlEncode("0:1111111111010000-000000"));
uri.append("&REQ0JourneyDep_Foot_speed=").append(WALKSPEED_MAP.get(walkSpeed));
uri.append("&existBikeEverywhere=yes");
uri.append("&existHafasAttrInc=yes");
for (final char p : products.toCharArray())
{
if (p == 'I')
uri.append("&REQ0JourneyProduct_prod_section_0_0=1&REQ0JourneyProduct_prod_section_0_1=1&REQ0JourneyProduct_prod_section_0_2");
if (p == 'R')
uri.append("&REQ0JourneyProduct_prod_section_0_3=1&REQ0JourneyProduct_prod_section_0_4=1");
if (p == 'S')
uri.append("&REQ0JourneyProduct_prod_section_0_5=1");
if (p == 'U')
uri.append("&REQ0JourneyProduct_prod_section_0_8=1");
if (p == 'T')
uri.append("&REQ0JourneyProduct_prod_section_0_9=1");
if (p == 'B')
uri.append("&REQ0JourneyProduct_prod_section_0_6=1&REQ0JourneyProduct_prod_section_0_11=1");
if (p == 'F')
uri.append("&REQ0JourneyProduct_prod_section_0_7=1");
if (p == 'C')
; // FIXME
}
return uri.toString();
}
@ -208,7 +228,8 @@ public class OebbProvider extends AbstractHafasProvider
private static final Pattern P_ADDRESSES = Pattern.compile("<option[^>]*>\\s*([^<\\[]*)(?:\\[[^\\[]*\\])?\\s*</option>", Pattern.DOTALL);
public QueryConnectionsResult queryConnections(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep, final WalkSpeed walkSpeed) throws IOException
final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed)
throws IOException
{
// get base url and cookies from form
final CharSequence form = ParserUtils.scrape(QUERY_CONNECTIONS_FORM_URL, false, null, null, true);
@ -218,7 +239,7 @@ public class OebbProvider extends AbstractHafasProvider
final String baseUri = m.group(1);
// query
final String query = connectionsQuery(fromType, from, viaType, via, toType, to, date, dep, walkSpeed);
final String query = connectionsQuery(fromType, from, viaType, via, toType, to, date, dep, products, walkSpeed);
final CharSequence page = ParserUtils.scrape(baseUri, true, query, null, true);
final Matcher mError = P_QUERY_CONNECTIONS_ERROR.matcher(page);

View file

@ -176,7 +176,7 @@ public class RmvProvider extends AbstractHafasProvider
}
private String connectionsQueryUri(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep, final WalkSpeed walkSpeed)
final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed)
{
final DateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yy");
final DateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm");
@ -197,6 +197,27 @@ public class RmvProvider extends AbstractHafasProvider
uri.append("&REQ0JourneyStops1.0A=").append(locationType(viaType));
}
uri.append("&REQ0JourneyDep_Foot_speed=").append(WALKSPEED_MAP.get(walkSpeed));
for (final char p : products.toCharArray())
{
if (p == 'I')
uri.append("&REQ0JourneyProduct_prod_list_1=1000000000000000");
if (p == 'R')
uri.append("&REQ0JourneyProduct_prod_list_2=0110000000100000");
if (p == 'S')
uri.append("&REQ0JourneyProduct_prod_list_3=0001000000000000");
if (p == 'U')
uri.append("&REQ0JourneyProduct_prod_list_4=0000100000000000");
if (p == 'T')
uri.append("&REQ0JourneyProduct_prod_list_5=0000010000000000");
if (p == 'B')
uri.append("&REQ0JourneyProduct_prod_list_6=0000001101000000");
if (p == 'F')
uri.append("&REQ0JourneyProduct_prod_list_7=0000000010000000");
if (p == 'C')
; // FIXME
}
uri.append("&start=Suchen");
return uri.toString();
@ -221,9 +242,10 @@ public class RmvProvider extends AbstractHafasProvider
"(mehrfach vorhanden oder identisch)|(keine Verbindung gefunden werden)|(derzeit nur Ausk&#252;nfte vom)", Pattern.CASE_INSENSITIVE);
public QueryConnectionsResult queryConnections(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep, final WalkSpeed walkSpeed) throws IOException
final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed)
throws IOException
{
final String uri = connectionsQueryUri(fromType, from, viaType, via, toType, to, date, dep, walkSpeed);
final String uri = connectionsQueryUri(fromType, from, viaType, via, toType, to, date, dep, products, walkSpeed);
final CharSequence page = ParserUtils.scrape(uri);
final Matcher mError = P_CHECK_CONNECTIONS_ERROR.matcher(page);

View file

@ -126,6 +126,9 @@ public class SbbProvider extends AbstractHafasProvider
uri.append("&REQ0JourneyStopsZ0ID=");
uri.append("&REQ0JourneyTime=").append(ParserUtils.urlEncode(TIME_FORMAT.format(date)));
uri.append("&queryPageDisplayed=yes");
// TODO products
uri.append("&start=Suchen");
return uri.toString();
@ -149,7 +152,8 @@ public class SbbProvider extends AbstractHafasProvider
.compile("(mehrfach vorhanden oder identisch)|(keine Verbindung gefunden werden)|(liegt nach dem Ende der Fahrplanperiode|liegt vor Beginn der Fahrplanperiode)");
public QueryConnectionsResult queryConnections(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep, final WalkSpeed walkSpeed) throws IOException
final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed)
throws IOException
{
final String uri = connectionsQueryUri(fromType, from, viaType, via, toType, to, date, dep);
final CharSequence page = ParserUtils.scrape(uri);
@ -528,7 +532,7 @@ public class SbbProvider extends AbstractHafasProvider
final char t = normalizeCommonTypes(ucType);
if (t != 0)
return t;
if (ucType.equals("ICN")) // Intercity-Neigezug, Schweiz
return 'I';
if (ucType.equals("X")) // InterConnex

View file

@ -72,7 +72,8 @@ public class SncbProvider extends AbstractHafasProvider
}
public QueryConnectionsResult queryConnections(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep, final WalkSpeed walkSpeed) throws IOException
final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed)
throws IOException
{
throw new UnsupportedOperationException();
}

View file

@ -66,7 +66,8 @@ public class TflProvider implements NetworkProvider
}
public QueryConnectionsResult queryConnections(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep, final WalkSpeed walkSpeed) throws IOException
final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed)
throws IOException
{
throw new UnsupportedOperationException();
}

View file

@ -162,7 +162,7 @@ public final class VbbProvider implements NetworkProvider
public static final String STATION_URL_CONNECTION = "http://mobil.bvg.de/Fahrinfo/bin/query.bin/dox";
private String connectionsQueryUri(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep)
final LocationType toType, final String to, final Date date, final boolean dep, final String products)
{
final DateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yy");
final DateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm");
@ -223,8 +223,28 @@ public final class VbbProvider implements NetworkProvider
uri.append("&REQ0HafasSearchForw=").append(dep ? "1" : "0");
uri.append("&REQ0JourneyDate=").append(ParserUtils.urlEncode(DATE_FORMAT.format(date)));
uri.append("&REQ0JourneyTime=").append(ParserUtils.urlEncode(TIME_FORMAT.format(date)));
uri.append("&start=Suchen");
for (final char p : products.toCharArray())
{
if (p == 'I')
uri.append("&vw=5");
if (p == 'R')
uri.append("&vw=6");
if (p == 'S')
uri.append("&vw=0");
if (p == 'U')
uri.append("&vw=1");
if (p == 'T')
uri.append("&vw=2");
if (p == 'B')
uri.append("&vw=3");
if (p == 'F')
uri.append("&vw=7");
if (p == 'C')
; // FIXME
}
uri.append("&start=Suchen");
return uri.toString();
}
@ -246,9 +266,10 @@ public final class VbbProvider implements NetworkProvider
.compile("(zu dicht beieinander|mehrfach vorhanden oder identisch)|(keine Verbindung gefunden)|(derzeit nur Ausk&#252;nfte vom)");
public QueryConnectionsResult queryConnections(final LocationType fromType, final String from, final LocationType viaType, final String via,
final LocationType toType, final String to, final Date date, final boolean dep, final WalkSpeed walkSpeed) throws IOException
final LocationType toType, final String to, final Date date, final boolean dep, String products, final WalkSpeed walkSpeed)
throws IOException
{
final String uri = connectionsQueryUri(fromType, from, viaType, via, toType, to, date, dep);
final String uri = connectionsQueryUri(fromType, from, viaType, via, toType, to, date, dep, products);
final CharSequence page = ParserUtils.scrape(uri);
final Matcher mError = P_CHECK_CONNECTIONS_ERROR.matcher(page);

View file

@ -248,7 +248,7 @@ public class VgsProvider extends AbstractHafasProvider
}
public QueryConnectionsResult queryConnections(LocationType fromType, String from, LocationType viaType, String via, LocationType toType,
String to, Date date, boolean dep, WalkSpeed walkSpeed) throws IOException
String to, Date date, boolean dep, String products, WalkSpeed walkSpeed) throws IOException
{
throw new UnsupportedOperationException();
}

View file

@ -80,7 +80,7 @@ public class VrnProvider extends AbstractEfaProvider
}
public QueryConnectionsResult queryConnections(LocationType fromType, String from, LocationType viaType, String via, LocationType toType,
String to, Date date, boolean dep, WalkSpeed walkSpeed) throws IOException
String to, Date date, boolean dep, String products, WalkSpeed walkSpeed) throws IOException
{
throw new UnsupportedOperationException();
}

View file

@ -80,7 +80,7 @@ public class VrrProvider extends AbstractEfaProvider
}
public QueryConnectionsResult queryConnections(LocationType fromType, String from, LocationType viaType, String via, LocationType toType,
String to, Date date, boolean dep, WalkSpeed walkSpeed) throws IOException
String to, Date date, boolean dep, String products, WalkSpeed walkSpeed) throws IOException
{
throw new UnsupportedOperationException();
}

View file

@ -34,7 +34,8 @@ import de.schildbach.pte.dto.QueryDeparturesResult;
public class BahnProviderLiveTest
{
private BahnProvider provider = new BahnProvider();
private static final String ALL_PRODUCTS = "IRSUTBFC";
@Test
public void departures() throws Exception
{
@ -46,7 +47,7 @@ public class BahnProviderLiveTest
public void shortConnection() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ANY, "Berlin", null, null, LocationType.ANY, "Leipzig",
new Date(), true, WalkSpeed.NORMAL);
new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
for (final Connection connection : result.connections)
@ -58,7 +59,7 @@ public class BahnProviderLiveTest
public void slowConnection() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ANY, "Marienburger Str., Berlin ", null, null, LocationType.ANY,
"Tutzinger-Hof-Platz, Starnberg", new Date(), true, WalkSpeed.NORMAL);
"Tutzinger-Hof-Platz, Starnberg", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
for (final Connection connection : result.connections)
@ -70,7 +71,7 @@ public class BahnProviderLiveTest
public void connectionWithFootway() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ADDRESS, "Berlin - Mitte, Unter den Linden 24", null, null,
LocationType.ADDRESS, "Starnberg, Possenhofener Straße 13", new Date(), true, WalkSpeed.NORMAL);
LocationType.ADDRESS, "Starnberg, Possenhofener Straße 13", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);

View file

@ -33,7 +33,8 @@ import de.schildbach.pte.dto.QueryDeparturesResult;
public class LinzProviderLiveTest
{
private LinzProvider provider = new LinzProvider();
private static final String ALL_PRODUCTS = "IRSUTBFC";
@Test
public void queryDepartures() throws Exception
{
@ -45,48 +46,49 @@ public class LinzProviderLiveTest
public void shortConnection() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.STATION, "Linz Hauptbahnhof", null, null, LocationType.STATION,
"Linz Auwiesen", new Date(), true, WalkSpeed.FAST);
"Linz Auwiesen", new Date(), true, ALL_PRODUCTS, WalkSpeed.FAST);
System.out.println(result);
// final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
// System.out.println(moreResult);
// final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
// System.out.println(moreResult);
}
@Test
public void longConnection() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.STATION, "Linz Auwiesen", null, null, LocationType.STATION,
"Linz Hafen", new Date(), true, WalkSpeed.SLOW);
"Linz Hafen", new Date(), true, ALL_PRODUCTS, WalkSpeed.SLOW);
System.out.println(result);
// final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
// System.out.println(moreResult);
// final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
// System.out.println(moreResult);
}
@Test
public void connectionBetweenCoordinates() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.WGS84, "48165238,11577473", null, null, LocationType.WGS84,
"47987199,11326532", new Date(), true, WalkSpeed.NORMAL);
"47987199,11326532", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
// final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
// System.out.println(moreResult);
// final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
// System.out.println(moreResult);
}
@Test public void connectionBetweenCoordinateAndStation() throws Exception
@Test
public void connectionBetweenCoordinateAndStation() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.WGS84, "48238341,11478230", null, null, LocationType.ANY,
"Ostbahnhof", new Date(), true, WalkSpeed.NORMAL);
"Ostbahnhof", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
// final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
// System.out.println(moreResult);
// final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
// System.out.println(moreResult);
}
@Test
public void connectionBetweenAddresses() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ADDRESS, "München, Maximilianstr. 1", null, null,
LocationType.ADDRESS, "Starnberg, Jahnstraße 50", new Date(), true, WalkSpeed.NORMAL);
LocationType.ADDRESS, "Starnberg, Jahnstraße 50", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
// final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
// System.out.println(moreResult);
// final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
// System.out.println(moreResult);
}
}

View file

@ -32,12 +32,13 @@ import de.schildbach.pte.dto.QueryConnectionsResult;
public class MvvProviderLiveTest
{
private MvvProvider provider = new MvvProvider();
private static final String ALL_PRODUCTS = "IRSUTBFC";
@Test
public void shortConnection() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ANY, "Marienplatz", null, null, LocationType.ANY, "Pasing",
new Date(), true, WalkSpeed.NORMAL);
new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
System.out.println(moreResult);
@ -47,7 +48,7 @@ public class MvvProviderLiveTest
public void longConnection() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ANY, "Starnberg, Arbeitsamt", null, null, LocationType.ANY,
"Ackermannstraße", new Date(), true, WalkSpeed.NORMAL);
"Ackermannstraße", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
// seems like there are no more connections all the time
}
@ -56,7 +57,7 @@ public class MvvProviderLiveTest
public void connectionBetweenCoordinates() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.WGS84, "48165238,11577473", null, null, LocationType.WGS84,
"47987199,11326532", new Date(), true, WalkSpeed.NORMAL);
"47987199,11326532", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
System.out.println(moreResult);
@ -66,7 +67,7 @@ public class MvvProviderLiveTest
public void connectionBetweenCoordinateAndStation() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.WGS84, "48238341,11478230", null, null, LocationType.ANY,
"Ostbahnhof", new Date(), true, WalkSpeed.NORMAL);
"Ostbahnhof", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
System.out.println(moreResult);
@ -76,7 +77,7 @@ public class MvvProviderLiveTest
public void connectionBetweenAddresses() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ADDRESS, "München, Maximilianstr. 1", null, null,
LocationType.ADDRESS, "Starnberg, Jahnstraße 50", new Date(), true, WalkSpeed.NORMAL);
LocationType.ADDRESS, "Starnberg, Jahnstraße 50", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
System.out.println(moreResult);

View file

@ -33,6 +33,7 @@ import de.schildbach.pte.dto.QueryConnectionsResult;
public class OebbProviderLiveTest
{
private OebbProvider provider = new OebbProvider();
private static final String ALL_PRODUCTS = "IRSUTBFC";
@Test
public void nearbyStation() throws Exception
@ -46,7 +47,7 @@ public class OebbProviderLiveTest
public void shortConnection() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ANY, "Linz", null, null, LocationType.ANY, "Berlin", new Date(),
true, WalkSpeed.NORMAL);
true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
System.out.println(moreResult);
@ -56,7 +57,7 @@ public class OebbProviderLiveTest
public void slowConnection() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ANY, "Ramsen, Zoll", null, null, LocationType.ANY, "Azuga",
new Date(), true, WalkSpeed.NORMAL);
new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
System.out.println(moreResult);
@ -66,7 +67,7 @@ public class OebbProviderLiveTest
public void connectionWithFootway() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ANY, "Graz, Haselweg", null, null, LocationType.ADDRESS,
"Innsbruck, Gumppstraße 69", new Date(), true, WalkSpeed.NORMAL);
"Innsbruck, Gumppstraße 69", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
System.out.println(moreResult);
@ -76,7 +77,7 @@ public class OebbProviderLiveTest
public void connectionWithFootway2() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ANY, "Wien, Krottenbachstraße 110!", null, null,
LocationType.ADDRESS, "Wien, Meidlinger Hauptstraße 1", new Date(), true, WalkSpeed.NORMAL);
LocationType.ADDRESS, "Wien, Meidlinger Hauptstraße 1", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
System.out.println(moreResult);

View file

@ -35,6 +35,7 @@ import de.schildbach.pte.dto.QueryConnectionsResult;
public class SbbProviderLiveTest
{
private SbbProvider provider = new SbbProvider();
private static final String ALL_PRODUCTS = "IRSUTBFC";
@Test
public void nearbyStation() throws Exception
@ -48,7 +49,7 @@ public class SbbProviderLiveTest
public void shortConnection() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ANY, "Zürich!", null, null, LocationType.ANY, "Bern",
new Date(), true, WalkSpeed.NORMAL);
new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
System.out.println(moreResult);
@ -58,7 +59,7 @@ public class SbbProviderLiveTest
public void slowConnection() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ANY, "Schocherswil, Alte Post!", null, null, LocationType.ANY,
"Laconnex, Mollach", new Date(), true, WalkSpeed.NORMAL);
"Laconnex, Mollach", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
System.out.println(moreResult);
@ -68,7 +69,7 @@ public class SbbProviderLiveTest
public void connectionWithFootway() throws Exception
{
final QueryConnectionsResult result = provider.queryConnections(LocationType.ADDRESS, "Spiez, Seestraße 62", null, null,
LocationType.ADDRESS, "Einsiedeln, Erlenmoosweg 24", new Date(), true, WalkSpeed.NORMAL);
LocationType.ADDRESS, "Einsiedeln, Erlenmoosweg 24", new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
System.out.println(moreResult);