mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-17 18:29:51 +00:00
Add Nicaragua provider based on Navitia.
This commit is contained in:
parent
d42edbadf9
commit
dae184bd31
3 changed files with 122 additions and 0 deletions
|
@ -89,4 +89,7 @@ public enum NetworkId {
|
||||||
|
|
||||||
// Africa
|
// Africa
|
||||||
GHANA,
|
GHANA,
|
||||||
|
|
||||||
|
// Nicaragua
|
||||||
|
NICARAGUA,
|
||||||
}
|
}
|
||||||
|
|
35
enabler/src/de/schildbach/pte/NicaraguaProvider.java
Normal file
35
enabler/src/de/schildbach/pte/NicaraguaProvider.java
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright the original author or authors.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.schildbach.pte;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ialokim
|
||||||
|
*/
|
||||||
|
public class NicaraguaProvider extends AbstractNavitiaProvider {
|
||||||
|
private static final String API_REGION = "ni";
|
||||||
|
|
||||||
|
public NicaraguaProvider(final String authorization) {
|
||||||
|
super(NetworkId.NICARAGUA, authorization);
|
||||||
|
setTimeZone("America/Managua");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String region() {
|
||||||
|
return API_REGION;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* Copyright the original author or authors.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.schildbach.pte.live;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import de.schildbach.pte.NicaraguaProvider;
|
||||||
|
import de.schildbach.pte.dto.Point;
|
||||||
|
|
||||||
|
public class NicaraguaProviderLiveTest extends AbstractNavitiaProviderLiveTest {
|
||||||
|
public NicaraguaProviderLiveTest() {
|
||||||
|
super(new NicaraguaProvider(secretProperty("navitia.authorization")));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void nearbyStationsAddress() throws Exception {
|
||||||
|
// Managua
|
||||||
|
nearbyStationsAddress(13090080, -86356250);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void nearbyStationsAddress2() throws Exception {
|
||||||
|
// Esteli
|
||||||
|
nearbyStationsAddress(12146120, -86274660);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void nearbyStationsStation() throws Exception {
|
||||||
|
nearbyStationsStation("stop_point:MNI:SP:node3230617621");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void nearbyStationsInvalidStation() throws Exception {
|
||||||
|
nearbyStationsInvalidStation("stop_point:MNIX:SP:node3230617621");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void queryDeparturesEquivsFalse() throws Exception {
|
||||||
|
queryDeparturesEquivsFalse("stop_point:MNI:SP:node3230617621");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void queryDeparturesInvalidStation() throws Exception {
|
||||||
|
queryDeparturesInvalidStation("stop_point:MNIX:SP:node3230617621");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void suggestLocations() throws Exception {
|
||||||
|
suggestLocationsFromName("Hospital");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void queryTripStations() throws Exception {
|
||||||
|
queryTrip("27 de Mayo", "San Miguel Arcángel");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void queryMoreTrips() throws Exception {
|
||||||
|
queryMoreTrips("Hospital", "Super Las Segovias");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getArea() throws Exception {
|
||||||
|
final Point[] polygon = provider.getArea();
|
||||||
|
assertTrue(polygon.length > 0);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue