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 static org.testng.Assert.assertEquals;
25 import static org.testng.Assert.assertFalse;
26 import static org.testng.Assert.assertTrue;
27 import static org.testng.Assert.fail;
28
29 import java.io.IOException;
30 import java.util.List;
31 import java.util.Optional;
32 import java.util.stream.Collectors;
33
34 import org.testng.TestNG;
35 import org.testng.annotations.Test;
36
37 /*
38 * @test
39 * @library /test/lib/share/classes
40 * @modules java.base/jdk.internal.misc
41 * jdk.management
42 * @run testng Basic
43 * @summary Basic tests for ProcessHandler
44 * @author Roger Riggs
45 */
46 public class Basic {
47 /**
48 * Tests of ProcessHandle.current.
49 */
50 @Test
51 public static void test1() {
52 try {
53 ProcessHandle self = ProcessHandle.current();
54 ProcessHandle self1 = ProcessHandle.current();
55 assertEquals(self, self1); //, "get pid twice should be same %d: %d");
56 } finally {
57 // Cleanup any left over processes
58 ProcessHandle.current().children().forEach(ProcessHandle::destroy);
59 }
|
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 static org.testng.Assert.assertEquals;
25 import static org.testng.Assert.assertFalse;
26 import static org.testng.Assert.assertTrue;
27 import static org.testng.Assert.fail;
28
29 import java.io.IOException;
30 import java.util.List;
31 import java.util.Optional;
32 import java.util.stream.Collectors;
33
34 import org.testng.TestNG;
35 import org.testng.annotations.Test;
36
37 /*
38 * @test
39 * @modules java.base/jdk.internal.misc
40 * jdk.management
41 * @run testng Basic
42 * @summary Basic tests for ProcessHandler
43 * @author Roger Riggs
44 */
45 public class Basic {
46 /**
47 * Tests of ProcessHandle.current.
48 */
49 @Test
50 public static void test1() {
51 try {
52 ProcessHandle self = ProcessHandle.current();
53 ProcessHandle self1 = ProcessHandle.current();
54 assertEquals(self, self1); //, "get pid twice should be same %d: %d");
55 } finally {
56 // Cleanup any left over processes
57 ProcessHandle.current().children().forEach(ProcessHandle::destroy);
58 }
|