@Test public void testConstructor_LinkNetworkRouteType() { Config config = ConfigUtils.createConfig(); config.plans().setNetworkRouteType(PlansConfigGroup.NetworkRouteType.LinkNetworkRoute); Scenario scenario = ScenarioUtils.createScenario(config); PopulationFactory pf = scenario.getPopulation().getFactory(); Id<Link> linkId = Id.create(1, Link.class); final Id<Link> startLinkId = linkId; final Id<Link> endLinkId = linkId; Assert.assertEquals(LinkNetworkRouteImpl.class, pf.getRouteFactories().createRoute(NetworkRoute.class, startLinkId, endLinkId).getClass()); }
@Test public void testConstructor_CompressedNetworkRouteType() { Config config = ConfigUtils.createConfig(); config.plans().setNetworkRouteType(PlansConfigGroup.NetworkRouteType.CompressedNetworkRoute); Scenario scenario = ScenarioUtils.createScenario(config); PopulationFactory pf = scenario.getPopulation().getFactory(); Id<Link> linkId = Id.create(1, Link.class); final Id<Link> startLinkId = linkId; final Id<Link> endLinkId = linkId; Assert.assertEquals(CompressedNetworkRouteImpl.class, pf.getRouteFactories().createRoute(NetworkRoute.class, startLinkId, endLinkId).getClass()); }
@Test public void testReadingPlansV4parallel() { Config config = ConfigUtils.createConfig(); config.plans().setNetworkRouteType("CompressedNetworkRoute"); Scenario s = ScenarioUtils.createScenario(config); new MatsimNetworkReader(s.getNetwork()).readFile("test/scenarios/equil/network.xml"); new ParallelPopulationReaderMatsimV4(s).readFile("test/scenarios/equil/plans1.xml"); Assert.assertEquals(1, s.getPopulation().getPersons().size()); Leg firstPersonsLeg = (Leg) s.getPopulation().getPersons().get(Id.create("1", Person.class)).getSelectedPlan().getPlanElements().get(1); // Assert.assertTrue(firstPersonsLeg.getRoute() instanceof CompressedNetworkRouteImpl); }