nearbyStations() gets its own result object

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@237 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach 2010-10-04 09:21:27 +00:00
parent ae3cc77277
commit 94d99f7e53
18 changed files with 115 additions and 70 deletions

View file

@ -17,6 +17,7 @@
package de.schildbach.pte; package de.schildbach.pte;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.util.ArrayList; import java.util.ArrayList;
@ -34,9 +35,9 @@ import org.xmlpull.v1.XmlPullParserFactory;
import de.schildbach.pte.dto.Autocomplete; import de.schildbach.pte.dto.Autocomplete;
import de.schildbach.pte.dto.Departure; import de.schildbach.pte.dto.Departure;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.Station; import de.schildbach.pte.dto.Station;
import de.schildbach.pte.dto.QueryDeparturesResult.Status;
import de.schildbach.pte.util.Color; import de.schildbach.pte.util.Color;
import de.schildbach.pte.util.ParserUtils; import de.schildbach.pte.util.ParserUtils;
import de.schildbach.pte.util.XmlPullUtil; import de.schildbach.pte.util.XmlPullUtil;
@ -88,7 +89,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
protected abstract String nearbyStationUri(String stationId); protected abstract String nearbyStationUri(String stationId);
public List<Station> nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations) public NearbyStationsResult nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations)
throws IOException throws IOException
{ {
String uri = null; String uri = null;
@ -104,7 +105,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
final CharSequence page = ParserUtils.scrape(uri); final CharSequence page = ParserUtils.scrape(uri);
if (P_NEARBY_MESSAGES.matcher(page).find()) if (P_NEARBY_MESSAGES.matcher(page).find())
return null; return new NearbyStationsResult(uri, NearbyStationsResult.Status.SERVICE_DOWN);
final XmlPullParserFactory factory = XmlPullParserFactory.newInstance(System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null); final XmlPullParserFactory factory = XmlPullParserFactory.newInstance(System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
final XmlPullParser pp = factory.newPullParser(); final XmlPullParser pp = factory.newPullParser();
@ -157,13 +158,13 @@ public abstract class AbstractEfaProvider implements NetworkProvider
} }
if (maxStations == 0 || maxStations >= stations.size()) if (maxStations == 0 || maxStations >= stations.size())
return stations; return new NearbyStationsResult(uri, stations);
else else
return stations.subList(0, maxStations); return new NearbyStationsResult(uri, stations.subList(0, maxStations));
} }
else if (nameState.equals("notidentified")) else if (nameState.equals("notidentified"))
{ {
return null; return new NearbyStationsResult(uri, NearbyStationsResult.Status.INVALID_STATION);
} }
else else
{ {
@ -174,6 +175,10 @@ public abstract class AbstractEfaProvider implements NetworkProvider
{ {
throw new RuntimeException(x); throw new RuntimeException(x);
} }
catch (final FileNotFoundException x)
{
return new NearbyStationsResult(uri, NearbyStationsResult.Status.SERVICE_DOWN);
}
} }
private static final Pattern P_LINE_IRE = Pattern.compile("IRE\\d+"); private static final Pattern P_LINE_IRE = Pattern.compile("IRE\\d+");
@ -497,7 +502,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
} }
else if (nameState.equals("notidentified")) else if (nameState.equals("notidentified"))
{ {
return new QueryDeparturesResult(uri, Status.INVALID_STATION); return new QueryDeparturesResult(uri, QueryDeparturesResult.Status.INVALID_STATION);
} }
else else
{ {

View file

@ -25,6 +25,7 @@ import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.Station; import de.schildbach.pte.dto.Station;
import de.schildbach.pte.util.Color; import de.schildbach.pte.util.Color;
import de.schildbach.pte.util.ParserUtils; import de.schildbach.pte.util.ParserUtils;
@ -41,7 +42,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
protected abstract String nearbyStationUri(String stationId); protected abstract String nearbyStationUri(String stationId);
public List<Station> nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations) public NearbyStationsResult nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations)
throws IOException throws IOException
{ {
if (stationId == null) if (stationId == null)
@ -89,9 +90,9 @@ public abstract class AbstractHafasProvider implements NetworkProvider
} }
if (maxStations == 0 || maxStations >= stations.size()) if (maxStations == 0 || maxStations >= stations.size())
return stations; return new NearbyStationsResult(uri, stations);
else else
return stations.subList(0, maxStations); return new NearbyStationsResult(uri, stations.subList(0, maxStations));
} }
protected static final Pattern P_NORMALIZE_LINE = Pattern.compile("([A-Za-zÄÖÜäöüßáàâéèêíìîóòôúùû/-]+)[\\s-]*(.*)"); protected static final Pattern P_NORMALIZE_LINE = Pattern.compile("([A-Za-zÄÖÜäöüßáàâéèêíìîóòôúùû/-]+)[\\s-]*(.*)");

View file

@ -34,6 +34,7 @@ import de.schildbach.pte.dto.Autocomplete;
import de.schildbach.pte.dto.Connection; import de.schildbach.pte.dto.Connection;
import de.schildbach.pte.dto.Departure; import de.schildbach.pte.dto.Departure;
import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.GetConnectionDetailsResult;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryConnectionsResult;
import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.Station; import de.schildbach.pte.dto.Station;
@ -89,7 +90,7 @@ public final class BahnProvider implements NetworkProvider
private final static Pattern P_NEARBY_STATIONS = Pattern private final static Pattern P_NEARBY_STATIONS = Pattern
.compile("<a class=\"uLine\" href=\".+?!X=(\\d+)!Y=(\\d+)!id=(\\d+)!dist=(\\d+).*?\">(.+?)</a>"); .compile("<a class=\"uLine\" href=\".+?!X=(\\d+)!Y=(\\d+)!id=(\\d+)!dist=(\\d+).*?\">(.+?)</a>");
public List<Station> nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations) public NearbyStationsResult nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations)
throws IOException throws IOException
{ {
if (lat == 0 && lon == 0) if (lat == 0 && lon == 0)
@ -97,9 +98,9 @@ public final class BahnProvider implements NetworkProvider
final List<Station> stations = new ArrayList<Station>(); final List<Station> stations = new ArrayList<Station>();
final String url = API_BASE + "query.exe/dox" + "?performLocating=2&tpl=stopsnear&look_maxdist=" + (maxDistance > 0 ? maxDistance : 5000) final String uri = API_BASE + "query.exe/dox" + "?performLocating=2&tpl=stopsnear&look_maxdist=" + (maxDistance > 0 ? maxDistance : 5000)
+ "&look_stopclass=1023" + "&look_x=" + lon + "&look_y=" + lat; + "&look_stopclass=1023" + "&look_x=" + lon + "&look_y=" + lat;
final CharSequence page = ParserUtils.scrape(url); final CharSequence page = ParserUtils.scrape(uri);
final Matcher m = P_NEARBY_STATIONS.matcher(page); final Matcher m = P_NEARBY_STATIONS.matcher(page);
while (m.find()) while (m.find())
@ -116,9 +117,9 @@ public final class BahnProvider implements NetworkProvider
} }
if (maxStations == 0 || maxStations >= stations.size()) if (maxStations == 0 || maxStations >= stations.size())
return stations; return new NearbyStationsResult(uri, stations);
else else
return stations.subList(0, maxStations); return new NearbyStationsResult(uri, stations.subList(0, maxStations));
} }
public StationLocationResult stationLocation(final String stationId) throws IOException public StationLocationResult stationLocation(final String stationId) throws IOException

View file

@ -33,6 +33,7 @@ import java.util.regex.Pattern;
import de.schildbach.pte.dto.Autocomplete; import de.schildbach.pte.dto.Autocomplete;
import de.schildbach.pte.dto.Connection; import de.schildbach.pte.dto.Connection;
import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.GetConnectionDetailsResult;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryConnectionsResult;
import de.schildbach.pte.dto.Station; import de.schildbach.pte.dto.Station;
import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.dto.StationLocationResult;
@ -133,7 +134,7 @@ public class MvvProvider extends AbstractEfaProvider
private static final Pattern P_NEARBY_FINE = Pattern.compile(".*?<n>(.*?)</n>.*?<r>.*?<id>(.*?)</id>.*?</r>.*?(?:<c>(\\d+),(\\d+)</c>.*?)?"); private static final Pattern P_NEARBY_FINE = Pattern.compile(".*?<n>(.*?)</n>.*?<r>.*?<id>(.*?)</id>.*?</r>.*?(?:<c>(\\d+),(\\d+)</c>.*?)?");
@Override @Override
public List<Station> nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations) public NearbyStationsResult nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations)
throws IOException throws IOException
{ {
String uri; String uri;
@ -169,9 +170,9 @@ public class MvvProvider extends AbstractEfaProvider
} }
if (maxStations == 0 || maxStations >= stations.size()) if (maxStations == 0 || maxStations >= stations.size())
return stations; return new NearbyStationsResult(uri, stations);
else else
return stations.subList(0, maxStations); return new NearbyStationsResult(uri, stations.subList(0, maxStations));
} }
public StationLocationResult stationLocation(final String stationId) throws IOException public StationLocationResult stationLocation(final String stationId) throws IOException

View file

@ -23,9 +23,9 @@ import java.util.List;
import de.schildbach.pte.dto.Autocomplete; import de.schildbach.pte.dto.Autocomplete;
import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.GetConnectionDetailsResult;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryConnectionsResult;
import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.Station;
import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.dto.StationLocationResult;
/** /**
@ -78,7 +78,7 @@ public interface NetworkProvider
* @return nearby stations * @return nearby stations
* @throws IOException * @throws IOException
*/ */
List<Station> nearbyStations(String stationId, int lat, int lon, int maxDistance, int maxStations) throws IOException; NearbyStationsResult nearbyStations(String stationId, int lat, int lon, int maxDistance, int maxStations) throws IOException;
/** /**
* Look up location of station. * Look up location of station.

View file

@ -34,6 +34,7 @@ import de.schildbach.pte.dto.Autocomplete;
import de.schildbach.pte.dto.Connection; import de.schildbach.pte.dto.Connection;
import de.schildbach.pte.dto.Departure; import de.schildbach.pte.dto.Departure;
import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.GetConnectionDetailsResult;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryConnectionsResult;
import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.Station; import de.schildbach.pte.dto.Station;
@ -100,13 +101,13 @@ public class RmvProvider extends AbstractHafasProvider
} }
@Override @Override
public List<Station> nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations) public NearbyStationsResult nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations)
throws IOException throws IOException
{ {
if (lat != 0 || lon != 0) if (lat != 0 || lon != 0)
{ {
final String url = API_BASE + "dox?input=" + latLonToDouble(lat) + "%20" + latLonToDouble(lon); final String uri = API_BASE + "dox?input=" + latLonToDouble(lat) + "%20" + latLonToDouble(lon);
final CharSequence page = ParserUtils.scrape(url); final CharSequence page = ParserUtils.scrape(uri);
final List<Station> stations = new ArrayList<Station>(); final List<Station> stations = new ArrayList<Station>();
@ -122,9 +123,9 @@ public class RmvProvider extends AbstractHafasProvider
} }
if (maxStations == 0 || maxStations >= stations.size()) if (maxStations == 0 || maxStations >= stations.size())
return stations; return new NearbyStationsResult(uri, stations);
else else
return stations.subList(0, maxStations); return new NearbyStationsResult(uri, stations.subList(0, maxStations));
} }
else if (stationId != null) else if (stationId != null)
{ {

View file

@ -29,9 +29,9 @@ import java.util.regex.Pattern;
import de.schildbach.pte.dto.Autocomplete; import de.schildbach.pte.dto.Autocomplete;
import de.schildbach.pte.dto.Departure; import de.schildbach.pte.dto.Departure;
import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.GetConnectionDetailsResult;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryConnectionsResult;
import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.Station;
import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.dto.StationLocationResult;
import de.schildbach.pte.dto.QueryDeparturesResult.Status; import de.schildbach.pte.dto.QueryDeparturesResult.Status;
import de.schildbach.pte.util.Color; import de.schildbach.pte.util.Color;
@ -54,7 +54,7 @@ public class TflProvider implements NetworkProvider
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public List<Station> nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations) public NearbyStationsResult nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations)
throws IOException throws IOException
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();

View file

@ -35,9 +35,9 @@ import de.schildbach.pte.dto.Autocomplete;
import de.schildbach.pte.dto.Connection; import de.schildbach.pte.dto.Connection;
import de.schildbach.pte.dto.Departure; import de.schildbach.pte.dto.Departure;
import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.GetConnectionDetailsResult;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryConnectionsResult;
import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.Station;
import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.dto.StationLocationResult;
import de.schildbach.pte.dto.QueryDeparturesResult.Status; import de.schildbach.pte.dto.QueryDeparturesResult.Status;
import de.schildbach.pte.util.Color; import de.schildbach.pte.util.Color;
@ -107,7 +107,7 @@ public final class VbbProvider implements NetworkProvider
return results; return results;
} }
public List<Station> nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations) public NearbyStationsResult nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations)
throws IOException throws IOException
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();

View file

@ -0,0 +1,49 @@
/*
* 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.dto;
import java.util.List;
/**
* @author Andreas Schildbach
*/
public final class NearbyStationsResult
{
public enum Status
{
OK, INVALID_STATION, SERVICE_DOWN
}
public final String uri;
public final Status status;
public final List<Station> stations;
public NearbyStationsResult(final String uri, List<Station> stations)
{
this.uri = uri;
this.status = Status.OK;
this.stations = stations;
}
public NearbyStationsResult(final String uri, final Status status)
{
this.uri = uri;
this.status = status;
this.stations = null;
}
}

View file

@ -22,7 +22,7 @@ import org.junit.Test;
import de.schildbach.pte.GvhProvider; import de.schildbach.pte.GvhProvider;
import de.schildbach.pte.dto.Autocomplete; import de.schildbach.pte.dto.Autocomplete;
import de.schildbach.pte.dto.Station; import de.schildbach.pte.dto.NearbyStationsResult;
/** /**
* @author Andreas Schildbach * @author Andreas Schildbach
@ -42,8 +42,8 @@ public class GvhProviderLiveTest
@Test @Test
public void nearbyStation() throws Exception public void nearbyStation() throws Exception
{ {
final List<Station> results = provider.nearbyStations("25000031", 0, 0, 0, 0); final NearbyStationsResult result = provider.nearbyStations("25000031", 0, 0, 0, 0);
System.out.println(results.size() + " " + results); System.out.println(result.stations.size() + " " + result.stations);
} }
} }

View file

@ -16,13 +16,11 @@
*/ */
package de.schildbach.pte.live; package de.schildbach.pte.live;
import java.util.List;
import org.junit.Test; import org.junit.Test;
import de.schildbach.pte.NasaProvider; import de.schildbach.pte.NasaProvider;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.Station;
/** /**
* @author Andreas Schildbach * @author Andreas Schildbach
@ -34,9 +32,9 @@ public class NasaProviderLiveTest
@Test @Test
public void nearbyStation() throws Exception public void nearbyStation() throws Exception
{ {
final List<Station> results = provider.nearbyStations("13000", 0, 0, 0, 0); final NearbyStationsResult result = provider.nearbyStations("13000", 0, 0, 0, 0);
System.out.println(results.size() + " " + results); System.out.println(result.stations.size() + " " + result.stations);
} }
@Test @Test

View file

@ -18,15 +18,14 @@
package de.schildbach.pte.live; package de.schildbach.pte.live;
import java.util.Date; import java.util.Date;
import java.util.List;
import org.junit.Test; import org.junit.Test;
import de.schildbach.pte.OebbProvider; import de.schildbach.pte.OebbProvider;
import de.schildbach.pte.NetworkProvider.LocationType; import de.schildbach.pte.NetworkProvider.LocationType;
import de.schildbach.pte.NetworkProvider.WalkSpeed; import de.schildbach.pte.NetworkProvider.WalkSpeed;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryConnectionsResult;
import de.schildbach.pte.dto.Station;
/** /**
* @author Andreas Schildbach * @author Andreas Schildbach
@ -38,9 +37,9 @@ public class OebbProviderLiveTest
@Test @Test
public void nearbyStation() throws Exception public void nearbyStation() throws Exception
{ {
final List<Station> results = provider.nearbyStations("902006", 0, 0, 0, 0); final NearbyStationsResult result = provider.nearbyStations("902006", 0, 0, 0, 0);
System.out.println(results.size() + " " + results); System.out.println(result.stations.size() + " " + result.stations);
} }
@Test @Test

View file

@ -16,12 +16,10 @@
*/ */
package de.schildbach.pte.live; package de.schildbach.pte.live;
import java.util.List;
import org.junit.Test; import org.junit.Test;
import de.schildbach.pte.RmvProvider; import de.schildbach.pte.RmvProvider;
import de.schildbach.pte.dto.Station; import de.schildbach.pte.dto.NearbyStationsResult;
/** /**
* @author Andreas Schildbach * @author Andreas Schildbach
@ -33,8 +31,8 @@ public class RmvProviderLiveTest
@Test @Test
public void nearbyStation() throws Exception public void nearbyStation() throws Exception
{ {
final List<Station> results = provider.nearbyStations("3000001", 0, 0, 0, 0); final NearbyStationsResult result = provider.nearbyStations("3000001", 0, 0, 0, 0);
System.out.println(results.size() + " " + results); System.out.println(result.stations.size() + " " + result.stations);
} }
} }

View file

@ -26,8 +26,8 @@ import de.schildbach.pte.SbbProvider;
import de.schildbach.pte.NetworkProvider.LocationType; import de.schildbach.pte.NetworkProvider.LocationType;
import de.schildbach.pte.NetworkProvider.WalkSpeed; import de.schildbach.pte.NetworkProvider.WalkSpeed;
import de.schildbach.pte.dto.Autocomplete; import de.schildbach.pte.dto.Autocomplete;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryConnectionsResult;
import de.schildbach.pte.dto.Station;
/** /**
* @author Andreas Schildbach * @author Andreas Schildbach
@ -39,9 +39,9 @@ public class SbbProviderLiveTest
@Test @Test
public void nearbyStation() throws Exception public void nearbyStation() throws Exception
{ {
final List<Station> results = provider.nearbyStations("8500010", 0, 0, 0, 0); final NearbyStationsResult result = provider.nearbyStations("8500010", 0, 0, 0, 0);
System.out.println(results.size() + " " + results); System.out.println(result.stations.size() + " " + result.stations);
} }
@Test @Test

View file

@ -16,12 +16,10 @@
*/ */
package de.schildbach.pte.live; package de.schildbach.pte.live;
import java.util.List;
import org.junit.Test; import org.junit.Test;
import de.schildbach.pte.SncbProvider; import de.schildbach.pte.SncbProvider;
import de.schildbach.pte.dto.Station; import de.schildbach.pte.dto.NearbyStationsResult;
/** /**
* @author Andreas Schildbach * @author Andreas Schildbach
@ -33,8 +31,8 @@ public class SncbProviderLiveTest
@Test @Test
public void nearbyStation() throws Exception public void nearbyStation() throws Exception
{ {
final List<Station> results = provider.nearbyStations("100080", 0, 0, 0, 0); final NearbyStationsResult result = provider.nearbyStations("100080", 0, 0, 0, 0);
System.out.println(results.size() + " " + results); System.out.println(result.stations.size() + " " + result.stations);
} }
} }

View file

@ -16,13 +16,11 @@
*/ */
package de.schildbach.pte.live; package de.schildbach.pte.live;
import java.util.List;
import org.junit.Test; import org.junit.Test;
import de.schildbach.pte.VgsProvider; import de.schildbach.pte.VgsProvider;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.Station;
/** /**
* @author Andreas Schildbach * @author Andreas Schildbach
@ -34,9 +32,9 @@ public class VgsProviderLiveTest
@Test @Test
public void nearbyStation() throws Exception public void nearbyStation() throws Exception
{ {
final List<Station> results = provider.nearbyStations("8000244", 0, 0, 0, 0); final NearbyStationsResult result = provider.nearbyStations("8000244", 0, 0, 0, 0);
System.out.println(results.size() + " " + results); System.out.println(result.stations.size() + " " + result.stations);
} }
@Test @Test

View file

@ -16,13 +16,11 @@
*/ */
package de.schildbach.pte.live; package de.schildbach.pte.live;
import java.util.List;
import org.junit.Test; import org.junit.Test;
import de.schildbach.pte.VrnProvider; import de.schildbach.pte.VrnProvider;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.Station;
/** /**
* @author Andreas Schildbach * @author Andreas Schildbach
@ -34,9 +32,9 @@ public class VrnProviderLiveTest
@Test @Test
public void nearbyStation() throws Exception public void nearbyStation() throws Exception
{ {
final List<Station> results = provider.nearbyStations("6032236", 0, 0, 0, 0); final NearbyStationsResult result = provider.nearbyStations("6032236", 0, 0, 0, 0);
System.out.println(results.size() + " " + results); System.out.println(result.stations.size() + " " + result.stations);
} }
@Test @Test

View file

@ -16,13 +16,11 @@
*/ */
package de.schildbach.pte.live; package de.schildbach.pte.live;
import java.util.List;
import org.junit.Test; import org.junit.Test;
import de.schildbach.pte.VrrProvider; import de.schildbach.pte.VrrProvider;
import de.schildbach.pte.dto.NearbyStationsResult;
import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.QueryDeparturesResult;
import de.schildbach.pte.dto.Station;
/** /**
* @author Andreas Schildbach * @author Andreas Schildbach
@ -34,9 +32,9 @@ public class VrrProviderLiveTest
@Test @Test
public void nearbyStation() throws Exception public void nearbyStation() throws Exception
{ {
final List<Station> results = provider.nearbyStations("20019904", 0, 0, 0, 0); final NearbyStationsResult result = provider.nearbyStations("20019904", 0, 0, 0, 0);
System.out.println(results.size() + " " + results); System.out.println(result.stations.size() + " " + result.stations);
} }
@Test @Test