@Test public void testShouldDelete() throws IOException { String prefix = getPrefix() + "/dptest"; createData(prefix); DateTimeFormatter formatter = DateTimeFormat.forPattern("yy/MM/dd"); DateTime oldest = formatter.parseDateTime("11/01/03"); assertTrue(dataPurgeService.shouldDelete(formatter, oldest, "11/01/01")); assertTrue(dataPurgeService.shouldDelete(formatter, oldest, "11/01/02")); assertFalse(dataPurgeService.shouldDelete(formatter, oldest, "11/01/03")); assertFalse(dataPurgeService.shouldDelete(formatter, oldest, "11/01/04")); assertTrue(dataPurgeService.shouldDelete(formatter, oldest, "10/01/04")); assertFalse(dataPurgeService.shouldDelete(formatter, oldest, "11/04/04")); assertFalse(dataPurgeService.shouldDelete(formatter, oldest, "12/04/04")); }
protected boolean shouldDelete(DateTimeFormatter dateTimeFormatter, DateTime oldestDataAllowed, String dateString) { boolean result = false; DateTime time = null; try { time = dateTimeFormatter.parseDateTime(dateString); } catch (Exception e) { } if (time != null && time.isBefore(oldestDataAllowed)) { result = true; } return result; }
DataPurgeServiceImpl implements DataPurgeService { protected boolean shouldDelete(DateTimeFormatter dateTimeFormatter, DateTime oldestDataAllowed, String dateString) { boolean result = false; DateTime time = null; try { time = dateTimeFormatter.parseDateTime(dateString); } catch (Exception e) { } if (time != null && time.isBefore(oldestDataAllowed)) { result = true; } return result; } }
DataPurgeServiceImpl implements DataPurgeService { protected boolean shouldDelete(DateTimeFormatter dateTimeFormatter, DateTime oldestDataAllowed, String dateString) { boolean result = false; DateTime time = null; try { time = dateTimeFormatter.parseDateTime(dateString); } catch (Exception e) { } if (time != null && time.isBefore(oldestDataAllowed)) { result = true; } return result; } DataPurgeServiceImpl(); }
DataPurgeServiceImpl implements DataPurgeService { protected boolean shouldDelete(DateTimeFormatter dateTimeFormatter, DateTime oldestDataAllowed, String dateString) { boolean result = false; DateTime time = null; try { time = dateTimeFormatter.parseDateTime(dateString); } catch (Exception e) { } if (time != null && time.isBefore(oldestDataAllowed)) { result = true; } return result; } DataPurgeServiceImpl(); @Override boolean purgeData(DataPurgeConfig dataPurgeConfig, DateTime currentTime); }
DataPurgeServiceImpl implements DataPurgeService { protected boolean shouldDelete(DateTimeFormatter dateTimeFormatter, DateTime oldestDataAllowed, String dateString) { boolean result = false; DateTime time = null; try { time = dateTimeFormatter.parseDateTime(dateString); } catch (Exception e) { } if (time != null && time.isBefore(oldestDataAllowed)) { result = true; } return result; } DataPurgeServiceImpl(); @Override boolean purgeData(DataPurgeConfig dataPurgeConfig, DateTime currentTime);  }