jdk/test/sun/management/jmxremote/bootstrap/CustomLauncherTest.java
changeset 21822 12f13ba496cd
parent 21802 b36494ddf19e
child 22062 175604b1209f
equal deleted inserted replaced
21821:2fb0dc66167a 21822:12f13ba496cd
    37 
    37 
    38 /**
    38 /**
    39  * @test
    39  * @test
    40  * @bug 6434402 8004926
    40  * @bug 6434402 8004926
    41  * @library /lib/testlibrary
    41  * @library /lib/testlibrary
       
    42  * @build jdk.testlibrary.ProcessTools
    42  * @build TestManager TestApplication CustomLauncherTest
    43  * @build TestManager TestApplication CustomLauncherTest
    43  * @run main/othervm CustomLauncherTest
    44  * @run main/othervm CustomLauncherTest
    44  * @author Jaroslav Bachorik
    45  * @author Jaroslav Bachorik
    45  */
    46  */
    46 public class CustomLauncherTest {
    47 public class CustomLauncherTest {
    47     private static final  String TEST_CLASSES = System.getProperty("test.classes");
    48     private static final  String TEST_CLASSPATH = System.getProperty("test.class.path");
    48     private static final  String TEST_JDK = System.getProperty("test.jdk");
    49     private static final  String TEST_JDK = System.getProperty("test.jdk");
    49 
    50 
    50     private static final  String TEST_SRC = System.getProperty("test.src");
    51     private static final  String TEST_SRC = System.getProperty("test.src");
    51     private static final  String OSNAME = System.getProperty("os.name");
    52     private static final  String OSNAME = System.getProperty("os.name");
    52     private static final  String ARCH;
    53     private static final  String ARCH;
    80         }
    81         }
    81         LIBARCH = ARCH.equals("i586") ? "i386" : ARCH;
    82         LIBARCH = ARCH.equals("i586") ? "i386" : ARCH;
    82     }
    83     }
    83 
    84 
    84     public static void main(String[] args) throws Exception {
    85     public static void main(String[] args) throws Exception {
    85         if (TEST_CLASSES == null || TEST_CLASSES.isEmpty()) {
    86         if (TEST_CLASSPATH == null || TEST_CLASSPATH.isEmpty()) {
    86             System.out.println("Test is designed to be run from jtreg only");
    87             System.out.println("Test is designed to be run from jtreg only");
    87             return;
    88             return;
    88         }
    89         }
    89 
    90 
    90         String PLATFORM = "";
    91         String PLATFORM = "";
   137 
   138 
   138             System.out.println("Starting custom launcher:");
   139             System.out.println("Starting custom launcher:");
   139             System.out.println("=========================");
   140             System.out.println("=========================");
   140             System.out.println("  launcher  : " + LAUNCHER);
   141             System.out.println("  launcher  : " + LAUNCHER);
   141             System.out.println("  libjvm    : " + libjvmPath.toString());
   142             System.out.println("  libjvm    : " + libjvmPath.toString());
   142             System.out.println("  classpath : " + TEST_CLASSES);
   143             System.out.println("  classpath : " + TEST_CLASSPATH);
   143             ProcessBuilder server = new ProcessBuilder(LAUNCHER, libjvmPath.toString(), TEST_CLASSES, "TestApplication");
   144             ProcessBuilder server = new ProcessBuilder(LAUNCHER, libjvmPath.toString(), TEST_CLASSPATH, "TestApplication");
   144 
   145 
   145             final AtomicReference<String> port = new AtomicReference<>();
   146             final AtomicReference<String> port = new AtomicReference<>();
   146             final AtomicReference<String> pid = new AtomicReference<>();
   147             final AtomicReference<String> pid = new AtomicReference<>();
   147 
   148 
   148             serverPrc = ProcessTools.startProcess(
   149             serverPrc = ProcessTools.startProcess(
   167             System.out.println("  PID           : " + pid.get());
   168             System.out.println("  PID           : " + pid.get());
   168             System.out.println("  shutdown port : " + port.get());
   169             System.out.println("  shutdown port : " + port.get());
   169 
   170 
   170             ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
   171             ProcessBuilder client = ProcessTools.createJavaProcessBuilder(
   171                 "-cp",
   172                 "-cp",
   172                 TEST_CLASSES +
   173                 TEST_CLASSPATH +
   173                     File.pathSeparator +
   174                     File.pathSeparator +
   174                     TEST_JDK +
   175                     TEST_JDK +
   175                     File.separator +
   176                     File.separator +
   176                     "lib" +
   177                     "lib" +
   177                     File.separator +
   178                     File.separator +