@Test public void testExpandPrefix() throws Exception { String prefix = getPrefix() + "/dptest/"; createNovDecData(prefix); String test1 = prefix + "*"; String test2 = prefix + "**01"; String test6 = prefix + "*/0101"; List<File> result1 = dataPurgeService.expandPrefix(test1); List<File> result2 = dataPurgeService.expandPrefix(test2); List<File> result3 = dataPurgeService.expandPrefix(test3); List<File> result4 = dataPurgeService.expandPrefix(test4); List<File> result5 = dataPurgeService.expandPrefix(test5); List<File> result6 = dataPurgeService.expandPrefix(test6); List<File> result7 = dataPurgeService.expandPrefix(test7); assertEquals(result1.size(), 2); assertEquals(result2.size(), 4); assertEquals(result3.size(), 12); assertEquals(result4.size(), 3); assertEquals(result5.size(), 2); assertEquals(result6.size(), 6); assertEquals(result7.size(), 2); }
protected List<File> expandPrefix(String path) { if (path.indexOf('*') == -1) { LinkedList<File> list = new LinkedList<>(); list.add(new File(path)); return list; } File cur = path.startsWith(dirSeperator) ? new File(dirSeperator) : new File("."); LinkedList<File> list = new LinkedList<>(); String[] tokens = LessStrings.splitArray(path, dirRegexSeperator); expandPrefix(list, cur, tokens, 0); return list; }
DataPurgeServiceImpl implements DataPurgeService { protected List<File> expandPrefix(String path) { if (path.indexOf('*') == -1) { LinkedList<File> list = new LinkedList<>(); list.add(new File(path)); return list; } File cur = path.startsWith(dirSeperator) ? new File(dirSeperator) : new File("."); LinkedList<File> list = new LinkedList<>(); String[] tokens = LessStrings.splitArray(path, dirRegexSeperator); expandPrefix(list, cur, tokens, 0); return list; } }
DataPurgeServiceImpl implements DataPurgeService { protected List<File> expandPrefix(String path) { if (path.indexOf('*') == -1) { LinkedList<File> list = new LinkedList<>(); list.add(new File(path)); return list; } File cur = path.startsWith(dirSeperator) ? new File(dirSeperator) : new File("."); LinkedList<File> list = new LinkedList<>(); String[] tokens = LessStrings.splitArray(path, dirRegexSeperator); expandPrefix(list, cur, tokens, 0); return list; } DataPurgeServiceImpl(); }
DataPurgeServiceImpl implements DataPurgeService { protected List<File> expandPrefix(String path) { if (path.indexOf('*') == -1) { LinkedList<File> list = new LinkedList<>(); list.add(new File(path)); return list; } File cur = path.startsWith(dirSeperator) ? new File(dirSeperator) : new File("."); LinkedList<File> list = new LinkedList<>(); String[] tokens = LessStrings.splitArray(path, dirRegexSeperator); expandPrefix(list, cur, tokens, 0); return list; } DataPurgeServiceImpl(); @Override boolean purgeData(DataPurgeConfig dataPurgeConfig, DateTime currentTime); }
DataPurgeServiceImpl implements DataPurgeService { protected List<File> expandPrefix(String path) { if (path.indexOf('*') == -1) { LinkedList<File> list = new LinkedList<>(); list.add(new File(path)); return list; } File cur = path.startsWith(dirSeperator) ? new File(dirSeperator) : new File("."); LinkedList<File> list = new LinkedList<>(); String[] tokens = LessStrings.splitArray(path, dirRegexSeperator); expandPrefix(list, cur, tokens, 0); return list; } DataPurgeServiceImpl(); @Override boolean purgeData(DataPurgeConfig dataPurgeConfig, DateTime currentTime);  }