Skip to content

Commit

Permalink
update bast counts test
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Mar 27, 2024
1 parent 11197f6 commit a334faf
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Map<String, Id<Link>> getManualMatched() {
return manualMatchedCounts;
}

private void readMapping() {
private synchronized void readMapping() {

// Already read
if (manualMatchedCounts != null)
Expand All @@ -60,6 +60,10 @@ private void readMapping() {
manualMatchedCounts = new HashMap<>();
ignoredCounts = new HashSet<>();

// No input file
if (input == null)
return;

try (var reader = IOUtils.getBufferedReader(input)) {
CSVFormat format = CSVFormat.Builder.create()
.setAllowMissingColumnNames(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public class CreateCountsFromBAStDataTest {

String countsOutput = "test-counts.xml.gz";

String ignoredCounts = "ignored.csv";
String manualMatchedCounts = "manual.csv";
String mapping = "mapping.csv";
String wrongManualMatchedCounts = "wrong_manual.csv";

String network = IOUtils.extendUrl(ExamplesUtils.getTestScenarioURL("berlin"), "network.xml.gz").toString();
Expand Down Expand Up @@ -61,9 +60,6 @@ void testCreateCountsFromBAStData() {
assertThat(counts.getMeasureLocations())
.hasSize(24);

assertThat(counts.getCounts())
.hasSize(24);

for (Map.Entry<Id<Link>, MeasurementLocation<Link>> e : counts.getMeasureLocations().entrySet()) {
assertThat(e.getValue().hasMeasurableForMode(Measurable.VOLUMES, TransportMode.car))
.isTrue();
Expand Down Expand Up @@ -105,7 +101,7 @@ void testWithIgnoredStations() {
"--shp-crs=" + shpCrs,
"--year=2021",
"--output=" + out2,
"--ignored-counts=" + utils.getPackageInputDirectory() + ignoredCounts,
"--counts-mapping=" + utils.getPackageInputDirectory() + mapping,
};

new CreateCountsFromBAStData().execute(args2);
Expand Down Expand Up @@ -140,7 +136,7 @@ void testManualMatchedCounts() {
"--shp-crs=" + shpCrs,
"--year=2021",
"--output=" + out,
"--manual-matched-counts=" + utils.getPackageInputDirectory() + manualMatchedCounts,
"--counts-mapping=" + utils.getPackageInputDirectory() + mapping,
};

new CreateCountsFromBAStData().execute(args);
Expand Down Expand Up @@ -178,7 +174,7 @@ void testManualMatchingWithWrongInput() {
"--shp-crs=" + shpCrs,
"--year=2021",
"--output=" + out,
"--manual-matched-counts=" + utils.getPackageInputDirectory() + wrongManualMatchedCounts,
"--counts-mapping=" + utils.getPackageInputDirectory() + wrongManualMatchedCounts,
};

Assertions.assertThrows(RuntimeException.class, () -> new CreateCountsFromBAStData().execute(args));
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
station,linkId,Using
2012_1,4205,x
2012_2,4219,x
2014,xxx,

0 comments on commit a334faf

Please sign in to comment.