< prev index next >

test/jdk/tools/jpackage/createinstaller/windows/base/JPackageCreateInstallerFileAssociationsBase.java

Print this page




 119         JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\." + TEST_EXT, null, false);
 120         JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\application/" + TEST_EXT, null, false);
 121     }
 122 
 123     private static void createFileAssociationsTestFile() throws Exception {
 124         try (PrintWriter out = new PrintWriter(new BufferedWriter(
 125                 new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
 126             out.println(TEST_NAME);
 127         }
 128     }
 129 
 130     private static void createFileAssociationsProperties() throws Exception {
 131         try (PrintWriter out = new PrintWriter(new BufferedWriter(
 132                 new FileWriter("fa.properties")))) {
 133             out.println("extension=" + TEST_EXT);
 134             out.println("mime-type=application/" + TEST_EXT);
 135             out.println("description=jpackage test extention");
 136         }
 137     }
 138 
 139     private static void init(String name, String ext) {
 140         TEST_NAME = name;
 141         EXT = ext;
 142         TEST_EXT = "jptest1";
 143         OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;

 144         CMD = new String[]{
 145             "create-installer",
 146             "--installer-type", EXT,
 147             "--input", "input",
 148             "--output", "output",
 149             "--name", TEST_NAME,
 150             "--main-jar", "hello.jar",
 151             "--main-class", "Hello",
 152             "--files", "hello.jar",
 153             "--file-associations", "fa.properties"};













 154     }
 155 
 156     public static void run(String name, String ext) throws Exception {
 157         init(name, ext);
 158 
 159         if (JPackageInstallerHelper.isVerifyInstall()) {
 160             verifyInstall();
 161         } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
 162             verifyUnInstall();
 163         } else {
 164             JPackageHelper.createHelloInstallerJar();
 165             createFileAssociationsProperties();
 166             testCreateInstaller();
 167         }
 168     }
 169 }


 119         JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\." + TEST_EXT, null, false);
 120         JPackageInstallerHelper.validateWinRegistry("HKLM\\Software\\Classes\\MIME\\Database\\Content Type\\application/" + TEST_EXT, null, false);
 121     }
 122 
 123     private static void createFileAssociationsTestFile() throws Exception {
 124         try (PrintWriter out = new PrintWriter(new BufferedWriter(
 125                 new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
 126             out.println(TEST_NAME);
 127         }
 128     }
 129 
 130     private static void createFileAssociationsProperties() throws Exception {
 131         try (PrintWriter out = new PrintWriter(new BufferedWriter(
 132                 new FileWriter("fa.properties")))) {
 133             out.println("extension=" + TEST_EXT);
 134             out.println("mime-type=application/" + TEST_EXT);
 135             out.println("description=jpackage test extention");
 136         }
 137     }
 138 
 139     private static void init(String name, String ext, String installDir, String testExt) {
 140         TEST_NAME = name;
 141         EXT = ext;
 142         TEST_EXT = testExt;
 143         OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
 144         if (installDir == null) {
 145             CMD = new String[]{
 146                 "create-installer",
 147                 "--installer-type", EXT,
 148                 "--input", "input",
 149                 "--output", "output",
 150                 "--name", TEST_NAME,
 151                 "--main-jar", "hello.jar",
 152                 "--main-class", "Hello",
 153                 "--files", "hello.jar",
 154                 "--file-associations", "fa.properties"};
 155         } else {
 156             CMD = new String[]{
 157                 "create-installer",
 158                 "--installer-type", EXT,
 159                 "--input", "input",
 160                 "--output", "output",
 161                 "--name", TEST_NAME,
 162                 "--main-jar", "hello.jar",
 163                 "--main-class", "Hello",
 164                 "--files", "hello.jar",
 165                 "--file-associations", "fa.properties",
 166                 "--install-dir", installDir};
 167         }
 168     }
 169 
 170     public static void run(String name, String ext, String installDir, String testExt) throws Exception {
 171         init(name, ext, installDir, testExt);
 172 
 173         if (JPackageInstallerHelper.isVerifyInstall()) {
 174             verifyInstall();
 175         } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
 176             verifyUnInstall();
 177         } else {
 178             JPackageHelper.createHelloInstallerJar();
 179             createFileAssociationsProperties();
 180             testCreateInstaller();
 181         }
 182     }
 183 }
< prev index next >