Skip to content

Commit a06ed19

Browse files
committed
Merge remote-tracking branch 'upstream/dev-2.x' into plan-connection-defaults
2 parents 76db9b5 + 7284086 commit a06ed19

File tree

141 files changed

+3526
-1965
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+3526
-1965
lines changed

.github/workflows/performance-test.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
cp otp-shaded/target/otp-shaded-*-SNAPSHOT.jar otp.jar
9292
java -Xmx32G -jar otp.jar --build --save test/performance/${{ matrix.location }}/
9393
94-
- name: Run speed test
94+
- name: Run RAPTOR speed test
9595
if: matrix.profile == 'core' || github.ref == 'refs/heads/dev-2.x'
9696
env:
9797
PERFORMANCE_INFLUX_DB_PASSWORD: ${{ secrets.PERFORMANCE_INFLUX_DB_PASSWORD }}
@@ -113,3 +113,12 @@ jobs:
113113
with:
114114
name: ${{ matrix.location }}-flight-recorder
115115
path: application/${{ matrix.location }}-speed-test.jfr
116+
117+
- name: Run transfer cache speed test
118+
if: matrix.profile == 'core' || github.ref == 'refs/heads/dev-2.x'
119+
env:
120+
PERFORMANCE_INFLUX_DB_PASSWORD: ${{ secrets.PERFORMANCE_INFLUX_DB_PASSWORD }}
121+
SPEEDTEST_LOCATION: ${{ matrix.location }}
122+
MAVEN_OPTS: "-Xmx50g -Dmaven.repo.local=/home/lenni/.m2/repository/"
123+
run: |
124+
mvn --projects application exec:java -Dexec.mainClass="org.opentripplanner.transit.speed_test.TransferCacheTest" -Dexec.classpathScope=test -Dexec.args="--dir=test/performance/${{ matrix.location }}"

application/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@
296296
<dependency>
297297
<groupId>org.onebusaway</groupId>
298298
<artifactId>onebusaway-gtfs</artifactId>
299-
<version>4.3.0</version>
299+
<version>5.0.0</version>
300300
</dependency>
301301
<!-- Processing is used for the debug GUI (though we could probably use just Java2D) -->
302302
<dependency>
@@ -312,9 +312,9 @@
312312
</dependency>
313313
<!-- OpenStreetMap protobuf (PBF) definitions and parser -->
314314
<dependency>
315-
<groupId>org.openstreetmap.osmosis</groupId>
316-
<artifactId>osmosis-osm-binary</artifactId>
317-
<version>0.48.3</version>
315+
<groupId>org.openstreetmap.pbf</groupId>
316+
<artifactId>osmpbf</artifactId>
317+
<version>1.6.0</version>
318318
</dependency>
319319
<!-- Command line parameter parsing -->
320320
<dependency>

application/src/client/graphiql/index.html

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@
3030
copy them directly into your environment, or perhaps include them in your
3131
favored resource bundler.
3232
-->
33-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/graphiql@3.0.4/graphiql.min.css" integrity="sha256-wTzfn13a+pLMB5rMeysPPR1hO7x0SwSeQI+cnw7VdbE=" crossorigin="anonymous">
33+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/graphiql@3.8.3/graphiql.min.css" integrity="sha256-sYaCR/jgUCzYaeWB9fPLVbM0hi5/UbHWy6zhEFm5rcI=" crossorigin="anonymous">
3434
<title>OTP GraphQL Explorer</title>
3535
</head>
3636

3737
<body>
3838
<div id="graphiql">Loading...</div>
39-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/graphiql.min.js" integrity="sha256-t0BNtgZ2L82dpHhlgKJl4yJ1tbQxcp1N5NkEjR82A7E=" crossorigin="anonymous"></script>
39+
40+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/graphiql.min.js" integrity="sha256-IvqrlAZ7aV5feVlhn75obrzIlVACoMl9mGvLukrUvCw=" crossorigin="anonymous"></script>
4041

4142
<script>
4243
const gtfsExampleQuery = `
@@ -131,6 +132,11 @@
131132
updateURL();
132133
}
133134

135+
function onEditHeaders(headers) {
136+
parameters.headers = headers;
137+
updateURL();
138+
}
139+
134140
function updateURL() {
135141
if(parameters["query"] !== gtfsExampleQuery && parameters["query"] !== transmodelExampleQuery) {
136142

@@ -168,16 +174,18 @@
168174
window.location.reload();
169175
};
170176

171-
function graphQLFetcher(graphQLParams) {
177+
function graphQLFetcher(query, { headers }) {
178+
const defaultHeaders = {
179+
Accept: 'application/json',
180+
'Content-Type': 'application/json',
181+
}
182+
const mergedHeaders = Object.assign({}, defaultHeaders, headers);
172183
return fetch(
173184
urls[apiFlavor],
174185
{
175186
method: 'post',
176-
headers: {
177-
Accept: 'application/json',
178-
'Content-Type': 'application/json',
179-
},
180-
body: JSON.stringify(graphQLParams),
187+
headers: mergedHeaders,
188+
body: JSON.stringify(query),
181189
credentials: 'omit',
182190
},
183191
).then(function (response) {
@@ -198,10 +206,12 @@
198206
defaultVariableEditorOpen: true,
199207
query: parameters.query || defaultQueries[apiFlavor],
200208
variables: parameters.variables,
209+
headers: parameters.headers,
201210
operationName: parameters.operationName,
202211
onEditQuery: onEditQuery,
203212
onEditVariables: onEditVariables,
204213
onEditOperationName: onEditOperationName,
214+
onEditHeaders: onEditHeaders,
205215
defaultEditorToolsVisibility: true
206216
},
207217
React.createElement(GraphiQL.Logo, {}, [header, select]));

application/src/client/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<link rel="icon" type="image/svg+xml" href="/img/otp-logo.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>OTP Debug</title>
8-
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2025/01/2025-01-02T15:56/assets/index-DODY0n0n.js"></script>
9-
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2025/01/2025-01-02T15:56/assets/index-BDL0-veX.css">
8+
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2025/01/2025-01-20T08:56/assets/index-BKHYHPIc.js"></script>
9+
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2025/01/2025-01-20T08:56/assets/index-BDL0-veX.css">
1010
</head>
1111
<body>
1212
<div id="root"></div>

application/src/ext-test/java/org/opentripplanner/ext/restapi/mapping/EnumMapperTest.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,11 @@
88
import java.util.Map;
99
import java.util.function.Function;
1010
import org.junit.jupiter.api.Test;
11-
import org.opentripplanner.ext.restapi.model.ApiAbsoluteDirection;
12-
import org.opentripplanner.ext.restapi.model.ApiRelativeDirection;
1311
import org.opentripplanner.ext.restapi.model.ApiVertexType;
14-
import org.opentripplanner.model.plan.AbsoluteDirection;
15-
import org.opentripplanner.model.plan.RelativeDirection;
1612
import org.opentripplanner.model.plan.VertexType;
1713

1814
public class EnumMapperTest {
1915

20-
private static final String MSG =
21-
"Assert that the API enums have the exact same values that " +
22-
"the domain enums of the same type, and that the specialized mapper is mapping all " +
23-
"values. If this assumtion does not hold, create a new test.";
24-
25-
@Test
26-
public void map() {
27-
try {
28-
verifyExactMatch(
29-
AbsoluteDirection.class,
30-
ApiAbsoluteDirection.class,
31-
AbsoluteDirectionMapper::mapAbsoluteDirection
32-
);
33-
verifyExactMatch(
34-
RelativeDirection.class,
35-
ApiRelativeDirection.class,
36-
RelativeDirectionMapper::mapRelativeDirection
37-
);
38-
} catch (RuntimeException ex) {
39-
System.out.println(MSG);
40-
throw ex;
41-
}
42-
}
43-
4416
@Test
4517
public void testVertexTypeMapping() {
4618
verifyExplicitMatch(
@@ -75,17 +47,4 @@ private <D extends Enum<?>, A extends Enum<?>> void verifyExplicitMatch(
7547
assertTrue(rest.isEmpty());
7648
}
7749

78-
private <D extends Enum<?>, A extends Enum<?>> void verifyExactMatch(
79-
Class<D> domainClass,
80-
Class<A> apiClass,
81-
Function<D, A> mapper
82-
) {
83-
List<A> rest = new ArrayList<>(List.of(apiClass.getEnumConstants()));
84-
for (D it : domainClass.getEnumConstants()) {
85-
A result = mapper.apply(it);
86-
assertEquals(result.name(), it.name());
87-
rest.remove(result);
88-
}
89-
assertTrue(rest.isEmpty());
90-
}
9150
}

application/src/ext-test/java/org/opentripplanner/ext/vehicleparking/bikely/BikelyUpdaterTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import java.time.Duration;
99
import java.util.Locale;
10+
import org.junit.jupiter.api.Disabled;
1011
import org.junit.jupiter.api.Test;
1112
import org.opentripplanner.service.vehicleparking.model.VehicleParkingState;
1213
import org.opentripplanner.test.support.ResourceLoader;
@@ -17,6 +18,7 @@
1718
public class BikelyUpdaterTest {
1819

1920
@Test
21+
@Disabled
2022
void parseBikeBoxes() {
2123
var uri = ResourceLoader.of(this).uri("bikely.json");
2224
var parameters = new BikelyUpdaterParameters(
@@ -41,8 +43,9 @@ void parseBikeBoxes() {
4143

4244
assertEquals(
4345
"First 12 hour(s) is NOK0.00, afterwards NOK10.00 per 1 hour(s)",
44-
first.getNote().toString(Locale.ENGLISH)
46+
first.getNote().toString(Locale.ROOT)
4547
);
48+
// This test fails in the entur ci pipline
4649
assertEquals(
4750
"Første 12 time(r) er kr 0,00. Deretter kr 10,00 per 1 time(r)",
4851
first.getNote().toString(Locales.NORWEGIAN_BOKMAL)

application/src/ext/java/org/opentripplanner/ext/flex/template/AbstractFlexTemplate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private FlexAccessEgress createFlexAccessEgress(
199199
return null;
200200
}
201201

202-
final var finalStateOpt = EdgeTraverser.traverseEdges(afterFlexState, transferEdges);
202+
final var finalStateOpt = EdgeTraverser.traverseEdges(afterFlexState[0], transferEdges);
203203

204204
return finalStateOpt
205205
.map(finalState -> {

application/src/ext/java/org/opentripplanner/ext/flex/template/FlexDirectPathFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private Optional<DirectFlexPath> createDirectGraphPath(
113113

114114
final State[] afterFlexState = flexEdge.traverse(accessNearbyStop.state);
115115

116-
var finalStateOpt = EdgeTraverser.traverseEdges(afterFlexState, egress.edges);
116+
var finalStateOpt = EdgeTraverser.traverseEdges(afterFlexState[0], egress.edges);
117117

118118
if (finalStateOpt.isEmpty()) {
119119
return Optional.empty();

application/src/ext/java/org/opentripplanner/ext/geocoder/LuceneIndex.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import org.apache.lucene.analysis.standard.StandardAnalyzer;
1919
import org.apache.lucene.codecs.Codec;
2020
import org.apache.lucene.codecs.PostingsFormat;
21-
import org.apache.lucene.codecs.lucene912.Lucene912Codec;
21+
import org.apache.lucene.codecs.lucene101.Lucene101Codec;
2222
import org.apache.lucene.document.Document;
2323
import org.apache.lucene.document.Field.Store;
2424
import org.apache.lucene.document.StoredField;
@@ -34,7 +34,7 @@
3434
import org.apache.lucene.search.FuzzyQuery;
3535
import org.apache.lucene.search.PrefixQuery;
3636
import org.apache.lucene.search.TermQuery;
37-
import org.apache.lucene.search.suggest.document.Completion912PostingsFormat;
37+
import org.apache.lucene.search.suggest.document.Completion101PostingsFormat;
3838
import org.apache.lucene.search.suggest.document.CompletionAnalyzer;
3939
import org.apache.lucene.search.suggest.document.ContextQuery;
4040
import org.apache.lucene.search.suggest.document.ContextSuggestField;
@@ -203,8 +203,8 @@ private StopCluster toStopCluster(Document document) {
203203

204204
static IndexWriterConfig iwcWithSuggestField(Analyzer analyzer, final Set<String> suggestFields) {
205205
IndexWriterConfig iwc = new IndexWriterConfig(analyzer);
206-
Codec filterCodec = new Lucene912Codec() {
207-
final PostingsFormat postingsFormat = new Completion912PostingsFormat();
206+
Codec filterCodec = new Lucene101Codec() {
207+
final PostingsFormat postingsFormat = new Completion101PostingsFormat();
208208

209209
@Override
210210
public PostingsFormat getPostingsFormatForField(String field) {
@@ -285,7 +285,7 @@ private Stream<Document> matchingDocuments(
285285
.stream(topDocs.scoreDocs)
286286
.map(scoreDoc -> {
287287
try {
288-
return searcher.doc(scoreDoc.doc);
288+
return searcher.storedFields().document(scoreDoc.doc);
289289
} catch (IOException e) {
290290
throw new RuntimeException(e);
291291
}
@@ -330,7 +330,7 @@ private Stream<Document> matchingDocuments(
330330
.stream(topDocs.scoreDocs)
331331
.map(scoreDoc -> {
332332
try {
333-
return searcher.doc(scoreDoc.doc);
333+
return searcher.storedFields().document(scoreDoc.doc);
334334
} catch (IOException e) {
335335
throw new RuntimeException(e);
336336
}

application/src/ext/java/org/opentripplanner/ext/restapi/mapping/RelativeDirectionMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static ApiRelativeDirection mapRelativeDirection(RelativeDirection domain
1414
case HARD_LEFT -> ApiRelativeDirection.HARD_LEFT;
1515
case LEFT -> ApiRelativeDirection.LEFT;
1616
case SLIGHTLY_LEFT -> ApiRelativeDirection.SLIGHTLY_LEFT;
17-
case CONTINUE -> ApiRelativeDirection.CONTINUE;
17+
case CONTINUE, ENTER_OR_EXIT_STATION -> ApiRelativeDirection.CONTINUE;
1818
case SLIGHTLY_RIGHT -> ApiRelativeDirection.SLIGHTLY_RIGHT;
1919
case RIGHT -> ApiRelativeDirection.RIGHT;
2020
case HARD_RIGHT -> ApiRelativeDirection.HARD_RIGHT;

application/src/ext/java/org/opentripplanner/ext/restapi/mapping/WalkStepMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public ApiWalkStep mapWalkStep(WalkStep domain) {
3939
api.streetName = domain.getDirectionText().toString(locale);
4040
api.absoluteDirection =
4141
domain.getAbsoluteDirection().map(AbsoluteDirectionMapper::mapAbsoluteDirection).orElse(null);
42-
api.exit = domain.getExit();
42+
api.exit = domain.highwayExit().orElse(null);
4343
api.stayOn = domain.isStayOn();
4444
api.area = domain.getArea();
4545
api.bogusName = domain.nameIsDerived();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use:
2+
# <TypeName>[.<FieldName>].(description|deprecated)[.append]
3+
#
4+
# Examples
5+
# // Replace the existing type description
6+
# Quay.description=The place for boarding/alighting a vehicle
7+
#
8+
# // Append to the existing type description
9+
# Quay.description.append=Append
10+
#
11+
# // Replace the existing field description
12+
# Quay.name.description=The public name
13+
#
14+
# // Append to the existing field description
15+
# Quay.name.description.append=(Source NSR)
16+
#
17+
# // Insert deprecated reason. Due to a bug in the Java GraphQL lib, an existing deprecated
18+
# // reason cannot be updated. Deleting the reason from the schema, and adding it back using
19+
# // the "default" TransmodelApiDocumentationProfile is a workaround.
20+
# Quay.name.deprecated=This field is deprecated ...
21+
22+
23+
TariffZone.description=A **zone** used to define a zonal fare structure in a zone-counting or \
24+
zone-matrix system. This includes TariffZone, as well as the specialised FareZone elements. \
25+
TariffZones are deprecated, please use FareZones. \
26+
\
27+
**TariffZone data will not be maintained from 1. MAY 2025 (Entur).**

application/src/main/java/org/opentripplanner/apis/gtfs/SchemaFactory.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.opentripplanner.apis.gtfs.datafetchers.CurrencyImpl;
2525
import org.opentripplanner.apis.gtfs.datafetchers.DefaultFareProductImpl;
2626
import org.opentripplanner.apis.gtfs.datafetchers.DepartureRowImpl;
27+
import org.opentripplanner.apis.gtfs.datafetchers.EntranceImpl;
2728
import org.opentripplanner.apis.gtfs.datafetchers.EstimatedTimeImpl;
2829
import org.opentripplanner.apis.gtfs.datafetchers.FareProductTypeResolver;
2930
import org.opentripplanner.apis.gtfs.datafetchers.FareProductUseImpl;
@@ -49,6 +50,7 @@
4950
import org.opentripplanner.apis.gtfs.datafetchers.RouteImpl;
5051
import org.opentripplanner.apis.gtfs.datafetchers.RouteTypeImpl;
5152
import org.opentripplanner.apis.gtfs.datafetchers.RoutingErrorImpl;
53+
import org.opentripplanner.apis.gtfs.datafetchers.StepFeatureTypeResolver;
5254
import org.opentripplanner.apis.gtfs.datafetchers.StopCallImpl;
5355
import org.opentripplanner.apis.gtfs.datafetchers.StopGeometriesImpl;
5456
import org.opentripplanner.apis.gtfs.datafetchers.StopImpl;
@@ -139,6 +141,7 @@ public static GraphQLSchema createSchema() {
139141
.type("AlertEntity", type -> type.typeResolver(new AlertEntityTypeResolver()))
140142
.type("CallStopLocation", type -> type.typeResolver(new CallStopLocationTypeResolver()))
141143
.type("CallScheduledTime", type -> type.typeResolver(new CallScheduledTimeTypeResolver()))
144+
.type("StepFeature", type -> type.typeResolver(new StepFeatureTypeResolver()))
142145
.type(typeWiring.build(AgencyImpl.class))
143146
.type(typeWiring.build(AlertImpl.class))
144147
.type(typeWiring.build(BikeParkImpl.class))
@@ -197,6 +200,7 @@ public static GraphQLSchema createSchema() {
197200
.type(typeWiring.build(LegTimeImpl.class))
198201
.type(typeWiring.build(RealTimeEstimateImpl.class))
199202
.type(typeWiring.build(EstimatedTimeImpl.class))
203+
.type(typeWiring.build(EntranceImpl.class))
200204
.build();
201205

202206
SchemaGenerator schemaGenerator = new SchemaGenerator();
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package org.opentripplanner.apis.gtfs.datafetchers;
2+
3+
import graphql.schema.DataFetcher;
4+
import org.opentripplanner.apis.gtfs.GraphQLUtils;
5+
import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers;
6+
import org.opentripplanner.apis.gtfs.generated.GraphQLTypes;
7+
import org.opentripplanner.transit.model.site.Entrance;
8+
9+
public class EntranceImpl implements GraphQLDataFetchers.GraphQLEntrance {
10+
11+
@Override
12+
public DataFetcher<String> publicCode() {
13+
return environment -> {
14+
Entrance entrance = environment.getSource();
15+
return entrance.getCode();
16+
};
17+
}
18+
19+
@Override
20+
public DataFetcher<String> entranceId() {
21+
return environment -> {
22+
Entrance entrance = environment.getSource();
23+
return entrance.getId().toString();
24+
};
25+
}
26+
27+
@Override
28+
public DataFetcher<String> name() {
29+
return environment -> {
30+
Entrance entrance = environment.getSource();
31+
return org.opentripplanner.framework.graphql.GraphQLUtils.getTranslation(
32+
entrance.getName(),
33+
environment
34+
);
35+
};
36+
}
37+
38+
@Override
39+
public DataFetcher<GraphQLTypes.GraphQLWheelchairBoarding> wheelchairAccessible() {
40+
return environment -> {
41+
Entrance entrance = environment.getSource();
42+
return GraphQLUtils.toGraphQL(entrance.getWheelchairAccessibility());
43+
};
44+
}
45+
}

0 commit comments

Comments
 (0)