mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 17:48:49 +00:00
fixed parsing of departure with ersatzzug message
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@156 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
45724ce974
commit
50cc56d6ab
2 changed files with 22 additions and 1 deletions
|
@ -458,6 +458,7 @@ public final class BahnProvider implements NetworkProvider
|
|||
+ "(?:, <span class=\"red\">([^<]*)</span>)?" // message
|
||||
+ "(?:(?:, )?(?:<span class=\"red\">heute )?(Gl\\. " + ParserUtils.P_PLATFORM + ")(?:\\s*</span>)?)?" // position
|
||||
+ "(?:,<br/><a[^>]*><span class=\"red\">[^<]*</a></span>)?" // (ersatzzug message)
|
||||
+ "(?:,<br/><span class=\"red\">[^<]*<a[^>]*>[^<]*</a></span>)?" // (ersatzzug message)
|
||||
, Pattern.DOTALL);
|
||||
private static final Pattern P_DEPARTURES_URI_STATION_ID = Pattern.compile("input=(\\d+)");
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ public class BahnProviderTest
|
|||
+ "<br />\n" //
|
||||
+ "<span class=\"bold\">21:58</span> <span class=\"green bold\">pünktl.</span>, Gl. 13");
|
||||
|
||||
assertNotNull(m.group(4)); // onTime
|
||||
assertNotNull(m.group(7)); // position
|
||||
}
|
||||
|
||||
|
@ -81,6 +82,7 @@ public class BahnProviderTest
|
|||
+ "<br />\n" //
|
||||
+ "<span class=\"bold\">07:02</span> <span class=\"red\">ca. +5</span>, <span class=\"red\">Fährt heute nur bis Düsseldorf Hbf</span>, Gl. 10");
|
||||
|
||||
assertNotNull(m.group(5)); // delay
|
||||
assertNotNull(m.group(6)); // message
|
||||
assertNotNull(m.group(7)); // position
|
||||
}
|
||||
|
@ -97,6 +99,7 @@ public class BahnProviderTest
|
|||
+ "<br />\n" //
|
||||
+ "<span class=\"bold\">17:10</span> <span class=\"green bold\">pünktl.</span>, <span class=\"red\">heute Gl. 7 </span>");
|
||||
|
||||
assertNotNull(m.group(4)); // onTime
|
||||
assertNotNull(m.group(7)); // position
|
||||
}
|
||||
|
||||
|
@ -112,6 +115,7 @@ public class BahnProviderTest
|
|||
+ "<br />\n" //
|
||||
+ "<span class=\"bold\">19:57</span> <span class=\"green bold\">pünktl.</span>, <span class=\"red\">Änderung im Zuglauf!</span>, <span class=\"red\">heute Gl. 7 </span>");
|
||||
|
||||
assertNotNull(m.group(4)); // onTime
|
||||
assertNotNull(m.group(6)); // message
|
||||
assertNotNull(m.group(7)); // position
|
||||
}
|
||||
|
@ -162,6 +166,22 @@ public class BahnProviderTest
|
|||
assertNotNull(m.group(7)); // position
|
||||
}
|
||||
|
||||
@Test
|
||||
public void departureWithErsatzzugMessage()
|
||||
{
|
||||
final Matcher m = assertFineDepartures("" //
|
||||
+ "<a href=\"http://mobile.bahn.de/bin/mobil/traininfo.exe/dox/606621/948269/912326/253956/80/si=591375&bt=dep&ti=14:28&pt=14:28&p=1111111111&date=10.09.10&max=10&rt=1&&\">\n" //
|
||||
+ "<span class=\"bold\">RB 93328</span>\n" //
|
||||
+ "</a>\n" //
|
||||
+ ">>\n" //
|
||||
+ "München Hbf Gl.27-36\n" //
|
||||
+ "<br />\n" //
|
||||
+ "<span class=\"bold\">14:49</span> <span class=\"green bold\">pünktl.</span>, Gl. 1,<br/><span class=\"red\">Ersatzzug für<a class=\"red underline\" href=\"http://mobile.bahn.de/bin/mobil/traininfo.exe/dox/611619/369020/735680/163967/80?ld=96159&rt=1&use_realtime_filter=1&date=10.09.10&time=14:49&station_evaId=8000220&station_type=dep&\">RB 5416</a></span>");
|
||||
|
||||
assertNotNull(m.group(4)); // onTime
|
||||
assertNotNull(m.group(7)); // position
|
||||
}
|
||||
|
||||
private void assertFineConnectionDetails(String s)
|
||||
{
|
||||
Matcher m = BahnProvider.P_CONNECTION_DETAILS_FINE.matcher(s);
|
||||
|
@ -175,7 +195,7 @@ public class BahnProviderTest
|
|||
Matcher m = BahnProvider.P_DEPARTURES_FINE.matcher(s);
|
||||
assertTrue(m.matches());
|
||||
|
||||
ParserUtils.printGroups(m);
|
||||
// ParserUtils.printGroups(m);
|
||||
|
||||
assertNotNull(m.group(1)); // line
|
||||
assertNotNull(m.group(2)); // destination
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue