public void testNoWar() throws Exception { String noWar = "noWar"; String ampLocation = getFileLocation(".amp", "module/test_v1.amp"); try { this.manager.installModule(ampLocation, noWar,false,false, false); } catch (ModuleManagementToolException exception) { assertTrue(exception.getMessage().endsWith("does not exist.")); } try { this.manager.installModule(ampLocation, noWar,false,false, true); //backup war } catch (ModuleManagementToolException exception) { assertTrue(exception.getMessage().endsWith("does not exist.")); } }
manager.outputErrorMessage(e.getMessage()); System.exit(ERROR_EXIT_CODE);
manager.outputErrorMessage(e.getMessage()); System.exit(ERROR_EXIT_CODE);
public void testInstallFromDir() throws Exception { manager.setVerbose(true); String warLocation = getFileLocation(".war", "module/test.war"); String ampLocation = getFileLocation(".amp", "module/test_v1.amp"); String ampV2Location = getFileLocation(".amp", "module/test_v2.amp"); int index = ampV2Location.lastIndexOf(File.separator); System.out.println(index); String directoryLocation = ampV2Location.substring(0, index); try { this.manager.installModules(directoryLocation, warLocation); } catch (ModuleManagementToolException exception) { exception.printStackTrace(); System.out.println("Expected failure: " + exception.getMessage()); } }
public void testExistingFilesInWar() throws Exception { manager.setVerbose(true); String warLocation = getFileLocation(".war", "module/test.war"); //Version 4.0.1 String ampLocation = getFileLocation(".amp", "module/test_v4.amp"); try { this.manager.installModule(ampLocation, warLocation, false, false, true); } catch(ModuleManagementToolException exception) { assertTrue(exception.getMessage().contains("will overwrite an existing file in the war")); } this.manager.installModule(ampLocation, warLocation, false, true, true); //Now force it checkContentsOfFile(warLocation + "/jsp/relogin.jsp", "VERSIONONE"); checkContentsOfFile(warLocation + "/css/main.css", "p{margin-bottom:1em;}"); this.manager.installModule(ampLocation, warLocation, false, true, false); //install it again }
assertTrue(exception.getMessage().endsWith("can only be installed in one of the following editions[CommuniT]"));
assertTrue(exception.getMessage().endsWith("can only be installed in one of the following editions[CommuniT]")); assertTrue(exception.getMessage().endsWith("can only be installed in one of the following editions[Community]")); assertTrue(exception.getMessage().endsWith("can only be installed in one of the following editions[Enterprise]")); assertTrue(exception.getMessage().endsWith("can only be installed in one of the following editions[Enterprise]"));
System.out.println("Expected: " + e.getMessage());
assertTrue(e.getMessage().contains("The amp will overwrite an existing file"));
assertTrue(exception.getMessage().contains("must be installed on a war version equal to or greater than 10.1")); assertTrue(exception.getMessage().contains("cannot be installed on a war version greater than 3.0")); assertTrue(exception.getMessage().contains("cannot be installed on a war version greater than 4.0.999"));
assertTrue(exception.getMessage().contains("must be installed on a war version equal to or greater than 10.1")); assertTrue(exception.getMessage().contains("cannot be installed on a war version greater than 3.0")); assertTrue(exception.getMessage().contains("cannot be installed on a war version greater than 3.4.10"));