< prev index next >

test/tools/jlink/JLinkTest.java

Print this page




 257 
 258         // compress 2
 259         {
 260             testCompress(helper, "compress2filtercmdcomposite2",
 261                     "--compress=2:filter=^/java.base/java/lang/*");
 262         }
 263 
 264         // invalid compress level
 265         {
 266             String[] userOptions = {"--compress", "invalid"};
 267             String moduleName = "invalidCompressLevel";
 268             helper.generateDefaultJModule(moduleName, "composite2");
 269             helper.generateDefaultImage(userOptions, moduleName).assertFailure("Error: Invalid compression level invalid");
 270         }
 271 
 272         // orphan argument - JDK-8166810
 273         {
 274             String[] userOptions = {"--compress", "2", "foo" };
 275             String moduleName = "orphanarg1";
 276             helper.generateDefaultJModule(moduleName, "composite2");
 277             helper.generateDefaultImage(userOptions, moduleName).assertFailure("Error: orphan argument: foo");
 278         }
 279 
 280         // orphan argument - JDK-8166810
 281         {
 282             String[] userOptions = {"--output", "foo", "bar" };
 283             String moduleName = "orphanarg2";
 284             helper.generateDefaultJModule(moduleName, "composite2");
 285             helper.generateDefaultImage(userOptions, moduleName).assertFailure("Error: orphan argument: bar");
 286         }
 287 
 288         // basic check for --help - JDK-8173717
 289         {
 290             JImageGenerator.getJLinkTask()
 291                     .option("--help")
 292                     .call().assertSuccess();
 293         }
 294     }
 295 
 296     private static void testCompress(Helper helper, String moduleName, String... userOptions) throws IOException {
 297         helper.generateDefaultJModule(moduleName, "composite2");
 298         Path imageDir = helper.generateDefaultImage(userOptions, moduleName).assertSuccess();
 299         helper.checkImage(imageDir, moduleName, null, null);
 300     }
 301 }


 257 
 258         // compress 2
 259         {
 260             testCompress(helper, "compress2filtercmdcomposite2",
 261                     "--compress=2:filter=^/java.base/java/lang/*");
 262         }
 263 
 264         // invalid compress level
 265         {
 266             String[] userOptions = {"--compress", "invalid"};
 267             String moduleName = "invalidCompressLevel";
 268             helper.generateDefaultJModule(moduleName, "composite2");
 269             helper.generateDefaultImage(userOptions, moduleName).assertFailure("Error: Invalid compression level invalid");
 270         }
 271 
 272         // orphan argument - JDK-8166810
 273         {
 274             String[] userOptions = {"--compress", "2", "foo" };
 275             String moduleName = "orphanarg1";
 276             helper.generateDefaultJModule(moduleName, "composite2");
 277             helper.generateDefaultImage(userOptions, moduleName).assertFailure("Error: invalid argument: foo");
 278         }
 279 
 280         // orphan argument - JDK-8166810
 281         {
 282             String[] userOptions = {"--output", "foo", "bar" };
 283             String moduleName = "orphanarg2";
 284             helper.generateDefaultJModule(moduleName, "composite2");
 285             helper.generateDefaultImage(userOptions, moduleName).assertFailure("Error: invalid argument: bar");
 286         }
 287 
 288         // basic check for --help - JDK-8173717
 289         {
 290             JImageGenerator.getJLinkTask()
 291                     .option("--help")
 292                     .call().assertSuccess();
 293         }
 294     }
 295 
 296     private static void testCompress(Helper helper, String moduleName, String... userOptions) throws IOException {
 297         helper.generateDefaultJModule(moduleName, "composite2");
 298         Path imageDir = helper.generateDefaultImage(userOptions, moduleName).assertSuccess();
 299         helper.checkImage(imageDir, moduleName, null, null);
 300     }
 301 }
< prev index next >