}
}
public void testMultipleFilesNotThere() {
// Tests to make sure we're releasing connections with 404's
FilesClient client = new FilesClient();
String filename = makeFileName("random");
String fullPath = FilenameUtils.concat(SYSTEM_TMP.getAbsolutePath(), filename);
try {
byte[] content = makeRandomFile(fullPath);
client.useSnet();
assertTrue(client.usingSnet());
assertTrue(client.login());
String containerName = createTempContainerName("file-not-there");
client.createContainer(containerName);
String[] names = new String[10];
for(int i=0; i < 10; ++i) names[i] = "File" + (i + 1) + ".txt";
for(int i=0; i < 5; ++i)
assertNotNull(client.storeObjectAs(containerName, new File(fullPath), "application/octet-stream", names[i]));
for (int i = 0; i < 10; i++) {
String fileName = names[i];
byte[] retrievedContent = null;
try {
retrievedContent = client.getObject(containerName, fileName);
assertArrayEquals(content, retrievedContent);
} catch(FilesNotFoundException ex) {
assertTrue(i >= 5);
}
}
// Cleanup
for(int i=0; i < 5; ++i)
client.deleteObject(containerName, names[i]);
client.deleteContainer(containerName);
} catch (Exception e) {
fail(e.getMessage());
}
finally {