mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 16:20:34 +00:00
EFA: Parse message code when querying for locations via JSON.
This commit is contained in:
parent
94adb91a25
commit
e60eabaa92
2 changed files with 17 additions and 0 deletions
|
@ -285,6 +285,16 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final JSONArray messages = stopFinder.getJSONArray("message");
|
||||||
|
for (int i = 0; i < messages.length(); i++)
|
||||||
|
{
|
||||||
|
final JSONObject message = messages.optJSONObject(i);
|
||||||
|
final String messageName = message.getString("name");
|
||||||
|
final String messageValue = Strings.emptyToNull(message.getString("value"));
|
||||||
|
if ("code".equals(messageName) && !"-8011".equals(messageValue))
|
||||||
|
return new SuggestLocationsResult(header, SuggestLocationsResult.Status.SERVICE_DOWN);
|
||||||
|
}
|
||||||
|
|
||||||
final JSONObject points = stopFinder.optJSONObject("points");
|
final JSONObject points = stopFinder.optJSONObject("points");
|
||||||
if (points != null)
|
if (points != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,6 +83,13 @@ public class SvvProviderLiveTest extends AbstractProviderLiveTest
|
||||||
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "60650458")));
|
assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "60650458")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void suggestLocationsAddress() throws Exception
|
||||||
|
{
|
||||||
|
final SuggestLocationsResult result = suggestLocations("Kaigasse 10");
|
||||||
|
print(result);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void suggestLocationsCoverage() throws Exception
|
public void suggestLocationsCoverage() throws Exception
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue