'previous connections' handling for hafas based providers

This commit is contained in:
Andreas Schildbach 2012-03-05 10:28:54 +01:00
parent d0cf992647
commit 0eb1ac9da9
2 changed files with 6 additions and 4 deletions

View file

@ -781,10 +781,10 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
public QueryConnectionsResult queryMoreConnections(final String context, final boolean next) throws IOException
{
final StringBuilder request = new StringBuilder("<ConScrReq scr=\"").append('F').append("\" nrCons=\"").append(NUM_CONNECTIONS).append("\">");
final StringBuilder request = new StringBuilder("<ConScrReq scrDir=\"").append(next ? 'F' : 'B').append("\" nrCons=\"")
.append(NUM_CONNECTIONS).append("\">");
request.append("<ConResCtxt>").append(context).append("</ConResCtxt>");
request.append("</ConScrReq>");
// TODO handle next/prev
return queryConnections(request.toString(), null, null, null);
}

View file

@ -77,8 +77,10 @@ public class VbbProviderLiveTest extends AbstractProviderLiveTest
null, new Location(LocationType.STATION, 9013103, "Berlin", "Prinzenstraße"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL,
Accessibility.NEUTRAL);
System.out.println(result);
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context, true);
System.out.println(moreResult);
final QueryConnectionsResult nextResult = provider.queryMoreConnections(result.context, true);
System.out.println(nextResult);
final QueryConnectionsResult previousResult = provider.queryMoreConnections(result.context, false);
System.out.println(previousResult);
}
@Test