diff --git a/enabler/src/de/schildbach/pte/AbstractEfaProvider.java b/enabler/src/de/schildbach/pte/AbstractEfaProvider.java index 2cf66f0c..57b32d55 100644 --- a/enabler/src/de/schildbach/pte/AbstractEfaProvider.java +++ b/enabler/src/de/schildbach/pte/AbstractEfaProvider.java @@ -86,6 +86,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider private final boolean needsSpEncId; private Charset requestUrlEncoding = ISO_8859_1; private boolean suppressPositions = false; + private boolean useRouteIndexAsConnectionId = true; private final XmlPullParserFactory parserFactory; private static class Context implements QueryConnectionsContext @@ -160,6 +161,11 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider this.suppressPositions = suppressPositions; } + public void setUseRouteIndexAsConnectionId(final boolean useRouteIndexAsConnectionId) + { + this.useRouteIndexAsConnectionId = useRouteIndexAsConnectionId; + } + protected TimeZone timeZone() { return TimeZone.getTimeZone("Europe/Berlin"); @@ -1901,7 +1907,8 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider while (XmlPullUtil.test(pp, "itdRoute")) { - final String id = pp.getAttributeValue(null, "routeIndex") + "-" + pp.getAttributeValue(null, "routeTripIndex"); + final String id = useRouteIndexAsConnectionId ? pp.getAttributeValue(null, "routeIndex") + "-" + + pp.getAttributeValue(null, "routeTripIndex") : null; final int numChanges = XmlPullUtil.intAttr(pp, "changes"); XmlPullUtil.enter(pp, "itdRoute"); diff --git a/enabler/src/de/schildbach/pte/AvvProvider.java b/enabler/src/de/schildbach/pte/AvvProvider.java index 5c0e37df..5d743fc4 100644 --- a/enabler/src/de/schildbach/pte/AvvProvider.java +++ b/enabler/src/de/schildbach/pte/AvvProvider.java @@ -28,6 +28,8 @@ public class AvvProvider extends AbstractEfaProvider public AvvProvider() { super(API_BASE, null); + + setUseRouteIndexAsConnectionId(false); } public NetworkId id() diff --git a/enabler/src/de/schildbach/pte/DubProvider.java b/enabler/src/de/schildbach/pte/DubProvider.java index 382df9d3..e3125fb5 100644 --- a/enabler/src/de/schildbach/pte/DubProvider.java +++ b/enabler/src/de/schildbach/pte/DubProvider.java @@ -35,6 +35,8 @@ public class DubProvider extends AbstractEfaProvider public DubProvider() { super(API_BASE, null); + + setUseRouteIndexAsConnectionId(false); } public NetworkId id() diff --git a/enabler/src/de/schildbach/pte/IvbProvider.java b/enabler/src/de/schildbach/pte/IvbProvider.java index 583cf364..c0d6478e 100644 --- a/enabler/src/de/schildbach/pte/IvbProvider.java +++ b/enabler/src/de/schildbach/pte/IvbProvider.java @@ -28,6 +28,8 @@ public class IvbProvider extends AbstractEfaProvider public IvbProvider() { super(API_BASE, null); + + setUseRouteIndexAsConnectionId(false); } public NetworkId id() diff --git a/enabler/src/de/schildbach/pte/MetProvider.java b/enabler/src/de/schildbach/pte/MetProvider.java index 517e5b35..769fd683 100644 --- a/enabler/src/de/schildbach/pte/MetProvider.java +++ b/enabler/src/de/schildbach/pte/MetProvider.java @@ -36,6 +36,8 @@ public class MetProvider extends AbstractEfaProvider public MetProvider() { super(API_BASE, null); + + setUseRouteIndexAsConnectionId(false); } public NetworkId id() diff --git a/enabler/src/de/schildbach/pte/NvbwProvider.java b/enabler/src/de/schildbach/pte/NvbwProvider.java index 08801f10..56f5dc77 100644 --- a/enabler/src/de/schildbach/pte/NvbwProvider.java +++ b/enabler/src/de/schildbach/pte/NvbwProvider.java @@ -34,6 +34,8 @@ public class NvbwProvider extends AbstractEfaProvider public NvbwProvider() { super(API_BASE, null); + + setUseRouteIndexAsConnectionId(false); } public NetworkId id() diff --git a/enabler/src/de/schildbach/pte/SfProvider.java b/enabler/src/de/schildbach/pte/SfProvider.java index a82b2487..c8b1aae5 100644 --- a/enabler/src/de/schildbach/pte/SfProvider.java +++ b/enabler/src/de/schildbach/pte/SfProvider.java @@ -34,6 +34,8 @@ public class SfProvider extends AbstractEfaProvider public SfProvider() { super(API_BASE, null); + + setUseRouteIndexAsConnectionId(false); } public NetworkId id() diff --git a/enabler/src/de/schildbach/pte/SydneyProvider.java b/enabler/src/de/schildbach/pte/SydneyProvider.java index 32f354fd..a64eb75a 100644 --- a/enabler/src/de/schildbach/pte/SydneyProvider.java +++ b/enabler/src/de/schildbach/pte/SydneyProvider.java @@ -30,6 +30,8 @@ public class SydneyProvider extends AbstractEfaProvider public SydneyProvider() { super(API_BASE, null); + + setUseRouteIndexAsConnectionId(false); } public NetworkId id() diff --git a/enabler/src/de/schildbach/pte/TlswProvider.java b/enabler/src/de/schildbach/pte/TlswProvider.java index 19c1b117..f8c8286c 100644 --- a/enabler/src/de/schildbach/pte/TlswProvider.java +++ b/enabler/src/de/schildbach/pte/TlswProvider.java @@ -35,6 +35,8 @@ public class TlswProvider extends AbstractEfaProvider public TlswProvider() { super(API_BASE, null); + + setUseRouteIndexAsConnectionId(false); } public NetworkId id() diff --git a/enabler/src/de/schildbach/pte/VagfrProvider.java b/enabler/src/de/schildbach/pte/VagfrProvider.java index 116a68f3..bb2ec8f6 100644 --- a/enabler/src/de/schildbach/pte/VagfrProvider.java +++ b/enabler/src/de/schildbach/pte/VagfrProvider.java @@ -38,6 +38,8 @@ public class VagfrProvider extends AbstractEfaProvider public VagfrProvider() { super(API_BASE, null); + + setUseRouteIndexAsConnectionId(false); } public NetworkId id() diff --git a/enabler/src/de/schildbach/pte/VblProvider.java b/enabler/src/de/schildbach/pte/VblProvider.java index b241fbeb..8b96fd9a 100644 --- a/enabler/src/de/schildbach/pte/VblProvider.java +++ b/enabler/src/de/schildbach/pte/VblProvider.java @@ -28,6 +28,8 @@ public class VblProvider extends AbstractEfaProvider public VblProvider() { super(API_BASE, null); + + setUseRouteIndexAsConnectionId(false); } public NetworkId id() diff --git a/enabler/src/de/schildbach/pte/VvtProvider.java b/enabler/src/de/schildbach/pte/VvtProvider.java index d17e7de7..c870ce07 100644 --- a/enabler/src/de/schildbach/pte/VvtProvider.java +++ b/enabler/src/de/schildbach/pte/VvtProvider.java @@ -28,6 +28,8 @@ public class VvtProvider extends AbstractEfaProvider public VvtProvider() { super(API_BASE, null); + + setUseRouteIndexAsConnectionId(false); } public NetworkId id() diff --git a/enabler/test/de/schildbach/pte/live/AvvProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/AvvProviderLiveTest.java index f458795d..4d79337a 100644 --- a/enabler/test/de/schildbach/pte/live/AvvProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/AvvProviderLiveTest.java @@ -17,6 +17,9 @@ package de.schildbach.pte.live; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Date; import java.util.List; @@ -87,7 +90,25 @@ public class AvvProviderLiveTest extends AbstractProviderLiveTest final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 101, null, "Königsplatz"), null, new Location( LocationType.STATION, 100, null, "Hauptbahnhof"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); System.out.println(result); + assertEquals(QueryConnectionsResult.Status.OK, result.status); + assertTrue(result.connections.size() > 0); + + if (!result.context.canQueryLater()) + return; + final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true); System.out.println(laterResult); + + if (!laterResult.context.canQueryLater()) + return; + + final QueryConnectionsResult later2Result = queryMoreConnections(laterResult.context, true); + System.out.println(later2Result); + + if (!later2Result.context.canQueryEarlier()) + return; + + final QueryConnectionsResult earlierResult = queryMoreConnections(later2Result.context, false); + System.out.println(earlierResult); } } diff --git a/enabler/test/de/schildbach/pte/live/DubProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/DubProviderLiveTest.java index 657adf40..ab999fee 100644 --- a/enabler/test/de/schildbach/pte/live/DubProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/DubProviderLiveTest.java @@ -17,6 +17,9 @@ package de.schildbach.pte.live; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Date; import java.util.List; @@ -71,7 +74,25 @@ public class DubProviderLiveTest extends AbstractProviderLiveTest null, new Location(LocationType.STATION, 3505445, null, "Airport Terminal 3"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); System.out.println(result); + assertEquals(QueryConnectionsResult.Status.OK, result.status); + assertTrue(result.connections.size() > 0); + + if (!result.context.canQueryLater()) + return; + final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true); System.out.println(laterResult); + + if (!laterResult.context.canQueryLater()) + return; + + final QueryConnectionsResult later2Result = queryMoreConnections(laterResult.context, true); + System.out.println(later2Result); + + if (!later2Result.context.canQueryEarlier()) + return; + + final QueryConnectionsResult earlierResult = queryMoreConnections(later2Result.context, false); + System.out.println(earlierResult); } } diff --git a/enabler/test/de/schildbach/pte/live/IvbProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/IvbProviderLiveTest.java index b9313f39..6d1282fb 100644 --- a/enabler/test/de/schildbach/pte/live/IvbProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/IvbProviderLiveTest.java @@ -17,6 +17,9 @@ package de.schildbach.pte.live; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Date; import java.util.List; @@ -87,7 +90,25 @@ public class IvbProviderLiveTest extends AbstractProviderLiveTest final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 60466402, null, "Kochstraße"), null, new Location( LocationType.STATION, 60461679, null, "Messe/Zeughaus"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); System.out.println(result); + assertEquals(QueryConnectionsResult.Status.OK, result.status); + assertTrue(result.connections.size() > 0); + + if (!result.context.canQueryLater()) + return; + final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true); System.out.println(laterResult); + + if (!laterResult.context.canQueryLater()) + return; + + final QueryConnectionsResult later2Result = queryMoreConnections(laterResult.context, true); + System.out.println(later2Result); + + if (!later2Result.context.canQueryEarlier()) + return; + + final QueryConnectionsResult earlierResult = queryMoreConnections(later2Result.context, false); + System.out.println(earlierResult); } } diff --git a/enabler/test/de/schildbach/pte/live/MetProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/MetProviderLiveTest.java index 297e7768..42b2561a 100644 --- a/enabler/test/de/schildbach/pte/live/MetProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/MetProviderLiveTest.java @@ -17,6 +17,9 @@ package de.schildbach.pte.live; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Date; import java.util.List; @@ -76,10 +79,29 @@ public class MetProviderLiveTest extends AbstractProviderLiveTest @Test public void shortConnection() throws Exception { - final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 0, null, "Hauptwache"), null, new Location( - LocationType.STATION, 0, null, "Südbahnhof"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); + final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 10002717, "Melbourne City", + "6-Franklin St/Elizabeth St"), null, new Location(LocationType.STATION, 10002722, "Melbourne City", + "1-Flinders Street Railway Station/Elizabeth St"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); System.out.println(result); + assertEquals(QueryConnectionsResult.Status.OK, result.status); + assertTrue(result.connections.size() > 0); + + if (!result.context.canQueryLater()) + return; + final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true); System.out.println(laterResult); + + if (!laterResult.context.canQueryLater()) + return; + + final QueryConnectionsResult later2Result = queryMoreConnections(laterResult.context, true); + System.out.println(later2Result); + + if (!later2Result.context.canQueryEarlier()) + return; + + final QueryConnectionsResult earlierResult = queryMoreConnections(later2Result.context, false); + System.out.println(earlierResult); } } diff --git a/enabler/test/de/schildbach/pte/live/NvbwProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/NvbwProviderLiveTest.java index 61757d73..2f236386 100644 --- a/enabler/test/de/schildbach/pte/live/NvbwProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/NvbwProviderLiveTest.java @@ -17,6 +17,9 @@ package de.schildbach.pte.live; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Date; import java.util.List; @@ -87,7 +90,25 @@ public class NvbwProviderLiveTest extends AbstractProviderLiveTest final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 17002402, null, "Bahnhof"), null, new Location( LocationType.STATION, 17009001, null, "Bahnhof"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); System.out.println(result); + assertEquals(QueryConnectionsResult.Status.OK, result.status); + assertTrue(result.connections.size() > 0); + + if (!result.context.canQueryLater()) + return; + final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true); System.out.println(laterResult); + + if (!laterResult.context.canQueryLater()) + return; + + final QueryConnectionsResult later2Result = queryMoreConnections(laterResult.context, true); + System.out.println(later2Result); + + if (!later2Result.context.canQueryEarlier()) + return; + + final QueryConnectionsResult earlierResult = queryMoreConnections(later2Result.context, false); + System.out.println(earlierResult); } } diff --git a/enabler/test/de/schildbach/pte/live/SfProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/SfProviderLiveTest.java index 195a67f7..418f116e 100644 --- a/enabler/test/de/schildbach/pte/live/SfProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/SfProviderLiveTest.java @@ -17,6 +17,9 @@ package de.schildbach.pte.live; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Date; import java.util.List; @@ -76,10 +79,29 @@ public class SfProviderLiveTest extends AbstractProviderLiveTest @Test public void shortConnection() throws Exception { - final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 0, null, "Hauptwache"), null, new Location( - LocationType.STATION, 0, null, "Südbahnhof"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); + final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 10001032, 37784976, -122406784, "San Francisco", + "BART Powell"), null, new Location(LocationType.STATION, 10001026, 37789376, -122401320, "San Francisco", "BART Montgomery"), + new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); System.out.println(result); + assertEquals(QueryConnectionsResult.Status.OK, result.status); + assertTrue(result.connections.size() > 0); + + if (!result.context.canQueryLater()) + return; + final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true); System.out.println(laterResult); + + if (!laterResult.context.canQueryLater()) + return; + + final QueryConnectionsResult later2Result = queryMoreConnections(laterResult.context, true); + System.out.println(later2Result); + + if (!later2Result.context.canQueryEarlier()) + return; + + final QueryConnectionsResult earlierResult = queryMoreConnections(later2Result.context, false); + System.out.println(earlierResult); } } diff --git a/enabler/test/de/schildbach/pte/live/SydneyProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/SydneyProviderLiveTest.java index 32c4d57c..4586562f 100644 --- a/enabler/test/de/schildbach/pte/live/SydneyProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/SydneyProviderLiveTest.java @@ -17,6 +17,9 @@ package de.schildbach.pte.live; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Date; import java.util.List; @@ -80,7 +83,25 @@ public class SydneyProviderLiveTest extends AbstractProviderLiveTest new Location(LocationType.STATION, 0, "Sydney", "Capitol Square"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); System.out.println(result); + assertEquals(QueryConnectionsResult.Status.OK, result.status); + assertTrue(result.connections.size() > 0); + + if (!result.context.canQueryLater()) + return; + final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true); System.out.println(laterResult); + + if (!laterResult.context.canQueryLater()) + return; + + final QueryConnectionsResult later2Result = queryMoreConnections(laterResult.context, true); + System.out.println(later2Result); + + if (!later2Result.context.canQueryEarlier()) + return; + + final QueryConnectionsResult earlierResult = queryMoreConnections(later2Result.context, false); + System.out.println(earlierResult); } } diff --git a/enabler/test/de/schildbach/pte/live/TlswProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/TlswProviderLiveTest.java index 60013cac..79b72e49 100644 --- a/enabler/test/de/schildbach/pte/live/TlswProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/TlswProviderLiveTest.java @@ -17,6 +17,9 @@ package de.schildbach.pte.live; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Date; import java.util.List; @@ -76,10 +79,29 @@ public class TlswProviderLiveTest extends AbstractProviderLiveTest @Test public void shortConnection() throws Exception { - final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 0, null, "70003023"), null, new Location( - LocationType.STATION, 0, null, "70003025"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); + final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 60011202, 51850168, -1094302, "Upper Arncott", + "Bullingdon Prison"), null, new Location(LocationType.STATION, 60006576, 51856352, -1113127, "Lower Arncott", "The Plough"), + new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); System.out.println(result); + assertEquals(QueryConnectionsResult.Status.OK, result.status); + assertTrue(result.connections.size() > 0); + + if (!result.context.canQueryLater()) + return; + final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true); System.out.println(laterResult); + + if (!laterResult.context.canQueryLater()) + return; + + final QueryConnectionsResult later2Result = queryMoreConnections(laterResult.context, true); + System.out.println(later2Result); + + if (!later2Result.context.canQueryEarlier()) + return; + + final QueryConnectionsResult earlierResult = queryMoreConnections(later2Result.context, false); + System.out.println(earlierResult); } } diff --git a/enabler/test/de/schildbach/pte/live/VagfrProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/VagfrProviderLiveTest.java index b3280013..df41068b 100644 --- a/enabler/test/de/schildbach/pte/live/VagfrProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/VagfrProviderLiveTest.java @@ -17,6 +17,9 @@ package de.schildbach.pte.live; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Date; import java.util.List; @@ -76,10 +79,29 @@ public class VagfrProviderLiveTest extends AbstractProviderLiveTest @Test public void shortConnection() throws Exception { - final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 0, null, "Hauptwache"), null, new Location( - LocationType.STATION, 0, null, "Südbahnhof"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); + final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 6930100, null, "Freiburg Bertoldsbrunnen"), null, + new Location(LocationType.STATION, 6930101, null, "Freiburg Siegesdenkmal"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, + Accessibility.NEUTRAL); System.out.println(result); + assertEquals(QueryConnectionsResult.Status.OK, result.status); + assertTrue(result.connections.size() > 0); + + if (!result.context.canQueryLater()) + return; + final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true); System.out.println(laterResult); + + if (!laterResult.context.canQueryLater()) + return; + + final QueryConnectionsResult later2Result = queryMoreConnections(laterResult.context, true); + System.out.println(later2Result); + + if (!later2Result.context.canQueryEarlier()) + return; + + final QueryConnectionsResult earlierResult = queryMoreConnections(later2Result.context, false); + System.out.println(earlierResult); } } diff --git a/enabler/test/de/schildbach/pte/live/VblProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/VblProviderLiveTest.java index 913c9fb3..27129e52 100644 --- a/enabler/test/de/schildbach/pte/live/VblProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/VblProviderLiveTest.java @@ -17,6 +17,9 @@ package de.schildbach.pte.live; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Date; import java.util.List; @@ -84,10 +87,29 @@ public class VblProviderLiveTest extends AbstractProviderLiveTest @Test public void shortConnection() throws Exception { - final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 0, null, "Hauptwache"), null, new Location( - LocationType.STATION, 0, null, "Südbahnhof"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); + final QueryConnectionsResult result = queryConnections( + new Location(LocationType.STATION, 119, 47050760, 8310252, "Luzern", "Luzern, Bahnhof"), null, new Location(LocationType.STATION, + 118, 47048844, 8306433, "Luzern", "Kantonalbank"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); System.out.println(result); + assertEquals(QueryConnectionsResult.Status.OK, result.status); + assertTrue(result.connections.size() > 0); + + if (!result.context.canQueryLater()) + return; + final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true); System.out.println(laterResult); + + if (!laterResult.context.canQueryLater()) + return; + + final QueryConnectionsResult later2Result = queryMoreConnections(laterResult.context, true); + System.out.println(later2Result); + + if (!later2Result.context.canQueryEarlier()) + return; + + final QueryConnectionsResult earlierResult = queryMoreConnections(later2Result.context, false); + System.out.println(earlierResult); } } diff --git a/enabler/test/de/schildbach/pte/live/VvtProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/VvtProviderLiveTest.java index 0940957a..c3b0a717 100644 --- a/enabler/test/de/schildbach/pte/live/VvtProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/VvtProviderLiveTest.java @@ -17,6 +17,9 @@ package de.schildbach.pte.live; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.util.Date; import java.util.List; @@ -84,10 +87,29 @@ public class VvtProviderLiveTest extends AbstractProviderLiveTest @Test public void shortConnection() throws Exception { - final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 0, null, "Hauptwache"), null, new Location( - LocationType.STATION, 0, null, "Südbahnhof"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); + final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 60161512, 47268336, 11355532, "Innsbruck", + "Allerheiligen"), null, new Location(LocationType.STATION, 60161510, 47267272, 11350938, "Innsbruck", "Tschiggfreystraße"), + new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL); System.out.println(result); + assertEquals(QueryConnectionsResult.Status.OK, result.status); + assertTrue(result.connections.size() > 0); + + if (!result.context.canQueryLater()) + return; + final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true); System.out.println(laterResult); + + if (!laterResult.context.canQueryLater()) + return; + + final QueryConnectionsResult later2Result = queryMoreConnections(laterResult.context, true); + System.out.println(later2Result); + + if (!later2Result.context.canQueryEarlier()) + return; + + final QueryConnectionsResult earlierResult = queryMoreConnections(later2Result.context, false); + System.out.println(earlierResult); } }