mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 16:20:34 +00:00
sanity-check h2g sequence number
This commit is contained in:
parent
7f62aa854e
commit
7ed8819fbb
2 changed files with 26 additions and 0 deletions
|
@ -1579,6 +1579,9 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
is.skipBytes(extensionHeaderPtr + 0x8);
|
||||
|
||||
final int seqNr = is.readShortReverse();
|
||||
if (seqNr <= 0)
|
||||
throw new IllegalStateException("illegal sequence number: " + seqNr);
|
||||
|
||||
final String requestId = strings.read(is);
|
||||
|
||||
final int connectionDetailsPtr = is.readIntReverse();
|
||||
|
|
|
@ -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,6 +90,8 @@ 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);
|
||||
assertEquals(QueryConnectionsResult.Status.OK, result.status);
|
||||
assertTrue(result.connections.size() > 0);
|
||||
|
||||
if (!result.context.canQueryLater())
|
||||
return;
|
||||
|
@ -149,6 +154,24 @@ public class RmvProviderLiveTest extends AbstractProviderLiveTest
|
|||
System.out.println(earlier4Result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void slowConnection() throws Exception
|
||||
{
|
||||
final QueryConnectionsResult result = queryConnections(
|
||||
new Location(LocationType.STATION, 3029079, 50017679, 8229480, "Mainz", "An den Dünen"), null, new Location(LocationType.STATION,
|
||||
3013508, 50142890, 8895203, "Hanau", "Beethovenplatz"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL,
|
||||
Accessibility.BARRIER_FREE);
|
||||
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);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortConnectionByName() throws Exception
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue