Search in sources :

Example 26 with ModuleDetails

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);
}
Also used : TFile(de.schlichtherle.truezip.file.TFile) ModuleDetailsImpl(org.alfresco.repo.module.ModuleDetailsImpl) ModuleDetails(org.alfresco.service.cmr.module.ModuleDetails) Properties(java.util.Properties) Test(org.junit.Test)

Example 27 with ModuleDetails

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());
}
Also used : TFile(de.schlichtherle.truezip.file.TFile) ModuleDetails(org.alfresco.service.cmr.module.ModuleDetails) Test(org.junit.Test)

Aggregations

ModuleDetails (org.alfresco.service.cmr.module.ModuleDetails)27 TFile (de.schlichtherle.truezip.file.TFile)9 Properties (java.util.Properties)7 ModuleDetailsImpl (org.alfresco.repo.module.ModuleDetailsImpl)7 Test (org.junit.Test)7 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 ModuleVersionNumber (org.alfresco.repo.module.ModuleVersionNumber)4 VersionNumber (org.alfresco.util.VersionNumber)4 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)3 ModuleDependency (org.alfresco.service.cmr.module.ModuleDependency)3 TFileInputStream (de.schlichtherle.truezip.file.TFileInputStream)2 InputStream (java.io.InputStream)2 HashMap (java.util.HashMap)2 ModulePackage (org.alfresco.rest.api.model.ModulePackage)2 AuditService (org.alfresco.service.cmr.audit.AuditService)2 BasicDataSource (org.apache.commons.dbcp.BasicDataSource)2 FsSyncException (de.schlichtherle.truezip.fs.FsSyncException)1 BufferedInputStream (java.io.BufferedInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1