LcL3ProductionType extends HadoopProductionType { static String getLcPeriodName(ProductionRequest productionRequest) throws ProductionException { DateRange minMax = productionRequest.createFromMinMax(); long diffMillis = minMax.getStopDate().getTime() - minMax.getStartDate().getTime() + L3ProductionType.MILLIS_PER_DAY; int periodLength = (int) (diffMillis / L3ProductionType.MILLIS_PER_DAY); String minDate = productionRequest.getString("minDate"); String resolution = productionRequest.getString("resolution", "FR"); return String.format("%s-%s-%dd", resolution, minDate, periodLength); } LcL3ProductionType(FileSystemService fileSystemService, HadoopProcessingService processingService,
                       StagingService stagingService); @Override Production createProduction(ProductionRequest productionRequest);  }
@Test public void testGetLcPeriodName() throws Exception { String periodName = LcL3ProductionType.getLcPeriodName(new ProductionRequest("test", "ewa", "minDate", "2010-07-01", "maxDate", "2010-07-15")); assertEquals("FR-2010-07-01-15d", periodName); periodName = LcL3ProductionType.getLcPeriodName(new ProductionRequest("test", "ewa", "minDate", "2010-07-01", "maxDate", "2010-07-07")); assertEquals("FR-2010-07-01-7d", periodName); periodName = LcL3ProductionType.getLcPeriodName(new ProductionRequest("test", "ewa", "minDate", "2010-07-01", "maxDate", "2010-07-10")); assertEquals("FR-2010-07-01-10d", periodName); periodName = LcL3ProductionType.getLcPeriodName(new ProductionRequest("test", "ewa", "minDate", "2011-01-01", "maxDate", "2011-12-31")); assertEquals("FR-2011-01-01-365d", periodName); periodName = LcL3ProductionType.getLcPeriodName(new ProductionRequest("test", "ewa", "minDate", "2010-03-02", "maxDate", "2010-03-12", "periodLength", "20", "resolution", "RR")); assertEquals("RR-2010-03-02-11d", periodName); try { LcL3ProductionType.getLcPeriodName(new ProductionRequest("test", "ewa", "minDate", "2010-03-02")); fail(); } catch (ProductionException pe) { assertEquals("Production parameter 'maxDate' not set.", pe.getMessage()); } }