Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev-2.x' into plan-connection
Browse files Browse the repository at this point in the history
  • Loading branch information
optionsome committed Jun 3, 2024
2 parents 997b2fd + f535524 commit 9e7e590
Show file tree
Hide file tree
Showing 167 changed files with 8,436 additions and 1,591 deletions.
1,062 changes: 680 additions & 382 deletions client-next/package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions client-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,36 @@
"@googlemaps/polyline-codec": "1.0.28",
"bootstrap": "5.3.3",
"graphql": "16.8.1",
"graphql-request": "6.1.0",
"maplibre-gl": "4.2.0",
"graphql-request": "7.0.1",
"maplibre-gl": "4.3.2",
"react": "18.3.1",
"react-bootstrap": "2.10.2",
"react-dom": "18.3.1",
"react-map-gl": "7.1.7"
},
"devDependencies": {
"@graphql-codegen/cli": "5.0.2",
"@graphql-codegen/client-preset": "4.2.5",
"@graphql-codegen/client-preset": "4.2.6",
"@graphql-codegen/introspection": "4.0.3",
"@parcel/watcher": "2.4.1",
"@testing-library/react": "15.0.7",
"@types/react": "18.3.1",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@typescript-eslint/eslint-plugin": "7.8.0",
"@typescript-eslint/parser": "7.8.0",
"@vitejs/plugin-react": "4.2.1",
"@typescript-eslint/eslint-plugin": "7.11.0",
"@typescript-eslint/parser": "7.11.0",
"@vitejs/plugin-react": "4.3.0",
"@vitest/coverage-v8": "1.6.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "6.8.0",
"eslint-plugin-react": "7.34.1",
"eslint-plugin-react": "7.34.2",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-react-refresh": "0.4.6",
"jsdom": "24.0.0",
"prettier": "3.2.5",
"eslint-plugin-react-refresh": "0.4.7",
"jsdom": "24.1.0",
"prettier": "3.3.0",
"typescript": "5.4.5",
"vite": "5.2.11",
"vite": "5.2.12",
"vitest": "1.6.0"
}
}
2 changes: 1 addition & 1 deletion client-next/src/hooks/useServerInfo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { graphql } from '../gql';
import request from 'graphql-request';
import { request } from 'graphql-request'; // eslint-disable-line import/no-unresolved
import { QueryType } from '../gql/graphql.ts';

const endpoint = import.meta.env.VITE_API_URL;
Expand Down
2 changes: 1 addition & 1 deletion client-next/src/hooks/useTripQuery.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useState } from 'react';
import { graphql } from '../gql';
import request from 'graphql-request';
import { request } from 'graphql-request'; // eslint-disable-line import/no-unresolved
import { QueryType, TripQueryVariables } from '../gql/graphql.ts';

const endpoint = import.meta.env.VITE_API_URL;
Expand Down
6 changes: 5 additions & 1 deletion docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle
- Optionally abort startup when unknown configuration parameters were detected [#5676](https://github.com/opentripplanner/OpenTripPlanner/pull/5676)
- Fix bug in heuristics cost calculation for egress legs [#5783](https://github.com/opentripplanner/OpenTripPlanner/pull/5783)
- Fix handling of implicit access and egress mode parameters. [#5821](https://github.com/opentripplanner/OpenTripPlanner/pull/5821)
- Add prettier:write to docs and rephrase slightly [ci skip] [#5831](https://github.com/opentripplanner/OpenTripPlanner/pull/5831)
- Make naming of stopTransferCosts/stopBoardAlightCosts consistent [#5822](https://github.com/opentripplanner/OpenTripPlanner/pull/5822)
- Namer for applying street names to nearby sidewalks [#5774](https://github.com/opentripplanner/OpenTripPlanner/pull/5774)
- Implement GTFS Flex safe duration spec draft [#5796](https://github.com/opentripplanner/OpenTripPlanner/pull/5796)
- Document and validate timeRange GraphQL parameter [#5834](https://github.com/opentripplanner/OpenTripPlanner/pull/5834)
- Log the origin of a request that causes a transfer cache addition. [#5874](https://github.com/opentripplanner/OpenTripPlanner/pull/5874)
- Fix handling of missing aimed departure time [#5865](https://github.com/opentripplanner/OpenTripPlanner/pull/5865)
- Add OTP request timeout GraphQL instrumentation [#5881](https://github.com/opentripplanner/OpenTripPlanner/pull/5881)
- Add feed publisher name and url to GTFS GraphQL API [#5835](https://github.com/opentripplanner/OpenTripPlanner/pull/5835)
[](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE)

## 2.5.0 (2024-03-13)
Expand Down
22 changes: 11 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@
<properties>
<otp.serialization.version.id>150</otp.serialization.version.id>
<!-- Lib versions - keep list sorted on property name -->
<geotools.version>31.0</geotools.version>
<geotools.version>31.1</geotools.version>
<google.dagger.version>2.51.1</google.dagger.version>
<jackson.version>2.17.1</jackson.version>
<jersey.version>3.1.6</jersey.version>
<jersey.version>3.1.7</jersey.version>
<junit.version>5.10.2</junit.version>
<micrometer.version>1.12.3</micrometer.version>
<micrometer.version>1.13.0</micrometer.version>
<netcdf4.version>5.5.3</netcdf4.version>
<logback.version>1.5.6</logback.version>
<lucene.version>9.10.0</lucene.version>
<slf4j.version>2.0.13</slf4j.version>
<netex-java-model.version>2.0.15</netex-java-model.version>
<siri-java-model.version>1.26</siri-java-model.version>
<siri-java-model.version>1.27</siri-java-model.version>
<jaxb-runtime.version>4.0.5</jaxb-runtime.version>
<!-- Other properties -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -209,7 +209,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
<executions>
<execution>
<id>build-helper-generate-sources</id>
Expand Down Expand Up @@ -363,7 +363,7 @@
properly if some input files are missing a terminating newline) -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
Expand Down Expand Up @@ -444,7 +444,7 @@
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.4.2</version>
<version>3.4.3</version>
<configuration>
<container>
<mainClass>org.opentripplanner.standalone.OTPMain</mainClass>
Expand Down Expand Up @@ -672,9 +672,9 @@
</dependency>

<dependency>
<groupId>org.entur.gbfs</groupId>
<groupId>org.mobilitydata</groupId>
<artifactId>gbfs-java-model</artifactId>
<version>3.1.1</version>
<version>1.0.6</version>
</dependency>

<!-- TESTING -->
Expand Down Expand Up @@ -916,7 +916,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.26.1</version>
<version>1.26.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -1013,7 +1013,7 @@
<!-- Recommended way to deploy to OSSRH , which allows deferred manual release to Central. -->
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<version>1.7.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand Down
5 changes: 3 additions & 2 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
// noise, so we slow it down a bit
{
"matchPackageNames": [
"org.entur.gbfs:gbfs-java-model"
"org.mobilitydata:gbfs-java-model"
],
"matchUpdateTypes": ["patch"],
"schedule": "on the 18th day of the month",
Expand Down Expand Up @@ -122,7 +122,8 @@
"com.google.cloud.tools:jib-maven-plugin",
"org.apache.maven.plugins:maven-shade-plugin",
"org.apache.maven.plugins:maven-compiler-plugin",
"org.apache.maven.plugins:maven-jar-plugin"
"org.apache.maven.plugins:maven-jar-plugin",
"org.sonatype.plugins:nexus-staging-maven-plugin"
],
"matchPackagePrefixes": [
"org.junit.jupiter:",
Expand Down
4 changes: 2 additions & 2 deletions src/client/debug-client-preview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="/img/otp-logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OTP Debug Client</title>
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/05/2024-05-08T07:10/assets/index-BTzXPLdZ.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/05/2024-05-08T07:10/assets/index-CrZjV0cy.css">
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/06/2024-06-03T06:10/assets/index-BYIu3HuU.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/06/2024-06-03T06:10/assets/index-CrZjV0cy.css">
</head>
<body>
<div id="root"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FlexPathTest {

static List<Arguments> cases() {
return List.of(
Arguments.of(TimePenalty.ZERO, THIRTY_MINS_IN_SECONDS),
Arguments.of(TimePenalty.NONE, THIRTY_MINS_IN_SECONDS),
Arguments.of(TimePenalty.of(Duration.ofMinutes(10), 1), 2400),
Arguments.of(TimePenalty.of(Duration.ofMinutes(10), 1.5f), 3300),
Arguments.of(TimePenalty.of(Duration.ZERO, 3), 5400)
Expand All @@ -30,8 +30,8 @@ static List<Arguments> cases() {

@ParameterizedTest
@MethodSource("cases")
void calculate(TimePenalty mod, int expectedSeconds) {
var modified = PATH.withDurationModifier(mod);
void calculate(TimePenalty penalty, int expectedSeconds) {
var modified = PATH.withTimePenalty(penalty);
assertEquals(expectedSeconds, modified.durationSeconds);
assertEquals(LineStrings.SIMPLE, modified.getGeometry());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.opentripplanner.ext.flex.trip;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.opentripplanner.graph_builder.issue.api.DataImportIssueStore.NOOP;

import java.util.List;
import org.junit.jupiter.api.Test;
import org.opentripplanner.ext.flex.FlexStopTimesForTest;
import org.opentripplanner.ext.flex.FlexTripsMapper;
import org.opentripplanner.ext.flex.flexpathcalculator.DirectFlexPathCalculator;
import org.opentripplanner.model.StopTime;
import org.opentripplanner.model.impl.OtpTransitServiceBuilder;
import org.opentripplanner.transit.model._data.TransitModelForTest;
import org.opentripplanner.transit.service.StopModel;

class FlexTripsMapperTest {

@Test
void defaultTimePenalty() {
var builder = new OtpTransitServiceBuilder(StopModel.of().build(), NOOP);
var stopTimes = List.of(stopTime(0), stopTime(1));
builder.getStopTimesSortedByTrip().addAll(stopTimes);
var trips = FlexTripsMapper.createFlexTrips(builder, NOOP);
assertEquals("[UnscheduledTrip{F:flex-1}]", trips.toString());
var unscheduled = (UnscheduledTrip) trips.getFirst();
var unchanged = unscheduled.flexPathCalculator(new DirectFlexPathCalculator());
assertInstanceOf(DirectFlexPathCalculator.class, unchanged);
}

private static StopTime stopTime(int seq) {
var st = FlexStopTimesForTest.area("08:00", "18:00");
st.setTrip(TransitModelForTest.trip("flex-1").build());
st.setStopSequence(seq);
return st;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import java.time.LocalDate;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -213,21 +215,21 @@ class StopClusters {
)
void stopClustersWithTypos(String searchTerm) {
var results = index.queryStopClusters(searchTerm).toList();
var ids = results.stream().map(StopCluster::id).toList();
var ids = results.stream().map(primaryId()).toList();
assertEquals(List.of(ALEXANDERPLATZ_STATION.getId()), ids);
}

@Test
void fuzzyStopClusters() {
var result1 = index.queryStopClusters("arts").map(StopCluster::id).toList();
var result1 = index.queryStopClusters("arts").map(primaryId()).toList();
assertEquals(List.of(ARTS_CENTER.getId()), result1);
}

@Test
void deduplicatedStopClusters() {
var result = index.queryStopClusters("lich").toList();
assertEquals(1, result.size());
assertEquals(LICHTERFELDE_OST_1.getName().toString(), result.getFirst().name());
assertEquals(LICHTERFELDE_OST_1.getName().toString(), result.getFirst().primary().name());
}

@ParameterizedTest
Expand Down Expand Up @@ -259,7 +261,7 @@ void deduplicatedStopClusters() {
}
)
void stopClustersWithSpace(String query) {
var result = index.queryStopClusters(query).map(StopCluster::id).toList();
var result = index.queryStopClusters(query).map(primaryId()).toList();
assertEquals(List.of(FIVE_POINTS_STATION.getId()), result);
}

Expand All @@ -268,24 +270,28 @@ void stopClustersWithSpace(String query) {
void fuzzyStopCode(String query) {
var result = index.queryStopClusters(query).toList();
assertEquals(1, result.size());
assertEquals(ARTS_CENTER.getName().toString(), result.getFirst().name());
assertEquals(ARTS_CENTER.getName().toString(), result.getFirst().primary().name());
}

@Test
void modes() {
var result = index.queryStopClusters("westh").toList();
assertEquals(1, result.size());
var stop = result.getFirst();
assertEquals(WESTHAFEN.getName().toString(), stop.name());
assertEquals(List.of(FERRY.name(), BUS.name()), stop.modes());
var cluster = result.getFirst();
assertEquals(WESTHAFEN.getName().toString(), cluster.primary().name());
assertEquals(List.of(FERRY.name(), BUS.name()), cluster.primary().modes());
}

@Test
void agenciesAndFeedPublisher() {
var result = index.queryStopClusters("alexanderplatz").toList().getFirst();
assertEquals(ALEXANDERPLATZ_STATION.getName().toString(), result.name());
assertEquals(List.of(StopClusterMapper.toAgency(BVG)), result.agencies());
assertEquals("A Publisher", result.feedPublisher().name());
var cluster = index.queryStopClusters("alexanderplatz").toList().getFirst();
assertEquals(ALEXANDERPLATZ_STATION.getName().toString(), cluster.primary().name());
assertEquals(List.of(StopClusterMapper.toAgency(BVG)), cluster.primary().agencies());
assertEquals("A Publisher", cluster.primary().feedPublisher().name());
}
}

private static @Nonnull Function<StopCluster, FeedScopedId> primaryId() {
return c -> c.primary().id();
}
}
Loading

0 comments on commit 9e7e590

Please sign in to comment.