< prev index next >

test/tools/jlink/IntegrationTest.java

Print this page




 197             throw new AssertionError("Directory not created");
 198         }
 199         File jimage = new File(output.toString(), "lib" + File.separator + "modules");
 200         if (!jimage.exists()) {
 201             throw new AssertionError("jimage not generated");
 202         }
 203         File release = new File(output.toString(), "release");
 204         if (!release.exists()) {
 205             throw new AssertionError("release not generated");
 206         }
 207 
 208         Properties props = new Properties();
 209         try (FileReader reader = new FileReader(release)) {
 210             props.load(reader);
 211         }
 212 
 213         checkReleaseProperty(props, "JAVA_VERSION");
 214         checkReleaseProperty(props, "JAVA_FULL_VERSION");
 215         checkReleaseProperty(props, "OS_NAME");
 216         checkReleaseProperty(props, "OS_ARCH");
 217         checkReleaseProperty(props, "OS_VERSION");

 218 
 219         if (!Files.exists(output.resolve("toto.txt"))) {
 220             throw new AssertionError("Post processing not called");
 221         }
 222 
 223     }
 224 
 225     static void checkReleaseProperty(Properties props, String name) {
 226         if (! props.containsKey(name)) {
 227             throw new AssertionError("release file does not contain property : " + name);
 228         }
 229 
 230         // property value is of min. length 3 and double quoted at the ends.
 231         String value = props.getProperty(name);
 232         if (value.length() < 3 ||
 233             value.charAt(0) != '"' ||
 234             value.charAt(value.length() - 1) != '"') {
 235             throw new AssertionError("release property " + name + " is not quoted property");
 236         }
 237     }


 197             throw new AssertionError("Directory not created");
 198         }
 199         File jimage = new File(output.toString(), "lib" + File.separator + "modules");
 200         if (!jimage.exists()) {
 201             throw new AssertionError("jimage not generated");
 202         }
 203         File release = new File(output.toString(), "release");
 204         if (!release.exists()) {
 205             throw new AssertionError("release not generated");
 206         }
 207 
 208         Properties props = new Properties();
 209         try (FileReader reader = new FileReader(release)) {
 210             props.load(reader);
 211         }
 212 
 213         checkReleaseProperty(props, "JAVA_VERSION");
 214         checkReleaseProperty(props, "JAVA_FULL_VERSION");
 215         checkReleaseProperty(props, "OS_NAME");
 216         checkReleaseProperty(props, "OS_ARCH");
 217         // OS_VERSION is added from makefile. We're testing API-way to create image here!
 218         // checkReleaseProperty(props, "OS_VERSION");
 219 
 220         if (!Files.exists(output.resolve("toto.txt"))) {
 221             throw new AssertionError("Post processing not called");
 222         }
 223 
 224     }
 225 
 226     static void checkReleaseProperty(Properties props, String name) {
 227         if (! props.containsKey(name)) {
 228             throw new AssertionError("release file does not contain property : " + name);
 229         }
 230 
 231         // property value is of min. length 3 and double quoted at the ends.
 232         String value = props.getProperty(name);
 233         if (value.length() < 3 ||
 234             value.charAt(0) != '"' ||
 235             value.charAt(value.length() - 1) != '"') {
 236             throw new AssertionError("release property " + name + " is not quoted property");
 237         }
 238     }
< prev index next >