author | herrick |
Fri, 21 Jun 2019 08:29:09 -0400 | |
branch | JDK-8200758-branch |
changeset 57419 | 44c2481650ce |
parent 57414 | 6eda749d3117 |
child 57445 | 405ddd80496e |
permissions | -rw-r--r-- |
57314 | 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 |
import java.io.File; |
|
25 |
import java.nio.file.Files; |
|
26 |
||
27 |
/* |
|
28 |
* @test |
|
29 |
* @summary jpackage create image with no main class arguments and with main-class attribute |
|
30 |
* @library ../helpers |
|
31 |
* @build JPackageHelper |
|
32 |
* @build JPackagePath |
|
33 |
* @modules jdk.jpackage |
|
34 |
* @run main/othervm -Xmx512m JPackageCreateAppImageMainClassErrorTest |
|
35 |
*/ |
|
36 |
public class JPackageCreateAppImageMainClassErrorTest { |
|
37 |
private static final String OUTPUT = "output"; |
|
38 |
private static final String app = JPackagePath.getApp(); |
|
39 |
private static final String appOutput = JPackagePath.getAppOutputFile(); |
|
40 |
private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); |
|
41 |
||
42 |
private static final String[] CMD = { |
|
43 |
"--input", "input", |
|
44 |
"--output", OUTPUT, |
|
45 |
"--name", "test", |
|
46 |
"--main-jar", "hello.jar"}; |
|
47 |
||
48 |
private static void validate(String output) throws Exception { |
|
57419
44c2481650ce
8225092: Several jpackage tests failes when run with jcov enabled
herrick
parents:
57414
diff
changeset
|
49 |
String[] result = JPackageHelper.splitAndFilter(output); |
57314 | 50 |
if (result.length != 2) { |
51 |
throw new AssertionError( |
|
52 |
"Unexpected number of lines: " + result.length); |
|
53 |
} |
|
54 |
||
55 |
if (!result[0].trim().contains("main class was not specified")) { |
|
56 |
throw new AssertionError("Unexpected result[0]: " + result[0]); |
|
57 |
} |
|
58 |
||
59 |
if (!result[1].trim().startsWith("Advice to fix: ")) { |
|
60 |
throw new AssertionError("Unexpected result[1]: " + result[1]); |
|
61 |
} |
|
62 |
} |
|
63 |
||
64 |
public static void main(String[] args) throws Exception { |
|
65 |
JPackageHelper.createHelloImageJar(); |
|
66 |
||
67 |
JPackageHelper.deleteOutputFolder(OUTPUT); |
|
68 |
validate(JPackageHelper.executeCLI(false, CMD)); |
|
69 |
||
70 |
JPackageHelper.deleteOutputFolder(OUTPUT); |
|
71 |
validate(JPackageHelper.executeToolProvider(false, CMD)); |
|
72 |
} |
|
73 |
||
74 |
} |