Merged BRANCHES/DEV/V4.1-BUG-FIX to HEAD:

46292: Fix for ALF-17783: Checks and creates the backup directory when needed.
   46295: Added some more tests related to ALF-17783

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@46765 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gethin James
2013-02-19 10:18:01 +00:00
parent 1492f83691
commit a6f0a3b423
4 changed files with 21 additions and 3 deletions

View File

@@ -583,6 +583,14 @@ public class ModuleManagementTool implements LogOutput
backupLocation = BACKUP_DIR + "/" + generateGuid() + ".bin";
if (preview == false)
{
//Create the directory if it doesn't exist.
TFile backupLocationDirectory = new TFile(warFileLocation+ BACKUP_DIR);
if (!backupLocationDirectory.exists())
{
backupLocationDirectory.mkdir();
}
//Backup the file
TFile backupFile = new TFile(warFileLocation + backupLocation);
destinationChild.cp_rp(backupFile);
}

View File

@@ -250,7 +250,7 @@ public class ModuleManagementToolTest extends TestCase
{
manager.setVerbose(true);
String warLocation = getFileLocation(".war", "module/test.war");
String warLocation = getFileLocation(".war", "module/alfresco-4.2.c.war");
String ampLocation = getFileLocation(".amp", "module/test_v4.amp");
try
@@ -263,8 +263,18 @@ public class ModuleManagementToolTest extends TestCase
{
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
String ampv2Location = getFileLocation(".amp", "module/test_v2.amp");
warLocation = getFileLocation(".war", "module/alfresco-4.2.c.war"); //Get a new war file
this.manager.installModule(ampLocation, warLocation, false, true, false); //install v1
this.manager.installModule(ampv2Location, warLocation, false, true, false); //install v2
//install another amp that replaces the same files
ampLocation = getFileLocation(".amp", "module/test_v4.amp");
warLocation = getFileLocation(".war", "module/alfresco-4.2.c.war"); //Get a new war file
String amp5Location = getFileLocation(".amp", "module/test_v7.amp"); //new amp that overides existing files
this.manager.installModule(ampLocation, warLocation, false, true, false);
this.manager.installModule(amp5Location, warLocation, false, true, false);
}
public void testInstallFromDir()