public void testIssue247() throws Exception {
// Setup
File tempDir = TestFileUtil.createTempDirectoryInSystemTemp();
LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();
TestClient clientDzHome = new TestClient("Dz", testConnection);
TestClient clientUxWork = new TestClient("Ux", testConnection);
UpOperationOptions upOptionsWithForce = new UpOperationOptions();
upOptionsWithForce.setForceUploadEnabled(true);
// home -- generate some database versions so that the cleanup/merge will have something to merge
clientDzHome.createNewFile("someotherfile0.xml");
clientDzHome.upWithForceChecksum();
for (int i=0; i<30; i++) {
clientDzHome.changeFile("someotherfile0.xml");
clientDzHome.upWithForceChecksum();
}
// home
clientDzHome.createNewFile("config.xml"); // <<<<< This is the file/checksum causing the issue
clientDzHome.upWithForceChecksum();
TestFileUtil.copyFile(clientDzHome.getLocalFile("config.xml"), new File(tempDir, "config.xml")); // Make a copy (for later)
// work
clientUxWork.down();
clientUxWork.changeFile("config.xml");
clientUxWork.upWithForceChecksum();
clientUxWork.createNewFile("someotherfile1.xml");
clientUxWork.upWithForceChecksum();
clientUxWork.createNewFile("someotherfile2.xml");
clientUxWork.upWithForceChecksum();
clientUxWork.createNewFile("someotherfile3.xml");
clientUxWork.upWithForceChecksum();
// home
clientDzHome.down();
clientDzHome.changeFile("config.xml");
clientDzHome.upWithForceChecksum();
clientDzHome.changeFile("config.xml");
clientDzHome.upWithForceChecksum();
// work
clientUxWork.down();
CleanupOperationOptions cleanupOptions = new CleanupOperationOptions();
cleanupOptions.setKeepVersionsCount(2);
clientUxWork.cleanup(cleanupOptions);
// home
clientDzHome.down();
clientDzHome.deleteFile("config.xml"); // Recreate problematic config.xml/checksum
TestFileUtil.copyFile(new File(tempDir, "config.xml"), clientDzHome.getLocalFile("config.xml"));
clientDzHome.upWithForceChecksum();
// work
clientUxWork.down();
// Tear down
TestFileUtil.deleteDirectory(tempDir);
clientUxWork.deleteTestData();
clientDzHome.deleteTestData();
}