1 /* 2 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @summary jpackage create image modular jar test 27 * @library ../helpers 28 * @build JPackageHelper 29 * @build JPackagePath 30 * @build Base 31 * @modules jdk.jpackage 32 * @run main/othervm -Xmx512m ModuleTest 33 */ 34 public class ModuleTest { 35 private static final String OUTPUT = "output"; 36 37 private static final String [] CMD1 = { 38 "--package-type", "app-image", 39 "--module-path", "module", 40 "--module", "com.other/com.other.Other", 41 "--output", OUTPUT, 42 "--name", "test", 43 }; 44 45 private static String [] commands = { 46 "--package-type", "app-image", 47 "--module-path", "module", 48 "--module", "com.other/com.other.Other", 49 "--output", OUTPUT, 50 "--name", "test", 51 "--add-modules", "TBD", 52 }; 53 54 private final static String [] paths = { 55 "ALL-MODULES", 56 "ALL_MODULE_PATH", 57 "ALL-SYSTEM", 58 "ALL-DEFAULT", 59 }; 60 61 public static void main(String[] args) throws Exception { 62 JPackageHelper.createOtherModule(); 63 64 JPackageHelper.deleteOutputFolder(OUTPUT); 65 Base.testCreateAppImage(CMD1); 66 67 for (String path : paths) { 68 commands[commands.length - 1] = path; 69 System.out.println("using --add-modules " + path); 70 JPackageHelper.deleteOutputFolder(OUTPUT); 71 Base.testCreateAppImageToolProvider(commands); 72 System.out.println("succeeded"); 73 } 74 } 75 76 }