< prev index next >

test/jdk/javax/management/mxbean/MXBeanWeirdParamTest.java

Print this page
rev 51731 : imported patch 8210732


  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  */
  23 
  24 /*
  25  * @test
  26  * @bug 8058865
  27  * @summary Checks that a serialized instance is not transmitted from an MXBean.
  28  * All the communication should be done via Open Types
  29  * @author Olivier Lagneau
  30  * @modules java.management.rmi
  31  * @library /lib/testlibrary
  32  * @library /test/lib
  33  * @compile Basic.java
  34  * @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanWeirdParamTest
  35  */
  36 
  37 import java.util.Map;
  38 import java.util.List;
  39 import java.util.ArrayList;
  40 import java.util.Arrays;
  41 
  42 import java.lang.Process;
  43 import java.lang.management.ManagementFactory;
  44 
  45 import javax.management.MBeanServer;
  46 import javax.management.MBeanServerConnection;
  47 import javax.management.remote.JMXConnector;
  48 import javax.management.remote.JMXConnectorFactory;
  49 import javax.management.remote.JMXConnectorServer;
  50 import javax.management.remote.JMXConnectorServerFactory;
  51 import javax.management.remote.JMXServiceURL;


 104 
 105         Utils.waitReady(cs, NINETY_SECONDS);
 106 
 107         JMXServiceURL addr = cs.getAddress();
 108         return addr;
 109     }
 110 
 111 
 112     /*
 113      * Creating command-line for running subprocess JVM:
 114      *
 115      * JVM command line is like:
 116      * {test_jdk}/bin/java {defaultopts} -cp {test.class.path} {testopts} main
 117      *
 118      * {defaultopts} are the default java options set by the framework.
 119      *
 120      */
 121     private List<String> buildCommandLine() {
 122         List<String> opts = new ArrayList<>();
 123         opts.add(JDKToolFinder.getJDKTool("java"));
 124         opts.addAll(Arrays.asList(jdk.testlibrary.Utils.getTestJavaOpts()));
 125         // We need to set WEIRD_PARAM propertty on the client-side
 126         opts.add("-DWEIRD_PARAM");
 127         opts.add("-cp");
 128         opts.add(System.getProperty("test.class.path", "test.class.path"));
 129         opts.add(CLIENT_CLASS_MAIN);
 130 
 131         return opts;
 132     }
 133 
 134     /**
 135      * Runs MXBeanWeirdParamTest$ClientSide with the passed options and redirects
 136      * subprocess standard I/O to the current (parent) process. This provides a
 137      * trace of what happens in the subprocess while it is runnning (and before
 138      * it terminates).
 139      *
 140      * @param serviceUrlStr string representing the JMX service Url to connect to.
 141      */
 142     private int runClientSide(String serviceUrlStr) throws Exception {
 143 
 144         // Building command-line




  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  */
  23 
  24 /*
  25  * @test
  26  * @bug 8058865
  27  * @summary Checks that a serialized instance is not transmitted from an MXBean.
  28  * All the communication should be done via Open Types
  29  * @author Olivier Lagneau
  30  * @modules java.management.rmi

  31  * @library /test/lib
  32  * @compile Basic.java
  33  * @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanWeirdParamTest
  34  */
  35 
  36 import java.util.Map;
  37 import java.util.List;
  38 import java.util.ArrayList;
  39 import java.util.Arrays;
  40 
  41 import java.lang.Process;
  42 import java.lang.management.ManagementFactory;
  43 
  44 import javax.management.MBeanServer;
  45 import javax.management.MBeanServerConnection;
  46 import javax.management.remote.JMXConnector;
  47 import javax.management.remote.JMXConnectorFactory;
  48 import javax.management.remote.JMXConnectorServer;
  49 import javax.management.remote.JMXConnectorServerFactory;
  50 import javax.management.remote.JMXServiceURL;


 103 
 104         Utils.waitReady(cs, NINETY_SECONDS);
 105 
 106         JMXServiceURL addr = cs.getAddress();
 107         return addr;
 108     }
 109 
 110 
 111     /*
 112      * Creating command-line for running subprocess JVM:
 113      *
 114      * JVM command line is like:
 115      * {test_jdk}/bin/java {defaultopts} -cp {test.class.path} {testopts} main
 116      *
 117      * {defaultopts} are the default java options set by the framework.
 118      *
 119      */
 120     private List<String> buildCommandLine() {
 121         List<String> opts = new ArrayList<>();
 122         opts.add(JDKToolFinder.getJDKTool("java"));
 123         opts.addAll(Arrays.asList(jdk.test.lib.Utils.getTestJavaOpts()));
 124         // We need to set WEIRD_PARAM propertty on the client-side
 125         opts.add("-DWEIRD_PARAM");
 126         opts.add("-cp");
 127         opts.add(System.getProperty("test.class.path", "test.class.path"));
 128         opts.add(CLIENT_CLASS_MAIN);
 129 
 130         return opts;
 131     }
 132 
 133     /**
 134      * Runs MXBeanWeirdParamTest$ClientSide with the passed options and redirects
 135      * subprocess standard I/O to the current (parent) process. This provides a
 136      * trace of what happens in the subprocess while it is runnning (and before
 137      * it terminates).
 138      *
 139      * @param serviceUrlStr string representing the JMX service Url to connect to.
 140      */
 141     private int runClientSide(String serviceUrlStr) throws Exception {
 142 
 143         // Building command-line


< prev index next >