Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added agencyTimezone to JSON report summary #1946

Merged
merged 7 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class FeedMetadata {
public double validationTimeSeconds;

public List<MemoryUsage> memoryUsageRecords;

// List of features that only require checking the presence of one record in the file.
private final List<Pair<FeatureMetadata, String>> FILE_BASED_FEATURES =
List.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -132,8 +134,8 @@ public void withFeedMetadataWithConfigTest() throws Exception {
+ "\"feedInfo\":{\"publisherName\":\"value1\",\"publisherUrl\":\"value2\",\"feedEmail\":\"[email protected]\",\"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\"]}";
Expand All @@ -154,8 +156,8 @@ public void withFeedMetadataNoConfigTest() throws Exception {
+ "\"feedInfo\":{\"publisherName\":\"value1\",\"publisherUrl\":\"value2\",\"feedEmail\":\"[email protected]\",\"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\"]}";
Expand Down
Loading