FireL3ProductionType extends HadoopProductionType { static List<DateRange> getIndividualDays(DateRange mainRange) throws ProductionException { List<DateRange> dateRangeList = new ArrayList<DateRange>(); Date minDate = mainRange.getStartDate(); Calendar testCalendar = DateUtils.createCalendar(); testCalendar.setTime(minDate); long endTime = mainRange.getStopDate().getTime(); dateRangeList.add(new DateRange(minDate, minDate)); while (testCalendar.getTimeInMillis() < endTime) { testCalendar.add(Calendar.DAY_OF_MONTH, 1); Date testCalendarTime = testCalendar.getTime(); dateRangeList.add(new DateRange(testCalendarTime, testCalendarTime)); } return dateRangeList; } FireL3ProductionType(FileSystemService fileSystemService, HadoopProcessingService processingService,
                         StagingService stagingService); @Override Production createProduction(ProductionRequest productionRequest); static final int DEFAULT_WINGS_RANGE; }
@Test public void testGetDateRanges() throws Exception { DateRange dateRange = new DateRange(getAsDate("2008-06-01"), getAsDate("2008-06-11")); List<DateRange> dateRanges = FireL3ProductionType.getIndividualDays(dateRange); assertEquals(11, dateRanges.size()); for (DateRange currentDateRange : dateRanges) { assertEquals(currentDateRange.getStartDate().getTime(), currentDateRange.getStopDate().getTime()); } assertEquals(dateRanges.get(0).getStartDate().getTime(), getAsDate("2008-06-01").getTime()); assertEquals(dateRanges.get(10).getStopDate().getTime(), getAsDate("2008-06-11").getTime()); }