< prev index next >

test/jdk/tools/jpackage/linux/base/FileAssociationsBase.java

Print this page




 103             throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
 104         }
 105     }
 106 
 107     private static void createAssociationsTestFile() throws Exception {
 108         try (PrintWriter out = new PrintWriter(new BufferedWriter(
 109                 new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
 110             out.println(TEST_NAME);
 111         }
 112     }
 113 
 114     private static void createAssociationsProperties() throws Exception {
 115         try (PrintWriter out = new PrintWriter(new BufferedWriter(
 116                 new FileWriter("fa.properties")))) {
 117             out.println("extension=" + TEST_EXT);
 118             out.println("mime-type=application/" + TEST_EXT);
 119             out.println("description=jpackage test extention");
 120         }
 121     }
 122 
 123     private static void init(String name, String ext) {
 124         TEST_NAME = name;
 125         EXT = ext;
 126         TEST_EXT = "jptest1";
 127         if (EXT.equals("rpm")) {
 128             OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1.x86_64." + EXT;
 129         } else {
 130             OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
 131         }
 132         CMD = new String[]{
 133             "--package-type", EXT,
 134             "--input", "input",
 135             "--output", "output",
 136             "--name", TEST_NAME,
 137             "--main-jar", "hello.jar",
 138             "--main-class", "Hello",
 139             "--file-associations", "fa.properties"};
 140     }
 141 
 142     public static void run(String name, String ext) throws Exception {
 143         init(name, ext);
 144 
 145         if (JPackageInstallerHelper.isVerifyInstall()) {
 146             verifyInstall();
 147         } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
 148             verifyUnInstall();


 103             throw new AssertionError("Error: " + folder.getAbsolutePath() + " exist");
 104         }
 105     }
 106 
 107     private static void createAssociationsTestFile() throws Exception {
 108         try (PrintWriter out = new PrintWriter(new BufferedWriter(
 109                 new FileWriter(TEST_NAME + "." + TEST_EXT)))) {
 110             out.println(TEST_NAME);
 111         }
 112     }
 113 
 114     private static void createAssociationsProperties() throws Exception {
 115         try (PrintWriter out = new PrintWriter(new BufferedWriter(
 116                 new FileWriter("fa.properties")))) {
 117             out.println("extension=" + TEST_EXT);
 118             out.println("mime-type=application/" + TEST_EXT);
 119             out.println("description=jpackage test extention");
 120         }
 121     }
 122 
 123     private static void init(String name, String ext) throws Exception {
 124         TEST_NAME = name;
 125         EXT = ext;
 126         TEST_EXT = "jptest1";
 127         if (EXT.equals("rpm")) {
 128             OUTPUT = "output" + File.separator + TEST_NAME + "-1.0-1." + Base.getRpmArch() + "." + EXT;
 129         } else {
 130             OUTPUT = "output" + File.separator + TEST_NAME + "-1.0." + EXT;
 131         }
 132         CMD = new String[]{
 133             "--package-type", EXT,
 134             "--input", "input",
 135             "--output", "output",
 136             "--name", TEST_NAME,
 137             "--main-jar", "hello.jar",
 138             "--main-class", "Hello",
 139             "--file-associations", "fa.properties"};
 140     }
 141 
 142     public static void run(String name, String ext) throws Exception {
 143         init(name, ext);
 144 
 145         if (JPackageInstallerHelper.isVerifyInstall()) {
 146             verifyInstall();
 147         } else if (JPackageInstallerHelper.isVerifyUnInstall()) {
 148             verifyUnInstall();
< prev index next >