@Test public void currentTimeDataTest() { weatherService.activate(start, 1); assertEquals(24, weatherReportRepo.count()); timeslotRepo = (TimeslotRepo) SpringApplicationContext.getBean("timeslotRepo"); int index = weatherReportRepo.currentWeatherReport().getTimeslotIndex(); Timeslot slot = timeslotRepo.findBySerialNumber(index); assertEquals(start, slot.getStartInstant()); assertEquals(timeslotRepo.currentTimeslot(), slot); timeService.setCurrentTime(next); index = weatherReportRepo.currentWeatherReport().getTimeslotIndex(); slot = timeslotRepo.findBySerialNumber(index); assertEquals(next, slot.getStartInstant()); assertEquals(timeslotRepo.currentTimeslot(), slot); assertEquals(2, weatherReportRepo.allWeatherReports().size()); assertFalse((weatherReportRepo.allWeatherReports().get(0).getTimeslotIndex() == weatherReportRepo.allWeatherReports().get(1).getTimeslotIndex()), "different timeslots"); }
@Override public void activate (Instant time, int phaseNumber) { long msec = time.getMillis(); if (msec % (getWeatherReqInterval() * TimeService.HOUR) != 0) { log.info("WeatherService reports not time to grab weather data."); } else { log.info("Timeslot " + timeslotRepo.currentTimeslot().getId() + " WeatherService reports time to make request for weather data"); DateTime dateTime = timeslotRepo.currentTimeslot().getStartTime(); if (blocking) { WeatherRequester wr = new WeatherRequester(dateTime); wr.run(); } else { aheadDays.add(dateTime.plusDays(daysAhead)); while (aheadDays.size() > 0) { WeatherRequester wr = new WeatherRequester(aheadDays.remove(0)); new Thread(wr).start(); } } } broadcastWeatherReports(); broadcastWeatherForecasts(); }
WeatherService extends TimeslotPhaseProcessor implements
    InitializationService { @Override public void activate (Instant time, int phaseNumber) { long msec = time.getMillis(); if (msec % (getWeatherReqInterval() * TimeService.HOUR) != 0) { log.info("WeatherService reports not time to grab weather data."); } else { log.info("Timeslot " + timeslotRepo.currentTimeslot().getId() + " WeatherService reports time to make request for weather data"); DateTime dateTime = timeslotRepo.currentTimeslot().getStartTime(); if (blocking) { WeatherRequester wr = new WeatherRequester(dateTime); wr.run(); } else { aheadDays.add(dateTime.plusDays(daysAhead)); while (aheadDays.size() > 0) { WeatherRequester wr = new WeatherRequester(aheadDays.remove(0)); new Thread(wr).start(); } } } broadcastWeatherReports(); broadcastWeatherForecasts(); } }
WeatherService extends TimeslotPhaseProcessor implements
    InitializationService { @Override public void activate (Instant time, int phaseNumber) { long msec = time.getMillis(); if (msec % (getWeatherReqInterval() * TimeService.HOUR) != 0) { log.info("WeatherService reports not time to grab weather data."); } else { log.info("Timeslot " + timeslotRepo.currentTimeslot().getId() + " WeatherService reports time to make request for weather data"); DateTime dateTime = timeslotRepo.currentTimeslot().getStartTime(); if (blocking) { WeatherRequester wr = new WeatherRequester(dateTime); wr.run(); } else { aheadDays.add(dateTime.plusDays(daysAhead)); while (aheadDays.size() > 0) { WeatherRequester wr = new WeatherRequester(aheadDays.remove(0)); new Thread(wr).start(); } } } broadcastWeatherReports(); broadcastWeatherForecasts(); }  }
WeatherService extends TimeslotPhaseProcessor implements
    InitializationService { @Override public void activate (Instant time, int phaseNumber) { long msec = time.getMillis(); if (msec % (getWeatherReqInterval() * TimeService.HOUR) != 0) { log.info("WeatherService reports not time to grab weather data."); } else { log.info("Timeslot " + timeslotRepo.currentTimeslot().getId() + " WeatherService reports time to make request for weather data"); DateTime dateTime = timeslotRepo.currentTimeslot().getStartTime(); if (blocking) { WeatherRequester wr = new WeatherRequester(dateTime); wr.run(); } else { aheadDays.add(dateTime.plusDays(daysAhead)); while (aheadDays.size() > 0) { WeatherRequester wr = new WeatherRequester(aheadDays.remove(0)); new Thread(wr).start(); } } } broadcastWeatherReports(); broadcastWeatherForecasts(); }  int getWeatherReqInterval(); String getServerUrl(); boolean isBlocking(); int getForecastHorizon(); @Override void activate(Instant time, int phaseNumber); @Override String initialize(Competition competition, List<String> completedInits); }
WeatherService extends TimeslotPhaseProcessor implements
    InitializationService { @Override public void activate (Instant time, int phaseNumber) { long msec = time.getMillis(); if (msec % (getWeatherReqInterval() * TimeService.HOUR) != 0) { log.info("WeatherService reports not time to grab weather data."); } else { log.info("Timeslot " + timeslotRepo.currentTimeslot().getId() + " WeatherService reports time to make request for weather data"); DateTime dateTime = timeslotRepo.currentTimeslot().getStartTime(); if (blocking) { WeatherRequester wr = new WeatherRequester(dateTime); wr.run(); } else { aheadDays.add(dateTime.plusDays(daysAhead)); while (aheadDays.size() > 0) { WeatherRequester wr = new WeatherRequester(aheadDays.remove(0)); new Thread(wr).start(); } } } broadcastWeatherReports(); broadcastWeatherForecasts(); }  int getWeatherReqInterval(); String getServerUrl(); boolean isBlocking(); int getForecastHorizon(); @Override void activate(Instant time, int phaseNumber); @Override String initialize(Competition competition, List<String> completedInits);  }