mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Removed superseded changes brought in by the merge.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@33777 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -170,32 +170,4 @@ public class ModuleDetailsHelper
|
|||||||
exception);
|
exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads a .properites file from the war and returns it as a Properties object
|
|
||||||
* @param warLocation The location of the war
|
|
||||||
* @param propertiesPath Path to the properties file (including .properties)
|
|
||||||
* @return Properties object or null
|
|
||||||
*/
|
|
||||||
public static Properties getPropertiesFromWar(String warLocation, String propertiesPath)
|
|
||||||
{
|
|
||||||
Properties result = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
File file = new File(warLocation+propertiesPath, ModuleManagementTool.DETECTOR_AMP_AND_WAR);
|
|
||||||
if (file.exists())
|
|
||||||
{
|
|
||||||
InputStream is = new FileInputStream(file);
|
|
||||||
result = new Properties();
|
|
||||||
result.load(is);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException exception)
|
|
||||||
{
|
|
||||||
throw new ModuleManagementToolException("Unable to load properties from the war file; "+propertiesPath, exception);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,6 @@ public class ModuleManagementTool
|
|||||||
|
|
||||||
/** Standard directories found in the alfresco war */
|
/** Standard directories found in the alfresco war */
|
||||||
public static final String BACKUP_DIR = WarHelper.MODULE_NAMESPACE_DIR+ "/backup";
|
public static final String BACKUP_DIR = WarHelper.MODULE_NAMESPACE_DIR+ "/backup";
|
||||||
public static final String VERSION_PROPERTIES = "/WEB-INF/classes/alfresco/version.properties";
|
|
||||||
|
|
||||||
/** Operations and options supperted via the command line interface to this class */
|
/** Operations and options supperted via the command line interface to this class */
|
||||||
private static final String OP_INSTALL = "install";
|
private static final String OP_INSTALL = "install";
|
||||||
@@ -232,9 +231,6 @@ public class ModuleManagementTool
|
|||||||
}
|
}
|
||||||
String installingId = installingModuleDetails.getId();
|
String installingId = installingModuleDetails.getId();
|
||||||
VersionNumber installingVersion = installingModuleDetails.getVersion();
|
VersionNumber installingVersion = installingModuleDetails.getVersion();
|
||||||
|
|
||||||
//Check that the target war repo is the correct version
|
|
||||||
checkTargetWarVersion(warFileLocation, installingModuleDetails);
|
|
||||||
|
|
||||||
//A series of checks
|
//A series of checks
|
||||||
warHelper.checkCompatibleVersion(theWar, installingModuleDetails);
|
warHelper.checkCompatibleVersion(theWar, installingModuleDetails);
|
||||||
@@ -376,20 +372,6 @@ public class ModuleManagementTool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkTargetWarVersion(String warFileLocation, ModuleDetails installingModuleDetails)
|
|
||||||
{
|
|
||||||
Properties warVers = ModuleDetailsHelper.getPropertiesFromWar(warFileLocation, VERSION_PROPERTIES);
|
|
||||||
outputMessage("WAR properties '" + warVers + "'");
|
|
||||||
VersionNumber warVersion = new VersionNumber(warVers.getProperty("version.major")+"."+warVers.getProperty("version.revision")+"."+warVers.getProperty("version.minor"));
|
|
||||||
if(warVersion.compareTo(installingModuleDetails.getRepoVersionMin())==-1) {
|
|
||||||
throw new ModuleManagementToolException("The module ("+installingModuleDetails.getTitle()+") must be installed on a repo version greater than "+installingModuleDetails.getRepoVersionMin());
|
|
||||||
}
|
|
||||||
if(warVersion.compareTo(installingModuleDetails.getRepoVersionMax())==1) {
|
|
||||||
throw new ModuleManagementToolException("The module ("+installingModuleDetails.getTitle()+") cannot be installed on a repo version greater than "+installingModuleDetails.getRepoVersionMax());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void backupWar(String warFileLocation, boolean backupWAR)
|
private void backupWar(String warFileLocation, boolean backupWAR)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -30,10 +30,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.alfresco.repo.module.ModuleDetailsImpl;
|
|
||||||
import org.alfresco.service.cmr.module.ModuleDetails;
|
|
||||||
import org.alfresco.util.TempFileProvider;
|
import org.alfresco.util.TempFileProvider;
|
||||||
import org.alfresco.util.VersionNumber;
|
|
||||||
import org.springframework.util.FileCopyUtils;
|
import org.springframework.util.FileCopyUtils;
|
||||||
|
|
||||||
import de.schlichtherle.io.DefaultRaesZipDetector;
|
import de.schlichtherle.io.DefaultRaesZipDetector;
|
||||||
@@ -267,48 +264,10 @@ public class ModuleManagementToolTest extends TestCase
|
|||||||
}
|
}
|
||||||
catch (ModuleManagementToolException exception)
|
catch (ModuleManagementToolException exception)
|
||||||
{
|
{
|
||||||
|
exception.printStackTrace();
|
||||||
System.out.println("Expected failure: " + exception.getMessage());
|
System.out.println("Expected failure: " + exception.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCheckTargetWarVersion() throws Exception
|
|
||||||
{
|
|
||||||
manager.setVerbose(true);
|
|
||||||
String warLocation = getFileLocation(".war", "module/test.war"); //Version 4.0.1
|
|
||||||
|
|
||||||
ModuleDetails installingModuleDetails = new ModuleDetailsImpl("test_it", new VersionNumber("9999"), "Test Mod", "Testing module");
|
|
||||||
installingModuleDetails.setRepoVersionMin(new VersionNumber("10.1"));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.manager.checkTargetWarVersion(warLocation, installingModuleDetails);
|
|
||||||
fail(); //should never get here
|
|
||||||
}
|
|
||||||
catch (ModuleManagementToolException exception)
|
|
||||||
{
|
|
||||||
assertTrue(exception.getMessage().endsWith("must be installed on a repo version greater than 10.1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
installingModuleDetails.setRepoVersionMin(new VersionNumber("1.1"));
|
|
||||||
this.manager.checkTargetWarVersion(warLocation, installingModuleDetails); //does not throw exception
|
|
||||||
|
|
||||||
installingModuleDetails.setRepoVersionMax(new VersionNumber("3.0"));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.manager.checkTargetWarVersion(warLocation, installingModuleDetails);
|
|
||||||
fail(); //should never get here
|
|
||||||
}
|
|
||||||
catch (ModuleManagementToolException exception)
|
|
||||||
{
|
|
||||||
assertTrue(exception.getMessage().endsWith("cannot be installed on a repo version greater than 3.0"));
|
|
||||||
}
|
|
||||||
|
|
||||||
installingModuleDetails.setRepoVersionMax(new VersionNumber("99"));
|
|
||||||
this.manager.checkTargetWarVersion(warLocation, installingModuleDetails); //does not throw exception
|
|
||||||
|
|
||||||
installingModuleDetails.setRepoVersionMin(new VersionNumber("4.0.1")); //current war version
|
|
||||||
installingModuleDetails.setRepoVersionMax(new VersionNumber("4.0.1")); //current war version
|
|
||||||
this.manager.checkTargetWarVersion(warLocation, installingModuleDetails); //does not throw exception
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void testList()
|
public void testList()
|
||||||
|
Reference in New Issue
Block a user