This is a Java library allowing you to get data from public transport providers. Look into NetworkProvider.java for an overview of the API.
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.
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.
THIS IS AN UNOFFICIAL FORK: It is kept in sync with the origin from github.com/schildbach/public-transport-enabler and applies selected pull requests until they are merged into upstream:
- Incofer, Costa Rica
NetworkId.CR
- CostaRicaProvider.java
- CostaRicaProviderLiveTest.java
- New York, United States
NetworkId.NEWYORK
- NewyorkProvider.java
- NewyorkProviderLiveTest.java
NetworkId.BRFLORIPA
- California, United States
NetworkId.CALIFORNIA
- CaliforniaProvider.java
- CaliforniaProviderLiveTest.java
- Hungary
NetworkId.HUNGARY
- HungaryProvider.java
- HungaryProviderLiveTest.java
- HSL using Navitia
NetworkId.FI
- HslProvider.java
- HslProviderLiveTest.java
- Portugal
NetworkId.PT
- PortugalProvider.java
- PortugalProviderLiveTest.java
There is a mirror on github, but for merge request please refer to our Gitlab repository.