author | iignatyev |
Fri, 21 Sep 2018 14:50:06 -0700 | |
changeset 51840 | dc15e45122b2 |
parent 47216 | 71c04702a3d5 |
child 52919 | ef9a34d58474 |
permissions | -rw-r--r-- |
42101
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
1 |
/* |
51840 | 2 |
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. |
42101
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
4 |
* |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
8 |
* |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
13 |
* accompanied this code). |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
14 |
* |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
18 |
* |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
21 |
* questions. |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
22 |
*/ |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
23 |
|
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
24 |
/* |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
25 |
* @test |
51840 | 26 |
* @library /test/lib |
42101
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
27 |
* @modules jdk.jartool/sun.tools.jar |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
28 |
* @build LingeredAppForJps |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
29 |
* @build LingeredApp |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
30 |
* @run main/othervm TestJps |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
31 |
*/ |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
32 |
|
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
33 |
/* |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
34 |
* Notes: |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
35 |
* @modules tag is ignored in driver mode, so need main/othervm |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
36 |
* |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
37 |
* Launching the process with relative path to an app jar file is not tested |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
38 |
* |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
39 |
* This test resides in default package, so correct appearance |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
40 |
* of the full package name actually is not tested. |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
41 |
*/ |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
42 |
|
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
43 |
import java.util.List; |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
44 |
import java.io.File; |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
45 |
|
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
46 |
public class TestJps { |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
47 |
|
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
48 |
public static void testJpsClass() throws Throwable { |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
49 |
LingeredApp app = new LingeredAppForJps(); |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
50 |
try { |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
51 |
LingeredApp.startApp(JpsHelper.getVmArgs(), app); |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
52 |
JpsHelper.runJpsVariants(app.getPid(), |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
53 |
LingeredAppForJps.getProcessName(), LingeredAppForJps.getFullProcessName(), app.getLockFileName()); |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
54 |
|
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
55 |
} finally { |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
56 |
LingeredApp.stopApp(app); |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
57 |
} |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
58 |
} |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
59 |
|
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
60 |
public static void testJpsJar() throws Throwable { |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
61 |
// Get any jar exception as early as possible |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
62 |
File jar = LingeredAppForJps.buildJar(); |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
63 |
|
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
64 |
// Jar created go to the main test |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
65 |
LingeredAppForJps app = new LingeredAppForJps(); |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
66 |
try { |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
67 |
LingeredAppForJps.startAppJar(JpsHelper.getVmArgs(), app, jar); |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
68 |
JpsHelper.runJpsVariants(app.getPid(), |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
69 |
LingeredAppForJps.getProcessName(jar), LingeredAppForJps.getFullProcessName(jar), app.getLockFileName()); |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
70 |
} finally { |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
71 |
LingeredAppForJps.stopApp(app); |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
72 |
} |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
73 |
|
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
74 |
} |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
75 |
|
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
76 |
public static void main(String[] args) throws Throwable { |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
77 |
testJpsClass(); |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
78 |
testJpsJar(); |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
79 |
} |
e75889484926
8165500: TestJpsJar shouldn't jar all test.classpath directories
dsamersoff
parents:
diff
changeset
|
80 |
} |