Skip to content

Commit

Permalink
added test which upload the same file twice; this fails with an excep…
Browse files Browse the repository at this point in the history
…tion.
  • Loading branch information
msiuts committed Jul 20, 2011
1 parent d7a2645 commit a0be0c3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/test/java/com/intridea/io/vfs/provider/s3/S3ProviderTest.java
Expand Up @@ -140,6 +140,30 @@ public void upload () throws FileNotFoundException, IOException {
Assert.assertTrue(dest.exists() && dest.getType().equals(FileType.FILE));
}

@Test(dependsOnMethods={"createFileOk"})
public void upload_multiple() throws Exception {
FileObject dest = fsManager.resolveFile("s3://" + bucketName + "/test-place/backup.zip");

// Delete file if exists
if (dest.exists()) {
dest.delete();
}

// Copy data
final File backupFile = new File(BACKUP_ZIP);

Assert.assertTrue(backupFile.exists(), "Backup file should exists");

FileObject src = fsManager.resolveFile(backupFile.getAbsolutePath());

// copy twice
dest.copyFrom(src, Selectors.SELECT_SELF);
Thread.sleep(2000L);
dest.copyFrom(src, Selectors.SELECT_SELF);

Assert.assertTrue(dest.exists() && dest.getType().equals(FileType.FILE));
}

@Test(dependsOnMethods={"createFileOk"})
public void uploadBigFile() throws FileNotFoundException, IOException {
FileObject dest = fsManager.resolveFile("s3://" + bucketName + "/big_file.iso");
Expand Down

0 comments on commit a0be0c3

Please sign in to comment.