use of org.alfresco.service.cmr.module.ModuleDetails in project alfresco-repository by Alfresco.
the class WarHelperImplTest method testCheckCompatibleEdition.
@Test
public void testCheckCompatibleEdition() {
Properties props = dummyModuleProperties();
ModuleDetails installingModuleDetails = new ModuleDetailsImpl(props);
// Community Edition
TFile theWar = getFile(".war", "module/test.war");
// Test for no edition specified
// does not throw exception
this.checkCompatibleEdition(theWar, installingModuleDetails);
// Test for invalid edition
props.setProperty(ModuleDetails.PROP_EDITIONS, "CommuniT");
installingModuleDetails = new ModuleDetailsImpl(props);
try {
this.checkCompatibleEdition(theWar, installingModuleDetails);
// should never get here
fail();
} catch (ModuleManagementToolException exception) {
assertTrue(exception.getMessage().endsWith("can only be installed in one of the following editions[CommuniT]"));
}
// should ignore case
props.setProperty(ModuleDetails.PROP_EDITIONS, ("CoMMunity"));
installingModuleDetails = new ModuleDetailsImpl(props);
// does not throw exception
this.checkCompatibleEdition(theWar, installingModuleDetails);
// should ignore case
props.setProperty(ModuleDetails.PROP_EDITIONS, ("enterprise,community,bob"));
installingModuleDetails = new ModuleDetailsImpl(props);
// does not throw exception
this.checkCompatibleEdition(theWar, installingModuleDetails);
// should ignore case
props.setProperty(ModuleDetails.PROP_EDITIONS, ("enterprise,Community"));
installingModuleDetails = new ModuleDetailsImpl(props);
// does not throw exception
this.checkCompatibleVersion(theWar, installingModuleDetails);
}
use of org.alfresco.service.cmr.module.ModuleDetails in project alfresco-repository by Alfresco.
the class WarHelperImplTest method testListModules.
@Test
public void testListModules() throws Exception {
TFile theWar = getFile(".war", "module/test.war");
List<ModuleDetails> details = this.listModules(theWar);
assertNotNull(details);
assertEquals(details.size(), 0);
theWar = getFile(".war", "module/share-4.2.a.war");
details = this.listModules(theWar);
assertNotNull(details);
assertEquals(details.size(), 1);
ModuleDetails aModule = details.get(0);
assertEquals("alfresco-mm-share", aModule.getId());
assertEquals("0.1.5.6", aModule.getModuleVersionNumber().toString());
assertEquals(ModuleInstallState.INSTALLED, aModule.getInstallState());
}
Aggregations