mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 08:10:46 +00:00
fixed parsing connections for Switzerland, ambiguous still missing
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@293 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
8a6b2a9ae3
commit
0a773096f0
8 changed files with 179 additions and 414 deletions
|
@ -214,6 +214,17 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Pattern P_CONNECTION_ID = Pattern.compile("co=(C\\d+-\\d+)&");
|
||||||
|
|
||||||
|
protected static String extractConnectionId(final String link)
|
||||||
|
{
|
||||||
|
final Matcher m = P_CONNECTION_ID.matcher(link);
|
||||||
|
if (m.find())
|
||||||
|
return m.group(1);
|
||||||
|
else
|
||||||
|
throw new IllegalArgumentException("cannot extract id from " + link);
|
||||||
|
}
|
||||||
|
|
||||||
private static final Map<Character, int[]> LINES = new HashMap<Character, int[]>();
|
private static final Map<Character, int[]> LINES = new HashMap<Character, int[]>();
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
|
@ -234,7 +234,7 @@ public final class BahnProvider implements NetworkProvider
|
||||||
return queryConnections(uri, page);
|
return queryConnections(uri, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Pattern P_CONNECTIONS_HEAD = Pattern.compile(".*" //
|
private static final Pattern P_CONNECTIONS_HEAD = Pattern.compile(".*?" //
|
||||||
+ "von: <span class=\"bold\">([^<]*)</span>.*?" // from
|
+ "von: <span class=\"bold\">([^<]*)</span>.*?" // from
|
||||||
+ "nach: <span class=\"bold\">([^<]*)</span>.*?" // to
|
+ "nach: <span class=\"bold\">([^<]*)</span>.*?" // to
|
||||||
+ "Datum: <span class=\"bold\">.., (\\d{2}\\.\\d{2}\\.\\d{2})</span>.*?" // currentDate
|
+ "Datum: <span class=\"bold\">.., (\\d{2}\\.\\d{2}\\.\\d{2})</span>.*?" // currentDate
|
||||||
|
@ -244,7 +244,7 @@ public final class BahnProvider implements NetworkProvider
|
||||||
private static final Pattern P_CONNECTIONS_COARSE = Pattern.compile("<tr><td class=\"overview timelink\">(.+?)</td></tr>", Pattern.DOTALL);
|
private static final Pattern P_CONNECTIONS_COARSE = Pattern.compile("<tr><td class=\"overview timelink\">(.+?)</td></tr>", Pattern.DOTALL);
|
||||||
private static final Pattern P_CONNECTIONS_FINE = Pattern.compile(".*?" //
|
private static final Pattern P_CONNECTIONS_FINE = Pattern.compile(".*?" //
|
||||||
+ "<a href=\"(http://mobile.bahn.de/bin/mobil/query.exe/dox[^\"]*?)\">" // link
|
+ "<a href=\"(http://mobile.bahn.de/bin/mobil/query.exe/dox[^\"]*?)\">" // link
|
||||||
+ "(\\d+:\\d+)<br />(\\d+:\\d+)</a></td>.+?" // departureTime, arrivalTime
|
+ "(\\d{1,2}:\\d{2})<br />(\\d{1,2}:\\d{2})</a></td>.+?" // departureTime, arrivalTime
|
||||||
+ "<td class=\"overview iphonepfeil\">(.*?)<br />.*?" // line
|
+ "<td class=\"overview iphonepfeil\">(.*?)<br />.*?" // line
|
||||||
, Pattern.DOTALL);
|
, Pattern.DOTALL);
|
||||||
|
|
||||||
|
@ -284,8 +284,8 @@ public final class BahnProvider implements NetworkProvider
|
||||||
line = normalizeLine(line);
|
line = normalizeLine(line);
|
||||||
else
|
else
|
||||||
line = null;
|
line = null;
|
||||||
final Connection connection = new Connection(ParserUtils.extractId(link), link, departureTime, arrivalTime, line,
|
final Connection connection = new Connection(AbstractHafasProvider.extractConnectionId(link), link, departureTime, arrivalTime,
|
||||||
line != null ? LINES.get(line.charAt(0)) : null, 0, from.name, 0, to.name, null);
|
line, line != null ? LINES.get(line.charAt(0)) : null, 0, from.name, 0, to.name, null);
|
||||||
connections.add(connection);
|
connections.add(connection);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -302,18 +302,19 @@ public final class BahnProvider implements NetworkProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Pattern P_CONNECTION_DETAILS_HEAD = Pattern.compile(".*<span class=\"bold\">Verbindungsdetails</span>.*", Pattern.DOTALL);
|
private static final Pattern P_CONNECTION_DETAILS_HEAD = Pattern.compile(".*?" //
|
||||||
|
+ "<span class=\"bold\">Verbindungsdetails</span>.*", Pattern.DOTALL);
|
||||||
private static final Pattern P_CONNECTION_DETAILS_COARSE = Pattern.compile("<div class=\"haupt rline\">\n(.+?>\n)</div>", Pattern.DOTALL);
|
private static final Pattern P_CONNECTION_DETAILS_COARSE = Pattern.compile("<div class=\"haupt rline\">\n(.+?>\n)</div>", Pattern.DOTALL);
|
||||||
static final Pattern P_CONNECTION_DETAILS_FINE = Pattern.compile("<span class=\"bold\">\\s*(.+?)\\s*</span>.*?" // departure
|
static final Pattern P_CONNECTION_DETAILS_FINE = Pattern.compile("<span class=\"bold\">\\s*(.+?)\\s*</span>.*?" // departure
|
||||||
+ "(?:" //
|
+ "(?:" //
|
||||||
+ "<span class=\"bold\">\\s*(.+?)\\s*</span>.*?" // line
|
+ "<span class=\"bold\">\\s*(.+?)\\s*</span>.*?" // line
|
||||||
+ "ab\\s+(?:<span[^>]*>.*?</span>)?\\s*(\\d+:\\d+)\\s*(?:<span[^>]*>.*?</span>)?" // departureTime
|
+ "ab\\s+(?:<span[^>]*>.*?</span>)?\\s*(\\d{1,2}:\\d{2})\\s*(?:<span[^>]*>.*?</span>)?" // departureTime
|
||||||
+ "\\s*(Gl\\. .+?)?\\s*\n" // departurePosition
|
+ "\\s*(Gl\\. .+?)?\\s*\n" // departurePosition
|
||||||
+ "am\\s+(\\d+\\.\\d+\\.\\d+).*?" // departureDate
|
+ "am\\s+(\\d{2}\\.\\d{2}\\.\\d{2}).*?" // departureDate
|
||||||
+ "<span class=\"bold\">\\s*(.+?)\\s*</span><br />.*?" // arrival
|
+ "<span class=\"bold\">\\s*(.+?)\\s*</span><br />.*?" // arrival
|
||||||
+ "an\\s+(?:<span[^>]*>.*?</span>)?\\s*(\\d+:\\d+)\\s*(?:<span[^>]*>.*?</span>)?" // arrivalTime
|
+ "an\\s+(?:<span[^>]*>.*?</span>)?\\s*(\\d{1,2}:\\d{2})\\s*(?:<span[^>]*>.*?</span>)?" // arrivalTime
|
||||||
+ "\\s*(Gl\\. .+?)?\\s*\n" // arrivalPosition
|
+ "\\s*(Gl\\. .+?)?\\s*\n" // arrivalPosition
|
||||||
+ "am\\s+(\\d+\\.\\d+\\.\\d+).*?" // arrivalDate
|
+ "am\\s+(\\d{2}\\.\\d{2}\\.\\d{2}).*?" // arrivalDate
|
||||||
+ "|" //
|
+ "|" //
|
||||||
+ "(\\d+) Min\\..*?" // footway
|
+ "(\\d+) Min\\..*?" // footway
|
||||||
+ "<span class=\"bold\">\\s*(.+?)\\s*</span><br />\n" // arrival
|
+ "<span class=\"bold\">\\s*(.+?)\\s*</span><br />\n" // arrival
|
||||||
|
@ -422,8 +423,8 @@ public final class BahnProvider implements NetworkProvider
|
||||||
if (firstDepartureTime == null || lastArrivalTime == null)
|
if (firstDepartureTime == null || lastArrivalTime == null)
|
||||||
throw new IllegalStateException("could not parse all parts of:\n" + page + "\n" + parts);
|
throw new IllegalStateException("could not parse all parts of:\n" + page + "\n" + parts);
|
||||||
|
|
||||||
return new GetConnectionDetailsResult(new Date(), new Connection(ParserUtils.extractId(uri), uri, firstDepartureTime, lastArrivalTime,
|
return new GetConnectionDetailsResult(new Date(), new Connection(AbstractHafasProvider.extractConnectionId(uri), uri, firstDepartureTime,
|
||||||
null, null, 0, firstDeparture, 0, lastArrival, parts));
|
lastArrivalTime, null, null, 0, firstDeparture, 0, lastArrival, parts));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -286,7 +286,7 @@ public class RmvProvider extends AbstractHafasProvider
|
||||||
line = normalizeLine(line);
|
line = normalizeLine(line);
|
||||||
else
|
else
|
||||||
line = null;
|
line = null;
|
||||||
final Connection connection = new Connection(ParserUtils.extractId(link), link, departureTime, arrivalTime, line,
|
final Connection connection = new Connection(extractConnectionId(link), link, departureTime, arrivalTime, line,
|
||||||
line != null ? lineColors(line) : null, 0, from.name, 0, to.name, null);
|
line != null ? lineColors(line) : null, 0, from.name, 0, to.name, null);
|
||||||
connections.add(connection);
|
connections.add(connection);
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,7 @@ public class RmvProvider extends AbstractHafasProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new GetConnectionDetailsResult(currentDate, new Connection(ParserUtils.extractId(uri), uri, firstDepartureTime, lastArrivalTime,
|
return new GetConnectionDetailsResult(currentDate, new Connection(extractConnectionId(uri), uri, firstDepartureTime, lastArrivalTime,
|
||||||
null, null, 0, firstDeparture, 0, lastArrival, parts));
|
null, null, 0, firstDeparture, 0, lastArrival, parts));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -44,19 +44,20 @@ import de.schildbach.pte.util.ParserUtils;
|
||||||
public class SbbProvider extends AbstractHafasProvider
|
public class SbbProvider extends AbstractHafasProvider
|
||||||
{
|
{
|
||||||
public static final String NETWORK_ID = "fahrplan.sbb.ch";
|
public static final String NETWORK_ID = "fahrplan.sbb.ch";
|
||||||
|
private static final String API_BASE = "http://fahrplan.sbb.ch/bin/";
|
||||||
|
|
||||||
private static final long PARSER_DAY_ROLLOVER_THRESHOLD_MS = 12 * 60 * 60 * 1000;
|
private static final long PARSER_DAY_ROLLOVER_THRESHOLD_MS = 12 * 60 * 60 * 1000;
|
||||||
|
|
||||||
public boolean hasCapabilities(final Capability... capabilities)
|
public boolean hasCapabilities(final Capability... capabilities)
|
||||||
{
|
{
|
||||||
for (final Capability capability : capabilities)
|
for (final Capability capability : capabilities)
|
||||||
if (capability == Capability.NEARBY_STATIONS)
|
if (capability == Capability.DEPARTURES)
|
||||||
return false;
|
return true;
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String NAME_URL = "http://fahrplan.sbb.ch/bin/bhftafel.exe/dox?input=";
|
private static final String NAME_URL = API_BASE + "bhftafel.exe/dox?input=";
|
||||||
private static final Pattern P_SINGLE_NAME = Pattern.compile(".*?<input type=\"hidden\" name=\"input\" value=\"(.+?)#(\\d+)\" />.*",
|
private static final Pattern P_SINGLE_NAME = Pattern.compile(".*?<input type=\"hidden\" name=\"input\" value=\"(.+?)#(\\d+)\" />.*",
|
||||||
Pattern.DOTALL);
|
Pattern.DOTALL);
|
||||||
private static final Pattern P_MULTI_NAME = Pattern.compile("<a href=\"http://fahrplan\\.sbb\\.ch/bin/bhftafel\\.exe/dox\\?input=(\\d+).*?\">\n?" //
|
private static final Pattern P_MULTI_NAME = Pattern.compile("<a href=\"http://fahrplan\\.sbb\\.ch/bin/bhftafel\\.exe/dox\\?input=(\\d+).*?\">\n?" //
|
||||||
|
@ -85,7 +86,7 @@ public class SbbProvider extends AbstractHafasProvider
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static String NEARBY_URI = "http://fahrplan.sbb.ch/bin/bhftafel.exe/dn?input=%s&distance=50&near=Anzeigen";
|
private final static String NEARBY_URI = API_BASE + "bhftafel.exe/dn?input=%s&distance=50&near=Anzeigen";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String nearbyStationUri(final String stationId)
|
protected String nearbyStationUri(final String stationId)
|
||||||
|
@ -99,7 +100,7 @@ public class SbbProvider extends AbstractHafasProvider
|
||||||
final DateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm");
|
final DateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm");
|
||||||
final StringBuilder uri = new StringBuilder();
|
final StringBuilder uri = new StringBuilder();
|
||||||
|
|
||||||
uri.append("http://fahrplan.sbb.ch/bin/query.exe/dn");
|
uri.append(API_BASE).append("query.exe/dox");
|
||||||
uri.append("?OK");
|
uri.append("?OK");
|
||||||
uri.append("&REQ0HafasMaxChangeTime=120");
|
uri.append("&REQ0HafasMaxChangeTime=120");
|
||||||
uri.append("&REQ0HafasOptimize1=").append(ParserUtils.urlEncode("1:1"));
|
uri.append("&REQ0HafasOptimize1=").append(ParserUtils.urlEncode("1:1"));
|
||||||
|
@ -175,6 +176,8 @@ public class SbbProvider extends AbstractHafasProvider
|
||||||
List<Location> viaAddresses = null;
|
List<Location> viaAddresses = null;
|
||||||
List<Location> toAddresses = null;
|
List<Location> toAddresses = null;
|
||||||
|
|
||||||
|
// FIXME cannot parse ambiguous
|
||||||
|
|
||||||
final Matcher mPreAddress = P_PRE_ADDRESS.matcher(page);
|
final Matcher mPreAddress = P_PRE_ADDRESS.matcher(page);
|
||||||
while (mPreAddress.find())
|
while (mPreAddress.find())
|
||||||
{
|
{
|
||||||
|
@ -214,43 +217,20 @@ public class SbbProvider extends AbstractHafasProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Pattern P_CONNECTIONS_HEAD = Pattern.compile(".*?" //
|
private static final Pattern P_CONNECTIONS_HEAD = Pattern.compile(".*?" //
|
||||||
+ "Von:.*?<td [^>]*>(?:<a.*?/a>)?(.*?)</td>.*?" // from
|
+ "Von: <strong>([^<]*)<.*?" // from
|
||||||
+ "Datum:.*?<td [^>]*>.., (\\d{2}\\.\\d{2}\\.\\d{2})</td>.*?" // date
|
+ "Nach: <strong>([^<]*)<.*?" // to
|
||||||
+ "Nach:.*?<td [^>]*>(?:<a.*?/a>)?(.*?)</td>.*?" // to
|
+ "Datum: .., (\\d{2}\\.\\d{2}\\.\\d{2}).*?" // currentDate
|
||||||
+ "(?:<a href=\"(http://fahrplan.sbb.ch/bin/query.exe/dn[^\"]*?&REQ0HafasScrollDir=2)\".*?)?" // linkEarlier
|
+ "(<p class=\"con_.*?)<p class=\"link1\">.*?" // body
|
||||||
+ "(?:<a href=\"(http://fahrplan.sbb.ch/bin/query.exe/dn[^\"]*?&REQ0HafasScrollDir=1)\".*?)?" // linkLater
|
+ "(?:<a href=\"(http://[^\"]*REQ0HafasScrollDir=2)\".*?)?" // linkEarlier
|
||||||
|
+ "(?:<a href=\"(http://[^\"]*REQ0HafasScrollDir=1)\".*?)?" // linkLater
|
||||||
, Pattern.DOTALL);
|
, Pattern.DOTALL);
|
||||||
private static final Pattern P_CONNECTIONS_COARSE = Pattern.compile("<tr class=\"(zebra-row-\\d)\">(.*?)</tr>\n"//
|
private static final Pattern P_CONNECTIONS_COARSE = Pattern.compile("\\G" //
|
||||||
+ "<tr class=\"\\1\">(.*?)</tr>\n"//
|
+ "<p class=\"(con_\\d+)\">\n" //
|
||||||
+ "(?:<tr class=\"\\1\">.*?</tr>\n)?", Pattern.DOTALL);
|
+ "(.*?)</p>\n", Pattern.DOTALL);
|
||||||
private static final Pattern P_CONNECTIONS_FINE = Pattern.compile(".*?" //
|
private static final Pattern P_CONNECTIONS_FINE = Pattern.compile("" //
|
||||||
+ "name=\"guiVCtrl_connection_detailsOut_select_([\\w-]+)\".*?" // id
|
+ "(?:<img [^>]*>)?" //
|
||||||
+ ".., (\\d{2}\\.\\d{2}\\.\\d{2}).*?" // departureDate
|
+ "<a href=\"(http://[^\"]*)\">" // link
|
||||||
+ "ab.*?(\\d{2}:\\d{2}).*?" // departureTime
|
+ "(\\d{1,2}:\\d{2})-(\\d{1,2}:\\d{2})</a>.*?" // departureTime, arrivalTime
|
||||||
+ "duration.*?\\d{1,2}:\\d{2}.*?" //
|
|
||||||
+ "(?:.., (\\d{2}\\.\\d{2}\\.\\d{2}).*?)?" // arrivalDate
|
|
||||||
+ "an.*?(\\d{2}:\\d{2}).*?" // arrivalTime
|
|
||||||
, Pattern.DOTALL);
|
|
||||||
private static final Pattern P_CONNECTIONS_DETAILS_COARSE = Pattern.compile("<a name=\"cis_([\\w-]+)\">.*?" // id
|
|
||||||
+ "<table .*? class=\"hac_detail\">\n?<tr>.*?</tr>(.*?)</table>", Pattern.DOTALL);
|
|
||||||
private static final Pattern P_CONNECTION_DETAILS_COARSE = Pattern.compile("<tr>(.*?class=\"stop-station-icon\".*?)</tr>\n?" //
|
|
||||||
+ "<tr>(.*?class=\"stop-station-icon last\".*?)</tr>", Pattern.DOTALL);
|
|
||||||
static final Pattern P_CONNECTION_DETAILS_FINE = Pattern.compile(".*?" //
|
|
||||||
+ "<td headers=\"stops-\\d+\" class=\"stop-station\">\n" //
|
|
||||||
+ "(?:<a href=\"http://fahrplan\\.sbb\\.ch/bin/bhftafel\\.exe/dn.*?input=(\\d+)&[^>]*>)?" // departureId
|
|
||||||
+ "([^\n<]*?)<.*?" // departure
|
|
||||||
+ "<td headers=\"date-\\d+\"[^>]*>\n(?:.., (\\d{2}\\.\\d{2}\\.\\d{2})\n)?</td>.*?" // departureDate
|
|
||||||
+ "<td headers=\"time-\\d+\"[^>]*>(?:(\\d{2}:\\d{2})| )</td>.*?" // departureTime
|
|
||||||
+ "<td headers=\"platform-\\d+\"[^>]*>\n(?:<span[^>]*>\n)?(.+?)?\\s*(?:<img[^>]*>\n</span>\n)?</td>.*?" // departurePosition
|
|
||||||
+ "<img src=\"/img/2/products/(\\w+?)_pic.gif\".*?" // lineType
|
|
||||||
+ "(?:<a href=\"http://fahrplan\\.sbb\\.ch/bin/traininfo\\.exe/dn[^>]*>\\s*(.*?)\\s*</a>|" // line
|
|
||||||
+ "\n(\\d+) Min\\.).*?" // min
|
|
||||||
+ "<td headers=\"stops-\\d+\" class=\"stop-station last\">\n" //
|
|
||||||
+ "(?:<a href=\"http://fahrplan\\.sbb\\.ch/bin/bhftafel\\.exe/dn.*?input=(\\d+)&[^>]*>)?" // arrivalId
|
|
||||||
+ "([^\n<]*?)<.*?" // arrival
|
|
||||||
+ "<td headers=\"date-\\d+\"[^>]*>\n(?:.., (\\d{2}\\.\\d{2}\\.\\d{2})\n)?</td>.*?" // arrivalDate
|
|
||||||
+ "<td headers=\"time-\\d+\"[^>]*>(?:(\\d{2}:\\d{2})| )</td>.*?" // arrivalTime
|
|
||||||
+ "<td headers=\"platform-\\d+\"[^>]*>\n(?:<span[^>]*>\n)?(.+?)?\\s*(?:<img[^>]*>\n</span>\n)?</td>.*?" // arrivalPosition
|
|
||||||
, Pattern.DOTALL);
|
, Pattern.DOTALL);
|
||||||
|
|
||||||
private QueryConnectionsResult queryConnections(final String uri, final CharSequence page) throws IOException
|
private QueryConnectionsResult queryConnections(final String uri, final CharSequence page) throws IOException
|
||||||
|
@ -259,36 +239,43 @@ public class SbbProvider extends AbstractHafasProvider
|
||||||
if (mHead.matches())
|
if (mHead.matches())
|
||||||
{
|
{
|
||||||
final Location from = new Location(LocationType.ANY, 0, 0, 0, ParserUtils.resolveEntities(mHead.group(1)));
|
final Location from = new Location(LocationType.ANY, 0, 0, 0, ParserUtils.resolveEntities(mHead.group(1)));
|
||||||
final Location to = new Location(LocationType.ANY, 0, 0, 0, ParserUtils.resolveEntities(mHead.group(3)));
|
final Location to = new Location(LocationType.ANY, 0, 0, 0, ParserUtils.resolveEntities(mHead.group(2)));
|
||||||
final String linkEarlier = mHead.group(4) != null ? ParserUtils.resolveEntities(mHead.group(4)) : null;
|
final Date currentDate = ParserUtils.parseDate(mHead.group(3));
|
||||||
final String linkLater = mHead.group(5) != null ? ParserUtils.resolveEntities(mHead.group(5)) : null;
|
final String body = mHead.group(4);
|
||||||
|
final String linkEarlier = mHead.group(5) != null ? ParserUtils.resolveEntities(mHead.group(5)) : null;
|
||||||
|
final String linkLater = mHead.group(6) != null ? ParserUtils.resolveEntities(mHead.group(6)) : null;
|
||||||
final List<Connection> connections = new ArrayList<Connection>();
|
final List<Connection> connections = new ArrayList<Connection>();
|
||||||
String oldZebra = null;
|
String oldZebra = null;
|
||||||
|
|
||||||
final Matcher mConCoarse = P_CONNECTIONS_COARSE.matcher(page);
|
final Matcher mCoarse = P_CONNECTIONS_COARSE.matcher(body);
|
||||||
while (mConCoarse.find())
|
while (mCoarse.find())
|
||||||
{
|
{
|
||||||
final String zebra = mConCoarse.group(1);
|
final String zebra = mCoarse.group(1);
|
||||||
if (oldZebra != null && zebra.equals(oldZebra))
|
if (oldZebra != null && zebra.equals(oldZebra))
|
||||||
throw new IllegalArgumentException("missed row? last:" + zebra);
|
throw new IllegalArgumentException("missed row? last:" + zebra);
|
||||||
else
|
else
|
||||||
oldZebra = zebra;
|
oldZebra = zebra;
|
||||||
|
|
||||||
final String set = mConCoarse.group(2) + mConCoarse.group(3);
|
final String set = mCoarse.group(2);
|
||||||
final Matcher mConFine = P_CONNECTIONS_FINE.matcher(set);
|
final Matcher mFine = P_CONNECTIONS_FINE.matcher(set);
|
||||||
if (mConFine.matches())
|
if (mFine.matches())
|
||||||
{
|
{
|
||||||
final String id = mConFine.group(1);
|
final String link = ParserUtils.resolveEntities(mFine.group(1));
|
||||||
final Date departureDate = ParserUtils.parseDate(mConFine.group(2));
|
Date departureTime = ParserUtils.joinDateTime(currentDate, ParserUtils.parseTime(mFine.group(2)));
|
||||||
final Date departureTime = ParserUtils.joinDateTime(departureDate, ParserUtils.parseTime(mConFine.group(3)));
|
if (!connections.isEmpty())
|
||||||
final Date arrivalDate = mConFine.group(4) != null ? ParserUtils.parseDate(mConFine.group(4)) : null;
|
{
|
||||||
final Date arrivalTime = ParserUtils.joinDateTime(arrivalDate != null ? arrivalDate : departureDate, ParserUtils
|
final long diff = ParserUtils.timeDiff(departureTime, connections.get(connections.size() - 1).departureTime);
|
||||||
.parseTime(mConFine.group(5)));
|
if (diff > PARSER_DAY_ROLLOVER_THRESHOLD_MS)
|
||||||
final String link = uri + "#" + id; // TODO use print link?
|
departureTime = ParserUtils.addDays(departureTime, -1);
|
||||||
|
else if (diff < -PARSER_DAY_ROLLOVER_THRESHOLD_MS)
|
||||||
|
departureTime = ParserUtils.addDays(departureTime, 1);
|
||||||
|
}
|
||||||
|
Date arrivalTime = ParserUtils.joinDateTime(currentDate, ParserUtils.parseTime(mFine.group(3)));
|
||||||
|
if (departureTime.after(arrivalTime))
|
||||||
|
arrivalTime = ParserUtils.addDays(arrivalTime, 1);
|
||||||
|
|
||||||
final Connection connection = new Connection(id, link, departureTime, arrivalTime, null, null, 0, from.name, 0, to.name,
|
connections.add(new Connection(extractConnectionId(link), link, departureTime, arrivalTime, null, null, 0, from.name, 0, to.name,
|
||||||
new ArrayList<Connection.Part>(1));
|
null));
|
||||||
connections.add(connection);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -296,77 +283,6 @@ public class SbbProvider extends AbstractHafasProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final Matcher mConDetCoarse = P_CONNECTIONS_DETAILS_COARSE.matcher(page);
|
|
||||||
while (mConDetCoarse.find())
|
|
||||||
{
|
|
||||||
final String id = mConDetCoarse.group(1);
|
|
||||||
final Connection connection = findConnection(connections, id);
|
|
||||||
|
|
||||||
Date lastDate = null;
|
|
||||||
|
|
||||||
final Matcher mDetCoarse = P_CONNECTION_DETAILS_COARSE.matcher(mConDetCoarse.group(2));
|
|
||||||
while (mDetCoarse.find())
|
|
||||||
{
|
|
||||||
final String set = mDetCoarse.group(1) + mDetCoarse.group(2);
|
|
||||||
|
|
||||||
final Matcher mDetFine = P_CONNECTION_DETAILS_FINE.matcher(set);
|
|
||||||
if (mDetFine.matches())
|
|
||||||
{
|
|
||||||
final int departureId = mDetFine.group(1) != null ? Integer.parseInt(mDetFine.group(1)) : 0;
|
|
||||||
|
|
||||||
final String departure = ParserUtils.resolveEntities(mDetFine.group(2));
|
|
||||||
|
|
||||||
Date departureDate = mDetFine.group(3) != null ? ParserUtils.parseDate(mDetFine.group(3)) : lastDate;
|
|
||||||
if (departureDate != null)
|
|
||||||
lastDate = departureDate;
|
|
||||||
|
|
||||||
final String lineType = mDetFine.group(6);
|
|
||||||
|
|
||||||
final int arrivalId = mDetFine.group(9) != null ? Integer.parseInt(mDetFine.group(9)) : 0;
|
|
||||||
|
|
||||||
final String arrival = ParserUtils.resolveEntities(mDetFine.group(10));
|
|
||||||
|
|
||||||
Date arrivalDate = mDetFine.group(11) != null ? ParserUtils.parseDate(mDetFine.group(11)) : lastDate;
|
|
||||||
if (arrivalDate != null)
|
|
||||||
lastDate = arrivalDate;
|
|
||||||
|
|
||||||
if (!lineType.equals("fuss") && !lineType.equals("transfer"))
|
|
||||||
{
|
|
||||||
if (departureId == 0)
|
|
||||||
throw new IllegalStateException("departureId");
|
|
||||||
|
|
||||||
final Date departureTime = ParserUtils.joinDateTime(departureDate, ParserUtils.parseTime(mDetFine.group(4)));
|
|
||||||
|
|
||||||
final String departurePosition = mDetFine.group(5) != null ? ParserUtils.resolveEntities(mDetFine.group(5)) : null;
|
|
||||||
|
|
||||||
final String line = normalizeLine(lineType, ParserUtils.resolveEntities(mDetFine.group(7)));
|
|
||||||
|
|
||||||
if (arrivalId == 0)
|
|
||||||
throw new IllegalStateException("arrivalId");
|
|
||||||
|
|
||||||
final Date arrivalTime = ParserUtils.joinDateTime(arrivalDate, ParserUtils.parseTime(mDetFine.group(12)));
|
|
||||||
|
|
||||||
final String arrivalPosition = mDetFine.group(13) != null ? ParserUtils.resolveEntities(mDetFine.group(13)) : null;
|
|
||||||
|
|
||||||
final Connection.Trip trip = new Connection.Trip(line, lineColors(line), 0, null, departureTime, departurePosition,
|
|
||||||
departureId, departure, arrivalTime, arrivalPosition, arrivalId, arrival);
|
|
||||||
connection.parts.add(trip);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final int min = Integer.parseInt(mDetFine.group(8));
|
|
||||||
|
|
||||||
final Connection.Footway footway = new Connection.Footway(min, departureId, departure, arrivalId, arrival);
|
|
||||||
connection.parts.add(footway);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("cannot parse '" + set + "' on " + uri);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new QueryConnectionsResult(uri, from, null, to, linkEarlier, linkLater, connections);
|
return new QueryConnectionsResult(uri, from, null, to, linkEarlier, linkLater, connections);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -375,24 +291,106 @@ public class SbbProvider extends AbstractHafasProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Connection findConnection(final List<Connection> connections, final String id)
|
private static final Pattern P_CONNECTION_DETAILS_HEAD = Pattern.compile(".*?" //
|
||||||
{
|
+ "<p class=\"conSecStart\">\n- ([^<]*) -\n</p>\n" //
|
||||||
for (final Connection connection : connections)
|
+ "(.*?)" //
|
||||||
if (connection.id.equals(id))
|
+ "<p class=\"remark\">\n" //
|
||||||
return connection;
|
+ "Abfahrt: (\\d+\\.\\d+\\.\\d+).*?", Pattern.DOTALL);
|
||||||
|
private static final Pattern P_CONNECTION_DETAILS_COARSE = Pattern.compile("\\G" //
|
||||||
|
+ "<p class=\"conSecJourney\">\n(.*?)</p>\n" //
|
||||||
|
+ "<p class=\"conSecDestination\">\n(.*?)</p>\n" //
|
||||||
|
, Pattern.DOTALL);
|
||||||
|
private static final Pattern P_CONNECTION_DETAILS_JOURNEY = Pattern.compile("" //
|
||||||
|
+ "(?:" //
|
||||||
|
+ "(.+?)\n.*?" // line
|
||||||
|
+ "ab (\\d{1,2}:\\d{2})\n" // departureTime
|
||||||
|
+ "(?: (Gl\\. .+?)\\s*\n)?" // departurePosition
|
||||||
|
+ ".*?" //
|
||||||
|
+ "an (\\d{1,2}:\\d{2})\n" // arrivalTime
|
||||||
|
+ "(?: (Gl\\. .+?)\\s*\n)?" // arrivalPosition
|
||||||
|
+ "|" //
|
||||||
|
+ "(?:Fussweg|Übergang)\n" //
|
||||||
|
+ "(\\d+) Min\\.\n" // minutes
|
||||||
|
+ ")" //
|
||||||
|
, Pattern.DOTALL);
|
||||||
|
private static final Pattern P_CONNECTION_DETAILS_DESTINATION = Pattern.compile("" //
|
||||||
|
+ "- ([^<]*) -\n" // destination
|
||||||
|
, Pattern.DOTALL);
|
||||||
|
|
||||||
return null;
|
public GetConnectionDetailsResult getConnectionDetails(final String uri) throws IOException
|
||||||
}
|
|
||||||
|
|
||||||
public GetConnectionDetailsResult getConnectionDetails(final String connectionUri) throws IOException
|
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException();
|
final CharSequence page = ParserUtils.scrape(uri);
|
||||||
|
|
||||||
|
final Matcher mHead = P_CONNECTION_DETAILS_HEAD.matcher(page);
|
||||||
|
if (mHead.matches())
|
||||||
|
{
|
||||||
|
Date firstDepartureTime = null;
|
||||||
|
final String firstDeparture = ParserUtils.resolveEntities(mHead.group(1));
|
||||||
|
Date lastArrivalTime = null;
|
||||||
|
String departure = firstDeparture;
|
||||||
|
final String body = mHead.group(2);
|
||||||
|
final Date date = ParserUtils.parseDate(mHead.group(3));
|
||||||
|
|
||||||
|
final List<Connection.Part> parts = new ArrayList<Connection.Part>(4);
|
||||||
|
|
||||||
|
final Matcher mCoarse = P_CONNECTION_DETAILS_COARSE.matcher(body);
|
||||||
|
while (mCoarse.find())
|
||||||
|
{
|
||||||
|
final Matcher mJourney = P_CONNECTION_DETAILS_JOURNEY.matcher(mCoarse.group(1));
|
||||||
|
final Matcher mDestination = P_CONNECTION_DETAILS_DESTINATION.matcher(mCoarse.group(2));
|
||||||
|
if (mJourney.matches() && mDestination.matches())
|
||||||
|
{
|
||||||
|
final String arrival = mDestination.group(1);
|
||||||
|
|
||||||
|
if (mJourney.group(6) == null)
|
||||||
|
{
|
||||||
|
final String line = normalizeLine(ParserUtils.resolveEntities(mJourney.group(1)));
|
||||||
|
Date departureTime = ParserUtils.joinDateTime(date, ParserUtils.parseTime(mJourney.group(2)));
|
||||||
|
if (lastArrivalTime != null && departureTime.before(lastArrivalTime))
|
||||||
|
departureTime = ParserUtils.addDays(departureTime, 1);
|
||||||
|
final String departurePosition = mJourney.group(3) != null ? ParserUtils.resolveEntities(mJourney.group(3)) : null;
|
||||||
|
Date arrivalTime = ParserUtils.joinDateTime(date, ParserUtils.parseTime(mJourney.group(4)));
|
||||||
|
if (departureTime.after(arrivalTime))
|
||||||
|
arrivalTime = ParserUtils.addDays(arrivalTime, 1);
|
||||||
|
final String arrivalPosition = mJourney.group(5) != null ? ParserUtils.resolveEntities(mJourney.group(5)) : null;
|
||||||
|
|
||||||
|
parts.add(new Connection.Trip(line, lineColors(line), 0, null, departureTime, departurePosition, 0, departure, arrivalTime,
|
||||||
|
arrivalPosition, 0, arrival));
|
||||||
|
|
||||||
|
if (firstDepartureTime == null)
|
||||||
|
firstDepartureTime = departureTime;
|
||||||
|
lastArrivalTime = arrivalTime;
|
||||||
|
departure = arrival;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final int min = Integer.parseInt(mJourney.group(6));
|
||||||
|
|
||||||
|
parts.add(new Connection.Footway(min, 0, departure, 0, arrival, 0, 0));
|
||||||
|
|
||||||
|
departure = arrival;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("cannot parse '" + mCoarse.group(1) + "', '" + mCoarse.group(2) + "' on " + uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new GetConnectionDetailsResult(new Date(), new Connection(AbstractHafasProvider.extractConnectionId(uri), uri, firstDepartureTime,
|
||||||
|
lastArrivalTime, null, null, 0, firstDeparture, 0, departure, parts));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("cannot parse '" + page + "' on " + uri);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String departuresQueryUri(final String stationId, final int maxDepartures)
|
public String departuresQueryUri(final String stationId, final int maxDepartures)
|
||||||
{
|
{
|
||||||
final StringBuilder uri = new StringBuilder();
|
final StringBuilder uri = new StringBuilder();
|
||||||
uri.append("http://fahrplan.sbb.ch/bin/bhftafel.exe/dox");
|
uri.append(API_BASE).append("bhftafel.exe/dox");
|
||||||
uri.append("?start=");
|
uri.append("?start=");
|
||||||
if (maxDepartures != 0)
|
if (maxDepartures != 0)
|
||||||
uri.append("&maxJourneys=").append(maxDepartures);
|
uri.append("&maxJourneys=").append(maxDepartures);
|
||||||
|
|
|
@ -277,7 +277,7 @@ public final class VbbProvider implements NetworkProvider
|
||||||
if (departureTime.after(arrivalTime))
|
if (departureTime.after(arrivalTime))
|
||||||
arrivalTime = ParserUtils.addDays(arrivalTime, 1);
|
arrivalTime = ParserUtils.addDays(arrivalTime, 1);
|
||||||
final String line = normalizeLine(ParserUtils.resolveEntities(mConFine.group(4)));
|
final String line = normalizeLine(ParserUtils.resolveEntities(mConFine.group(4)));
|
||||||
final Connection connection = new Connection(ParserUtils.extractId(link), link, departureTime, arrivalTime, line,
|
final Connection connection = new Connection(AbstractHafasProvider.extractConnectionId(link), link, departureTime, arrivalTime, line,
|
||||||
line != null ? LINES.get(line.charAt(0)) : null, 0, from.name, 0, to.name, null);
|
line != null ? LINES.get(line.charAt(0)) : null, 0, from.name, 0, to.name, null);
|
||||||
connections.add(connection);
|
connections.add(connection);
|
||||||
}
|
}
|
||||||
|
@ -424,7 +424,7 @@ public final class VbbProvider implements NetworkProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstDepartureTime != null && lastArrivalTime != null)
|
if (firstDepartureTime != null && lastArrivalTime != null)
|
||||||
return new GetConnectionDetailsResult(currentDate, new Connection(ParserUtils.extractId(uri), uri, firstDepartureTime,
|
return new GetConnectionDetailsResult(currentDate, new Connection(AbstractHafasProvider.extractConnectionId(uri), uri, firstDepartureTime,
|
||||||
lastArrivalTime, null, null, firstDepartureId, firstDeparture, lastArrivalId, lastArrival, parts));
|
lastArrivalTime, null, null, firstDepartureId, firstDeparture, lastArrivalId, lastArrival, parts));
|
||||||
else
|
else
|
||||||
return new GetConnectionDetailsResult(currentDate, null);
|
return new GetConnectionDetailsResult(currentDate, null);
|
||||||
|
|
|
@ -267,9 +267,11 @@ public final class ParserUtils
|
||||||
return cTime.getTime();
|
return cTime.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long timeDiff(Date d1, Date d2)
|
public static long timeDiff(final Date d1, final Date d2)
|
||||||
{
|
{
|
||||||
return d1.getTime() - d2.getTime();
|
final long t1 = d1.getTime();
|
||||||
|
final long t2 = d2.getTime();
|
||||||
|
return t1 - t2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date addDays(final Date time, final int days)
|
public static Date addDays(final Date time, final int days)
|
||||||
|
@ -329,10 +331,5 @@ public final class ParserUtils
|
||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String extractId(final String link)
|
|
||||||
{
|
|
||||||
return link.substring(link.length() - 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String P_PLATFORM = "[\\wÄÖÜäöüßáàâéèêíìîóòôúùû\\. -/&#;]+?";
|
public static final String P_PLATFORM = "[\\wÄÖÜäöüßáàâéèêíìîóòôúùû\\. -/&#;]+?";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,249 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2010 the original author or authors.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.schildbach.pte;
|
|
||||||
|
|
||||||
import static junit.framework.Assert.assertNotNull;
|
|
||||||
import static junit.framework.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Andreas Schildbach
|
|
||||||
*/
|
|
||||||
public class SbbProviderTest
|
|
||||||
{
|
|
||||||
@Test
|
|
||||||
public void tripThatTriggeredLongRunningMatch()
|
|
||||||
{
|
|
||||||
assertFineConnectionDetails("<td headers=\"stops-0\" class=\"stop-station-icon\" valign=\"top\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/query.exe/dn?ld=&i=mc.023454218.1281459219&n=1&uscid=10\"><img src=\"/img/2/icon_map_location.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Umgebungskarte: Budapest-Keleti pu.\" hspace=\"3\" style=\"vertical-align:middle;margin-right:4px;\" /></a>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/bhftafel.exe/dn?seqnr=1&ident=mc.023454218.1281459219&input=5510017&boardType=dep&time=21:05\" title=\"Haltestelleninformation: Budapest-Keleti pu.\">Budapest-Keleti pu.</a></td>\n" //
|
|
||||||
+ "<td headers=\"date-0\" class=\"date\" align=\"left\">\n" //
|
|
||||||
+ "Di, 10.08.10\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"time-0\" class=\"time prefix timeLeft\" align=\"left\" nowrap=\"nowrap\">ab</td><td headers=\"time-0\" class=\"time timeRight\" align=\"left\" nowrap=\"nowrap\">21:05</td><td headers=\"platform-0\" class=\"platform\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"products-0\" class=\"products last\" style=\"white-space:nowrap;\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "<img src=\"/img/2/products/en_pic.gif\" width=\"18\" height=\"18\" alt=\"EN 462\" style=\"margin-top:2px;\"><br />\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/traininfo.exe/dn/180702/86414/270520/75026/85?seqnr=1&ident=mc.023454218.1281459219&date=10.08.10&station_evaId=5510017&station_type=dep&journeyStartIdx=0&journeyEndIdx=12&\" title=\"Fahrtinformation\">\n" //
|
|
||||||
+ "EN 462\n" //
|
|
||||||
+ "</a>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"capacity-0\" class=\"capacity last\" style=\"white-space:nowrap;\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "<div style=\"width:65px;height:15px;line-height:15px;\">\n" //
|
|
||||||
+ "<div style=\"float:left;width:30px;height:15px;line-height:15px;\">\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "<div style=\"float:left;width:30px;height:15px;line-height:15px;margin-left:4px;\">\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"remarks-0\" class=\"remarks last\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "EuroNight, <img src=\"/img/2/products/attr_2_pic.gif\" width=\"16\" height=\"12\" border=\"0\" title=\"Nur 2. Klasse\" alt=\"Nur 2. Klasse\"> <img src=\"/img/2/products/attr_rr_pic.gif\" width=\"16\" height=\"12\" border=\"0\" title=\"Reservierung obligatorisch\" alt=\"Reservierung obligatorisch\"> <img src=\"/img/2/products/attr_wl_pic.gif\" width=\"16\" height=\"12\" border=\"0\" title=\"Schlafwagen\" alt=\"Schlafwagen\"> <img src=\"/img/2/products/attr_cc_pic.gif\" width=\"16\" height=\"12\" border=\"0\" title=\"Liegewagen\" alt=\"Liegewagen\"> <img src=\"/img/2/products/attr_mi_pic.gif\" width=\"16\" height=\"12\" border=\"0\" title=\"Minibar\" alt=\"Minibar\"> GP </td>\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station-icon last\" valign=\"top\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/query.exe/dn?ld=&i=mc.023454218.1281459219&n=1&uscid=11\"><img src=\"/img/2/icon_map_location.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Umgebungskarte: München Hbf\" hspace=\"3\" style=\"vertical-align:middle;margin-right:4px;\" /></a></td>\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station last\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/bhftafel.exe/dn?seqnr=1&ident=mc.023454218.1281459219&input=8020347&boardType=arr&time=06:15\" title=\"Haltestelleninformation: München Hbf\">München Hbf</a></td>\n" //
|
|
||||||
+ "<td headers=\"date-0\" class=\"date last\" align=\"left\">\n" //
|
|
||||||
+ "Mi, 11.08.10\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"time-0\" class=\"time prefix last timeLeft\" align=\"left\" nowrap=\"nowrap\">an</td><td headers=\"time-0\" class=\"time last timeRight\" align=\"left\" nowrap=\"nowrap\">06:15</td><td headers=\"platform-0\" class=\"platform last\" align=\"left\">\n" //
|
|
||||||
+ "12 \n" //
|
|
||||||
+ "</td>\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void tripWithoutDate()
|
|
||||||
{
|
|
||||||
assertFineConnectionDetails("<td headers=\"stops-2\" class=\"stop-station-icon\" valign=\"top\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/query.exe/dn?ld=&i=38.03520220.1281445666&n=1&uscid=14\"><img src=\"/img/2/icon_map_location.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Umgebungskarte: Aarau\" hspace=\"3\" style=\"vertical-align:middle;margin-right:4px;\" /></a>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"stops-2\" class=\"stop-station\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/bhftafel.exe/dn?seqnr=1&ident=38.03520220.1281445666&input=8502113&boardType=dep&time=15:47\" title=\"Haltestelleninformation: Aarau\">Aarau</a></td>\n" //
|
|
||||||
+ "<td headers=\"date-2\" class=\"date\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"time-2\" class=\"time prefix timeLeft\" align=\"left\" nowrap=\"nowrap\">ab</td><td headers=\"time-2\" class=\"time timeRight\" align=\"left\" nowrap=\"nowrap\">15:47</td><td headers=\"platform-2\" class=\"platform\" align=\"left\">\n" //
|
|
||||||
+ "5 \n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"products-2\" class=\"products last\" style=\"white-space:nowrap;\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "<img src=\"/img/2/products/ir_pic.gif\" width=\"18\" height=\"18\" alt=\"IR 1928\" style=\"margin-top:2px;\"><br />\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/traininfo.exe/dn/485775/162441/812040/244101/85?seqnr=1&ident=38.03520220.1281445666&date=10.08.10&station_evaId=8502113&station_type=dep&journeyStartIdx=3&journeyEndIdx=6&\" title=\"Fahrtinformation\">\n" //
|
|
||||||
+ "IR 1928\n" //
|
|
||||||
+ "</a>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"capacity-2\" class=\"capacity last\" style=\"white-space:nowrap;\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "<div style=\"width:65px;height:15px;line-height:15px;\">\n" //
|
|
||||||
+ "<div style=\"float:left;width:30px;height:15px;line-height:15px;\">\n" //
|
|
||||||
+ "1. <img src=\"/img/2/icon_capacity1.gif\" alt=\"Tiefe bis mittlere Belegung erwartet\" title=\"Tiefe bis mittlere Belegung erwartet\" style=\"border:0px;width:14px;height12:px\" />\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "<div style=\"float:left;width:30px;height:15px;line-height:15px;margin-left:4px;\">\n" //
|
|
||||||
+ "2. <img src=\"/img/2/icon_capacity1.gif\" alt=\"Tiefe bis mittlere Belegung erwartet\" title=\"Tiefe bis mittlere Belegung erwartet\" style=\"border:0px;width:14px;height12:px\" />\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"remarks-2\" class=\"remarks last\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "InterRegio </td>\n" //
|
|
||||||
+ "\n" //
|
|
||||||
+ "<td headers=\"stops-2\" class=\"stop-station-icon last\" valign=\"top\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/query.exe/dn?ld=&i=38.03520220.1281445666&n=1&uscid=15\"><img src=\"/img/2/icon_map_location.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Umgebungskarte: Bern\" hspace=\"3\" style=\"vertical-align:middle;margin-right:4px;\" /></a></td>\n" //
|
|
||||||
+ "<td headers=\"stops-2\" class=\"stop-station last\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/bhftafel.exe/dn?seqnr=1&ident=38.03520220.1281445666&input=8507000&boardType=arr&time=16:25\" title=\"Haltestelleninformation: Bern\">Bern</a></td>\n" //
|
|
||||||
+ "<td headers=\"date-2\" class=\"date last\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"time-2\" class=\"time prefix last timeLeft\" align=\"left\" nowrap=\"nowrap\">an</td><td headers=\"time-2\" class=\"time last timeRight\" align=\"left\" nowrap=\"nowrap\">16:25</td><td headers=\"platform-2\" class=\"platform last\" align=\"left\">\n" //
|
|
||||||
+ "10 \n" //
|
|
||||||
+ "</td>");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void tripWithPrognosisInPosition()
|
|
||||||
{
|
|
||||||
assertFineConnectionDetails("\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station-icon\" valign=\"top\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/query.exe/dn?ld=&i=1d.012380247.1283691798&n=1&uscid=13\"><img src=\"/img/2/icon_map_location.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Umgebungskarte: Spiez\" hspace=\"3\" style=\"vertical-align:middle;margin-right:4px;\" /></a>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/bhftafel.exe/dn?seqnr=1&ident=1d.012380247.1283691798&input=8507483&boardType=dep&time=15:54\" title=\"Haltestelleninformation: Spiez\">Spiez</a></td>\n" //
|
|
||||||
+ "<td headers=\"date-0\" class=\"date\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"time-0\" class=\"time prefix timeLeft\" align=\"left\" nowrap=\"nowrap\">ab</td><td headers=\"time-0\" class=\"time timeRight\" align=\"left\" nowrap=\"nowrap\">15:54</td><td headers=\"platform-0\" class=\"platform\" align=\"left\">\n" //
|
|
||||||
+ "4 \n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"products-0\" class=\"products last\" style=\"white-space:nowrap;\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "<img src=\"/img/2/products/ic_pic.gif\" width=\"18\" height=\"18\" alt=\"IC 1080\" style=\"margin-top:2px;\"><br />\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/traininfo.exe/dn/339144/113432/403392/88648/85?seqnr=1&ident=1d.012380247.1283691798&date=05.09.10&station_evaId=8507483&station_type=dep&journeyStartIdx=3&journeyEndIdx=9&\" title=\"Fahrtinformation\">\n" //
|
|
||||||
+ "IC 1080\n" //
|
|
||||||
+ "</a>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"capacity-0\" class=\"capacity last\" style=\"white-space:nowrap;\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "<div style=\"width:65px;height:15px;line-height:15px;\">\n" //
|
|
||||||
+ "<div style=\"float:left;width:30px;height:15px;line-height:15px;\">\n" //
|
|
||||||
+ "1. <img src=\"/img/2/icon_capacity2.gif\" alt=\"Hohe Belegung erwartet\" title=\"Hohe Belegung erwartet\" style=\"border:0px;width:14px;height12:px\" />\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "<div style=\"float:left;width:30px;height:15px;line-height:15px;margin-left:4px;\">\n" //
|
|
||||||
+ "2. <img src=\"/img/2/icon_capacity2.gif\" alt=\"Hohe Belegung erwartet\" title=\"Hohe Belegung erwartet\" style=\"border:0px;width:14px;height12:px\" />\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"remarks-0\" class=\"remarks last\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "InterCity, <img src=\"/img/2/products/attr_wr_pic.gif\" width=\"16\" height=\"12\" border=\"0\" title=\"Restaurant\" alt=\"Restaurant\"> <img src=\"/img/2/products/attr_mi_pic.gif\" width=\"16\" height=\"12\" border=\"0\" title=\"Minibar\" alt=\"Minibar\"> <img src=\"/img/2/products/attr_r_pic.gif\" width=\"16\" height=\"12\" border=\"0\" title=\"Reservierung möglich\" alt=\"Reservierung möglich\"> FZ BZ RZ </td>\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station-icon last\" valign=\"top\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/query.exe/dn?ld=&i=1d.012380247.1283691798&n=1&uscid=14\"><img src=\"/img/2/icon_map_location.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Umgebungskarte: Basel SBB\" hspace=\"3\" style=\"vertical-align:middle;margin-right:4px;\" /></a></td>\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station last\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/bhftafel.exe/dn?seqnr=1&ident=1d.012380247.1283691798&input=8500010&boardType=arr&time=17:32\" title=\"Haltestelleninformation: Basel SBB\">Basel SBB</a></td>\n" //
|
|
||||||
+ "<td headers=\"date-0\" class=\"date last\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"time-0\" class=\"time prefix last timeLeft\" align=\"left\" nowrap=\"nowrap\">an</td><td headers=\"time-0\" class=\"time last timeRight\" align=\"left\" nowrap=\"nowrap\">17:32</td><td headers=\"platform-0\" class=\"platform last\" align=\"left\">\n" //
|
|
||||||
+ "<span class=\"prognosis\">\n" //
|
|
||||||
+ "12 <img src=\"/img/2/rt_platform_change.gif\" border=\"0\" width=\"12\" height=\"12\" alt=\"Gleiswechsel!\" />\n" //
|
|
||||||
+ "</span>\n" //
|
|
||||||
+ "</td>");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void footwayFromStationToStation()
|
|
||||||
{
|
|
||||||
assertFineConnectionDetails("\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station-icon\" valign=\"top\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/query.exe/dn?ld=&i=9q.030782220.1281450202&n=1&uscid=10\"><img src=\"/img/2/icon_map_location.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Umgebungskarte: Amriswil, Bahnhof\" hspace=\"3\" style=\"vertical-align:middle;margin-right:4px;\" /></a>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/bhftafel.exe/dn?seqnr=1&ident=9q.030782220.1281450202&input=8587138&boardType=dep&time=16:38\" title=\"Haltestelleninformation: Amriswil, Bahnhof\">Amriswil, Bahnhof</a></td>\n" //
|
|
||||||
+ "<td headers=\"date-0\" class=\"date\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"time-0\" class=\"time prefix timeLeft\" align=\"left\" nowrap=\"nowrap\"> </td><td headers=\"time-0\" class=\"time timeRight\" align=\"left\" nowrap=\"nowrap\"> </td><td headers=\"platform-0\" class=\"platform\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"products-0\" class=\"products last\" style=\"white-space:nowrap;\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "<img src=\"/img/2/products/fuss_pic.gif\" width=\"18\" height=\"18\" border=\"0\" vspace=\"2\" alt=\"Fussweg\" /><br />\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/query.exe/dn?ld=&i=9q.030782220.1281450202&n=1&uscid=11\">Fussweg</a>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"capacity-0\" class=\"capacity last\" style=\"white-space:nowrap;\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "<div style=\"width:65px;height:15px;line-height:15px;\">\n" //
|
|
||||||
+ "<div style=\"float:left;width:30px;height:15px;line-height:15px;\">\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "<div style=\"float:left;width:30px;height:15px;line-height:15px;margin-left:4px;\">\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"remarks-0\" class=\"remarks last\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "1 Min., Y </td>\n" //
|
|
||||||
+ "\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station-icon last\" valign=\"top\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/query.exe/dn?ld=&i=9q.030782220.1281450202&n=1&uscid=12\"><img src=\"/img/2/icon_map_location.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Umgebungskarte: Amriswil\" hspace=\"3\" style=\"vertical-align:middle;margin-right:4px;\" /></a></td>\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station last\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/bhftafel.exe/dn?seqnr=1&ident=9q.030782220.1281450202&input=8506109&boardType=arr&time=16:39\" title=\"Haltestelleninformation: Amriswil\">Amriswil</a></td>\n" //
|
|
||||||
+ "<td headers=\"date-0\" class=\"date last\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"time-0\" class=\"time prefix last timeLeft\" align=\"left\" nowrap=\"nowrap\"> </td><td headers=\"time-0\" class=\"time last timeRight\" align=\"left\" nowrap=\"nowrap\"> </td><td headers=\"platform-0\" class=\"platform last\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void footwayFromStationToAddress()
|
|
||||||
{
|
|
||||||
assertFineConnectionDetails("\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station-icon\" valign=\"top\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/query.exe/dn?ld=&i=0y.01800219.1282687338&n=1&uscid=30\"><img src=\"/img/2/icon_map_location.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Umgebungskarte: Einsiedeln, Birchli/Garage\" hspace=\"3\" style=\"vertical-align:middle;margin-right:4px;\" /></a>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/bhftafel.exe/dn?seqnr=1&ident=0y.01800219.1282687338&input=8580858&boardType=dep&time=08:09\" title=\"Haltestelleninformation: Einsiedeln, Birchli/Garage\">Einsiedeln, Birchli/Garage</a></td>\n" //
|
|
||||||
+ "<td headers=\"date-0\" class=\"date\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"time-0\" class=\"time prefix timeLeft\" align=\"left\" nowrap=\"nowrap\"> </td><td headers=\"time-0\" class=\"time timeRight\" align=\"left\" nowrap=\"nowrap\"> </td><td headers=\"platform-0\" class=\"platform\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"products-0\" class=\"products last\" style=\"white-space:nowrap;\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "<img src=\"/img/2/products/fuss_pic.gif\" width=\"18\" height=\"18\" border=\"0\" vspace=\"2\" alt=\"Fussweg\" /><br />\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/query.exe/dn?ld=&i=0y.01800219.1282687338&n=1&uscid=31\">Fussweg</a>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"capacity-0\" class=\"capacity last\" style=\"white-space:nowrap;\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "<div style=\"width:65px;height:15px;line-height:15px;\">\n" //
|
|
||||||
+ "<div style=\"float:left;width:30px;height:15px;line-height:15px;\">\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "<div style=\"float:left;width:30px;height:15px;line-height:15px;margin-left:4px;\">\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "</div>\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"remarks-0\" class=\"remarks last\" rowspan=\"2\" valign=\"top\">\n" //
|
|
||||||
+ "9 Min. </td>\n" //
|
|
||||||
+ "\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station-icon last\" valign=\"top\">\n" //
|
|
||||||
+ "<a href=\"http://fahrplan.sbb.ch/bin/query.exe/dn?ld=&i=0y.01800219.1282687338&n=1&uscid=32\"><img src=\"/img/2/icon_map_location.gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"Umgebungskarte: 8840 Einsiedeln, Erlenmoosweg 24\" hspace=\"3\" style=\"vertical-align:middle;margin-right:4px;\" /></a></td>\n" //
|
|
||||||
+ "<td headers=\"stops-0\" class=\"stop-station last\">\n" //
|
|
||||||
+ "8840 Einsiedeln, Erlenmoosweg 24</td>\n" //
|
|
||||||
+ "<td headers=\"date-0\" class=\"date last\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n" //
|
|
||||||
+ "<td headers=\"time-0\" class=\"time prefix last timeLeft\" align=\"left\" nowrap=\"nowrap\"> </td><td headers=\"time-0\" class=\"time last timeRight\" align=\"left\" nowrap=\"nowrap\"> </td><td headers=\"platform-0\" class=\"platform last\" align=\"left\">\n" //
|
|
||||||
+ "</td>\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void assertFineConnectionDetails(String s)
|
|
||||||
{
|
|
||||||
Matcher m = SbbProvider.P_CONNECTION_DETAILS_FINE.matcher(s);
|
|
||||||
assertTrue(m.matches());
|
|
||||||
|
|
||||||
// ParserUtils.printGroups(m);
|
|
||||||
|
|
||||||
assertNotNull(m.group(2)); // departure
|
|
||||||
assertTrue(m.group(5) == null || m.group(5).length() < 10); // departurePosition
|
|
||||||
assertNotNull(m.group(10)); // arrival
|
|
||||||
assertTrue(m.group(13) == null || m.group(13).length() < 10); // arrivalPosition
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -24,6 +24,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
import de.schildbach.pte.SbbProvider;
|
import de.schildbach.pte.SbbProvider;
|
||||||
import de.schildbach.pte.NetworkProvider.WalkSpeed;
|
import de.schildbach.pte.NetworkProvider.WalkSpeed;
|
||||||
|
import de.schildbach.pte.dto.Connection;
|
||||||
import de.schildbach.pte.dto.Location;
|
import de.schildbach.pte.dto.Location;
|
||||||
import de.schildbach.pte.dto.LocationType;
|
import de.schildbach.pte.dto.LocationType;
|
||||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||||
|
@ -62,6 +63,8 @@ public class SbbProviderLiveTest
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
|
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
|
||||||
System.out.println(moreResult);
|
System.out.println(moreResult);
|
||||||
|
for (final Connection connection : moreResult.connections)
|
||||||
|
System.out.println(provider.getConnectionDetails(connection.link));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -72,6 +75,8 @@ public class SbbProviderLiveTest
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
|
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
|
||||||
System.out.println(moreResult);
|
System.out.println(moreResult);
|
||||||
|
for (final Connection connection : moreResult.connections)
|
||||||
|
System.out.println(provider.getConnectionDetails(connection.link));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -82,6 +87,8 @@ public class SbbProviderLiveTest
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
|
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.linkLater);
|
||||||
System.out.println(moreResult);
|
System.out.println(moreResult);
|
||||||
|
for (final Connection connection : moreResult.connections)
|
||||||
|
System.out.println(provider.getConnectionDetails(connection.link));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue