Skip to content

Commit

Permalink
Adapt to navitia.io configuration (one single country provider)
Browse files Browse the repository at this point in the history
  • Loading branch information
ialokim authored and Felix Delattre committed Mar 1, 2018
1 parent 4fc547f commit a55f616
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 60 deletions.
44 changes: 0 additions & 44 deletions enabler/src/de/schildbach/pte/ManaguaProvider.java

This file was deleted.

2 changes: 1 addition & 1 deletion enabler/src/de/schildbach/pte/NetworkId.java
Expand Up @@ -91,5 +91,5 @@ public enum NetworkId {
GHANA,

// Nicaragua
ESTELI, MANAGUA,
NICARAGUA,
}
@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2014-2015 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
Expand All @@ -17,23 +17,14 @@

package de.schildbach.pte;

import okhttp3.HttpUrl;

/**
* @author Nico Alt
* @author ialokim
*/
public class EsteliProvider extends AbstractNavitiaProvider {
private static String API_REGION = "ni-esteli";

public EsteliProvider(final HttpUrl apiBase, final String authorization) {
super(NetworkId.ESTELI, apiBase, authorization);

setTimeZone("America/Managua");
}

public EsteliProvider(final String authorization) {
super(NetworkId.ESTELI, authorization);
public class NicaraguaProvider extends AbstractNavitiaProvider {
private static final String API_REGION = "ni";

public NicaraguaProvider(final String authorization) {
super(NetworkId.NICARAGUA, authorization);
setTimeZone("America/Managua");
}

Expand Down
85 changes: 85 additions & 0 deletions enabler/test/de/schildbach/pte/live/NicaraguaProviderLiveTest.java
@@ -0,0 +1,85 @@
/*
* Copyright 2015-2016 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 <http://www.gnu.org/licenses/>.
*/

package de.schildbach.pte.live;

import org.junit.Test;

import de.schildbach.pte.NicaraguaProvider;
import de.schildbach.pte.dto.Point;

import static org.junit.Assert.assertTrue;

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);
}
}

0 comments on commit a55f616

Please sign in to comment.