36 37 private static void copyResults() throws Exception { 38 List<String> files = new ArrayList<>(); 39 files.add(OUTPUT.toLowerCase()); 40 JPackageInstallerHelper.copyTestResults(files); 41 } 42 43 private static final String infoResult = "infoResult.txt"; 44 private static void validatePackage() throws Exception { 45 int retVal = JPackageHelper.execute(new File(infoResult), "dpkg", 46 "--info", OUTPUT.toLowerCase()); 47 if (retVal != 0) { 48 throw new AssertionError("dpkg exited with error: " + retVal); 49 } 50 51 File outfile = new File(infoResult); 52 if (!outfile.exists()) { 53 throw new AssertionError(infoResult + " was not created"); 54 } 55 56 String output = Files.readString(outfile.toPath()); 57 if (!output.contains("Maintainer: " + EMAIL)) { 58 throw new AssertionError("Unexpected result: " + output); 59 } 60 } 61 62 private static void testCreateInstaller() throws Exception { 63 JPackageHelper.executeCLI(true, CMD); 64 JPackageInstallerHelper.validateOutput(OUTPUT); 65 validatePackage(); 66 copyResults(); 67 } 68 69 private static void verifyInstall() throws Exception { 70 String app = JPackagePath.getLinuxInstalledApp(TEST_NAME); 71 JPackageInstallerHelper.validateApp(app); 72 } 73 74 private static void verifyUnInstall() throws Exception { 75 String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME); 76 File folder = new File(folderPath); 77 if (folder.exists()) { 78 throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist"); | 36 37 private static void copyResults() throws Exception { 38 List<String> files = new ArrayList<>(); 39 files.add(OUTPUT.toLowerCase()); 40 JPackageInstallerHelper.copyTestResults(files); 41 } 42 43 private static final String infoResult = "infoResult.txt"; 44 private static void validatePackage() throws Exception { 45 int retVal = JPackageHelper.execute(new File(infoResult), "dpkg", 46 "--info", OUTPUT.toLowerCase()); 47 if (retVal != 0) { 48 throw new AssertionError("dpkg exited with error: " + retVal); 49 } 50 51 File outfile = new File(infoResult); 52 if (!outfile.exists()) { 53 throw new AssertionError(infoResult + " was not created"); 54 } 55 56 boolean maintainerFound = false; 57 for (String line: Files.readAllLines(outfile.toPath())) { 58 if (line.matches("^[ ]*Maintainer:.*$")) { 59 maintainerFound = true; 60 if (!line.contains(EMAIL)) { 61 throw new AssertionError("Unexpected result: " + line); 62 } 63 } 64 } 65 66 if (!maintainerFound) { 67 throw new AssertionError("Maintainer field not found"); 68 } 69 } 70 71 private static void testCreateInstaller() throws Exception { 72 JPackageHelper.executeCLI(true, CMD); 73 JPackageInstallerHelper.validateOutput(OUTPUT); 74 validatePackage(); 75 copyResults(); 76 } 77 78 private static void verifyInstall() throws Exception { 79 String app = JPackagePath.getLinuxInstalledApp(TEST_NAME); 80 JPackageInstallerHelper.validateApp(app); 81 } 82 83 private static void verifyUnInstall() throws Exception { 84 String folderPath = JPackagePath.getLinuxInstallFolder(TEST_NAME); 85 File folder = new File(folderPath); 86 if (folder.exists()) { 87 throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist"); |