@Test public void testGetNextExecutionDate() { assertNotNull("getNextExecutionDate", MailReport.getNextExecutionDate(Period.JOUR)); assertNotNull("getNextExecutionDate", MailReport.getNextExecutionDate(Period.SEMAINE)); assertNotNull("getNextExecutionDate", MailReport.getNextExecutionDate(Period.MOIS)); }
public static Date getNextExecutionDate(Period period) { final Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); switch (period) { case JOUR: calendar.add(Calendar.DAY_OF_YEAR, 1); break; case SEMAINE: calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); if (calendar.getTimeInMillis() < System.currentTimeMillis()) { calendar.add(Calendar.DAY_OF_YEAR, 7); } break; case MOIS: calendar.set(Calendar.DAY_OF_MONTH, 1); if (calendar.getTimeInMillis() < System.currentTimeMillis()) { calendar.add(Calendar.MONTH, 1); } break; case ANNEE: throw new IllegalArgumentException(String.valueOf(period)); case TOUT: throw new IllegalArgumentException(String.valueOf(period)); default: throw new IllegalArgumentException(String.valueOf(period)); } return calendar.getTime(); }
MailReport { public static Date getNextExecutionDate(Period period) { final Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); switch (period) { case JOUR: calendar.add(Calendar.DAY_OF_YEAR, 1); break; case SEMAINE: calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); if (calendar.getTimeInMillis() < System.currentTimeMillis()) { calendar.add(Calendar.DAY_OF_YEAR, 7); } break; case MOIS: calendar.set(Calendar.DAY_OF_MONTH, 1); if (calendar.getTimeInMillis() < System.currentTimeMillis()) { calendar.add(Calendar.MONTH, 1); } break; case ANNEE: throw new IllegalArgumentException(String.valueOf(period)); case TOUT: throw new IllegalArgumentException(String.valueOf(period)); default: throw new IllegalArgumentException(String.valueOf(period)); } return calendar.getTime(); } }
MailReport { public static Date getNextExecutionDate(Period period) { final Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); switch (period) { case JOUR: calendar.add(Calendar.DAY_OF_YEAR, 1); break; case SEMAINE: calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); if (calendar.getTimeInMillis() < System.currentTimeMillis()) { calendar.add(Calendar.DAY_OF_YEAR, 7); } break; case MOIS: calendar.set(Calendar.DAY_OF_MONTH, 1); if (calendar.getTimeInMillis() < System.currentTimeMillis()) { calendar.add(Calendar.MONTH, 1); } break; case ANNEE: throw new IllegalArgumentException(String.valueOf(period)); case TOUT: throw new IllegalArgumentException(String.valueOf(period)); default: throw new IllegalArgumentException(String.valueOf(period)); } return calendar.getTime(); }  }
MailReport { public static Date getNextExecutionDate(Period period) { final Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); switch (period) { case JOUR: calendar.add(Calendar.DAY_OF_YEAR, 1); break; case SEMAINE: calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); if (calendar.getTimeInMillis() < System.currentTimeMillis()) { calendar.add(Calendar.DAY_OF_YEAR, 7); } break; case MOIS: calendar.set(Calendar.DAY_OF_MONTH, 1); if (calendar.getTimeInMillis() < System.currentTimeMillis()) { calendar.add(Calendar.MONTH, 1); } break; case ANNEE: throw new IllegalArgumentException(String.valueOf(period)); case TOUT: throw new IllegalArgumentException(String.valueOf(period)); default: throw new IllegalArgumentException(String.valueOf(period)); } return calendar.getTime(); }  static void scheduleReportMailForLocalServer(Collector collector, Timer timer); static List<Period> getMailPeriods(); static Date getNextExecutionDate(Period period); void sendReportMailForLocalServer(Collector collector, Period period); void sendReportMail(Collector collector, boolean collectorServer,
			List<JavaInformations> javaInformationsList, Period period); }
MailReport { public static Date getNextExecutionDate(Period period) { final Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); switch (period) { case JOUR: calendar.add(Calendar.DAY_OF_YEAR, 1); break; case SEMAINE: calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); if (calendar.getTimeInMillis() < System.currentTimeMillis()) { calendar.add(Calendar.DAY_OF_YEAR, 7); } break; case MOIS: calendar.set(Calendar.DAY_OF_MONTH, 1); if (calendar.getTimeInMillis() < System.currentTimeMillis()) { calendar.add(Calendar.MONTH, 1); } break; case ANNEE: throw new IllegalArgumentException(String.valueOf(period)); case TOUT: throw new IllegalArgumentException(String.valueOf(period)); default: throw new IllegalArgumentException(String.valueOf(period)); } return calendar.getTime(); }  static void scheduleReportMailForLocalServer(Collector collector, Timer timer); static List<Period> getMailPeriods(); static Date getNextExecutionDate(Period period); void sendReportMailForLocalServer(Collector collector, Period period); void sendReportMail(Collector collector, boolean collectorServer,
			List<JavaInformations> javaInformationsList, Period period);  }