mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-14 08:40:29 +00:00
migrated Frankfurt to binary connection queries
This commit is contained in:
parent
c2b9c37796
commit
24d7b9eb2b
2 changed files with 84 additions and 1 deletions
|
@ -18,11 +18,15 @@
|
|||
package de.schildbach.pte;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
import de.schildbach.pte.dto.QueryConnectionsContext;
|
||||
import de.schildbach.pte.dto.QueryConnectionsResult;
|
||||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||
import de.schildbach.pte.util.ParserUtils;
|
||||
|
||||
|
@ -32,7 +36,7 @@ import de.schildbach.pte.util.ParserUtils;
|
|||
public class RmvProvider extends AbstractHafasProvider
|
||||
{
|
||||
public static final NetworkId NETWORK_ID = NetworkId.RMV;
|
||||
private static final String API_BASE = "http://auskunft.nvv.de/nvv/bin/jp/";
|
||||
private static final String API_BASE = "http://auskunft.nvv.de/auskunft/bin/jp/";
|
||||
|
||||
public RmvProvider()
|
||||
{
|
||||
|
@ -168,6 +172,27 @@ public class RmvProvider extends AbstractHafasProvider
|
|||
return jsonGetStops(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendCustomConnectionsQueryBinaryUri(final StringBuilder uri)
|
||||
{
|
||||
uri.append("&h2g-direct=11");
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryConnectionsResult queryConnections(final Location from, final Location via, final Location to, final Date date, final boolean dep,
|
||||
final int maxNumConnections, final String products, final WalkSpeed walkSpeed, final Accessibility accessibility,
|
||||
final Set<Option> options) throws IOException
|
||||
{
|
||||
return queryConnectionsBinary(from, via, to, date, dep, maxNumConnections, products, walkSpeed, accessibility, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryConnectionsResult queryMoreConnections(final QueryConnectionsContext contextObj, final boolean later, final int numConnections)
|
||||
throws IOException
|
||||
{
|
||||
return queryMoreConnectionsBinary(contextObj, later, numConnections);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
|
|
|
@ -87,8 +87,66 @@ public class RmvProviderLiveTest extends AbstractProviderLiveTest
|
|||
final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 3000001, null, "Hauptwache"), null, new Location(
|
||||
LocationType.STATION, 3000912, null, "Südbahnhof"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
System.out.println(result);
|
||||
|
||||
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.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryConnectionsResult later3Result = queryMoreConnections(later2Result.context, true);
|
||||
System.out.println(later3Result);
|
||||
|
||||
if (!later3Result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryConnectionsResult later4Result = queryMoreConnections(later3Result.context, true);
|
||||
System.out.println(later4Result);
|
||||
|
||||
if (!later4Result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryConnectionsResult later5Result = queryMoreConnections(later4Result.context, true);
|
||||
System.out.println(later5Result);
|
||||
|
||||
if (!later5Result.context.canQueryLater())
|
||||
return;
|
||||
|
||||
final QueryConnectionsResult later6Result = queryMoreConnections(later5Result.context, true);
|
||||
System.out.println(later6Result);
|
||||
|
||||
if (!result.context.canQueryEarlier())
|
||||
return;
|
||||
|
||||
final QueryConnectionsResult earlierResult = queryMoreConnections(result.context, false);
|
||||
System.out.println(earlierResult);
|
||||
|
||||
if (!earlierResult.context.canQueryEarlier())
|
||||
return;
|
||||
|
||||
final QueryConnectionsResult earlier2Result = queryMoreConnections(earlierResult.context, false);
|
||||
System.out.println(earlier2Result);
|
||||
|
||||
if (!earlier2Result.context.canQueryEarlier())
|
||||
return;
|
||||
|
||||
final QueryConnectionsResult earlier3Result = queryMoreConnections(earlier2Result.context, false);
|
||||
System.out.println(earlier3Result);
|
||||
|
||||
if (!earlier3Result.context.canQueryEarlier())
|
||||
return;
|
||||
|
||||
final QueryConnectionsResult earlier4Result = queryMoreConnections(earlier3Result.context, false);
|
||||
System.out.println(earlier4Result);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue