Path: blob/master/test/jdk/sun/management/jdp/JdpJmxRemoteDynamicPortTest.java
51071 views
/*1* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test JdpJmxRemoteDynamicPortTest.java25* @bug 816733726* @summary Verify a non-zero value is assigned to jmxremote.port27* when VM is started with jmxremote.port=0.28*29* @library /test/lib30*31* @build ClientConnection JdpTestUtil JdpTestCase JdpJmxRemoteDynamicPortTestCase DynamicLauncher32* @run main/othervm JdpJmxRemoteDynamicPortTest33*/3435import java.lang.management.ManagementFactory;3637public class JdpJmxRemoteDynamicPortTest extends DynamicLauncher {38final String testName = "JdpJmxRemoteDynamicPortTestCase";3940public static void main(String[] args) throws Exception {41DynamicLauncher launcher = new JdpJmxRemoteDynamicPortTest();42launcher.run();43}4445protected String[] options() {46String[] options = {47"-Dcom.sun.management.jmxremote.authenticate=false",48"-Dcom.sun.management.jmxremote.ssl=false",49"-Dcom.sun.management.jmxremote=true",50"-Dcom.sun.management.jmxremote.port=0",51"-Dcom.sun.management.jmxremote.autodiscovery=true",52"-Dcom.sun.management.jdp.pause=1",53"-Dcom.sun.management.jdp.name=" + jdpName,54"-Djava.util.logging.SimpleFormatter.format='%1$tF %1$tT %4$-7s %5$s %n'",55testName56};57return options;58}59}606162