Package org.onebusaway.gtfs.services.calendar

Examples of org.onebusaway.gtfs.services.calendar.CalendarService


            Collection<String> agencyIds = this.getAgencyIds();
            if (agencyIds.size() == 0) {
                timeZone = TimeZone.getTimeZone("GMT");
                LOG.warn("graph contains no agencies; API request times will be interpreted as GMT.");
            } else {
                CalendarService cs = this.getCalendarService();
                for (String agencyId : agencyIds) {
                    TimeZone tz = cs.getTimeZoneForAgencyId(agencyId);
                    if (timeZone == null) {
                        LOG.debug("graph time zone set to {}", tz);
                        timeZone = tz;
                    } else if (!timeZone.equals(tz)) {
                        LOG.error("agency time zone differs from graph time zone: {}", tz);
View Full Code Here


    public void testSetServiceDays() throws Exception {

        String agencyId = "AGENCY";
        Graph graph = mock(Graph.class);
        RoutingRequest routingRequest = mock(RoutingRequest.class);
        CalendarService calendarService = mock(CalendarService.class);

        when(graph.getTimeZone()).thenReturn(TimeZone.getTimeZone("Europe/Budapest"));
        when(graph.getCalendarService()).thenReturn(calendarService);
        when(graph.getAgencyIds()).thenReturn(Collections.<String>singletonList(agencyId));
        when(calendarService.getTimeZoneForAgencyId(agencyId)).thenReturn(TimeZone.getTimeZone("Europe/Budapest"));

        when(routingRequest.getSecondsSinceEpoch())
            .thenReturn(
                1393750800L /* 2014-03-02T10:00:00+01:00 */,

 
View Full Code Here

public class GtfsLibrary {

    public static final char ID_SEPARATOR = ':'; // note this is different than what OBA GTFS uses to match our 1.0 API

    public static GtfsContext createContext(GtfsRelationalDao dao) {
        CalendarService calendarService = createCalendarService(dao);
        return createContext(dao,calendarService);
    }
View Full Code Here

        if (defaultAgencyId != null)
            reader.setDefaultAgencyId(defaultAgencyId);

        reader.run();

        CalendarService calendarService = createCalendarService(dao);

        return new GtfsContextImpl(dao, calendarService);
    }
View Full Code Here

public class ServiceIdOverlapCacheTest {

  @Test
  public void test() {

    CalendarService calendarService = Mockito.mock(CalendarService.class);

    TimeZone tz = TimeZone.getDefault();

    AgencyAndId serviceIdA = new AgencyAndId("1", "serviceIdA");
    AgencyAndId serviceIdB = new AgencyAndId("1", "serviceIdB");
    AgencyAndId serviceIdC = new AgencyAndId("1", "serviceIdC");
    AgencyAndId serviceIdD = new AgencyAndId("1", "serviceIdD");

    LocalizedServiceId lsidA = new LocalizedServiceId(serviceIdA, tz);
    LocalizedServiceId lsidB = new LocalizedServiceId(serviceIdB, tz);
    LocalizedServiceId lsidC = new LocalizedServiceId(serviceIdC, tz);
    LocalizedServiceId lsidD = new LocalizedServiceId(serviceIdD, tz);

    Set<ServiceDate> serviceDatesA = set(new ServiceDate(2010, 9, 10),
        new ServiceDate(2010, 9, 11));
    Set<ServiceDate> serviceDatesB = set(new ServiceDate(2010, 9, 11),
        new ServiceDate(2010, 9, 12));
    Set<ServiceDate> serviceDatesC = set(new ServiceDate(2010, 9, 12),
        new ServiceDate(2010, 9, 13));
    Set<ServiceDate> serviceDatesD = set(new ServiceDate(2010, 9, 13));

    Mockito.when(calendarService.getServiceDatesForServiceId(serviceIdA)).thenReturn(
        serviceDatesA);
    Mockito.when(calendarService.getServiceDatesForServiceId(serviceIdB)).thenReturn(
        serviceDatesB);
    Mockito.when(calendarService.getServiceDatesForServiceId(serviceIdC)).thenReturn(
        serviceDatesC);
    Mockito.when(calendarService.getServiceDatesForServiceId(serviceIdD)).thenReturn(
        serviceDatesD);

    ServiceIdOverlapCache cache = new ServiceIdOverlapCache();
    cache.setCalendarService(calendarService);
View Full Code Here

TOP

Related Classes of org.onebusaway.gtfs.services.calendar.CalendarService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.