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: removed route name and agency information components #1659

Merged
merged 1 commit into from
Jan 25, 2024
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,9 +142,7 @@ private void loadSpecFeaturesBasedOnFilePresence(GtfsFeedContainer feedContainer
}

private void loadSpecFeaturesBasedOnFieldPresence(GtfsFeedContainer feedContainer) {
loadRouteNamesComponent(feedContainer);
loadRouteColorsComponent(feedContainer);
loadAgencyInformationComponent(feedContainer);
loadHeadsignsComponent(feedContainer);
loadWheelchairAccessibilityComponent(feedContainer);
loadTTSComponent(feedContainer);
Expand Down Expand Up @@ -295,17 +293,6 @@ private void loadHeadsignsComponent(GtfsFeedContainer feedContainer) {
List.of((Function<GtfsStopTime, Boolean>) GtfsStopTime::hasStopHeadsign)));
}

private void loadAgencyInformationComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Agency Information",
hasAtLeastOneRecordForFields(
feedContainer,
GtfsAgency.FILENAME,
List.of(
GtfsAgency::hasAgencyEmail,
(Function<GtfsAgency, Boolean>) GtfsAgency::hasAgencyPhone)));
}

private void loadRouteColorsComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Route Colors",
Expand All @@ -319,17 +306,6 @@ private void loadRouteColorsComponent(GtfsFeedContainer feedContainer) {
List.of((Function<GtfsRoute, Boolean>) GtfsRoute::hasRouteTextColor)));
}

private void loadRouteNamesComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Route Names",
hasAtLeastOneRecordForFields(
feedContainer,
GtfsRoute.FILENAME,
List.of(
GtfsRoute::hasRouteShortName,
(Function<GtfsRoute, Boolean>) GtfsRoute::hasRouteLongName)));
}

private void loadZoneBasedComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Zone-Based Fares", hasAtLeastOneRecordInFile(feedContainer, GtfsArea.FILENAME));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,58 +68,6 @@ private void validateSpecFeature(
}
}

@Test
public void containsRouteNamesComponentTest() throws IOException, InterruptedException {
String routesContent =
"route_id,agency_id,route_short_name,route_long_name,route_type\n"
+ "1,1,Short Name,Long Name,1\n"
+ "2,1,,,1\n";
createDataFile("routes.txt", routesContent);
validateSpecFeature(
"Route Names",
true,
ImmutableList.of(GtfsRouteTableDescriptor.class, GtfsAgencyTableDescriptor.class));
}

@Test
public void omitsRouteNamesComponentTest1() throws IOException, InterruptedException {
String routesContent =
"route_id,agency_id,route_short_name,route_long_name,route_type\n"
+ "1,1,,,1\n"
+ "2,1,,,1\n";
createDataFile("routes.txt", routesContent);
validateSpecFeature(
"Route Names",
false,
ImmutableList.of(GtfsRouteTableDescriptor.class, GtfsAgencyTableDescriptor.class));
}

@Test
public void omitsRouteNamesComponentTest2() throws IOException, InterruptedException {
String routesContent =
"route_id,agency_id,route_short_name,route_long_name,route_type\n"
+ "1,1,Short Name,,1\n"
+ "2,1,,,1\n";
createDataFile("routes.txt", routesContent);
validateSpecFeature(
"Route Names",
false,
ImmutableList.of(GtfsRouteTableDescriptor.class, GtfsAgencyTableDescriptor.class));
}

@Test
public void omitsRouteNamesComponentTest3() throws IOException, InterruptedException {
String routesContent =
"route_id,agency_id,route_short_name,route_long_name,route_type\n"
+ "1,1,,Long Name,1\n"
+ "2,1,,,1\n";
createDataFile("routes.txt", routesContent);
validateSpecFeature(
"Route Names",
false,
ImmutableList.of(GtfsRouteTableDescriptor.class, GtfsAgencyTableDescriptor.class));
}

@Test
/**
* This method is to test when both route_color and route_text_color are present in routes.txt,
Expand Down Expand Up @@ -248,10 +196,6 @@ public void omitsComponents() throws IOException, InterruptedException {
"Pathways (basic)",
false,
ImmutableList.of(GtfsPathwayTableDescriptor.class, GtfsAgencyTableDescriptor.class));
validateSpecFeature(
"Route Names",
false,
ImmutableList.of(GtfsRouteTableDescriptor.class, GtfsAgencyTableDescriptor.class));
validateSpecFeature(
"Shapes",
false,
Expand Down Expand Up @@ -423,48 +367,6 @@ public void omitsZoneBasedFaresComponentTest() throws IOException, InterruptedEx
ImmutableList.of(GtfsStopAreaTableDescriptor.class, GtfsAgencyTableDescriptor.class));
}

@Test
public void containsAgencyInformationComponent() throws IOException, InterruptedException {
tmpDir.delete();
rootDir = tmpDir.newFolder("data");
String agencyContent =
"agency_id, agency_name, agency_url, agency_timezone, agency_phone, agency_email\n"
+ "1, name, https://dummy.ca, America/Los_Angeles, 1234567890, [email protected]\n";
createDataFile(GtfsAgency.FILENAME, agencyContent);
validateSpecFeature(
"Agency Information", true, ImmutableList.of(GtfsAgencyTableDescriptor.class));
}

@Test
public void omitsAgencyInformationComponent1() throws IOException, InterruptedException {
tmpDir.delete();
rootDir = tmpDir.newFolder("data");
String agencyContent =
"agency_id, agency_name, agency_url, agency_timezone, agency_phone, agency_email\n"
+ "1, name, https://dummy.ca, America/Los_Angeles, , [email protected]\n";
createDataFile(GtfsAgency.FILENAME, agencyContent);
validateSpecFeature(
"Agency Information", false, ImmutableList.of(GtfsAgencyTableDescriptor.class));
}

@Test
public void omitsAgencyInformationComponent2() throws IOException, InterruptedException {
tmpDir.delete();
rootDir = tmpDir.newFolder("data");
String agencyContent =
"agency_id, agency_name, agency_url, agency_timezone, agency_phone, agency_email\n"
+ "1, name, https://dummy.ca, America/Los_Angeles, 1234567890, \n";
createDataFile(GtfsAgency.FILENAME, agencyContent);
validateSpecFeature(
"Agency Information", false, ImmutableList.of(GtfsAgencyTableDescriptor.class));
}

@Test
public void omitsAgencyInformationComponent3() throws IOException, InterruptedException {
validateSpecFeature(
"Agency Information", false, ImmutableList.of(GtfsAgencyTableDescriptor.class));
}

@Test
public void containsHeadsignsComponent1() throws IOException, InterruptedException {
String content = "route_id, service_id, trip_id, trip_headsign\n" + "1, 2, 3, headsign_dummy\n";
Expand Down
Loading