@Test public void testDownloadFilesWithDelta() throws Exception { final File testDir = new File(TEST_DIRECTORY + File.separator + "barge_a_queue_noire"); File existingFile = new File(testDir.getAbsolutePath() + File.separator + "barge_a_queue_noire_1.jpg"); FileHelper.forceMkdir(testDir); FileHelper.createEmptyFile(existingFile); FileHelper.createEmptyFile(new File(existingFile.getAbsolutePath() + ".properties")); Assert.assertEquals(0, existingFile.length()); final List<File> downloadedFiles = this.downloadHelper.downloadFiles( TEST_DIRECTORY, "barge_a_queue_noire", OrnidroidFileType.PICTURE); Assert.assertTrue(downloadedFiles.size() == 2); existingFile = new File(existingFile.getAbsolutePath()); Assert.assertEquals(0, existingFile.length()); final File newFile = new File(testDir + File.separator + "barge_a_queue_noire_2.jpg"); Assert.assertTrue(newFile.length() > 0); }
public List<File> downloadFiles(final String ornidroidMediaHome, final String directoryName, final OrnidroidFileType fileType) throws OrnidroidException { final String destinationPath = ornidroidMediaHome + File.separator + directoryName; final String baseUrl = getBaseUrl(directoryName, fileType); final String[] filesToDownload = readContentFile(baseUrl, destinationPath); final List<File> downloadedFiles = new ArrayList<File>(); if (null != filesToDownload) { for (final String fileName : filesToDownload) { final File downloadedFile = downloadFile(baseUrl, fileName, destinationPath); if ((null != downloadedFile) && downloadedFile.exists()) { downloadedFiles.add(downloadedFile); } } } return downloadedFiles; }
DownloadHelperImpl implements DownloadHelperInterface { public List<File> downloadFiles(final String ornidroidMediaHome, final String directoryName, final OrnidroidFileType fileType) throws OrnidroidException { final String destinationPath = ornidroidMediaHome + File.separator + directoryName; final String baseUrl = getBaseUrl(directoryName, fileType); final String[] filesToDownload = readContentFile(baseUrl, destinationPath); final List<File> downloadedFiles = new ArrayList<File>(); if (null != filesToDownload) { for (final String fileName : filesToDownload) { final File downloadedFile = downloadFile(baseUrl, fileName, destinationPath); if ((null != downloadedFile) && downloadedFile.exists()) { downloadedFiles.add(downloadedFile); } } } return downloadedFiles; } }
DownloadHelperImpl implements DownloadHelperInterface { public List<File> downloadFiles(final String ornidroidMediaHome, final String directoryName, final OrnidroidFileType fileType) throws OrnidroidException { final String destinationPath = ornidroidMediaHome + File.separator + directoryName; final String baseUrl = getBaseUrl(directoryName, fileType); final String[] filesToDownload = readContentFile(baseUrl, destinationPath); final List<File> downloadedFiles = new ArrayList<File>(); if (null != filesToDownload) { for (final String fileName : filesToDownload) { final File downloadedFile = downloadFile(baseUrl, fileName, destinationPath); if ((null != downloadedFile) && downloadedFile.exists()) { downloadedFiles.add(downloadedFile); } } } return downloadedFiles; }  }
DownloadHelperImpl implements DownloadHelperInterface { public List<File> downloadFiles(final String ornidroidMediaHome, final String directoryName, final OrnidroidFileType fileType) throws OrnidroidException { final String destinationPath = ornidroidMediaHome + File.separator + directoryName; final String baseUrl = getBaseUrl(directoryName, fileType); final String[] filesToDownload = readContentFile(baseUrl, destinationPath); final List<File> downloadedFiles = new ArrayList<File>(); if (null != filesToDownload) { for (final String fileName : filesToDownload) { final File downloadedFile = downloadFile(baseUrl, fileName, destinationPath); if ((null != downloadedFile) && downloadedFile.exists()) { downloadedFiles.add(downloadedFile); } } } return downloadedFiles; }  File downloadFile(final String baseUrl, final String fileName,
			final String destinationPath); List<File> downloadFiles(final String ornidroidMediaHome,
			final String directoryName, final OrnidroidFileType fileType); String getBaseUrl(final String directoryName,
			final OrnidroidFileType fileType); String[] readContentFile(final String baseUrl,
			final String destinationPath); }
DownloadHelperImpl implements DownloadHelperInterface { public List<File> downloadFiles(final String ornidroidMediaHome, final String directoryName, final OrnidroidFileType fileType) throws OrnidroidException { final String destinationPath = ornidroidMediaHome + File.separator + directoryName; final String baseUrl = getBaseUrl(directoryName, fileType); final String[] filesToDownload = readContentFile(baseUrl, destinationPath); final List<File> downloadedFiles = new ArrayList<File>(); if (null != filesToDownload) { for (final String fileName : filesToDownload) { final File downloadedFile = downloadFile(baseUrl, fileName, destinationPath); if ((null != downloadedFile) && downloadedFile.exists()) { downloadedFiles.add(downloadedFile); } } } return downloadedFiles; }  File downloadFile(final String baseUrl, final String fileName,
			final String destinationPath); List<File> downloadFiles(final String ornidroidMediaHome,
			final String directoryName, final OrnidroidFileType fileType); String getBaseUrl(final String directoryName,
			final OrnidroidFileType fileType); String[] readContentFile(final String baseUrl,
			final String destinationPath);  }