public boolean deleteFileFromStorage(String jarName) throws IOException { return fileStorage.delete(jarName); }
public boolean deleteFileFromStorage(String jarName) throws IOException { return fileStorage.delete(jarName); }
@Test public void testJarStorage() throws IOException { FileStorage fileStorage = getFileStorage(); File file = File.createTempFile("test", ".tmp"); file.deleteOnExit(); List<String> lines = Lists.newArrayList("test-line-1", "test-line-2"); Files.write(file.toPath(), lines, Charset.forName("UTF-8")); String name = "file.name"; // delete the file if it already exists fileStorage.delete(name); fileStorage.upload(new FileInputStream(file), name); InputStream inputStream = fileStorage.download(name); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); String nextLine; List<String> actual = Lists.newArrayList(); while((nextLine = bufferedReader.readLine()) != null) { actual.add(nextLine); } Assert.assertEquals(lines, actual); } }