Search in sources :

Example 1 with BlockIndexFactoryServiceImpl

use of org.onebusaway.transit_data_federation.impl.blocks.BlockIndexFactoryServiceImpl in project onebusaway-application-modules by camsys.

the class StopTimeServiceImplTest method setup.

@Before
public void setup() {
    _factory = new BlockIndexFactoryServiceImpl();
    _stop = stop("stopId", 47.0, -122.0);
    _stopId = _stop.getId();
    TransitGraphDao graph = Mockito.mock(TransitGraphDao.class);
    Mockito.when(graph.getStopEntryForId(_stop.getId(), true)).thenReturn(_stop);
    CalendarServiceData data = new CalendarServiceData();
    data.putDatesForLocalizedServiceId(lsid("sA"), Arrays.asList(date("2009-09-01 00:00"), date("2009-09-02 00:00")));
    data.putDatesForLocalizedServiceId(lsid("sB"), Arrays.asList(date("2009-09-03 00:00")));
    CalendarServiceImpl calendarService = new CalendarServiceImpl();
    calendarService.setData(data);
    _calendarService = new ExtendedCalendarServiceImpl();
    _calendarService.setCalendarService(calendarService);
    _blockIndexService = Mockito.mock(BlockIndexService.class);
    _service = new StopTimeServiceImpl();
    _service.setTransitGraphDao(graph);
    _service.setCalendarService(_calendarService);
    _service.setBlockIndexService(_blockIndexService);
    BlockConfigurationEntry bcA = blockConfiguration(block("bA"), serviceIds(lsids("sA"), lsids()));
    BlockConfigurationEntry bcB = blockConfiguration(block("bB"), serviceIds(lsids("sB"), lsids()));
    _transitGraphDao = Mockito.mock(TransitGraphDao.class);
    Mockito.when(_transitGraphDao.getAllBlocks()).thenReturn(Arrays.asList(bcA.getBlock(), bcB.getBlock()));
    _calendarService.setTransitGraphDao(_transitGraphDao);
    _calendarService.start();
}
Also used : CalendarServiceData(org.onebusaway.gtfs.model.calendar.CalendarServiceData) TransitGraphDao(org.onebusaway.transit_data_federation.services.transit_graph.TransitGraphDao) CalendarServiceImpl(org.onebusaway.gtfs.impl.calendar.CalendarServiceImpl) BlockIndexService(org.onebusaway.transit_data_federation.services.blocks.BlockIndexService) BlockIndexFactoryServiceImpl(org.onebusaway.transit_data_federation.impl.blocks.BlockIndexFactoryServiceImpl) BlockConfigurationEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry) Before(org.junit.Before)

Example 2 with BlockIndexFactoryServiceImpl

use of org.onebusaway.transit_data_federation.impl.blocks.BlockIndexFactoryServiceImpl in project onebusaway-application-modules by camsys.

the class UnitTestingSupport method blockTripIndices.

public static List<BlockTripIndex> blockTripIndices(BlockEntryImpl... blocks) {
    List<BlockEntry> list = new ArrayList<BlockEntry>();
    for (BlockEntryImpl block : blocks) list.add(block);
    BlockIndexFactoryService factory = new BlockIndexFactoryServiceImpl();
    return factory.createTripIndices(list);
}
Also used : BlockEntry(org.onebusaway.transit_data_federation.services.transit_graph.BlockEntry) ArrayList(java.util.ArrayList) BlockIndexFactoryService(org.onebusaway.transit_data_federation.services.blocks.BlockIndexFactoryService) BlockEntryImpl(org.onebusaway.transit_data_federation.impl.transit_graph.BlockEntryImpl) BlockIndexFactoryServiceImpl(org.onebusaway.transit_data_federation.impl.blocks.BlockIndexFactoryServiceImpl)

Aggregations

BlockIndexFactoryServiceImpl (org.onebusaway.transit_data_federation.impl.blocks.BlockIndexFactoryServiceImpl)2 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 CalendarServiceImpl (org.onebusaway.gtfs.impl.calendar.CalendarServiceImpl)1 CalendarServiceData (org.onebusaway.gtfs.model.calendar.CalendarServiceData)1 BlockEntryImpl (org.onebusaway.transit_data_federation.impl.transit_graph.BlockEntryImpl)1 BlockIndexFactoryService (org.onebusaway.transit_data_federation.services.blocks.BlockIndexFactoryService)1 BlockIndexService (org.onebusaway.transit_data_federation.services.blocks.BlockIndexService)1 BlockConfigurationEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry)1 BlockEntry (org.onebusaway.transit_data_federation.services.transit_graph.BlockEntry)1 TransitGraphDao (org.onebusaway.transit_data_federation.services.transit_graph.TransitGraphDao)1