85 private static void verifyUnInstall() throws Exception { 86 String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME); 87 File folder = new File(folderPath); 88 if (folder.exists()) { 89 throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist"); 90 } 91 } 92 93 private static void init(String name, String ext) { 94 TEST_NAME = name; 95 EXT = ext; 96 OUTPUT_1 = "output" + File.separator + TEST_NAME + "-1.0." + EXT; 97 CMD_1 = new String[]{ 98 "create-installer", 99 "--installer-type", EXT, 100 "--input", "input", 101 "--output", "output", 102 "--name", TEST_NAME, 103 "--main-jar", "hello.jar", 104 "--main-class", "Hello", 105 "--files", "hello.jar" + File.pathSeparator + FILE_1, 106 "--app-version", "1.0", 107 "--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"}; 108 OUTPUT_2 = "output" + File.separator + TEST_NAME + "-2.0." + EXT; 109 CMD_2 = new String[]{ 110 "create-installer", 111 "--installer-type", EXT, 112 "--input", "input", 113 "--output", "output", 114 "--name", TEST_NAME, 115 "--main-jar", "hello.jar", 116 "--main-class", "Hello", 117 "--files", "hello.jar" + File.pathSeparator + FILE_2, 118 "--app-version", "2.0", 119 "--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"}; 120 } 121 122 private static void createInputFile(String name, String context) throws Exception { 123 try (PrintWriter out = new PrintWriter( 124 new BufferedWriter(new FileWriter("input" + File.separator + name)))) { 125 out.println(context); 126 } 127 } 128 129 public static void run(String name, String ext) throws Exception { 130 init(name, ext); 131 132 if (JPackageInstallerHelper.isVerifyInstall()) { 133 verifyInstall(); 134 } else if (JPackageInstallerHelper.isVerifyUnInstall()) { 135 verifyUnInstall(); 136 } else { 137 JPackageHelper.createHelloInstallerJar(); | 85 private static void verifyUnInstall() throws Exception { 86 String folderPath = JPackagePath.getWinInstallFolder(TEST_NAME); 87 File folder = new File(folderPath); 88 if (folder.exists()) { 89 throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist"); 90 } 91 } 92 93 private static void init(String name, String ext) { 94 TEST_NAME = name; 95 EXT = ext; 96 OUTPUT_1 = "output" + File.separator + TEST_NAME + "-1.0." + EXT; 97 CMD_1 = new String[]{ 98 "create-installer", 99 "--installer-type", EXT, 100 "--input", "input", 101 "--output", "output", 102 "--name", TEST_NAME, 103 "--main-jar", "hello.jar", 104 "--main-class", "Hello", 105 "--app-version", "1.0", 106 "--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"}; 107 OUTPUT_2 = "output" + File.separator + TEST_NAME + "-2.0." + EXT; 108 CMD_2 = new String[]{ 109 "create-installer", 110 "--installer-type", EXT, 111 "--input", "input", 112 "--output", "output", 113 "--name", TEST_NAME, 114 "--main-jar", "hello.jar", 115 "--main-class", "Hello", 116 "--app-version", "2.0", 117 "--win-upgrade-uuid", "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"}; 118 } 119 120 private static void createInputFile(String name, String context) throws Exception { 121 try (PrintWriter out = new PrintWriter( 122 new BufferedWriter(new FileWriter("input" + File.separator + name)))) { 123 out.println(context); 124 } 125 } 126 127 public static void run(String name, String ext) throws Exception { 128 init(name, ext); 129 130 if (JPackageInstallerHelper.isVerifyInstall()) { 131 verifyInstall(); 132 } else if (JPackageInstallerHelper.isVerifyUnInstall()) { 133 verifyUnInstall(); 134 } else { 135 JPackageHelper.createHelloInstallerJar(); |