diff --git a/src/test/java/org/matsim/run/RunLeipzigIntegrationTest.java b/src/test/java/org/matsim/run/RunLeipzigIntegrationTest.java index 299d6d5..21de5f2 100644 --- a/src/test/java/org/matsim/run/RunLeipzigIntegrationTest.java +++ b/src/test/java/org/matsim/run/RunLeipzigIntegrationTest.java @@ -2,6 +2,7 @@ import org.junit.Assert; import org.junit.Ignore; +import org.junit.Rule; import org.junit.Test; import org.matsim.analysis.ParkingLocation; import org.matsim.api.core.v01.Id; @@ -10,9 +11,13 @@ import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; import org.matsim.core.controler.OutputDirectoryHierarchy; +import org.matsim.core.events.EventsUtils; import org.matsim.core.network.NetworkUtils; import org.matsim.simwrapper.SimWrapperConfigGroup; +import org.matsim.testcases.MatsimTestUtils; +import org.matsim.utils.eventsfilecomparison.EventsFileComparator; +import java.io.File; import java.nio.file.Path; import static org.assertj.core.api.Assertions.assertThat; @@ -23,9 +28,11 @@ public class RunLeipzigIntegrationTest { private static final String URL = "https://svn.vsp.tu-berlin.de/repos/public-svn/matsim/scenarios/countries/de/leipzig/leipzig-v1.2/input/"; private static final String exampleShp = "input/v1.3/drtServiceArea/Leipzig_stadt.shp"; + @Rule + public MatsimTestUtils utils = new MatsimTestUtils(); + @Test public final void runPoint1pctIntegrationTest() { - Path output = Path.of("output/it-1pct"); Config config = ConfigUtils.loadConfig("input/v1.3/leipzig-v1.3-10pct.config.xml"); @@ -33,20 +40,22 @@ public final void runPoint1pctIntegrationTest() { config.qsim().setNumberOfThreads(1); config.controler().setLastIteration(1); config.controler().setOverwriteFileSetting(OutputDirectoryHierarchy.OverwriteFileSetting.deleteDirectoryIfExists); - config.controler().setOutputDirectory(output.toString()); + config.controler().setOutputDirectory(utils.getOutputDirectory()); config.plans().setInputFile(URL + "leipzig-v1.2-0.1pct.plans-initial.xml.gz"); ConfigUtils.addOrGetModule(config, SimWrapperConfigGroup.class).defaultDashboards = SimWrapperConfigGroup.Mode.disabled; MATSimApplication.execute(RunLeipzigScenario.class, config, "run", "--1pct", "--slow-speed-area", exampleShp, - "--slow-speed-relative-change", "0.5","--drt-area", exampleShp, "--post-processing", "disabled" + "--slow-speed-relative-change", "0.5", "--drt-area", exampleShp, "--post-processing", "disabled" ); - assertThat(output) - .exists() - .isNotEmptyDirectory(); + assertThat(EventsUtils.compareEventsFiles( + new File(utils.getOutputDirectory(), "leipzig-1pct.output_events.xml.gz").toString(), + new File(utils.getClassInputDirectory(), "runPoint1pctIntegrationTest_events.xml.zst").toString() + )).isEqualTo(EventsFileComparator.Result.FILES_ARE_EQUAL); + - Network network = NetworkUtils.readNetwork(output + "/" + config.controler().getRunId() + ".output_network.xml.gz"); + Network network = NetworkUtils.readNetwork(utils.getOutputDirectory() + "/" + config.controler().getRunId() + ".output_network.xml.gz"); assertTrue(network.getLinks().get(Id.createLinkId("24232899")).getFreespeed() < 12.501000000000001); assertTrue(network.getLinks().get(Id.createLinkId("24675139")).getFreespeed() < 7.497); } @@ -91,7 +100,7 @@ public final void runOptDrtExamplePopulationTest() { ConfigUtils.addOrGetModule(config, SimWrapperConfigGroup.class).defaultDashboards = SimWrapperConfigGroup.Mode.disabled; MATSimApplication.execute(RunLeipzigScenario.class, config, "run", "--1pct", "--drt-area", exampleShp, - "--drt-modes", "drtNorth,drtSoutheast", "--waiting-time-threshold-optDrt", "600", "--post-processing", "disabled"); + "--drt-modes", "drtNorth,drtSoutheast", "--waiting-time-threshold-optDrt", "600", "--post-processing", "disabled"); Assert.assertNotNull(config.getModules().get("multiModeOptDrt")); Assert.assertNotNull(config.getModules().get("multiModeOptDrt").getParameterSets()); diff --git a/test/input/org/matsim/run/RunLeipzigIntegrationTest/runPoint1pctIntegrationTest_events.xml.zst b/test/input/org/matsim/run/RunLeipzigIntegrationTest/runPoint1pctIntegrationTest_events.xml.zst new file mode 100644 index 0000000..9090fe7 Binary files /dev/null and b/test/input/org/matsim/run/RunLeipzigIntegrationTest/runPoint1pctIntegrationTest_events.xml.zst differ