Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev-2.x' into upstream-merge-2…
Browse files Browse the repository at this point in the history
…023-11-14
  • Loading branch information
leonardehrenfried committed Nov 20, 2023
2 parents 2d43aea + 3be1f0c commit 5e9d486
Show file tree
Hide file tree
Showing 74 changed files with 967 additions and 2,747 deletions.
2 changes: 1 addition & 1 deletion docs/BuildConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ case where this is not the case.
{
"type" : "gtfs",
"feedId" : "SE",
"source" : "gs://BUCKET/OTP_GCS_WORK_DIR/sweeden-gtfs.obj"
"source" : "https://skanetrafiken.se/download/sweden.gtfs.zip"
},
{
"type" : "netex",
Expand Down
5 changes: 5 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle
- Add Roadmap setup docs [#5468](https://github.com/opentripplanner/OpenTripPlanner/pull/5468)
- Interpolate increasing stop times for GTFS-RT cancelled trips [#5348](https://github.com/opentripplanner/OpenTripPlanner/pull/5348)
- Remove itineraries outside the search window in arriveBy search [#5433](https://github.com/opentripplanner/OpenTripPlanner/pull/5433)
- Add back walk-reluctance in Transmodel API [#5471](https://github.com/opentripplanner/OpenTripPlanner/pull/5471)
- Make `feedId` required for realtime updaters [#5502](https://github.com/opentripplanner/OpenTripPlanner/pull/5502)
- Fix serialization of `AtomicInteger` [#5508](https://github.com/opentripplanner/OpenTripPlanner/pull/5508)
- Improve linking of fixed stops used by flex trips [#5503](https://github.com/opentripplanner/OpenTripPlanner/pull/5503)
- Keep min transfer filter is not local to group-by-filters [#5436](https://github.com/opentripplanner/OpenTripPlanner/pull/5436)
[](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE)

## 2.4.0 (2023-09-13)
Expand Down
3 changes: 2 additions & 1 deletion docs/RouterConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,8 @@ Used to group requests when monitoring OTP.
]
},
{
"type" : "websocket-gtfs-rt-updater"
"type" : "websocket-gtfs-rt-updater",
"feedId" : "ov"
},
{
"type" : "siri-et-updater",
Expand Down
9 changes: 5 additions & 4 deletions docs/UpdaterConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The information is downloaded in a single HTTP request and polled regularly.
|---------------------------|:---------------:|------------------------------------------------------------------------------|:----------:|---------------|:-----:|
| type = "real-time-alerts" | `enum` | The type of the updater. | *Required* | | 1.5 |
| earlyStartSec | `integer` | How long before the posted start of an event it should be displayed to users | *Optional* | `0` | 1.5 |
| feedId | `string` | The id of the feed to apply the alerts to. | *Optional* | | 1.5 |
| feedId | `string` | The id of the feed to apply the alerts to. | *Required* | | 1.5 |
| frequency | `duration` | How often the URL should be fetched. | *Optional* | `"PT1M"` | 1.5 |
| fuzzyTripMatching | `boolean` | Whether to match trips fuzzily. | *Optional* | `false` | 1.5 |
| url | `string` | URL to fetch the GTFS-RT feed from. | *Required* | | 1.5 |
Expand Down Expand Up @@ -93,7 +93,7 @@ The information is downloaded in a single HTTP request and polled regularly.
|-----------------------------------------------------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|----------------------|:-----:|
| type = "stop-time-updater" | `enum` | The type of the updater. | *Required* | | 1.5 |
| [backwardsDelayPropagationType](#u__5__backwardsDelayPropagationType) | `enum` | How backwards propagation should be handled. | *Optional* | `"required-no-data"` | 2.2 |
| feedId | `string` | Which feed the updates apply to. | *Optional* | | 1.5 |
| feedId | `string` | Which feed the updates apply to. | *Required* | | 1.5 |
| frequency | `duration` | How often the data should be downloaded. | *Optional* | `"PT1M"` | 1.5 |
| fuzzyTripMatching | `boolean` | If the trips should be matched fuzzily. | *Optional* | `false` | 1.5 |
| [url](#u__5__url) | `string` | The URL of the GTFS-RT resource. | *Required* | | 1.5 |
Expand Down Expand Up @@ -181,7 +181,7 @@ file.
|-----------------------------------------------------------------------|:---------:|--------------------------|:----------:|----------------------|:-----:|
| type = "websocket-gtfs-rt-updater" | `enum` | The type of the updater. | *Required* | | 1.5 |
| [backwardsDelayPropagationType](#u__7__backwardsDelayPropagationType) | `enum` | TODO | *Optional* | `"required-no-data"` | 1.5 |
| feedId | `string` | TODO | *Optional* | | 1.5 |
| feedId | `string` | TODO | *Required* | | 1.5 |
| reconnectPeriodSec | `integer` | TODO | *Optional* | `60` | 1.5 |
| url | `string` | TODO | *Optional* | | 1.5 |

Expand All @@ -205,7 +205,8 @@ TODO
{
"updaters" : [
{
"type" : "websocket-gtfs-rt-updater"
"type" : "websocket-gtfs-rt-updater",
"feedId" : "ov"
}
]
}
Expand Down
12 changes: 6 additions & 6 deletions docs/sandbox/VehicleParking.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ All updaters have the following parameters in common:
| type = "vehicle-parking" | `enum` | The type of the updater. | *Required* | | 1.5 |
| facilitiesFrequencySec | `integer` | How often the facilities should be updated. | *Optional* | `3600` | 2.2 |
| facilitiesUrl | `string` | URL of the facilities. | *Optional* | | 2.2 |
| [feedId](#u__2__feedId) | `string` | The name of the data source. | *Optional* | | 2.2 |
| [feedId](#u__2__feedId) | `string` | The name of the data source. | *Required* | | 2.2 |
| hubsUrl | `string` | Hubs URL | *Optional* | | 2.2 |
| [sourceType](#u__2__sourceType) | `enum` | The source of the vehicle updates. | *Required* | | 2.2 |
| [timeZone](#u__2__timeZone) | `time-zone` | The time zone of the feed. | *Optional* | | 2.2 |
Expand All @@ -49,7 +49,7 @@ All updaters have the following parameters in common:

<h4 id="u__2__feedId">feedId</h4>

**Since version:** `2.2`**Type:** `string`**Cardinality:** `Optional`
**Since version:** `2.2`**Type:** `string`**Cardinality:** `Required`
**Path:** /updaters/[2]

The name of the data source.
Expand Down Expand Up @@ -106,7 +106,7 @@ Used for converting abstract opening hours into concrete points in time.
| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since |
|---------------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:|
| type = "vehicle-parking" | `enum` | The type of the updater. | *Required* | | 1.5 |
| [feedId](#u__3__feedId) | `string` | The name of the data source. | *Optional* | | 2.2 |
| [feedId](#u__3__feedId) | `string` | The name of the data source. | *Required* | | 2.2 |
| frequency | `duration` | How often to update the source. | *Optional* | `"PT1M"` | 2.2 |
| [sourceType](#u__3__sourceType) | `enum` | The source of the vehicle updates. | *Required* | | 2.2 |
| [timeZone](#u__3__timeZone) | `time-zone` | The time zone of the feed. | *Optional* | | 2.2 |
Expand All @@ -119,7 +119,7 @@ Used for converting abstract opening hours into concrete points in time.

<h4 id="u__3__feedId">feedId</h4>

**Since version:** `2.2`**Type:** `string`**Cardinality:** `Optional`
**Since version:** `2.2`**Type:** `string`**Cardinality:** `Required`
**Path:** /updaters/[3]

The name of the data source.
Expand Down Expand Up @@ -193,7 +193,7 @@ Tags to add to the parking lots.
| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since |
|---------------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:|
| type = "vehicle-parking" | `enum` | The type of the updater. | *Required* | | 1.5 |
| [feedId](#u__4__feedId) | `string` | The name of the data source. | *Optional* | | 2.2 |
| [feedId](#u__4__feedId) | `string` | The name of the data source. | *Required* | | 2.2 |
| frequency | `duration` | How often to update the source. | *Optional* | `"PT1M"` | 2.3 |
| [sourceType](#u__4__sourceType) | `enum` | The source of the vehicle updates. | *Required* | | 2.2 |
| url | `string` | URL of the locations endpoint. | *Optional* | | 2.3 |
Expand All @@ -204,7 +204,7 @@ Tags to add to the parking lots.

<h4 id="u__4__feedId">feedId</h4>

**Since version:** `2.2`**Type:** `string`**Cardinality:** `Optional`
**Since version:** `2.2`**Type:** `string`**Cardinality:** `Required`
**Path:** /updaters/[4]

The name of the data source.
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@


<properties>
<otp.serialization.version.id>126</otp.serialization.version.id>
<otp.serialization.version.id>128</otp.serialization.version.id>
<!-- Lib versions - keep list sorted on property name -->
<geotools.version>30.0</geotools.version>
<google.dagger.version>2.48.1</google.dagger.version>
Expand Down Expand Up @@ -965,7 +965,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.24.0</version>
<version>1.25.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.opentripplanner.ext.emissions;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.File;
import org.junit.jupiter.api.Test;
Expand All @@ -13,6 +14,8 @@ public class Co2EmissionsDataReaderTest {
private static final File CO2_GTFS_ZIP = RES.file("emissions-test-gtfs.zip");
private static final File CO2_GTFS = RES.file("emissions-test-gtfs/");
private static final File INVALID_CO2_GTFS = RES.file("emissions-invalid-test-gtfs/");
private static final File CO2_MISSING_GTFS_ZIP = RES.file("emissions-missing-test-gtfs.zip");
private static final File CO2_MISSING_GTFS = RES.file("emissions-missing-test-gtfs");

private Co2EmissionsDataReader co2EmissionsDataReader = new Co2EmissionsDataReader(
new DefaultDataImportIssueStore()
Expand All @@ -35,4 +38,16 @@ void testInvalidCo2EmissionsDataReading() {
var emissions = co2EmissionsDataReader.readGtfs(INVALID_CO2_GTFS);
assertEquals(0, emissions.size());
}

@Test
void testMissingCo2EmissionsZipDataReading() {
var emissions = co2EmissionsDataReader.readGtfsZip(CO2_MISSING_GTFS_ZIP);
assertTrue(emissions.isEmpty());
}

@Test
void testMissingCo2EmissionsDataReading() {
var emissions = co2EmissionsDataReader.readGtfs(CO2_MISSING_GTFS);
assertTrue(emissions.isEmpty());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package org.opentripplanner.ext.emissions;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.opentripplanner.datastore.api.FileType.GTFS;
import static org.opentripplanner.standalone.config.framework.json.JsonSupport.jsonNodeFromResource;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import java.io.File;
import java.util.Optional;
import org.junit.jupiter.api.Test;
import org.opentripplanner.datastore.api.DataSource;
import org.opentripplanner.datastore.api.FileType;
import org.opentripplanner.datastore.file.FileDataSource;
import org.opentripplanner.framework.application.OtpFileNames;
import org.opentripplanner.graph_builder.ConfiguredDataSource;
import org.opentripplanner.gtfs.graphbuilder.GtfsFeedParameters;
import org.opentripplanner.standalone.config.BuildConfig;
import org.opentripplanner.test.support.ResourceLoader;
import org.opentripplanner.transit.model.framework.FeedScopedId;

public class EmissionsModuleTest {

private final ResourceLoader RES = ResourceLoader.of(EmissionsModuleTest.class);
private final File CO2_GTFS_ZIP = RES.file("emissions-test-gtfs.zip");
private final File CO2_GTFS = RES.file("emissions-test-gtfs/");
private final String CONFIG_PATH = "standalone/config/" + OtpFileNames.BUILD_CONFIG_FILENAME;
private final BuildConfig buildConfig = new BuildConfig(
jsonNodeFromResource(CONFIG_PATH),
CONFIG_PATH,
true
);
private final Multimap<FileType, DataSource> inputData = ArrayListMultimap.create();

@Test
void testMultipleGtfsDataReading() {
inputData.put(GTFS, new FileDataSource(CO2_GTFS_ZIP, GTFS));
inputData.put(GTFS, new FileDataSource(CO2_GTFS, GTFS));
Iterable<ConfiguredDataSource<GtfsFeedParameters>> configuredDataSource = getGtfsConfiguredDatasource();
EmissionsDataModel emissionsDataModel = new EmissionsDataModel();
EmissionsModule emissionsModule = new EmissionsModule(
configuredDataSource,
buildConfig,
emissionsDataModel,
null
);
emissionsModule.buildGraph();
assertEquals(
Optional.of(0.006),
emissionsDataModel.getCO2EmissionsById(new FeedScopedId("emissionstest", "1001"))
);
assertEquals(
Optional.of(0.041),
emissionsDataModel.getCO2EmissionsById(new FeedScopedId("emissionstest1", "1002"))
);
}

private Iterable<ConfiguredDataSource<GtfsFeedParameters>> getGtfsConfiguredDatasource() {
return inputData
.get(GTFS)
.stream()
.map(it -> new ConfiguredDataSource<>(it, getGtfsFeedConfig(it)))
.toList();
}

private GtfsFeedParameters getGtfsFeedConfig(DataSource dataSource) {
return buildConfig.transitFeeds
.gtfsFeeds()
.stream()
.findFirst()
.orElse(buildConfig.gtfsDefaults.copyOf().withSource(dataSource.uri()).build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.opentripplanner.framework.application.OTPFeature;
import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore;
import org.opentripplanner.graph_builder.module.DirectTransferGenerator;
import org.opentripplanner.graph_builder.module.StreetLinkerModule;
import org.opentripplanner.graph_builder.module.TestStreetLinkerModule;
import org.opentripplanner.gtfs.graphbuilder.GtfsBundle;
import org.opentripplanner.gtfs.graphbuilder.GtfsModule;
import org.opentripplanner.model.GenericLocation;
Expand All @@ -34,7 +34,6 @@
import org.opentripplanner.routing.api.request.RouteRequest;
import org.opentripplanner.routing.api.request.request.filter.AllowAllTransitFilter;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.test.support.ResourceLoader;
import org.opentripplanner.transit.service.TransitModel;

/**
Expand Down Expand Up @@ -186,7 +185,7 @@ private static void addGtfsToGraph(Graph graph, TransitModel transitModel, List<
gtfsModule.buildGraph();

// link stations to streets
StreetLinkerModule.linkStreetsForTestOnly(graph, transitModel);
TestStreetLinkerModule.link(graph, transitModel);

// link flex locations to streets
new AreaStopsToVerticesMapper(graph, transitModel).buildGraph();
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feed_publisher_name,feed_publisher_url,feed_lang,feed_start_date,feed_end_date,feed_version,feed_id
emissionstest,http://www.emissionstest.fi/,fi,20230623,20230806,2023-06-23 22:42:09,emissionstest
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
feed_publisher_name,feed_publisher_url,feed_lang,feed_start_date,feed_end_date,feed_version,feed_id
emissionstest,http://www.emissionstest.fi/,fi,20230623,20230806,2023-06-23 22:42:09,emissionstest
emissionstest,http://www.emissionstest.fi/,fi,20230623,20230806,2023-06-23 22:42:09,emissionstest1
2 changes: 1 addition & 1 deletion src/ext/graphql/transmodelapi/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ type QueryType {
"Date and time for the earliest time the user is willing to start the journey (if arriveBy=false/not set) or the latest acceptable time of arriving (arriveBy=true). Defaults to now"
dateTime: DateTime,
"Debug the itinerary-filter-chain. OTP will attach a system notice to itineraries instead of removing them. This is very convenient when tuning the filters."
debugItineraryFilter: Boolean = false,
debugItineraryFilter: Boolean = false @deprecated(reason : "Use `itineraryFilter.debug` instead."),
"A list of filters for which trips should be included. A trip will be included if it matches with at least one filter. An empty list of filters means that all trips should be included. If a search include this parameter, \"whiteListed\", \"banned\" & \"modes.transportModes\" filters will be ignored."
filters: [TripFilterInput!],
"The start location"
Expand Down
Loading

0 comments on commit 5e9d486

Please sign in to comment.