catch (StorageException e) {
cleanupFailed = true;
}
assertTrue(cleanupFailed);
TransferManager transferManager = new TransactionAwareTransferManager(
new UnreliableLocalTransferPlugin().createTransferManager(testConnection, null), null);
assertEquals(2, transferManager.list(MultichunkRemoteFile.class).size());
assertEquals(2, new File(testConnection.getPath(), "multichunks").list().length);
// Note that the list here differs from the actual files, because the transaction fails
// while deletions have been done
assertEquals(2, transferManager.list(DatabaseRemoteFile.class).size());
assertEquals(0, new File(testConnection.getPath(), "databases").list().length);
assertEquals(1, transferManager.list(TransactionRemoteFile.class).size());
assertEquals(1, new File(testConnection.getPath(), "transactions").list().length);
assertEquals(1, transferManager.list(ActionRemoteFile.class).size());
assertEquals(1, new File(testConnection.getPath(), "actions").list().length);
File tempDir = TestFileUtil.createTempDirectoryInSystemTemp();
File tempFile = File.createTempFile("multichunk", "", tempDir);
for (RemoteFile remoteFile : transferManager.list(DatabaseRemoteFile.class).values()) {
transferManager.download(remoteFile, tempFile);
assertTrue(tempFile.exists());
tempFile.delete();
}
clientA.cleanup(cleanupOptions);
assertEquals(2, transferManager.list(MultichunkRemoteFile.class).size());
assertEquals(2, new File(testConnection.getPath(), "multichunks").list().length);
assertEquals(1, transferManager.list(DatabaseRemoteFile.class).size());
assertEquals(1, new File(testConnection.getPath(), "databases").list().length);
assertEquals(0, transferManager.list(TransactionRemoteFile.class).size());
assertEquals(0, new File(testConnection.getPath(), "transactions").list().length);
assertEquals(0, transferManager.list(ActionRemoteFile.class).size());
assertEquals(0, new File(testConnection.getPath(), "actions").list().length);
}