use of org.alfresco.repo.module.ModuleVersionNumber in project alfresco-repository by Alfresco.
the class ModuleComponentHelperTest method testStartComponentsV00.
public void testStartComponentsV00() {
ModuleVersionNumber moduleVersion = new ModuleVersionNumber("0.0");
startComponents(moduleVersion);
}
use of org.alfresco.repo.module.ModuleVersionNumber in project alfresco-repository by Alfresco.
the class ModuleComponentHelperTest method testStartComponentsV30.
public void testStartComponentsV30() {
ModuleVersionNumber moduleVersion = new ModuleVersionNumber("3.0");
startComponents(moduleVersion);
}
use of org.alfresco.repo.module.ModuleVersionNumber in project alfresco-repository by Alfresco.
the class ModuleComponentHelperTest method testStartComponentsV35.
public void testStartComponentsV35() {
ModuleVersionNumber moduleVersion = new ModuleVersionNumber("3.5");
startComponents(moduleVersion);
}
use of org.alfresco.repo.module.ModuleVersionNumber in project alfresco-repository by Alfresco.
the class ModuleServiceImplTest method setUp.
@Before
public void setUp() throws Exception {
moduleService = new ModuleServiceImpl();
Resource simpleMod = new PathMatchingResourcePatternResolver().getResource("classpath:alfresco/module/simplemodule.properties");
assertNotNull(simpleMod);
RegistryService reg = mock(RegistryService.class);
ApplicationContext applicationContext = mock(ApplicationContext.class);
when(reg.getProperty((RegistryKey) any())).thenAnswer(new Answer<Serializable>() {
public Serializable answer(InvocationOnMock invocation) throws Throwable {
RegistryKey key = (RegistryKey) invocation.getArguments()[0];
return new ModuleVersionNumber("1.1");
}
});
doReturn(Arrays.asList("fee", "alfresco-simple-module", "fo")).when(reg).getChildElements((RegistryKey) any());
doReturn(new Resource[] { simpleMod }).when(applicationContext).getResources(anyString());
moduleService.setRegistryService(reg);
moduleService.setApplicationContext(applicationContext);
}
use of org.alfresco.repo.module.ModuleVersionNumber in project alfresco-repository by Alfresco.
the class WarHelperImplTest method testCheckCompatibleVersionUsingManifest.
@Test
public void testCheckCompatibleVersionUsingManifest() throws IOException {
// Now check the compatible versions using the manifest
TFile theWar = getFile(".war", "module/share-3.4.11.war");
ModuleDetails installingModuleDetails = new ModuleDetailsImpl("test_it", new ModuleVersionNumber("9999"), "Test Mod", "Testing module");
installingModuleDetails.setRepoVersionMin(new VersionNumber("10.1"));
try {
this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails);
// should never get here
fail();
} catch (ModuleManagementToolException exception) {
assertTrue(exception.getMessage().contains("must be installed on a war version equal to or greater than 10.1"));
}
installingModuleDetails.setRepoVersionMin(new VersionNumber("1.1"));
// does not throw exception
this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails);
installingModuleDetails.setRepoVersionMax(new VersionNumber("3.0"));
try {
this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails);
// should never get here
fail();
} catch (ModuleManagementToolException exception) {
assertTrue(exception.getMessage().contains("cannot be installed on a war version greater than 3.0"));
}
installingModuleDetails.setRepoVersionMax(new VersionNumber("99"));
// does not throw exception
this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails);
// current war version
installingModuleDetails.setRepoVersionMin(new VersionNumber("3.4.11"));
// current war version
installingModuleDetails.setRepoVersionMax(new VersionNumber("3.4.11"));
// does not throw exception
this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails);
// current war version
installingModuleDetails.setRepoVersionMin(new VersionNumber("3.4.7"));
// current war version
installingModuleDetails.setRepoVersionMax(new VersionNumber("3.4.11"));
// does not throw exception
this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails);
try {
// current war version
installingModuleDetails.setRepoVersionMin(new VersionNumber("3.4.0"));
// current war version
installingModuleDetails.setRepoVersionMax(new VersionNumber("3.4.10"));
// does not throw exception
this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails);
// should never get here
fail("Should not pass as current version is 3.4.11 and the max value is 3.4.10");
} catch (ModuleManagementToolException exception) {
assertTrue(exception.getMessage().contains("cannot be installed on a war version greater than 3.4.10"));
}
theWar = getFile(".war", "module/share-4.2.a.war");
installingModuleDetails = new ModuleDetailsImpl("test_it", new ModuleVersionNumber("9999"), "Test Mod", "Testing module");
installingModuleDetails.setRepoVersionMin(new VersionNumber("101.1"));
// this should fail BUT we are using a non-numeric version number so instead it passes without validation
this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails);
theWar = getFile(".war", "module/alfresco-4.2.a.war");
// this should fail BUT we are using a non-numeric version number so instead it passes without validation
this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails);
}
Aggregations