private String getFileLocation(String extension, String location) throws IOException { File file = TempFileProvider.createTempFile("moduleManagementToolTest-", extension); InputStream is = this.getClass().getClassLoader().getResourceAsStream(location); assertNotNull(is); OutputStream os = new FileOutputStream(file); FileCopyUtils.copy(is, os); return file.getPath(); }
public void testBasicFolderInstall() throws Exception { manager.setVerbose(true); String warDirectory = extractToDir(".war", "module/test.war"); String ampDirectory = extractToDir(".amp", "module/test_v1.amp"); String ampV2Directory = getFileLocation(".amp", "module/test_v2.amp"); assertNotNull(warDirectory); assertNotNull(ampDirectory); assertNotNull(ampV2Directory); installerSharedTests(warDirectory, ampDirectory, ampV2Directory); //Now try it on share warDirectory = extractToDir(".war", "module/share-3.4.11.war"); assertNotNull(warDirectory); assertNotNull(ampDirectory); this.manager.installModule(ampDirectory, warDirectory); warDirectory = extractToDir(".war", "module/share-4.2.a.war"); assertNotNull(warDirectory); String ampV2Location = getFileLocation(".amp", "module/test_v6.amp"); this.manager.installModule(ampV2Location, warDirectory); }
private void checkContentsOfFile(String location, String expectedContents) throws IOException { File file = new TFile(location); assertTrue(file.exists()); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(new TFileInputStream(file))); String line = reader.readLine(); assertNotNull(line); assertEquals(expectedContents, line.trim()); } finally { if (reader != null) { try { reader.close(); } catch (Throwable e ) {} } } } }
assertNotNull(installed0); assertEquals(9, installed0.getAdds().size()); assertNotNull(installed1); assertEquals(8, installed1.getAdds().size()); assertEquals(1, installed1.getMkdirs().size());
assertNotNull(details); assertEquals(details.size(), 0); assertNotNull(details); assertEquals(details.size(), 1); ModuleDetails aModule = details.get(0); assertNotNull(details); assertEquals(details.size(), 1); aModule = details.get(0); assertNotNull(details); assertEquals(details.size(), 3);