mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 18:48:49 +00:00
parse even more multiple messages with departures
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@163 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
7715ef8dab
commit
e906b35aa6
2 changed files with 25 additions and 8 deletions
|
@ -457,7 +457,7 @@ public final class BahnProvider implements NetworkProvider
|
||||||
+ "<span class=\"bold\">(\\d{1,2}:\\d{2})</span>" // time
|
+ "<span class=\"bold\">(\\d{1,2}:\\d{2})</span>" // time
|
||||||
+ "(?: <span class=\"[\\w ]*\">(?:(pünktl\\.)|ca. \\+(\\d+))</span>)?" // ontime, delay
|
+ "(?: <span class=\"[\\w ]*\">(?:(pünktl\\.)|ca. \\+(\\d+))</span>)?" // ontime, delay
|
||||||
+ "(?: k\\.A\\.)?" //
|
+ "(?: k\\.A\\.)?" //
|
||||||
+ "(?:, <span class=\"red\">([^<]*)</span>)?" // message
|
+ "(?:, <span class=\"red\">([^<]*)</span>)*" // messages FIXME
|
||||||
+ "(?:(?:, )?(?:<span class=\"red\">heute )?(Gl\\. " + ParserUtils.P_PLATFORM + ")(?:\\s*</span>)?)?" // position
|
+ "(?:(?:, )?(?:<span class=\"red\">heute )?(Gl\\. " + ParserUtils.P_PLATFORM + ")(?:\\s*</span>)?)?" // position
|
||||||
+ "(?:,<br/><a[^>]*><span class=\"red\">[^<]*</a></span>)?" // (ersatzzug message)
|
+ "(?:,<br/><a[^>]*><span class=\"red\">[^<]*</a></span>)?" // (ersatzzug message)
|
||||||
+ "(?:,<br/><span class=\"red\">[^<]*<a[^>]*>[^<]*</a></span>)?" // (ersatzzug message)
|
+ "(?:,<br/><span class=\"red\">[^<]*<a[^>]*>[^<]*</a></span>)?" // (ersatzzug message)
|
||||||
|
|
|
@ -136,7 +136,23 @@ public class BahnProviderTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void departureWithMultipleMessages()
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void departureWithMessageAndErsatzzugMessage()
|
||||||
{
|
{
|
||||||
final Matcher m = assertFineDepartures("" //
|
final Matcher m = assertFineDepartures("" //
|
||||||
+ "<a href=\"http://mobile.bahn.de/bin/mobil/traininfo.exe/dox/208035/206616/13568/62563/80/si=624141&bt=dep&ti=09:34&pt=09:34&p=1111111111&date=08.09.10&max=10&rt=1&&\">\n" //
|
+ "<a href=\"http://mobile.bahn.de/bin/mobil/traininfo.exe/dox/208035/206616/13568/62563/80/si=624141&bt=dep&ti=09:34&pt=09:34&p=1111111111&date=08.09.10&max=10&rt=1&&\">\n" //
|
||||||
|
@ -167,18 +183,19 @@ public class BahnProviderTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void departureWithErsatzzugMessage()
|
public void departureWithMultipleMessages()
|
||||||
{
|
{
|
||||||
final Matcher m = assertFineDepartures("" //
|
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" //
|
+ "<a href=\"http://mobile.bahn.de/bin/mobil/traininfo.exe/dox/66819/191058/790068/372764/80/si=445675&bt=dep&ti=10:44&pt=10:44&p=1111111111&date=15.09.10&max=10&rt=1&&\">\n" //
|
||||||
+ "<span class=\"bold\">RB 93328</span>\n" //
|
+ "<span class=\"bold\">S 11</span>\n" //
|
||||||
+ "</a>\n" //
|
+ "</a>\n" //
|
||||||
+ ">>\n" //
|
+ ">>\n" //
|
||||||
+ "München Hbf Gl.27-36\n" //
|
+ "Bergisch Gladbach\n" //
|
||||||
+ "<br />\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>");
|
+ "<span class=\"bold\">10:59</span> <span class=\"green bold\">pünktl.</span>, <span class=\"red\">Änderung im Zuglauf!</span>, <span class=\"red\">Fährt heute nur bis Köln-Dellbrück</span>, Gl. 1");
|
||||||
|
|
||||||
assertNotNull(m.group(4)); // onTime
|
assertNotNull(m.group(4)); // onTime
|
||||||
|
assertNotNull(m.group(6)); // message
|
||||||
assertNotNull(m.group(7)); // position
|
assertNotNull(m.group(7)); // position
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue