< prev index next >

test/java/lang/ProcessHandle/Basic.java

Print this page
rev 17324 : 8181759: add explicit @build actions for jdk.test.lib classes in all :tier1 tests
Reviewed-by: duke


  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
  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         }
  60     }
  61 




  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
  40  * @modules java.base/jdk.internal.misc
  41  *          jdk.management
  42  * @build jdk.test.lib.Utils
  43  *        jdk.test.lib.Asserts
  44  *        jdk.test.lib.JDKToolFinder
  45  *        jdk.test.lib.JDKToolLauncher
  46  *        jdk.test.lib.Platform
  47  *        jdk.test.lib.process.*
  48  * @run testng Basic
  49  * @summary Basic tests for ProcessHandler
  50  * @author Roger Riggs
  51  */
  52 public class Basic {
  53     /**
  54      * Tests of ProcessHandle.current.
  55      */
  56     @Test
  57     public static void test1() {
  58         try {
  59             ProcessHandle self = ProcessHandle.current();
  60             ProcessHandle self1 = ProcessHandle.current();
  61             assertEquals(self, self1); //, "get pid twice should be same %d: %d");
  62         } finally {
  63             // Cleanup any left over processes
  64             ProcessHandle.current().children().forEach(ProcessHandle::destroy);
  65         }
  66     }
  67 


< prev index next >