mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-14 16:40:30 +00:00
Navitia: Add support for products in queryTrips.
This commit is contained in:
parent
54ea75fefc
commit
6255bd1d76
2 changed files with 34 additions and 1 deletions
|
@ -1019,6 +1019,35 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider
|
|||
queryUri.append("&last_section_mode=bike");
|
||||
}
|
||||
|
||||
// Set forbidden commercial modes.
|
||||
if (!products.equals(Product.ALL))
|
||||
{
|
||||
if (!products.contains(Product.SUBURBAN_TRAIN))
|
||||
{
|
||||
queryUri.append("&forbidden_uris[]=commercial_mode:train");
|
||||
}
|
||||
if (!products.contains(Product.SUBWAY))
|
||||
{
|
||||
queryUri.append("&forbidden_uris[]=commercial_mode:metro");
|
||||
}
|
||||
if (!products.contains(Product.TRAM))
|
||||
{
|
||||
queryUri.append("&forbidden_uris[]=commercial_mode:tram");
|
||||
}
|
||||
if (!products.contains(Product.BUS))
|
||||
{
|
||||
queryUri.append("&forbidden_uris[]=commercial_mode:bus");
|
||||
}
|
||||
if (!products.contains(Product.FERRY))
|
||||
{
|
||||
queryUri.append("&forbidden_uris[]=commercial_mode:ferry");
|
||||
}
|
||||
if (!products.contains(Product.CABLECAR))
|
||||
{
|
||||
queryUri.append("&forbidden_uris[]=commercial_mode:cablecar");
|
||||
}
|
||||
}
|
||||
|
||||
final CharSequence page = ParserUtils.scrape(queryUri.toString(), authorization);
|
||||
|
||||
// System.out.println(queryUri);
|
||||
|
|
|
@ -22,6 +22,8 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -228,8 +230,10 @@ public class ParisProviderLiveTest extends AbstractProviderLiveTest
|
|||
@Test
|
||||
public void queryTripNoSolution() throws Exception
|
||||
{
|
||||
final List<Product> emptyList = new LinkedList<Product>();
|
||||
|
||||
final QueryTripsResult result = queryTrips(new Location(LocationType.STATION, "stop_point:RTP:SP:3926410"), null, new Location(
|
||||
LocationType.STATION, "stop_point:RTP:SP:3926410"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
LocationType.STATION, "stop_point:RTP:SP:3926410"), new Date(), true, emptyList, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
|
||||
|
||||
assertEquals(QueryTripsResult.Status.NO_TRIPS, result.status);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue