@Test public void testGetDirectoryList() throws IOException { String prefix = getPrefix() + "/dptest"; createData(prefix); List<File> directoryList = dataPurgeService.getSubdirectoryList(new File(prefix), null); assertNotNull(directoryList); assertEquals(9, directoryList.size()); }
protected List<File> getSubdirectoryList(File current, List<File> directoryList) { if (directoryList == null) { directoryList = new ArrayList<>(); } directoryList.add(current); if (current.isDirectory()) { File[] fileArray = current.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.isDirectory(); } }); if (fileArray != null) { for (File directory : fileArray) { getSubdirectoryList(directory, directoryList); } } } return directoryList; }
DataPurgeServiceImpl implements DataPurgeService { protected List<File> getSubdirectoryList(File current, List<File> directoryList) { if (directoryList == null) { directoryList = new ArrayList<>(); } directoryList.add(current); if (current.isDirectory()) { File[] fileArray = current.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.isDirectory(); } }); if (fileArray != null) { for (File directory : fileArray) { getSubdirectoryList(directory, directoryList); } } } return directoryList; } }
DataPurgeServiceImpl implements DataPurgeService { protected List<File> getSubdirectoryList(File current, List<File> directoryList) { if (directoryList == null) { directoryList = new ArrayList<>(); } directoryList.add(current); if (current.isDirectory()) { File[] fileArray = current.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.isDirectory(); } }); if (fileArray != null) { for (File directory : fileArray) { getSubdirectoryList(directory, directoryList); } } } return directoryList; } DataPurgeServiceImpl(); }
DataPurgeServiceImpl implements DataPurgeService { protected List<File> getSubdirectoryList(File current, List<File> directoryList) { if (directoryList == null) { directoryList = new ArrayList<>(); } directoryList.add(current); if (current.isDirectory()) { File[] fileArray = current.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.isDirectory(); } }); if (fileArray != null) { for (File directory : fileArray) { getSubdirectoryList(directory, directoryList); } } } return directoryList; } DataPurgeServiceImpl(); @Override boolean purgeData(DataPurgeConfig dataPurgeConfig, DateTime currentTime); }
DataPurgeServiceImpl implements DataPurgeService { protected List<File> getSubdirectoryList(File current, List<File> directoryList) { if (directoryList == null) { directoryList = new ArrayList<>(); } directoryList.add(current); if (current.isDirectory()) { File[] fileArray = current.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.isDirectory(); } }); if (fileArray != null) { for (File directory : fileArray) { getSubdirectoryList(directory, directoryList); } } } return directoryList; } DataPurgeServiceImpl(); @Override boolean purgeData(DataPurgeConfig dataPurgeConfig, DateTime currentTime);  }