Search in sources :

Example 1 with CalendarSimplicationStrategy

use of org.onebusaway.gtfs_transformer.updates.CalendarSimplicationStrategy in project onebusaway-gtfs-modules by OneBusAway.

the class TransformFactoryTest method testCalendarSimplification.

@Test
public void testCalendarSimplification() throws IOException, TransformSpecificationException {
    _factory.addModificationsFromString("{'op':'calendar_simplification'}");
    GtfsTransformStrategy transform = _transformer.getLastTransform();
    assertEquals(CalendarSimplicationStrategy.class, transform.getClass());
    CalendarSimplicationStrategy simplification = (CalendarSimplicationStrategy) transform;
    assertFalse(simplification.isUndoGoogleTransitDataFeedMergeTool());
    _factory.addModificationsFromString("{'op':'calendar_simplification', 'min_number_of_weeks_for_calendar_entry':10}");
    simplification = (CalendarSimplicationStrategy) _transformer.getLastTransform();
    assertEquals(10, simplification.getLibrary().getMinNumberOfWeeksForCalendarEntry());
    _factory.addModificationsFromString("{'op':'calendar_simplification', 'day_of_the_week_inclusion_ratio':0.1}");
    simplification = (CalendarSimplicationStrategy) _transformer.getLastTransform();
    assertEquals(0.1, simplification.getLibrary().getDayOfTheWeekInclusionRatio(), 0.0);
    _factory.addModificationsFromString("{'op':'calendar_simplification', 'undo_google_transit_data_feed_merge_tool':true}");
    simplification = (CalendarSimplicationStrategy) _transformer.getLastTransform();
    assertTrue(simplification.isUndoGoogleTransitDataFeedMergeTool());
}
Also used : CalendarSimplicationStrategy(org.onebusaway.gtfs_transformer.updates.CalendarSimplicationStrategy) GtfsTransformStrategy(org.onebusaway.gtfs_transformer.services.GtfsTransformStrategy) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 GtfsTransformStrategy (org.onebusaway.gtfs_transformer.services.GtfsTransformStrategy)1 CalendarSimplicationStrategy (org.onebusaway.gtfs_transformer.updates.CalendarSimplicationStrategy)1