< prev index next >

test/java/lang/ProcessHandle/InfoTest.java

Print this page


   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  */


  36 import java.util.List;
  37 import java.util.Objects;
  38 import java.util.Optional;
  39 import java.util.Random;
  40 import java.util.concurrent.TimeUnit;
  41 
  42 import jdk.test.lib.Platform;
  43 import jdk.test.lib.Utils;
  44 import org.testng.Assert;
  45 import org.testng.TestNG;
  46 import org.testng.annotations.Test;
  47 
  48 /*
  49  * @test
  50  * @bug 8077350 8081566 8081567 8098852 8136597
  51  * @library /test/lib/share/classes
  52  * @build jdk.test.lib.Platform jdk.test.lib.Utils
  53  * @run testng InfoTest
  54  * @summary Functions of ProcessHandle.Info
  55  * @author Roger Riggs
  56  * @key intermittent
  57  */
  58 
  59 public class InfoTest {
  60 
  61     static String whoami;
  62 
  63     static {
  64         try {
  65             // Create a file and take the username from the file
  66             Path p = Paths.get("OwnerName.tmp");
  67             Files.createFile(p);
  68             UserPrincipal owner = Files.getOwner(p);
  69             whoami = owner.getName();
  70             Files.delete(p);
  71         } catch (IOException ex) {
  72             ex.printStackTrace();
  73             throw new UncheckedIOException("tmp file", ex);
  74         }
  75     }
  76 


   1 /*
   2  * Copyright (c) 2014, 2016, 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  */


  36 import java.util.List;
  37 import java.util.Objects;
  38 import java.util.Optional;
  39 import java.util.Random;
  40 import java.util.concurrent.TimeUnit;
  41 
  42 import jdk.test.lib.Platform;
  43 import jdk.test.lib.Utils;
  44 import org.testng.Assert;
  45 import org.testng.TestNG;
  46 import org.testng.annotations.Test;
  47 
  48 /*
  49  * @test
  50  * @bug 8077350 8081566 8081567 8098852 8136597
  51  * @library /test/lib/share/classes
  52  * @build jdk.test.lib.Platform jdk.test.lib.Utils
  53  * @run testng InfoTest
  54  * @summary Functions of ProcessHandle.Info
  55  * @author Roger Riggs

  56  */
  57 
  58 public class InfoTest {
  59 
  60     static String whoami;
  61 
  62     static {
  63         try {
  64             // Create a file and take the username from the file
  65             Path p = Paths.get("OwnerName.tmp");
  66             Files.createFile(p);
  67             UserPrincipal owner = Files.getOwner(p);
  68             whoami = owner.getName();
  69             Files.delete(p);
  70         } catch (IOException ex) {
  71             ex.printStackTrace();
  72             throw new UncheckedIOException("tmp file", ex);
  73         }
  74     }
  75 


< prev index next >