@Test public void testReportValues() { weatherService.activate(start, 1); WeatherReport wr = weatherReportRepo.allWeatherReports().get(0); assertEquals(3.5, wr.getTemperature(), .0001); assertEquals(4.0, wr.getWindSpeed(), .0001); assertEquals(250.0, wr.getWindDirection(), .0001); assertEquals(1.0, wr.getCloudCover(), .0001); Instant reqTime = timeslotRepo.findBySerialNumber(24).getStartInstant(); assertNotNull(reqTime); assertEquals(24, weatherReportRepo.count()); timeService.setCurrentTime(reqTime); weatherService.activate(reqTime, 1); assertEquals(48, weatherReportRepo.count()); assertEquals(48, weatherForecastRepo.count()); assertEquals(false, wr.getTemperature() == weatherReportRepo .allWeatherReports().get(24).getTemperature()); timeService.setCurrentTime(timeslotRepo.findBySerialNumber(47) .getStartInstant()); assertEquals(false, weatherReportRepo.allWeatherReports().get(23).getTemperature() == weatherReportRepo .allWeatherReports().get(47).getTemperature()); assertEquals(false, wr.getId() == weatherReportRepo.allWeatherReports() .get(24).getId()); }
@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);  }