LocalTemplateDownloader extends TemplateDownloaderBase implements TemplateDownloader { public LocalTemplateDownloader(StorageLayer storageLayer, String downloadUrl, String toDir, long maxTemplateSizeInBytes, DownloadCompleteCallback callback) { super(storageLayer, downloadUrl, toDir, maxTemplateSizeInBytes, callback); final String filename = new File(downloadUrl).getName(); _toFile = toDir.endsWith(File.separator) ? toDir + filename : toDir + File.separator + filename; } LocalTemplateDownloader(StorageLayer storageLayer, String downloadUrl, String toDir,
      long maxTemplateSizeInBytes, DownloadCompleteCallback callback);  LocalTemplateDownloader(StorageLayer storageLayer, String downloadUrl, String toDir,
      long maxTemplateSizeInBytes);  LocalTemplateDownloader(String downloadUrl, String toDir, long maxTemplateSizeInBytes); @Override long download(boolean resume, DownloadCompleteCallback callback); static final Logger s_logger; }
@Test public void localTemplateDownloaderTest() throws Exception { final String url = new File("pom.xml").toURI().toURL().toString(); final long defaultMaxTemplateSizeInBytes = TemplateDownloader.DEFAULT_MAX_TEMPLATE_SIZE_IN_BYTES; final String tempDir = System.getProperty("java.io.tmpdir"); final TemplateDownloader td = new LocalTemplateDownloader(url, tempDir, defaultMaxTemplateSizeInBytes); final long bytes = td.download(true, null); assertThat(bytes, greaterThan(0L)); }