@Test public void testResetExistingDirectory() throws OrnidroidException, IOException { final File srcDir = buildOrnidroidHomeTest(TEST_DIRECTORY + "/srcDir"); final File imagesDir = new File(srcDir.getAbsolutePath() + File.separator + Constants.IMAGES_DIRECTORY); FileHelper.createEmptyFile(new File(imagesDir.getAbsolutePath() + File.separator + BasicConstants.CUSTOM_MEDIA_FILE_PREFIX + "file1.jpg")); FileHelper.createEmptyFile(new File(imagesDir.getAbsolutePath() + File.separator + BasicConstants.CUSTOM_MEDIA_FILE_PREFIX + "file1.jpg.properties")); FileHelper.createEmptyFile(new File(imagesDir.getAbsolutePath() + File.separator + "file1.jpg")); FileHelper.createEmptyFile(new File(imagesDir.getAbsolutePath() + File.separator + "file1.jpg.properties")); Assert.assertEquals( "precondition : there should be 4 files in the test directory : file1.jpg and custom_file1 and their properties files", 4, imagesDir.list().length); this.ornidroidIOService.resetExistingDirectory(imagesDir); Assert.assertEquals( "there should be 2 files in the test directory : file1.jpg, its properties files", 2, imagesDir.list().length); }
@Override public void resetExistingDirectory(File directoryToReset) throws OrnidroidException { List<File> filesList = Arrays.asList(directoryToReset .listFiles(new OrnidroidOfficialFileFilter(true))); for (File fileToDelete : filesList) { try { FileHelper.forceDelete(fileToDelete); } catch (IOException e) { throw new OrnidroidException( OrnidroidError.ORNIDROID_DOWNLOAD_ERROR, e); } } }
OrnidroidIOServiceImpl implements IOrnidroidIOService { @Override public void resetExistingDirectory(File directoryToReset) throws OrnidroidException { List<File> filesList = Arrays.asList(directoryToReset .listFiles(new OrnidroidOfficialFileFilter(true))); for (File fileToDelete : filesList) { try { FileHelper.forceDelete(fileToDelete); } catch (IOException e) { throw new OrnidroidException( OrnidroidError.ORNIDROID_DOWNLOAD_ERROR, e); } } } }
OrnidroidIOServiceImpl implements IOrnidroidIOService { @Override public void resetExistingDirectory(File directoryToReset) throws OrnidroidException { List<File> filesList = Arrays.asList(directoryToReset .listFiles(new OrnidroidOfficialFileFilter(true))); for (File fileToDelete : filesList) { try { FileHelper.forceDelete(fileToDelete); } catch (IOException e) { throw new OrnidroidException( OrnidroidError.ORNIDROID_DOWNLOAD_ERROR, e); } } } OrnidroidIOServiceImpl(); }
OrnidroidIOServiceImpl implements IOrnidroidIOService { @Override public void resetExistingDirectory(File directoryToReset) throws OrnidroidException { List<File> filesList = Arrays.asList(directoryToReset .listFiles(new OrnidroidOfficialFileFilter(true))); for (File fileToDelete : filesList) { try { FileHelper.forceDelete(fileToDelete); } catch (IOException e) { throw new OrnidroidException( OrnidroidError.ORNIDROID_DOWNLOAD_ERROR, e); } } } OrnidroidIOServiceImpl(); void addCustomMediaFile(final String birdDirectory,
			final OrnidroidFileType fileType, final String selectedFileName,
			final File selectedFile, final String comment); void checkAndCreateDirectory(final File fileDirectory); void checkOrnidroidHome(final String ornidroidHome); void downloadMediaFiles(final String mediaHomeDirectory,
			final Bird bird, final OrnidroidFileType fileType); List<String> filesToUpdate(final String mediaHomeDirectory,
			final Bird bird, final OrnidroidFileType fileType); void loadMediaFiles(final String fileDirectory, final Bird bird,
			final OrnidroidFileType fileType); void removeCustomMediaFile(final OrnidroidFile ornidroidFile); @Override void resetExistingDirectory(File directoryToReset); void downloadZipPackage(String zipname, String mediaHomeDirectory); boolean isEnoughFreeSpace(OrnidroidFileType fileType); ZipPackage getZipname(OrnidroidFileType fileType); int getZipDownloadProgressPercent(OrnidroidFileType fileType,
			int folderSizeBeforeDownload); int getInstallProgressPercent(OrnidroidFileType fileType); }
OrnidroidIOServiceImpl implements IOrnidroidIOService { @Override public void resetExistingDirectory(File directoryToReset) throws OrnidroidException { List<File> filesList = Arrays.asList(directoryToReset .listFiles(new OrnidroidOfficialFileFilter(true))); for (File fileToDelete : filesList) { try { FileHelper.forceDelete(fileToDelete); } catch (IOException e) { throw new OrnidroidException( OrnidroidError.ORNIDROID_DOWNLOAD_ERROR, e); } } } OrnidroidIOServiceImpl(); void addCustomMediaFile(final String birdDirectory,
			final OrnidroidFileType fileType, final String selectedFileName,
			final File selectedFile, final String comment); void checkAndCreateDirectory(final File fileDirectory); void checkOrnidroidHome(final String ornidroidHome); void downloadMediaFiles(final String mediaHomeDirectory,
			final Bird bird, final OrnidroidFileType fileType); List<String> filesToUpdate(final String mediaHomeDirectory,
			final Bird bird, final OrnidroidFileType fileType); void loadMediaFiles(final String fileDirectory, final Bird bird,
			final OrnidroidFileType fileType); void removeCustomMediaFile(final OrnidroidFile ornidroidFile); @Override void resetExistingDirectory(File directoryToReset); void downloadZipPackage(String zipname, String mediaHomeDirectory); boolean isEnoughFreeSpace(OrnidroidFileType fileType); ZipPackage getZipname(OrnidroidFileType fileType); int getZipDownloadProgressPercent(OrnidroidFileType fileType,
			int folderSizeBeforeDownload); int getInstallProgressPercent(OrnidroidFileType fileType);  }