* {@link IDataStore#getDataFiles(LocalDate, LocalDate)}
*/
@Test
public void testGetDataFiles_startEnd() throws IOException {
LocalDate lowerBound = new LocalDate(1, 1, 10);
LocalDate upperBound = new LocalDate(3, 1, 1);
LocalDate insideLowerBound = lowerBound.plusMonths(1);
LocalDate insideUpperBound = upperBound.minusMonths(1);
Set<File> files = new HashSet<File>();
files.add(store.getDataFile(lowerBound));
files.add(store.getDataFile(upperBound));
files.add(store.getDataFile(insideLowerBound));
files.add(store.getDataFile(insideUpperBound));
for (File f : files) {
if (!f.exists() && !f.createNewFile()) {
throw new RuntimeException();
}
}
List<File> returnedFiles = store.getDataFiles(lowerBound, upperBound);
assertEquals(files.size(), returnedFiles.size());
for (File f : returnedFiles) {
assertTrue(files.contains(f));
}
assertEquals(0, store.getDataFiles(upperBound, lowerBound).size());
for (File f : files) {
FileUtils.forceDelete(f);
}
assertEquals(0, store.getDataFiles(lowerBound, upperBound).size());
// Temporary test for testing files across multiple workspaces:
LocalDate end = new LocalDate();
LocalDate start = end.minusYears(1);
List<File> result = new ArrayList<File>();
IPath[] storagePaths = XmlPlugin.getDefault().getStoragePaths();
MutableDateTime date = start.toDateTime(new LocalTime(0, 0, 0)).toMutableDateTime();
while (new LocalDate(date.toInstant().getMillis()).compareTo(end) <= 0) {
for (IPath path : storagePaths) {
File f = store.getDataFile(new LocalDate(date.getMillis()), path);
if (f.exists()) {
result.add(f);
}
}
date.addMonths(1);