Skip to content

Commit 8847f54

Browse files
Merge branch 'dev' into dev-flex
# Conflicts: # pom.xml
2 parents c29e369 + 57c9943 commit 8847f54

File tree

6 files changed

+14
-96
lines changed

6 files changed

+14
-96
lines changed

.github/workflows/maven.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
with:
4343
mongodb-version: 4.2
4444
- name: Setup Maven Cache
45-
uses: actions/cache@v2
45+
uses: actions/cache@v4
4646
id: cache
4747
with:
4848
path: ~/.m2

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
<dependency>
263263
<groupId>org.mobilitydata.gtfs-validator</groupId>
264264
<artifactId>gtfs-validator-main</artifactId>
265-
<version>4.2.0</version>
265+
<version>6.0.0</version>
266266
</dependency>
267267
<!-- Used for loading/fetching/validating/writing GTFS entities. gtfs-lib also provides access to:
268268
- commons-io - generic utilities

src/main/java/com/conveyal/datatools/manager/models/Deployment.java

+8-43
Original file line numberDiff line numberDiff line change
@@ -442,31 +442,16 @@ public byte[] generateBuildConfig() throws IOException {
442442
}
443443
return customBuildConfig != null
444444
? customBuildConfig.getBytes(StandardCharsets.UTF_8)
445-
: getProjectBuildConfig();
446-
}
447-
448-
/**
449-
* If a project build config exists, return this as a byte array, or null if not available.
450-
*/
451-
private byte[] getProjectBuildConfig() {
452-
Project project = parentProject();
453-
return project.buildConfig != null
454-
? writeToBytes(project.buildConfig)
455445
: null;
456446
}
457447

458448
public String generateBuildConfigAsString() {
459-
if (customBuildConfig != null) return customBuildConfig;
460-
return writeToString(this.parentProject().buildConfig);
461-
}
462-
463-
/** Convenience method to write serializable object (primarily for router/build config objects) to byte array. */
464-
private <O extends Serializable> byte[] writeToBytes(O object) {
465449
try {
466-
return otpConfigMapper.writer().writeValueAsBytes(object);
467-
} catch (JsonProcessingException e) {
468-
LOG.error("Value contains malformed JSON", e);
469-
return null;
450+
return new String(generateBuildConfig(), StandardCharsets.UTF_8);
451+
// TODO: Correctly generate default build config
452+
} catch (Exception e) {
453+
LOG.error("Failed to generate build config: ", e);
454+
return "";
470455
}
471456
}
472457

@@ -487,37 +472,17 @@ public byte[] generateRouterConfig() throws IOException {
487472
customRouterConfig = downloadedConfig;
488473
}
489474

490-
byte[] customRouterConfigString = customRouterConfig != null
475+
return customRouterConfig != null
491476
? customRouterConfig.getBytes(StandardCharsets.UTF_8)
492477
: null;
493-
494-
byte[] routerConfigString = parentProject().routerConfig != null
495-
? writeToBytes(parentProject().routerConfig)
496-
: null;
497-
498-
// If both router configs are present, merge the JSON before returning
499-
// Merger code from: https://stackoverflow.com/questions/35747813/how-to-merge-two-json-strings-into-one-in-java
500-
if (customRouterConfigString != null && routerConfigString != null) {
501-
ObjectMapper mapper = new ObjectMapper();
502-
Map<String, Object> map1 = mapper.readValue(customRouterConfigString, Map.class);
503-
Map<String, Object> map2 = mapper.readValue(routerConfigString, Map.class);
504-
Map<String, Object> merged = new HashMap<String, Object>(map2);
505-
merged.putAll(map1);
506-
return mapper.writeValueAsString(merged).getBytes();
507-
}
508-
509-
return customRouterConfigString != null
510-
? customRouterConfigString
511-
: routerConfigString != null
512-
? routerConfigString
513-
: null;
514478
}
515479

516480
/** Generate router config for deployment as byte array (for writing to file output stream). */
517481
public String generateRouterConfigAsString() {
518482
try {
519483
return new String(generateRouterConfig(), StandardCharsets.UTF_8);
520-
} catch (IOException e) {
484+
// TODO: Correctly generate default router config
485+
} catch (Exception e) {
521486
LOG.error("Failed to generate router config: ", e);
522487
return "";
523488
}

src/main/java/com/conveyal/datatools/manager/models/OtpBuildConfig.java

+2-19
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,11 @@
66

77
/**
88
* Created by demory on 3/8/15.
9+
*
10+
* TODO: Figure out how to remove this class without causing problems in the DB migration
911
*/
1012
@JsonIgnoreProperties(ignoreUnknown = true)
1113
public class OtpBuildConfig implements Serializable {
1214
private static final long serialVersionUID = 1L;
1315

14-
public Boolean fetchElevationUS;
15-
// FIXME: elevation bucket causing NPE issue if missing values when deploying to OTP
16-
// public S3Bucket elevationBucket;
17-
18-
public Boolean stationTransfers;
19-
20-
public Double subwayAccessTime;
21-
22-
/** Currently only supports no-configuration fares, e.g. New York or San Francisco */
23-
public String fares;
24-
25-
public OtpBuildConfig() {}
26-
27-
public static class S3Bucket implements Serializable {
28-
private static final long serialVersionUID = 1L;
29-
public String accessKey;
30-
public String secretKey;
31-
public String bucketName;
32-
}
3316
}

src/main/java/com/conveyal/datatools/manager/models/OtpRouterConfig.java

+2-26
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,11 @@
77

88
/**
99
* Created by demory on 3/8/15.
10+
*
11+
* TODO: Figure out how to remove this class without causing problems in the DB migration
1012
*/
1113
@JsonIgnoreProperties(ignoreUnknown = true)
1214
public class OtpRouterConfig implements Serializable {
1315
private static final long serialVersionUID = 1L;
14-
public Double driveDistanceReluctance;
1516

16-
public Double stairsReluctance;
17-
18-
public Collection<Updater> updaters;
19-
20-
public ItineraryFilter itineraryFilters;
21-
22-
public static class ItineraryFilter implements Serializable {
23-
private static final long serialVersionUID = 1L;
24-
public String nonTransitGeneralizedCostLimit;
25-
}
26-
27-
public static class Updater implements Serializable {
28-
private static final long serialVersionUID = 1L;
29-
public String type;
30-
31-
public Integer frequencySec;
32-
33-
public String sourceType;
34-
35-
public String url;
36-
37-
public String feedId;
38-
}
39-
40-
public String requestLogFile;
4117
}

src/main/java/com/conveyal/datatools/manager/models/Project.java

-6
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ public class Project extends Model {
4747

4848
public boolean useCustomOsmBounds;
4949

50-
public OtpBuildConfig buildConfig;
51-
52-
public OtpRouterConfig routerConfig;
53-
5450
public String organizationId;
5551

5652
/** Last successful auto deploy. **/
@@ -111,8 +107,6 @@ public List<OtpServer> availableOtpServers() {
111107

112108

113109
public Project() {
114-
this.buildConfig = new OtpBuildConfig();
115-
this.routerConfig = new OtpRouterConfig();
116110
this.useCustomOsmBounds = false;
117111
}
118112

0 commit comments

Comments
 (0)