test/sun/management/jmxremote/startstop/JMXStartStopTest.java

Print this page
rev 9529 : 8034960: Serviceability tests using @library failing with java.lang.NoClassDefFoundError


  37 import java.util.Map;
  38 import java.util.Objects;
  39 import java.util.Set;
  40 import java.util.concurrent.TimeUnit;
  41 import java.util.concurrent.TimeoutException;
  42 import java.util.concurrent.atomic.AtomicBoolean;
  43 import java.util.concurrent.atomic.AtomicReference;
  44 import java.util.function.Consumer;
  45 
  46 import javax.management.*;
  47 import javax.management.remote.*;
  48 import javax.net.ssl.SSLHandshakeException;
  49 
  50 import jdk.testlibrary.ProcessTools;
  51 import jdk.testlibrary.JDKToolLauncher;
  52 
  53 /**
  54  * @test
  55  * @bug 7110104
  56  * @library /lib/testlibrary
  57  * @build jdk.testlibrary.ProcessTools
  58  * @build jdk.testlibrary.JDKToolLauncher
  59  * @build jdk.testlibrary.Utils
  60  * @build JMXStartStopTest JMXStartStopDoSomething
  61  * @run main/othervm JMXStartStopTest
  62  * @summary Makes sure that enabling/disabling the management agent through
  63  *          JCMD achieves the desired results
  64  */
  65 public class JMXStartStopTest {
  66     private static final String TEST_JDK = System.getProperty("test.jdk");
  67     private static final String TEST_SRC = System.getProperty("test.src");
  68 
  69     private static final boolean verbose = false;
  70 
  71     /**
  72      * Dynamically allocates two distinct ports using {@linkplain java.net.ServerSocket}
  73      * It keeps each of those ports blocked until it is first accessed by its getter
  74      */
  75     private static class PortAllocator {
  76         private final int port1, port2;
  77         private final ServerSocket ss1, ss2;
  78         PortAllocator() {
  79             try {
  80                 ss1 = new ServerSocket(0);




  37 import java.util.Map;
  38 import java.util.Objects;
  39 import java.util.Set;
  40 import java.util.concurrent.TimeUnit;
  41 import java.util.concurrent.TimeoutException;
  42 import java.util.concurrent.atomic.AtomicBoolean;
  43 import java.util.concurrent.atomic.AtomicReference;
  44 import java.util.function.Consumer;
  45 
  46 import javax.management.*;
  47 import javax.management.remote.*;
  48 import javax.net.ssl.SSLHandshakeException;
  49 
  50 import jdk.testlibrary.ProcessTools;
  51 import jdk.testlibrary.JDKToolLauncher;
  52 
  53 /**
  54  * @test
  55  * @bug 7110104
  56  * @library /lib/testlibrary
  57  * @build jdk.testlibrary.* JMXStartStopTest JMXStartStopDoSomething



  58  * @run main/othervm JMXStartStopTest
  59  * @summary Makes sure that enabling/disabling the management agent through
  60  *          JCMD achieves the desired results
  61  */
  62 public class JMXStartStopTest {
  63     private static final String TEST_JDK = System.getProperty("test.jdk");
  64     private static final String TEST_SRC = System.getProperty("test.src");
  65 
  66     private static final boolean verbose = false;
  67 
  68     /**
  69      * Dynamically allocates two distinct ports using {@linkplain java.net.ServerSocket}
  70      * It keeps each of those ports blocked until it is first accessed by its getter
  71      */
  72     private static class PortAllocator {
  73         private final int port1, port2;
  74         private final ServerSocket ss1, ss2;
  75         PortAllocator() {
  76             try {
  77                 ss1 = new ServerSocket(0);