< prev index next >

test/tools/jlink/JLinkTest.java

Print this page




 174                     .output(helper.createNewImageDir(moduleName))
 175                     .limitMods("java.base")
 176                     .repeatedLimitMods(moduleName) // second --limit-modules overrides first
 177                     .addMods(moduleName)
 178                     .call().assertSuccess();
 179         }
 180 
 181         {
 182             // Help
 183             StringWriter writer = new StringWriter();
 184             PrintWriter pw = new PrintWriter(writer);
 185             JLINK_TOOL.run(pw, pw, "--help");
 186             String output = writer.toString();
 187             if (output.split("\n").length < 10) {
 188                 System.err.println(output);
 189                 throw new AssertionError("Help");
 190             }
 191         }
 192 
 193         {
 194             // License files
 195             Path file = Paths.get("LICENSE");
 196             Files.createFile(file);
 197             String copied = "LICENSE";
 198             String[] arr = copied.split(",");
 199             String[] copyFiles = new String[2];
 200             copyFiles[0] = "--copy-files";
 201             copyFiles[1] = file.toAbsolutePath().toString();
 202             Path imageDir = helper.generateDefaultImage(copyFiles, "composite2").assertSuccess();
 203             helper.checkImage(imageDir, "composite2", null, null, arr);
 204         }
 205 
 206         {
 207             // List plugins
 208             StringWriter writer = new StringWriter();
 209             PrintWriter pw = new PrintWriter(writer);
 210 
 211             JLINK_TOOL.run(pw, pw, "--list-plugins");
 212             String output = writer.toString();
 213             long number = Stream.of(output.split("\\R"))
 214                     .filter((s) -> s.matches("Plugin Name:.*"))
 215                     .count();
 216             if (number != totalPlugins) {
 217                 System.err.println(output);
 218                 throw new AssertionError("Found: " + number + " expected " + totalPlugins);
 219             }
 220         }
 221 
 222         // filter out files and resources + Skip debug + compress
 223         {
 224             String[] userOptions = {"--compress", "2", "--strip-debug",
 225                 "--exclude-resources", "*.jcov, */META-INF/*", "--exclude-files",
 226                 "*" + Helper.getDebugSymbolsExtension()};




 174                     .output(helper.createNewImageDir(moduleName))
 175                     .limitMods("java.base")
 176                     .repeatedLimitMods(moduleName) // second --limit-modules overrides first
 177                     .addMods(moduleName)
 178                     .call().assertSuccess();
 179         }
 180 
 181         {
 182             // Help
 183             StringWriter writer = new StringWriter();
 184             PrintWriter pw = new PrintWriter(writer);
 185             JLINK_TOOL.run(pw, pw, "--help");
 186             String output = writer.toString();
 187             if (output.split("\n").length < 10) {
 188                 System.err.println(output);
 189                 throw new AssertionError("Help");
 190             }
 191         }
 192 
 193         {













 194             // List plugins
 195             StringWriter writer = new StringWriter();
 196             PrintWriter pw = new PrintWriter(writer);
 197 
 198             JLINK_TOOL.run(pw, pw, "--list-plugins");
 199             String output = writer.toString();
 200             long number = Stream.of(output.split("\\R"))
 201                     .filter((s) -> s.matches("Plugin Name:.*"))
 202                     .count();
 203             if (number != totalPlugins) {
 204                 System.err.println(output);
 205                 throw new AssertionError("Found: " + number + " expected " + totalPlugins);
 206             }
 207         }
 208 
 209         // filter out files and resources + Skip debug + compress
 210         {
 211             String[] userOptions = {"--compress", "2", "--strip-debug",
 212                 "--exclude-resources", "*.jcov, */META-INF/*", "--exclude-files",
 213                 "*" + Helper.getDebugSymbolsExtension()};


< prev index next >