use of org.alfresco.repo.module.ModuleVersionNumber in project records-management by Alfresco.
the class ModulePatchComponent method getModuleVersionNumber.
/**
* Helper method to get the ModuleVersionNumber.
*/
private ModuleVersionNumber getModuleVersionNumber(String registryProperty) {
String moduleId = modulePatchExecuter.getModuleId();
RegistryKey moduleKeyVersion = new RegistryKey(ModuleComponentHelper.URI_MODULES_1_0, new String[] { REGISTRY_PATH_MODULES, moduleId, registryProperty });
Serializable moduleVersion = this.registryService.getProperty(moduleKeyVersion);
return new ModuleVersionNumber(moduleVersion.toString());
}
use of org.alfresco.repo.module.ModuleVersionNumber in project records-management by Alfresco.
the class ModulePatchComponent method executeInternal.
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executeInternal() {
ModuleVersionNumber moduleInstalledVersionNumber = getModuleVersionNumber(REGISTRY_PROPERTY_INSTALLED_VERSION);
ModuleVersionNumber moduleCurrentVersionNumber = getModuleVersionNumber(REGISTRY_PROPERTY_CURRENT_VERSION);
String moduleName = getName();
if (isVersionLaterThan(moduleInstalledVersionNumber, moduleCurrentVersionNumber)) {
LOGGER.info("Module patch component '{}' is skipped for upgrade from version {} to version {}", moduleName, moduleInstalledVersionNumber, moduleCurrentVersionNumber);
} else {
try {
LOGGER.info("Module patch component '{}' is executing ...", moduleName);
// execute path within an isolated transaction
retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>() {
@Override
public Void execute() {
behaviourFilter.disableBehaviour();
try {
executePatch();
} finally {
behaviourFilter.enableBehaviour();
}
return null;
}
}, false, true);
LOGGER.info(" ... completed module patch '{}'", moduleName);
} catch (Exception exception) {
// record the exception otherwise it gets swallowed
LOGGER.info(" ... error encountered. {}", exception.getMessage(), exception);
throw exception;
}
}
}
use of org.alfresco.repo.module.ModuleVersionNumber in project alfresco-repository by Alfresco.
the class WarHelperImplTest method testNoVersionProperties.
@Test
public void testNoVersionProperties() {
TFile theWar = getFile(".war", "module/empty.war");
ModuleDetails installingModuleDetails = new ModuleDetailsImpl("test_it", new ModuleVersionNumber("9999"), "Test Mod", "Testing module");
installingModuleDetails.setRepoVersionMin(new VersionNumber("10.1"));
// does not throw exception
this.checkCompatibleVersion(theWar, installingModuleDetails);
// does not throw exception
this.checkCompatibleEdition(theWar, installingModuleDetails);
}
use of org.alfresco.repo.module.ModuleVersionNumber in project alfresco-repository by Alfresco.
the class ModuleComponentHelperTest method testStartComponentsV10.
public void testStartComponentsV10() {
ModuleVersionNumber moduleVersion = new ModuleVersionNumber("1.0");
startComponents(moduleVersion);
}
use of org.alfresco.repo.module.ModuleVersionNumber in project alfresco-repository by Alfresco.
the class ModuleComponentHelperTest method testgetModuleVersionNumber.
public void testgetModuleVersionNumber() {
ModuleVersionNumber moduleVersion = new ModuleVersionNumber("3.5");
VersionNumber versNumber = new VersionNumber("3.5");
assertEquals(moduleVersion, helper.getModuleVersionNumber(moduleVersion));
assertEquals(moduleVersion, helper.getModuleVersionNumber(versNumber));
try {
helper.getModuleVersionNumber(null);
// should never get here
assertTrue(false);
} catch (ModuleManagementToolException e) {
// should get here
}
// try {
// helper.getModuleVersionNumber("any object");
// assertTrue(false); //should never get here
// } catch (ModuleManagementToolException e) {
// //should get here
// }
// assertTrue(true);
}
Aggregations