diff --git a/main/src/main/java/org/mobilitydata/gtfsvalidator/report/JsonReportSummary.java b/main/src/main/java/org/mobilitydata/gtfsvalidator/report/JsonReportSummary.java index 1f75f1d57b..51ba19c605 100644 --- a/main/src/main/java/org/mobilitydata/gtfsvalidator/report/JsonReportSummary.java +++ b/main/src/main/java/org/mobilitydata/gtfsvalidator/report/JsonReportSummary.java @@ -142,12 +142,14 @@ private static class JsonReportAgencyMetadata { private final String url; private final String phone; private final String email; + private final String timezone; public JsonReportAgencyMetadata(AgencyMetadata agencyMetadata) { name = agencyMetadata.name; url = agencyMetadata.url; phone = agencyMetadata.phone; email = agencyMetadata.email; + timezone = agencyMetadata.timezone; } } diff --git a/main/src/main/java/org/mobilitydata/gtfsvalidator/report/model/AgencyMetadata.java b/main/src/main/java/org/mobilitydata/gtfsvalidator/report/model/AgencyMetadata.java index 19bf1ad57b..2b0fdaf09c 100644 --- a/main/src/main/java/org/mobilitydata/gtfsvalidator/report/model/AgencyMetadata.java +++ b/main/src/main/java/org/mobilitydata/gtfsvalidator/report/model/AgencyMetadata.java @@ -7,17 +7,22 @@ public class AgencyMetadata { public final String url; public final String phone; public final String email; + public final String timezone; - public AgencyMetadata(String name, String url, String phone, String email) { - + public AgencyMetadata(String name, String url, String phone, String email, String timezone) { this.name = name; this.url = url; this.phone = phone.isEmpty() ? "N/A" : phone; this.email = email.isEmpty() ? "N/A" : email; + this.timezone = timezone.isEmpty() ? "N/A" : timezone; } public static AgencyMetadata from(GtfsAgency agency) { return new AgencyMetadata( - agency.agencyName(), agency.agencyUrl(), agency.agencyPhone(), agency.agencyEmail()); + agency.agencyName(), + agency.agencyUrl(), + agency.agencyPhone(), + agency.agencyEmail(), + agency.agencyTimezone().getId()); } } diff --git a/main/src/main/java/org/mobilitydata/gtfsvalidator/report/model/FeedMetadata.java b/main/src/main/java/org/mobilitydata/gtfsvalidator/report/model/FeedMetadata.java index 4b04270743..60411d7d37 100644 --- a/main/src/main/java/org/mobilitydata/gtfsvalidator/report/model/FeedMetadata.java +++ b/main/src/main/java/org/mobilitydata/gtfsvalidator/report/model/FeedMetadata.java @@ -57,6 +57,7 @@ public class FeedMetadata { public double validationTimeSeconds; public List memoryUsageRecords; + // List of features that only require checking the presence of one record in the file. private final List> FILE_BASED_FEATURES = List.of( diff --git a/main/src/test/java/org/mobilitydata/gtfsvalidator/report/model/JsonReportSummaryTest.java b/main/src/test/java/org/mobilitydata/gtfsvalidator/report/model/JsonReportSummaryTest.java index 70ee5e5293..43c5aa863e 100644 --- a/main/src/test/java/org/mobilitydata/gtfsvalidator/report/model/JsonReportSummaryTest.java +++ b/main/src/test/java/org/mobilitydata/gtfsvalidator/report/model/JsonReportSummaryTest.java @@ -50,12 +50,14 @@ private static ValidationRunnerConfig generateValidationRunnerConfig() throws Ex private static FeedMetadata generateFeedMetaData() { FeedMetadata feedMetadata = mock(FeedMetadata.class); when(feedMetadata.getFilenames()).thenReturn(ImmutableSortedSet.of("file1", "file2")); - new AgencyMetadata("agency1", "some URL 1", "phone1", "email1"); + new AgencyMetadata("agency1", "some URL 1", "phone1", "email1", "America/Los_Angeles"); feedMetadata.agencies = new ArrayList<>( Arrays.asList( - new AgencyMetadata("agency1", "some URL 1", "phone1", "email1"), - new AgencyMetadata("agency1", "some URL 1", "phone1", "email1"))); + new AgencyMetadata( + "agency1", "some URL 1", "phone1", "email1", "America/Los_Angeles"), + new AgencyMetadata( + "agency1", "some URL 1", "phone1", "email1", "America/Los_Angeles"))); feedMetadata.feedInfo = Map.of( FeedMetadata.FEED_INFO_PUBLISHER_NAME, @@ -132,8 +134,8 @@ public void withFeedMetadataWithConfigTest() throws Exception { + "\"feedInfo\":{\"publisherName\":\"value1\",\"publisherUrl\":\"value2\",\"feedEmail\":\"me@foo.com\",\"feedServiceWindowStart\":\"2024-01-02\", \"feedServiceWindowEnd\":\"2024-11-06\"}," + "\"validationTimeSeconds\":100.0," + "\"agencies\":[" - + "{\"name\":\"agency1\",\"url\":\"some URL 1\",\"phone\":\"phone1\",\"email\":\"email1\"}," - + "{\"name\":\"agency1\",\"url\":\"some URL 1\",\"phone\":\"phone1\",\"email\":\"email1\"}]," + + "{\"name\":\"agency1\",\"url\":\"some URL 1\",\"phone\":\"phone1\",\"email\":\"email1\", \"timezone\":\"America/Los_Angeles\"}," + + "{\"name\":\"agency1\",\"url\":\"some URL 1\",\"phone\":\"phone1\",\"email\":\"email1\", \"timezone\":\"America/Los_Angeles\"}]," + "\"files\":[\"file1\",\"file2\"]," + "\"counts\":{\"Shapes\":1,\"Trips\":2}," + "\"gtfsFeatures\":[\"Feature2\"]}"; @@ -154,8 +156,8 @@ public void withFeedMetadataNoConfigTest() throws Exception { + "\"feedInfo\":{\"publisherName\":\"value1\",\"publisherUrl\":\"value2\",\"feedEmail\":\"me@foo.com\",\"feedServiceWindowStart\":\"2024-01-02\", \"feedServiceWindowEnd\":\"2024-11-06\"}," + "\"validationTimeSeconds\":100.0," + "\"agencies\":[" - + "{\"name\":\"agency1\",\"url\":\"some URL 1\",\"phone\":\"phone1\",\"email\":\"email1\"}," - + "{\"name\":\"agency1\",\"url\":\"some URL 1\",\"phone\":\"phone1\",\"email\":\"email1\"}]," + + "{\"name\":\"agency1\",\"url\":\"some URL 1\",\"phone\":\"phone1\",\"email\":\"email1\",\"timezone\":\"America/Los_Angeles\"}," + + "{\"name\":\"agency1\",\"url\":\"some URL 1\",\"phone\":\"phone1\",\"email\":\"email1\",\"timezone\":\"America/Los_Angeles\"}]," + "\"files\":[\"file1\",\"file2\"]," + "\"counts\":{\"Shapes\":1,\"Trips\":2}," + "\"gtfsFeatures\":[\"Feature2\"]}";