ExtendedCalendarServiceImpl implements ExtendedCalendarService { @Cacheable @Override public Set<Date> getDatesForServiceIds(ServiceIdActivation serviceIds) { Set<Date> serviceDates = null; List<LocalizedServiceId> activeServiceIds = serviceIds.getActiveServiceIds(); List<LocalizedServiceId> inactiveServiceIds = serviceIds.getInactiveServiceIds(); for (LocalizedServiceId activeServiceId : activeServiceIds) { List<Date> dates = _calendarService.getDatesForLocalizedServiceId(activeServiceId); if (dates.isEmpty()) return Collections.emptySet(); if (serviceDates == null) serviceDates = new HashSet<Date>(dates); else serviceDates.retainAll(dates); if (serviceDates.isEmpty()) return Collections.emptySet(); } for (LocalizedServiceId inactiveServiceId : inactiveServiceIds) { List<Date> dates = _calendarService.getDatesForLocalizedServiceId(inactiveServiceId); serviceDates.removeAll(dates); } return serviceDates; }  void setServiceDateLowerBoundsInWeeks(int serviceDateLowerBoundsInWeeks); void setServiceDateUpperBoundsInWeeks(int serviceDateUpperBoundsInWeeks); @Autowired void setCalendarService(CalendarService calendarService); @Autowired void setTransitGraphDao(TransitGraphDao transitGraphDao); void setServiceDateRangeCacheInterval(int hours); void setServiceDateRangeCache(Cache serviceDateRangeCache); @PostConstruct @Refreshable(dependsOn = RefreshableResources.CALENDAR_DATA) void start(); @Cacheable @Override Set<ServiceDate> getServiceDatesForServiceIds(
      ServiceIdActivation serviceIds); @Cacheable @Override Set<Date> getDatesForServiceIds(ServiceIdActivation serviceIds); @Cacheable List<Date> getDatesForServiceIdsAsOrderedList(
      ServiceIdActivation serviceIds); @SuppressWarnings("unchecked") @Override Collection<Date> getServiceDatesWithinRange(
      ServiceIdActivation serviceIds, ServiceInterval interval, Date from,
      Date to); @Override @Cacheable boolean areServiceIdsActiveOnServiceDate(
      ServiceIdActivation serviceIds, Date serviceDate); @Override List<Date> getServiceDatesForInterval(ServiceIdActivation serviceIds,
      ServiceInterval serviceInterval, long time, boolean findDepartures); @Override List<Date> getNextServiceDatesForDepartureInterval(
      ServiceIdActivation serviceIds, ServiceInterval serviceInterval, long time); @Override List<Date> getPreviousServiceDatesForArrivalInterval(
      ServiceIdActivation serviceIds, ServiceInterval serviceInterval, long time);  }
@Test public void testGetServiceDatesForServiceIds01() { ServiceIdActivation serviceIds = serviceIds(lsids("sA"), lsids("sB")); Set<Date> dates = _service.getDatesForServiceIds(serviceIds); assertEquals(1, dates.size()); assertTrue(dates.contains(new ServiceDate(2010, 9, 10).getAsDate(timeZone()))); }
@Test public void testGetServiceDatesForServiceIds02() { ServiceIdActivation serviceIds = serviceIds(lsids("sA", "sB"), lsids()); Set<Date> dates = _service.getDatesForServiceIds(serviceIds); assertEquals(1, dates.size()); assertTrue(dates.contains(new ServiceDate(2010, 9, 11).getAsDate(timeZone()))); }
@Test public void testGetServiceDatesForServiceIds03() { ServiceIdActivation serviceIds = serviceIds(lsids("sC", "sD"), lsids()); Set<Date> dates = _service.getDatesForServiceIds(serviceIds); assertEquals(1, dates.size()); assertTrue(dates.contains(new ServiceDate(2010, 9, 13).getAsDate(timeZone()))); }
@Test public void testGetServiceDatesForServiceIds04() { ServiceIdActivation serviceIds = serviceIds(lsids("sA", "sC"), lsids()); Set<Date> dates = _service.getDatesForServiceIds(serviceIds); assertEquals(0, dates.size()); }