@Test public void testCheckCompatibleEdition() Properties props = dummyModuleProperties(); ModuleDetails installingModuleDetails = new ModuleDetailsImpl(props); TFile theWar = getFile(".war", "module/test.war"); //Community Edition this.checkCompatibleEdition(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleEdition(theWar, installingModuleDetails); this.checkCompatibleEdition(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleEdition(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleVersion(theWar, installingModuleDetails); //does not throw exception
@Test public void testfindManifest() throws Exception { //Now check the compatible versions using the manifest TFile theWar = getFile(".war", "module/share-3.4.11.war"); Manifest manifest = this.findManifest(theWar); assertNotNull(manifest); assertEquals("Alfresco Share Enterprise", manifest.getMainAttributes().getValue(MANIFEST_IMPLEMENTATION_TITLE)); assertEquals("3.4.11", manifest.getMainAttributes().getValue(MANIFEST_SPECIFICATION_VERSION)); theWar = getFile(".war", "module/alfresco-4.2.a.war"); manifest = this.findManifest(theWar); assertNotNull(manifest); assertEquals("Alfresco Repository Community", manifest.getMainAttributes().getValue(MANIFEST_IMPLEMENTATION_TITLE)); assertEquals("4.2.a", manifest.getMainAttributes().getValue(MANIFEST_SPECIFICATION_VERSION)); }
/** * Tests to see if the war is a share war. */ @Test public void testIsShareWar() { TFile theWar = getFile(".war", "module/test.war"); //Version 4.1.0 assertFalse(this.isShareWar(theWar)); theWar = getFile(".war", "module/empty.war"); assertFalse(this.isShareWar(theWar)); theWar = getFile(".war", "module/alfresco-4.2.a.war"); assertFalse(this.isShareWar(theWar)); theWar = getFile(".war", "module/share-4.2.a.war"); assertTrue(this.isShareWar(theWar)); }
@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")); this.checkCompatibleVersion(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleEdition(theWar, installingModuleDetails); //does not throw exception }
Properties props = dummyModuleProperties(); ModuleDetails installingModuleDetails = new ModuleDetailsImpl(props); TFile theWar = getFile(".war", "module/share-3.4.11.war"); //enterprise edition this.checkCompatibleEditionUsingManifest(theWar, installingModuleDetails); //does not throw exception try this.checkCompatibleEditionUsingManifest(theWar, installingModuleDetails); this.checkCompatibleEditionUsingManifest(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleEditionUsingManifest(theWar, installingModuleDetails); theWar = getFile(".war", "module/share-4.2.a.war"); this.checkCompatibleEditionUsingManifest(theWar, installingModuleDetails); String propertiesLocation = getFile(".amp", "module/test_v5.amp") + "/module.properties"; installingModuleDetails = ModuleDetailsHelper.createModuleDetailsFromPropertyLocation(propertiesLocation); this.checkCompatibleEdition(theWar, installingModuleDetails); theWar = getFile(".war", "module/share-3.4.11.war"); this.checkCompatibleEdition(theWar, installingModuleDetails);//should succeed theWar = getFile(".war", "module/share-4.2.a.war"); this.checkCompatibleEdition(theWar, installingModuleDetails);
@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()); }
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); this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails); this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails); //does not throw exception fail("Should not pass as current version is 3.4.11 and the max value is 3.4.10"); //should never get here 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.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails); theWar = getFile(".war", "module/alfresco-4.2.a.war"); this.checkCompatibleVersionUsingManifest(theWar, installingModuleDetails);
@Test public void testCheckCompatibleVersion() TFile theWar = getFile(".war", "module/test.war"); //Version 4.1.0 try this.checkCompatibleVersion(theWar, installingModuleDetails); this.checkCompatibleVersion(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleVersion(theWar, installingModuleDetails); this.checkCompatibleVersion(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleVersion(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleVersion(theWar, installingModuleDetails); //does not throw exception this.checkCompatibleVersion(theWar, installingModuleDetails); //does not throw exception fail("Should not pass as current version is 4.1.0 and the max value is 4.0.999"); //should never get here