Skip to content

Commit

Permalink
refactor(Fixed merge conflicts):
Browse files Browse the repository at this point in the history
  • Loading branch information
br648 committed Oct 25, 2023
2 parents 32c0840 + 80a968c commit 2d7d77c
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
# Install node 14+ for running maven-semantic-release.
# Install node 18+ for running maven-semantic-release.
- name: Use Node.js 18.X
uses: actions/setup-node@v1
with:
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# gtfs-lib [![Build Status](https://travis-ci.org/conveyal/gtfs-lib.svg?branch=master)](https://travis-ci.org/conveyal/gtfs-lib)
[![Join the chat at https://matrix.to/#/#transit-data-tools:gitter.im](https://badges.gitter.im/repo.png)](https://matrix.to/#/#gtfs-lib:gitter.im)


A library for loading and saving GTFS feeds of arbitrary size with disk-backed storage.

Expand All @@ -14,6 +16,10 @@ The main design goals are:

A gtfs-lib GTFSFeed object should faithfully represent the contents of a single GTFS feed file. At least during the initial load, no heuristics are applied to clean up the data. Basic syntax is verified, and any problems encountered are logged in detail. At this stage, fields or entites may be missing, and the data may be nonsensical. Then in an optional post-load validation phase, semantic checks are performed and problems are optionally repaired.

## Getting in touch

We have a [Gitter space](https://matrix.to/#/#transit-data-tools:gitter.im) for the full TRANSIT-Data-Tools project where you can post questions and comments. This includes a room dedicated to GTFS-lib discussions.

## Usage

gtfs-lib can be used as a Java library or run via the command line. If using this library with PostgreSQL for persistence, you must use at least version 9.6 of PostgreSQL.
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.0-jre</version>
<version>32.0.0-jre</version>
</dependency>
<dependency>
<groupId>org.locationtech.jts</groupId>
Expand Down Expand Up @@ -315,7 +315,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.25</version>
<version>42.4.3</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -332,13 +332,13 @@
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java</artifactId>
<version>11.0</version>
<version>17.4</version>
</dependency>
<!-- Contains special utils for things like converting escaped strings to unescaped strings for logging. -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.6</version>
<version>1.10.0</version>
</dependency>
<!-- Used for GeoJSON packing and unpacking (https://github.com/ngageoint/simple-features-geojson-java) -->
<dependency>
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/conveyal/gtfs/error/NewGTFSErrorType.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public enum NewGTFSErrorType {
// MTC-specific errors.
FIELD_VALUE_TOO_LONG(Priority.MEDIUM, "Field value has too many characters."),

// Shared Stops-specifc errors.
MULTIPLE_SHARED_STOPS_GROUPS(Priority.HIGH, "A GTFS stop belongs to more than one shared-stop group."),
SHARED_STOP_GROUP_MUTLIPLE_PRIMARY_STOPS(Priority.HIGH, "A Shared-stop group has multiple primary stops."),
SHARED_STOP_GROUP_ENTITY_DOES_NOT_EXIST(Priority.MEDIUM, "The stop referenced by a shared-stop does not exist."),

// Unknown errors.
OTHER(Priority.LOW, "Other errors.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,12 @@ public class GraphQLGtfsSchema {
.field(MapFetcher.field("description"))
.build();

private static final GraphQLScalarType stringList = new GraphQLScalarType("StringList", "List of Strings", new StringCoercing());
private static final GraphQLScalarType stringList = GraphQLScalarType
.newScalar()
.name("StringList")
.description("List of Strings")
.coercing(new StringCoercing())
.build();

// Represents GTFS Editor service exceptions.
public static final GraphQLObjectType scheduleExceptionType = newObject().name("scheduleException")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public List<Map<String, Object>> get (DataFetchingEnvironment environment) {
* Handle fetching functionality for a given namespace, set of join values, and arguments. This is broken out from
* the standard get function so that it can be reused in other fetchers (i.e., NestedJdbcFetcher)
*/
List<Map<String, Object>> getResults (
public List<Map<String, Object>> getResults (
String namespace,
List<String> parentJoinValues,
Map<String, Object> graphQLQueryArguments
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/conveyal/gtfs/loader/JdbcTableWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,11 @@ private String[] parseExceptionListField(int id, String namespace, Table table,
return parsedString.replaceAll("[{}]", "").split("[,]", 0);
}

private String getResultSetString(int column, ResultSet resultSet) throws java.sql.SQLException {
String resultSetString = resultSet.getString(column);
return resultSetString == null ? "" : resultSetString;
}

/**
* Delete all entries in calendar dates associated with a schedule exception.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/conveyal/gtfs/GTFSTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.csvreader.CsvReader;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.io.Files;
import graphql.Assert;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.input.BOMInputStream;
Expand All @@ -34,6 +33,7 @@
import java.io.InputStream;
import java.io.PrintStream;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
Expand Down Expand Up @@ -253,12 +253,12 @@ public void canLoadFeedWithErrors () {
* Tests whether "fake-agency" GTFS can be placed in a zipped subdirectory and loaded/exported successfully.
*/
@Test
public void canLoadAndExportSimpleAgencyInSubDirectory() {
public void canLoadAndExportSimpleAgencyInSubDirectory() throws IOException {
String zipFileName = null;
// Get filename for fake-agency resource
String resourceFolder = TestUtils.getResourceFileName("fake-agency");
// Recursively copy folder into temp directory, which we zip up and run the integration test on.
File tempDir = Files.createTempDir();
File tempDir = Files.createTempDirectory("").toFile();
tempDir.deleteOnExit();
File nestedDir = new File(TestUtils.fileNameWithDir(tempDir.getAbsolutePath(), "fake-agency"));
LOG.info("Creating temp folder with nested subdirectory at {}", tempDir.getAbsolutePath());
Expand Down

0 comments on commit 2d7d77c

Please sign in to comment.