OrnidroidIOServiceImpl implements IOrnidroidIOService { public void downloadZipPackage(String zipname, String mediaHomeDirectory) throws OrnidroidException { OrnidroidException exception = null; deleteTempFiles(mediaHomeDirectory, zipname); File zipPackageFile = downloadHelper.downloadFile( DownloadConstants.getOrnidroidWebSite(), zipname, mediaHomeDirectory); if (zipPackageFile == null) { RuntimeException runtimeException = new RuntimeException( "no media file downloaded with parameters : " + zipname + BasicConstants.BLANK_STRING + mediaHomeDirectory); Log.e(BasicConstants.LOG_TAG, runtimeException.getMessage(), runtimeException); throw new OrnidroidException( OrnidroidError.ORNIDROID_DOWNLOAD_ERROR, runtimeException); } int tentative = 0; boolean success = false; while (!success && tentative < 10) { success = FileHelper.unzipFile(zipPackageFile.getName(), mediaHomeDirectory); if (!success) { Log.e(BasicConstants.LOG_TAG, "unzip failed " + tentative + " " + zipPackageFile.getName()); } tentative++; } try { FileHelper.forceDelete(zipPackageFile); } catch (IOException e) { Log.e(BasicConstants.LOG_TAG, e.getMessage(), e); exception = new OrnidroidException(OrnidroidError.UNZIP_PACKAGE, e); } if (!success) { exception = new OrnidroidException(OrnidroidError.UNZIP_PACKAGE, null); } if (exception != null) { throw exception; } } 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);  }
@Test public void testDownloadZipPackage() throws OrnidroidException { this.ornidroidIOService.downloadZipPackage("audio.zip", TEST_DIRECTORY); }