Skip to content

Commit

Permalink
Adapt to changes in matsim-libs#3165: "EventsFileComparator.Result" h…
Browse files Browse the repository at this point in the history
…as been moved and renamed to "ComparisonResult"
  • Loading branch information
kt86 authored and michalmac committed Mar 26, 2024
1 parent 7a41c78 commit aa34940
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public static void run( String[] args, boolean runWithOTFVis ) throws ExecutionE
if ( args==null || args.length==0 || args[0]==null ){
config = ConfigUtils.loadConfig( IOUtils.extendUrl( ExamplesUtils.getTestScenarioURL( "freight-chessboard-9x9" ), "config.xml" ) );
config.plans().setInputFile( null ); // remove passenger input
config.controller().setOutputDirectory( "./output/freight" );
config.controller().setOutputDirectory( "./output/freight_services" );
config.controller().setLastIteration( 0 ); // no iterations; for iterations see RunFreightWithIterationsExample. kai, jan'23

FreightCarriersConfigGroup freightConfigGroup = ConfigUtils.addOrGetModule( config, FreightCarriersConfigGroup.class );
freightConfigGroup.setCarriersFile("singleCarrierFiveActivitiesWithoutRoutes_Shipments.xml");
freightConfigGroup.setCarriersFile("singleCarrierFiveActivitiesWithoutRoutes.xml");
freightConfigGroup.setCarriersVehicleTypesFile( "vehicleTypes.xml" );
} else {
config = ConfigUtils.loadConfig( args, new FreightCarriersConfigGroup() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.matsim.core.utils.io.IOUtils;
import org.matsim.examples.ExamplesUtils;
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.utils.eventsfilecomparison.ComparisonResult;
import org.matsim.utils.eventsfilecomparison.EventsFileComparator;

public class RunFreightExampleTest{
Expand Down Expand Up @@ -42,8 +43,8 @@ void testMain(){
{
String expected = utils.getInputDirectory() + "/output_events.xml.gz";
String actual = utils.getOutputDirectory() + "/output_events.xml.gz";
EventsFileComparator.Result result = EventsUtils.compareEventsFiles( expected, actual );
Assertions.assertEquals( EventsFileComparator.Result.FILES_ARE_EQUAL, result );
ComparisonResult result = EventsUtils.compareEventsFiles( expected, actual );
Assertions.assertEquals( ComparisonResult.FILES_ARE_EQUAL, result );
}

} catch( Exception ee ){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.matsim.core.utils.io.IOUtils;
import org.matsim.examples.ExamplesUtils;
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.utils.eventsfilecomparison.ComparisonResult;
import org.matsim.utils.eventsfilecomparison.EventsFileComparator;

import java.net.URL;
Expand Down Expand Up @@ -44,8 +45,8 @@ void testMain(){
{
String expected = utils.getInputDirectory() + "/output_events.xml.gz";
String actual = utils.getOutputDirectory() + "/output_events.xml.gz";
EventsFileComparator.Result result = EventsUtils.compareEventsFiles( expected, actual );
Assertions.assertEquals( EventsFileComparator.Result.FILES_ARE_EQUAL, result );
ComparisonResult result = EventsUtils.compareEventsFiles( expected, actual );
Assertions.assertEquals( ComparisonResult.FILES_ARE_EQUAL, result );
}

} catch( Exception ee ){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import org.matsim.codeexamples.mobsim.simpleAdaptiveSignalEngine.RunSimpleAdaptiveSignalExample;
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.utils.eventsfilecomparison.ComparisonResult;
import org.matsim.utils.eventsfilecomparison.EventsFileComparator;

/**
Expand All @@ -44,8 +45,8 @@ void testRunSimpleAdaptiveSignalExample(){
// compare event files
final String expected = testUtils.getClassInputDirectory() + "output_events.xml.gz";
final String actual = testUtils.getOutputDirectory() + "output_events.xml.gz";
EventsFileComparator.Result result = EventsFileComparator.compare(expected, actual);

ComparisonResult result = EventsFileComparator.compare(expected, actual);
System.out.println("result of events file comparison=" + result.name() ) ;

// Assert.assertEquals("different event files",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.matsim.core.utils.io.IOUtils;
import org.matsim.examples.ExamplesUtils;
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.utils.eventsfilecomparison.ComparisonResult;
import org.matsim.utils.eventsfilecomparison.EventsFileComparator;

import static org.junit.jupiter.api.Assertions.fail;
Expand All @@ -34,7 +35,7 @@ void testMain(){
String expected = utils.getInputDirectory() + "/output_events.xml.gz" ;
String actual = utils.getOutputDirectory() + "/output_events.xml.gz" ;
var result = EventsUtils.compareEventsFiles( expected, actual );
Assertions.assertEquals( EventsFileComparator.Result.FILES_ARE_EQUAL, result);
Assertions.assertEquals( ComparisonResult.FILES_ARE_EQUAL, result);
}
{
final Population expected = PopulationUtils.createPopulation( ConfigUtils.createConfig() );
Expand Down

0 comments on commit aa34940

Please sign in to comment.