1 /*
2 * Copyright (c) 2014, 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.util.ArrayList;
25 import java.util.List;
26
27 import jdk.testlibrary.OutputAnalyzer;
28 import jdk.testlibrary.ProcessTools;
29
30 /*
31 * @test
32 * @summary The test application will be started with java class:
33 * java JpsBase
34 * For all possible combinations of jps arguments a jps process
35 * will be started from within the test application.
36 * The output should contain proper values.
37 * @library /lib/testlibrary
38 * @build jdk.testlibrary.* JpsHelper JpsBase
39 * @run driver TestJpsClass
40 */
41 public class TestJpsClass {
42
43 public static void main(String[] args) throws Throwable {
44 String testJdk = System.getProperty("test.jdk", "?");
45 String testSrc = System.getProperty("test.src", "?");
46 String testClassPath = System.getProperty("test.class.path", "?");
47
48 List<String> cmd = new ArrayList<>();
49 cmd.addAll(JpsHelper.getVmArgs());
50 cmd.add("-Dtest.jdk=" + testJdk);
51 cmd.add("-Dtest.src=" + testSrc);
52 cmd.add("-cp");
53 cmd.add(testClassPath);
54 cmd.add("JpsBase");
55 cmd.add("monkey");
56
57 ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(cmd.toArray(new String[cmd.size()]));
|
1 /*
2 * Copyright (c) 2014, 2015, 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.util.ArrayList;
25 import java.util.List;
26
27 import jdk.testlibrary.OutputAnalyzer;
28 import jdk.testlibrary.ProcessTools;
29
30 /*
31 * @test
32 * @summary The test application will be started with java class:
33 * java JpsBase
34 * For all possible combinations of jps arguments a jps process
35 * will be started from within the test application.
36 * The output should contain proper values.
37 * @library /lib/testlibrary
38 * @modules jdk.jartool/sun.tools.jar
39 * java.management
40 * @build jdk.testlibrary.* JpsHelper JpsBase
41 * @run driver TestJpsClass
42 */
43 public class TestJpsClass {
44
45 public static void main(String[] args) throws Throwable {
46 String testJdk = System.getProperty("test.jdk", "?");
47 String testSrc = System.getProperty("test.src", "?");
48 String testClassPath = System.getProperty("test.class.path", "?");
49
50 List<String> cmd = new ArrayList<>();
51 cmd.addAll(JpsHelper.getVmArgs());
52 cmd.add("-Dtest.jdk=" + testJdk);
53 cmd.add("-Dtest.src=" + testSrc);
54 cmd.add("-cp");
55 cmd.add(testClassPath);
56 cmd.add("JpsBase");
57 cmd.add("monkey");
58
59 ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(cmd.toArray(new String[cmd.size()]));
|