mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 06:08:52 +00:00
get berlin/brandenburg connections from classic site rather than mobile site
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@553 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
1b6bd8ebfd
commit
9e9cee2111
3 changed files with 273 additions and 361 deletions
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* Copyright 2010, 2011 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.assertTrue;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
*/
|
||||
public class BvgProviderTest
|
||||
{
|
||||
@Test
|
||||
public void footwayWithLink()
|
||||
{
|
||||
assertFineConnectionDetails("" //
|
||||
+ "<a href=\"/Stadtplan/index/mobil?language=d&location=,ADR,WGS84,13426558,52536061&label=10405 Bln Pankow, Christburger Str. 123\">10405 Bln Pankow, Christburger Str. 123</a>\n"
|
||||
+ "<br />\n" //
|
||||
+ "10 Min.\n" //
|
||||
+ "Fussweg\n" //
|
||||
+ "<br />\n" //
|
||||
+ "<a href=\"/Fahrinfo/bin/stboard.bin/dox?ld=0.1&n=2&i=c6.0318411.1278336553&rt=0&input=9110017\">\n" //
|
||||
+ "<strong>Prenzlauer Allee/Danziger Str. (Berlin)</strong>\n" //
|
||||
+ "</a>\n" //
|
||||
+ "<br />\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void footwayWithoutLink()
|
||||
{
|
||||
assertFineConnectionDetails("" //
|
||||
+ "18 Min.\n" //
|
||||
+ "Fussweg\n" //
|
||||
+ "<br />\n" //
|
||||
+ "<strong>Berlin, Deutschlandhalle</strong>\n" //
|
||||
+ "<br/>Messedamm 26; 14055 Berlin\n" //
|
||||
+ "<br />\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void footwayUebergang()
|
||||
{
|
||||
assertFineConnectionDetails("" //
|
||||
+ "17 Min.\n" //
|
||||
+ "Übergang\n" //
|
||||
+ "<br />\n" //
|
||||
+ "<a href=\"/Fahrinfo/bin/stboard.bin/dox?ld=0.1&n=2&i=fx.0101111.1283848693&rt=0&input=9025321\">\n" //
|
||||
+ "<strong>S Olympiastadion (Berlin)</strong>\n" //
|
||||
+ "</a>\n" //
|
||||
+ "<br />\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void trip()
|
||||
{
|
||||
assertFineConnectionDetails("" //
|
||||
+ "<a href=\"/Fahrinfo/bin/stboard.bin/dox?ld=0.1&n=2&i=er.042611.1278315324&rt=0&input=9275402\">\n" //
|
||||
+ "<strong>Brandenburg, Frhr.-v.-Thüngen-Str.</strong>\n" //
|
||||
+ "</a>\n" //
|
||||
+ "<br />\n" //
|
||||
+ "ab 09:35\n" //
|
||||
+ "<br/><strong>BusH/528</strong>\n" //
|
||||
+ "Ri. Brandenburg, Potsdamer Str.\n" //
|
||||
+ "<br />\n" //
|
||||
+ "an 09:41\n" //
|
||||
+ "<br />\n" //
|
||||
+ "<a href=\"/Fahrinfo/bin/stboard.bin/dox?ld=0.1&n=2&i=er.042611.1278315324&rt=0&input=9275104\">\n" //
|
||||
+ "<strong>Brandenburg, Plauer Str.</strong>\n" //
|
||||
+ "</a>\n" //
|
||||
+ "<br />\n");
|
||||
}
|
||||
|
||||
private void assertFineConnectionDetails(String s)
|
||||
{
|
||||
Matcher m = BvgProvider.P_CONNECTION_DETAILS_FINE.matcher(s);
|
||||
assertTrue(m.matches());
|
||||
// ParserUtils.printGroups(m);
|
||||
}
|
||||
}
|
|
@ -24,7 +24,6 @@ import org.junit.Test;
|
|||
|
||||
import de.schildbach.pte.BvgProvider;
|
||||
import de.schildbach.pte.NetworkProvider.WalkSpeed;
|
||||
import de.schildbach.pte.dto.Connection;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -77,20 +76,59 @@ public class BvgProviderLiveTest
|
|||
null, new Location(LocationType.STATION, 9013103, "Berlin", "Prinzenstraße"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||
System.out.println(result);
|
||||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context);
|
||||
for (final Connection connection : result.connections)
|
||||
provider.getConnectionDetails(connection.link);
|
||||
System.out.println(moreResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortViaConnection() throws Exception
|
||||
{
|
||||
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.STATION, 9056102, "Berlin", "Nollendorfplatz"),
|
||||
new Location(LocationType.STATION, 9044202, "Berlin", "Bundesplatz"), new Location(LocationType.STATION, 9013103, "Berlin",
|
||||
"Prinzenstraße"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||
System.out.println(result);
|
||||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context);
|
||||
System.out.println(moreResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void connectionBetweenCoordinates() throws Exception
|
||||
{
|
||||
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.ADDRESS, 0, 52501507, 13357026), null,
|
||||
new Location(LocationType.ADDRESS, 0, 52513639, 13568648), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.ADDRESS, 0, 52501507, 13357026, null, "from"),
|
||||
null, new Location(LocationType.ADDRESS, 0, 52513639, 13568648, null, "to"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||
System.out.println(result);
|
||||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context);
|
||||
System.out.println(moreResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void viaConnectionBetweenCoordinates() throws Exception
|
||||
{
|
||||
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.ADDRESS, 0, 52501507, 13357026, null, "from"),
|
||||
new Location(LocationType.ADDRESS, 0, 52479868, 13324247, null, "via"), new Location(LocationType.ADDRESS, 0, 52513639, 13568648,
|
||||
null, "to"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||
System.out.println(result);
|
||||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context);
|
||||
System.out.println(moreResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void connectionBetweenAddresses() throws Exception
|
||||
{
|
||||
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.ADDRESS, 0, null, "10715 Bln Charlb.-Wilm., Weimarische Str. 7"),
|
||||
null, new Location(LocationType.ADDRESS, 0, null, "10178 Bln Mitte, Sophienstr. 24"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||
System.out.println(result);
|
||||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context);
|
||||
System.out.println(moreResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void viaConnectionBetweenAddresses() throws Exception
|
||||
{
|
||||
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.ADDRESS, 0, null, "10715 Bln Charlb.-Wilm., Weimarische Str. 7"),
|
||||
new Location(LocationType.ADDRESS, 0, null, "10115 Bln Mitte, Hannoversche Str. 20"), new Location(LocationType.ADDRESS, 0, null,
|
||||
"10178 Bln Mitte, Sophienstr. 24"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||
System.out.println(result);
|
||||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context);
|
||||
for (final Connection connection : result.connections)
|
||||
provider.getConnectionDetails(connection.link);
|
||||
System.out.println(moreResult);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue