author | herrick |
Sun, 15 Sep 2019 07:34:39 -0400 | |
branch | JDK-8200758-branch |
changeset 58147 | 45a9084fe981 |
parent 58114 | 42df7de58e39 |
permissions | -rw-r--r-- |
57307 | 1 |
/* |
2 |
* Copyright (c) 2018, 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 verbose test |
|
27 |
* @library ../helpers |
|
28 |
* @build JPackageHelper |
|
29 |
* @build JPackagePath |
|
30 |
* @modules jdk.jpackage |
|
57446 | 31 |
* @run main/othervm -Xmx512m VerboseTest |
57307 | 32 |
*/ |
57446 | 33 |
public class VerboseTest { |
57307 | 34 |
private static final String OUTPUT = "output"; |
35 |
private static final String[] CMD = { |
|
58114
42df7de58e39
8230519: jpackage "--package-type" values and default
herrick
parents:
57446
diff
changeset
|
36 |
"--package-type", "app-image", |
57307 | 37 |
"--input", "input", |
58147
45a9084fe981
8230521: rename --output/-o option and add default value (".")
herrick
parents:
58114
diff
changeset
|
38 |
"--dest", OUTPUT, |
57307 | 39 |
"--name", "test", |
40 |
"--main-jar", "hello.jar", |
|
41 |
"--main-class", "Hello", |
|
42 |
}; |
|
43 |
||
44 |
private static final String[] CMD_VERBOSE = { |
|
58114
42df7de58e39
8230519: jpackage "--package-type" values and default
herrick
parents:
57446
diff
changeset
|
45 |
"--package-type", "app-image", |
57307 | 46 |
"--input", "input", |
58147
45a9084fe981
8230521: rename --output/-o option and add default value (".")
herrick
parents:
58114
diff
changeset
|
47 |
"--dest", OUTPUT, |
57307 | 48 |
"--name", "test", |
49 |
"--main-jar", "hello.jar", |
|
50 |
"--main-class", "Hello", |
|
51 |
"--verbose"}; |
|
52 |
||
53 |
private static void validate(String result, String resultVerbose) |
|
54 |
throws Exception { |
|
55 |
String[] r = result.split("\n"); |
|
56 |
String[] rv = resultVerbose.split("\n"); |
|
57 |
||
58 |
if (r.length >= rv.length) { |
|
59 |
System.err.println("r.length: " + r.length); |
|
60 |
System.err.println(result); |
|
61 |
System.err.println("rv.length: " + rv.length); |
|
62 |
System.err.println(resultVerbose); |
|
63 |
throw new AssertionError( |
|
64 |
"non-verbose output is less or equal to verbose output"); |
|
65 |
} |
|
66 |
} |
|
67 |
||
68 |
private static void testCreateAppImage() throws Exception { |
|
69 |
String result = JPackageHelper.executeCLI(true, CMD); |
|
70 |
JPackageHelper.deleteOutputFolder(OUTPUT); |
|
71 |
String resultVerbose = JPackageHelper.executeCLI(true, CMD_VERBOSE); |
|
72 |
validate(result, resultVerbose); |
|
73 |
} |
|
74 |
||
75 |
private static void testCreateAppImageToolProvider() throws Exception { |
|
76 |
JPackageHelper.deleteOutputFolder(OUTPUT); |
|
77 |
String result = JPackageHelper.executeToolProvider(true, CMD); |
|
78 |
JPackageHelper.deleteOutputFolder(OUTPUT); |
|
79 |
String resultVerbose = |
|
80 |
JPackageHelper.executeToolProvider(true, CMD_VERBOSE); |
|
81 |
validate(result, resultVerbose); |
|
82 |
} |
|
83 |
||
84 |
public static void main(String[] args) throws Exception { |
|
85 |
JPackageHelper.createHelloImageJar(); |
|
86 |
testCreateAppImage(); |
|
87 |
testCreateAppImageToolProvider(); |
|
88 |
} |
|
89 |
||
90 |
} |