public-transport-enabler/enabler
Torsten Grote 14f02607f1 Navitia: Less network requests and no NPE when querying for departures.
The AbstractNavitiaProvider was making one network request per departure
it found, just to find the `Product`. This information is mostly
available in the second request it makes, so this should be taken when
available.

Also, in rare cases no destination can be found for a line. It should
not crash in these cases. This was also fixed within this commit.
2016-03-09 13:18:50 +01:00
..
src/de/schildbach/pte Navitia: Less network requests and no NPE when querying for departures. 2016-03-09 13:18:50 +01:00
test/de/schildbach/pte Style: Preconditions and unit tests for parseColor(). 2016-02-29 10:38:30 +01:00
.gitignore Migrate build from Maven to Gradle. 2015-07-01 18:43:36 +02:00
build.gradle Migrate build from Maven to Gradle. 2015-07-01 18:43:36 +02:00
COPYING sub-project for enabler 2012-02-23 14:03:41 +01:00
README.md Add a README.md file to the enabler project. 2016-03-08 11:53:27 +01:00

Public Transport Enabler

This is a Java library allowing you to get data from public transport providers. Look into NetworkProvider.java for an overview of the API.

Using providers that require secrets

For some providers a secret like an API key is required to use their API. Copy the secrets.properties.template file to secrets.properties like so:

$ cp test/de/schildbach/pte/live/secrets.properties.template test/de/schildbach/pte/live/secrets.properties

You need to request the secrets directly from the provider. For Navitia based providers, you can request a secret here.

How to run live tests?

Make sure the test you want to run does not require a secret and if it does, see above for how to get one. Once you have the secret or if your provider does not need one, you can run the tests in your IDE. Both IntelliJ and Eclipse have excellent support for JUnit tests.

If you prefer to run tests from the command line, you can comment out the test exclude at the end of build.gradle and use this command to only execute a test for a single provider:

$ gradle -Dtest.single=ParisProviderLive test

This uses the ParisProvider as an example. Just replace it with the provider you want to test.