mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix backup deletion issue identified by RM-516
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@42788 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -478,7 +478,7 @@ public class ModuleManagementTool implements LogOutput
|
|||||||
TFile modified = new TFile(warFileLocation + update.getKey());
|
TFile modified = new TFile(warFileLocation + update.getKey());
|
||||||
TFile backup = new TFile(warFileLocation + update.getValue());
|
TFile backup = new TFile(warFileLocation + update.getValue());
|
||||||
backup.cp_rp(modified);
|
backup.cp_rp(modified);
|
||||||
backup.deleteOnExit();
|
backup.rm();
|
||||||
}
|
}
|
||||||
|
|
||||||
outputVerboseMessage("Recovering file '" + update.getKey() + "' from backup '" + update.getValue() + "'", true);
|
outputVerboseMessage("Recovering file '" + update.getKey() + "' from backup '" + update.getValue() + "'", true);
|
||||||
|
@@ -241,11 +241,20 @@ public class ModuleManagementToolTest extends TestCase
|
|||||||
manager.setVerbose(true);
|
manager.setVerbose(true);
|
||||||
|
|
||||||
String warLocation = getFileLocation(".war", "module/test.war");
|
String warLocation = getFileLocation(".war", "module/test.war");
|
||||||
String ampLocation = getFileLocation(".amp", "module/test_v1.amp");
|
String ampLocation = getFileLocation(".amp", "module/test_v4.amp");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
// Initial install of module
|
// Initial install of module
|
||||||
this.manager.installModule(ampLocation, warLocation, false, false, false);
|
this.manager.installModule(ampLocation, warLocation, false, false, false); //not forced
|
||||||
this.manager.installModule(ampLocation, warLocation, false, true, false);
|
fail("Failed to detect existing files in the amp");
|
||||||
|
}
|
||||||
|
catch (ModuleManagementToolException e)
|
||||||
|
{
|
||||||
|
assertTrue(e.getMessage().contains("The amp will overwrite an existing file"));
|
||||||
|
}
|
||||||
|
this.manager.installModule(ampLocation, warLocation, false, true, false); //install it again
|
||||||
|
this.manager.installModule(ampLocation, warLocation, false, true, false); //install it again, just to be sure
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInstallFromDir()
|
public void testInstallFromDir()
|
||||||
@@ -291,6 +300,7 @@ public class ModuleManagementToolTest extends TestCase
|
|||||||
this.manager.installModule(ampLocation, warLocation, false, true, true); //Now force it
|
this.manager.installModule(ampLocation, warLocation, false, true, true); //Now force it
|
||||||
checkContentsOfFile(warLocation + "/jsp/relogin.jsp", "VERSIONONE");
|
checkContentsOfFile(warLocation + "/jsp/relogin.jsp", "VERSIONONE");
|
||||||
checkContentsOfFile(warLocation + "/css/main.css", "p{margin-bottom:1em;}");
|
checkContentsOfFile(warLocation + "/css/main.css", "p{margin-bottom:1em;}");
|
||||||
|
this.manager.installModule(ampLocation, warLocation, false, true, false); //install it again
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user