32 * @build JPackagePath |
32 * @build JPackagePath |
33 * @modules jdk.jpackage |
33 * @modules jdk.jpackage |
34 * @run main/othervm -Xmx512m JPackageCreateImageBuildRootTest |
34 * @run main/othervm -Xmx512m JPackageCreateImageBuildRootTest |
35 */ |
35 */ |
36 public class JPackageCreateImageBuildRootTest { |
36 public class JPackageCreateImageBuildRootTest { |
|
37 private static final String OUTPUT = "output"; |
37 private static String buildRoot = null; |
38 private static String buildRoot = null; |
38 private static final String BUILD_ROOT = "buildRoot"; |
39 private static final String BUILD_ROOT = "buildRoot"; |
39 private static final String BUILD_ROOT_TB = "buildRootToolProvider"; |
40 private static final String BUILD_ROOT_TB = "buildRootToolProvider"; |
40 |
41 |
41 private static final String [] CMD = { |
42 private static final String [] CMD = { |
42 "create-image", |
43 "create-image", |
43 "--input", "input", |
44 "--input", "input", |
44 "--output", "output", |
45 "--output", OUTPUT, |
|
46 "--name", "test", |
|
47 "--main-jar", "hello.jar", |
|
48 "--main-class", "Hello", |
|
49 "--files", "hello.jar" }; |
|
50 |
|
51 private static final String [] CMD_BUILD_ROOT = { |
|
52 "create-image", |
|
53 "--input", "input", |
|
54 "--output", OUTPUT, |
45 "--name", "test", |
55 "--name", "test", |
46 "--main-jar", "hello.jar", |
56 "--main-jar", "hello.jar", |
47 "--main-class", "Hello", |
57 "--main-class", "Hello", |
48 "--files", "hello.jar", |
58 "--files", "hello.jar", |
49 "--overwrite" }; |
|
50 |
|
51 private static final String [] CMD_BUILD_ROOT = { |
|
52 "create-image", |
|
53 "--input", "input", |
|
54 "--output", "output", |
|
55 "--name", "test", |
|
56 "--main-jar", "hello.jar", |
|
57 "--main-class", "Hello", |
|
58 "--files", "hello.jar", |
|
59 "--overwrite", |
|
60 "--build-root", "TBD"}; |
59 "--build-root", "TBD"}; |
61 |
60 |
62 private static void validate(boolean retain) throws Exception { |
61 private static void validate(boolean retain) throws Exception { |
63 File br = new File(buildRoot); |
62 File br = new File(buildRoot); |
64 if (retain) { |
63 if (retain) { |
84 |
83 |
85 private static void testBuildRoot() throws Exception { |
84 private static void testBuildRoot() throws Exception { |
86 init(false); |
85 init(false); |
87 JPackageHelper.executeCLI(true, CMD); |
86 JPackageHelper.executeCLI(true, CMD); |
88 validate(false); |
87 validate(false); |
|
88 JPackageHelper.deleteOutputFolder(OUTPUT); |
89 JPackageHelper.executeCLI(true, CMD_BUILD_ROOT); |
89 JPackageHelper.executeCLI(true, CMD_BUILD_ROOT); |
90 validate(true); |
90 validate(true); |
91 } |
91 } |
92 |
92 |
93 private static void testBuildRootToolProvider() throws Exception { |
93 private static void testBuildRootToolProvider() throws Exception { |
94 init(true); |
94 init(true); |
|
95 JPackageHelper.deleteOutputFolder(OUTPUT); |
95 JPackageHelper.executeToolProvider(true, CMD); |
96 JPackageHelper.executeToolProvider(true, CMD); |
96 validate(false); |
97 validate(false); |
|
98 JPackageHelper.deleteOutputFolder(OUTPUT); |
97 JPackageHelper.executeToolProvider(true, CMD_BUILD_ROOT); |
99 JPackageHelper.executeToolProvider(true, CMD_BUILD_ROOT); |
98 validate(true); |
100 validate(true); |
99 } |
101 } |
100 |
102 |
101 public static void main(String[] args) throws Exception { |
103 public static void main(String[] args) throws Exception { |