8059037: JdpTest.sh hangs when trying to kill the test VM
Summary: Removed shell tests enable java ones
Reviewed-by: sla, miauno
--- a/jdk/test/TEST.groups Thu Oct 09 16:05:24 2014 +0800
+++ b/jdk/test/TEST.groups Thu Oct 09 06:49:13 2014 -0700
@@ -365,7 +365,6 @@
java/util/zip/3GBZipFiles.sh \
jdk/lambda/FDTest.java \
jdk/lambda/separate/Compiler.java \
- sun/management/jdp/JdpTest.sh \
sun/management/jmxremote/bootstrap/JvmstatCountersTest.java \
sun/management/jmxremote/bootstrap/LocalManagementTest.java \
sun/management/jmxremote/bootstrap/CustomLauncherTest.java \
--- a/jdk/test/sun/management/jdp/JdpClient.java Thu Oct 09 16:05:24 2014 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.IOException;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.NetworkInterface;
-import java.net.ProtocolFamily;
-import java.net.StandardProtocolFamily;
-import java.net.StandardSocketOptions;
-import java.nio.ByteBuffer;
-import java.nio.channels.DatagramChannel;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.Selector;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Map;
-
-import sun.management.jdp.JdpException;
-import sun.management.jdp.JdpJmxPacket;
-import sun.management.jdp.JdpPacketReader;
-
-public class JdpClient {
-
- private static class PacketListener implements Runnable {
-
- private static final int BUFFER_LENGTH = 4096;
- private final DatagramChannel channel;
- private static int maxPacketCount = 1;
- private static int maxEmptyPacketCount = 10;
-
- private void get(Map<?, ?> map, String key)
- throws JdpException {
-
- if (map.get(key) == null) {
- throw new JdpException("Test failed, packet field " + key + " missed");
- }
- }
-
- private void checkFieldPresence(JdpJmxPacket p)
- throws IOException, JdpException {
-
- byte[] b = p.getPacketData();
-
- JdpPacketReader reader = new JdpPacketReader(b);
- Map<String, String> pMap = reader.getDiscoveryDataAsMap();
-
- get(pMap, JdpJmxPacket.UUID_KEY);
- get(pMap, JdpJmxPacket.MAIN_CLASS_KEY);
- get(pMap, JdpJmxPacket.JMX_SERVICE_URL_KEY);
- // get(pMap, JdpJmxPacket.INSTANCE_NAME_KEY);
- get(pMap, JdpJmxPacket.PROCESS_ID_KEY);
- get(pMap, JdpJmxPacket.BROADCAST_INTERVAL_KEY);
- get(pMap, JdpJmxPacket.RMI_HOSTNAME_KEY);
- }
-
-
- PacketListener(DatagramChannel channel) {
- this.channel = channel;
- }
-
- @java.lang.Override
- public void run() {
- try {
- Selector sel;
- sel = Selector.open();
- channel.configureBlocking(false);
- channel.register(sel, SelectionKey.OP_READ);
- ByteBuffer buf = ByteBuffer.allocate(1024);
-
- int count = 1;
- int emptyPacketsCount = 1;
-
- try {
- while (true) {
-
- // Use tcpdump -U -w - -s 1400 -c 2 -vv port 7095
- // to verify that correct packet being sent
- sel.selectedKeys().clear();
- buf.rewind();
-
- sel.select(10 * 1000);
- channel.receive(buf);
-
- if (buf.position() == 0) {
- if (JdpDoSomething.getVerbose()) {
- System.err.println("Empty packet received");
- }
- if (++emptyPacketsCount > maxEmptyPacketCount) {
- throw new RuntimeException("Test failed, maxEmptyPacketCount reached");
- }
-
- continue;
- }
-
- buf.flip();
- byte[] dgramData = new byte[buf.remaining()];
- buf.get(dgramData);
- try {
- JdpJmxPacket packet = new JdpJmxPacket(dgramData);
- JdpDoSomething.printJdpPacket(packet);
- checkFieldPresence(packet);
- if (++count > maxPacketCount) {
- break;
- }
- } catch (JdpException e) {
- e.printStackTrace();
- throw new RuntimeException("Test failed");
- }
-
- }
-
- System.out.println("OK: Test passed");
-
- } finally {
- sel.close();
- channel.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- throw new RuntimeException("Test failed");
- }
- }
- }
-
- public static void main(String[] args) {
- try {
- String discoveryPort = System.getProperty("com.sun.management.jdp.port");
- String discoveryAddress = System.getProperty("com.sun.management.jdp.address");
- if (discoveryAddress == null || discoveryPort == null) {
- System.out.println("Test failed. address and port must be specified");
- return;
- }
-
- int port = Integer.parseInt(discoveryPort);
- InetAddress address = InetAddress.getByName(discoveryAddress);
-
-
- ProtocolFamily family = (address instanceof Inet6Address)
- ? StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
-
- DatagramChannel channel;
-
- channel = DatagramChannel.open(family);
- channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
- channel.bind(new InetSocketAddress(port));
-
- Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
- for (NetworkInterface interf : Collections.list(nets)) {
- if (interf.supportsMulticast()) {
- try {
- channel.join(address, interf);
- } catch (IOException e) {
- // Skip not configured interfaces
- }
- }
- }
-
- PacketListener listener = new PacketListener(channel);
- new Thread(listener, "Jdp Client").start();
-
- } catch (RuntimeException e) {
- System.out.println("Test failed.");
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Test failed. unexpected error " + e);
- }
- }
-}
--- a/jdk/test/sun/management/jdp/JdpDefaultsTest.java Thu Oct 09 16:05:24 2014 +0800
+++ b/jdk/test/sun/management/jdp/JdpDefaultsTest.java Thu Oct 09 06:49:13 2014 -0700
@@ -25,6 +25,9 @@
* A JVM with JDP on should send multicast JDP packets regularly.
*
* @author Alex Schenkman
+ */
+
+/*
* @test JdpDefaultsTest
* @summary Assert that we can read JDP packets from a multicast socket connection, on default IP and port.
* @library /lib/testlibrary
--- a/jdk/test/sun/management/jdp/JdpDoSomething.java Thu Oct 09 16:05:24 2014 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.util.Objects;
-
-import sun.management.jdp.JdpJmxPacket;
-import sun.management.jdp.JdpException;
-
-public class JdpDoSomething {
-
- private static final String lockFileName = "JdpDoSomething.lck";
- private static final boolean verbose = false;
-
- public static boolean getVerbose() {
- return verbose;
- }
-
- public static void printJdpPacket(JdpJmxPacket p) {
- if (getVerbose()) {
- try {
- RandomAccessFile f = new RandomAccessFile("out.dmp", "rw");
- f.write(p.getPacketData());
- f.close();
- } catch (IOException e) {
- System.out.println("Can't write a dump file: " + e);
- }
-
- System.out.println("Id: " + p.getId());
- System.out.println("Jmx: " + p.getJmxServiceUrl());
- System.out.println("Main: " + p.getMainClass());
- System.out.println("InstanceName: " + p.getInstanceName());
- System.out.println("ProccessId: " + p.getProcessId());
- System.out.println("BroadcastInterval: " + p.getBroadcastInterval());
- System.out.println("Rmi Hostname: " + p.getRmiHostname());
-
- System.out.flush();
- }
- }
-
- public static void compaireJdpPacketEx(JdpJmxPacket p1, JdpJmxPacket p2)
- throws JdpException {
-
- if (!Objects.equals(p1, p1)) {
- throw new JdpException("Packet mismatch error");
- }
-
- if (!Objects.equals(p1.getMainClass(), p2.getMainClass())) {
- throw new JdpException("Packet mismatch error (main class)");
- }
-
- if (!Objects.equals(p1.getInstanceName(), p2.getInstanceName())) {
- throw new JdpException("Packet mismatch error (instance name)");
- }
- }
-
- public static void doSomething() {
- try {
- File lockFile = new File(lockFileName);
- lockFile.createNewFile();
-
- while (lockFile.exists()) {
- long datetime = lockFile.lastModified();
- long epoch = System.currentTimeMillis() / 1000;
-
- // Don't allow test app to run more than an hour
- if (epoch - datetime > 3600) {
- System.err.println("Lock is too old. Aborting");
- return;
- }
- Thread.sleep(1);
- }
-
- } catch (Throwable e) {
- System.err.println("Something bad happens:" + e);
- }
- }
-
- public static void main(String args[]) throws Exception {
- System.err.println("main enter");
- doSomething();
- System.err.println("main exit");
- }
-}
--- a/jdk/test/sun/management/jdp/JdpOffTest.java Thu Oct 09 16:05:24 2014 +0800
+++ b/jdk/test/sun/management/jdp/JdpOffTest.java Thu Oct 09 06:49:13 2014 -0700
@@ -26,6 +26,9 @@
* com.sun.management.jmxremote.autodiscovery=false should be respected.
*
* @author Alex Schenkman
+ */
+
+/*
* @test JdpOffTest.java
* @summary Assert that no JDP packets are sent to the default address and port.
* @library /lib/testlibrary
--- a/jdk/test/sun/management/jdp/JdpSpecificAddressTest.java Thu Oct 09 16:05:24 2014 +0800
+++ b/jdk/test/sun/management/jdp/JdpSpecificAddressTest.java Thu Oct 09 06:49:13 2014 -0700
@@ -25,6 +25,9 @@
* A JVM with JDP on should send multicast JDP packets regularly.
*
* @author Alex Schenkman
+ */
+
+/*
* @test JdpSpecificAddressTest
* @summary Assert that we can read JDP packets from a multicast socket connection, on specific IP and port.
* @library /lib/testlibrary
--- a/jdk/test/sun/management/jdp/JdpTest.sh Thu Oct 09 16:05:24 2014 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,358 +0,0 @@
-#!/bin/sh -x
-
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-
-# @test
-# @bug 7169888
-# @compile -XDignore.symbol.file JdpUnitTest.java JdpClient.java JdpDoSomething.java
-# @run shell JdpTest.sh --jtreg --no-compile
-# @summary No word Failed expected in the test output
-
-_verbose=no
-_jtreg=no
-_compile=yes
-
-# temporary disable jcmd related tests
-# _testsuite="01,02,03,04,05"
-_testsuite="01"
-
-_pwd=`pwd`
-
-_testclasses=".classes"
-_testsrc="${_pwd}"
-_lockFileName="JdpDoSomething.lck"
-
-_logname=".classes/output.txt"
-_last_pid=""
-
-_ip="224.0.23.178"
-_port="7095"
-_jmxport="4545"
-
-_do_compile(){
- # If the test run without JTReg, we have to compile it by our self
- # Under JTReg see @compile statement above
- # sun.* packages is not included to symbol file lib/ct.sym so we have
- # to ignore it
-
- if [ ! -d ${_testclasses} ]
- then
- mkdir -p ${_testclasses}
- fi
-
- rm -f ${_testclasses}/*.class
-
- # Compile testcase
- ${COMPILEJAVA}/bin/javac -XDignore.symbol.file -d ${_testclasses} \
- JdpUnitTest.java \
- JdpDoSomething.java \
- JdpClient.java
-
-
- if [ ! -f ${_testclasses}/JdpDoSomething.class -o ! -f ${_testclasses}/JdpClient.class -o ! -f ${_testclasses}/JdpUnitTest.class ]
- then
- echo "ERROR: Can't compile"
- exit 255
- fi
-}
-
-
-_app_start(){
-
- testappname=$1
- shift
-
- ${TESTJAVA}/bin/java -server $* -cp ${_testclasses} ${testappname} >> ${_logname} 2>&1 &
- _last_pid=$!
-
-# wait until VM is actually starts.
-# please note, if vm doesn't start for some reason
-# jtreg kills the test by timeout. Don't file a bug.
- cnt=1
- while true
- do
- npid=`_get_pid`
- if [ "${npid}" != "" ]
- then
- break
- fi
- if [ "${cnt}" = "10" ]
- then
- echo "ERROR: Test app not started. Please check machine resources before filing a bug."
- if [ "${_jtreg}" = "yes" ]
- then
- exit 255
- fi
- break
- fi
- cnt=`expr $cnt + 1`
- sleep 1
- done
-}
-
-_get_pid(){
- ${TESTJAVA}/bin/jps | sed -n "/Jdp/s/ .*//p"
-}
-
-_app_stop(){
- rm ${_lockFileName}
-
-# wait until VM is actually shuts down
- while true
- do
- npid=`_get_pid`
- if [ "${npid}" = "" ]
- then
- break
- fi
- sleep 1
- done
-}
-
-_testme(){
- ${TESTJAVA}/bin/java \
- -cp ${_testclasses} \
- $* \
- -Dcom.sun.management.jdp.port=${_port} \
- -Dcom.sun.management.jdp.address=${_ip} \
- JdpClient
-}
-
-
-_jcmd(){
- ${TESTJAVA}/bin/jcmd JdpDoSomething $* > /dev/null 2>/dev/null
-}
-
-
-_echo(){
- echo "$*"
- echo "$*" >> ${_logname}
-}
-
-# ============= TESTS ======================================
-
-test_01(){
-
- _echo "**** Test one ****"
-
- _app_start JdpUnitTest \
- -Dcom.sun.management.jdp.port=${_port} \
- -Dcom.sun.management.jdp.address=${_ip} \
- -Dcom.sun.management.jdp.name=testme \
- -Djava.rmi.server.hostname=localhost \
- -Dcom.sun.management.jdp.pause=5
-
- res=`_testme`
-
- case "${res}" in
- OK*)
- _echo "Passed"
- ;;
- *)
- _echo "Failed!"
- ;;
- esac
-
- _app_stop
-}
-
-test_02(){
-
- _echo "**** Test two ****"
-
- _app_start JdpDoSomething \
- -Dcom.sun.management.jdp.port=${_port} \
- -Dcom.sun.management.jdp.address=${_ip} \
- -Dcom.sun.management.jdp.pause=5 \
- -Dcom.sun.management.jdp.name=testme \
- -Djava.rmi.server.hostname=localhost \
- -Dcom.sun.management.jmxremote.port=${_jmxport} \
- -Dcom.sun.management.jmxremote.authenticate=false \
- -Dcom.sun.management.jmxremote.ssl=false
-
- res=`_testme`
-
- case "${res}" in
- OK*)
- _echo "Passed"
- ;;
- *)
- _echo "Failed!"
- ;;
- esac
-
- _app_stop
-}
-
-test_03(){
-
- _echo "**** Test three ****"
-
- _app_start JdpDoSomething
-
- _jcmd ManagementAgent.start\
- jdp.port=${_port} \
- jdp.address=${_ip} \
- jdp.pause=5 \
- jdp.name=jcmdtest \
- jmxremote.port=${_jmxport} \
- jmxremote.authenticate=false \
- jmxremote.ssl=false
-
- res=`_testme`
-
- case "${res}" in
- OK*)
- _echo "Passed"
- ;;
- *)
- _echo "Failed!"
- ;;
- esac
-
- _app_stop
-}
-
-test_04(){
-
- _echo "**** Test four ****"
-
- _app_start JdpDoSomething \
- -Dcom.sun.management.jmxremote.autodiscovery=true \
- -Dcom.sun.management.jdp.name=testme \
- -Djava.rmi.server.hostname=localhost \
- -Dcom.sun.management.jmxremote.port=${_jmxport} \
- -Dcom.sun.management.jmxremote.authenticate=false \
- -Dcom.sun.management.jmxremote.ssl=false
-
- res=`_testme`
-
- case "${res}" in
- OK*)
- _echo "Passed"
- ;;
- *)
- _echo "Failed!"
- ;;
- esac
-
- _app_stop
-}
-
-test_05(){
-
- _echo "**** Test five ****"
-
- _app_start JdpDoSomething
-
- _jcmd ManagementAgent.start\
- jmxremote.autodiscovery=true \
- jmxremote.port=${_jmxport} \
- jmxremote.authenticate=false \
- jmxremote.ssl=false
-
-
- res=`_testme`
-
- case "${res}" in
- OK*)
- _echo "Passed"
- ;;
- *)
- _echo "Failed!"
- ;;
- esac
-
- _app_stop
-}
-
-
-# ============= MAIN =======================================
-
-if [ "x${TESTJAVA}" = "x" ]
-then
- echo "TESTJAVA env have to be set"
- exit
-fi
-
-# COMPILEJAVA variable is set when we test jre
-if [ "x${COMPILEJAVA}" = "x" ]
-then
- COMPILEJAVA="${TESTJAVA}"
-fi
-
-
-#------------------------------------------------------------------------------
-# reading parameters
-
-for parm in "$@"
-do
- case $parm in
- --verbose) _verbose=yes ;;
- --jtreg) _jtreg=yes ;;
- --no-compile) _compile=no ;;
- --testsuite=*) _testsuite=`_echo $parm | sed "s,^--.*=\(.*\),\1,"` ;;
- *)
- echo "Undefined parameter $parm. Try --help for help"
- exit
- ;;
- esac
-done
-
-if [ "${_compile}" = "yes" ]
-then
- _do_compile
-fi
-
-if [ "${_jtreg}" = "yes" ]
-then
- _testclasses=${TESTCLASSES}
- _testsrc=${TESTSRC}
- _logname="output.txt"
-fi
-
-# Make sure _tesclasses is absolute path
-tt=`echo ${_testclasses} | sed -e 's,/,,'`
-if [ "${tt}" = "${_testclasses}" ]
-then
- _testclasses="${_pwd}/${_testclasses}"
-fi
-
-_policyname="${_testclasses}/policy"
-
-rm -f ${_logname}
-rm -f ${_policyname}
-
-if [ -f ${_testsrc}/policy.tpl ]
-then
-
-cat ${_testsrc}/policy.tpl | \
- sed -e "s,@_TESTCLASSES@,${_testclasses},g" -e "s,@TESTJAVA@,${TESTJAVA},g" \
- > ${_policyname}
-
-fi
-
-# Local mode tests
-for i in `echo ${_testsuite} | sed -e "s/,/ /g"`
-do
- test_${i}
-done
--- a/jdk/test/sun/management/jdp/JdpUnitTest.java Thu Oct 09 16:05:24 2014 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.util.UUID;
-
-import sun.management.jdp.JdpController;
-import sun.management.jdp.JdpPacket;
-import sun.management.jdp.JdpJmxPacket;
-import sun.management.jdp.JdpException;
-
-public class JdpUnitTest {
-
-
- static byte[] russian_name = {(byte) 0xd0, (byte) 0xbf, (byte) 0xd1, (byte) 0x80, (byte) 0xd0, (byte) 0xbe, (byte) 0xd0, (byte) 0xb2,
- (byte) 0xd0, (byte) 0xb5, (byte) 0xd1, (byte) 0x80, (byte) 0xd0, (byte) 0xba, (byte) 0xd0, (byte) 0xb0,
- (byte) 0x20, (byte) 0xd1, (byte) 0x81, (byte) 0xd0, (byte) 0xb2, (byte) 0xd1, (byte) 0x8f, (byte) 0xd0,
- (byte) 0xb7, (byte) 0xd0, (byte) 0xb8, (byte) 0x0a};
-
- /**
- * This test tests that complete packet is build correctly
- */
- public static void PacketBuilderTest()
- throws IOException, JdpException {
-
- /* Complete packet test */
- {
- JdpJmxPacket p1 = new JdpJmxPacket(UUID.randomUUID(), "fake://unit-test");
- p1.setMainClass("FakeUnitTest");
- p1.setInstanceName(new String(russian_name, "UTF-8"));
- byte[] b = p1.getPacketData();
-
- JdpJmxPacket p2 = new JdpJmxPacket(b);
- JdpDoSomething.printJdpPacket(p1);
- JdpDoSomething.compaireJdpPacketEx(p1, p2);
- }
-
- /*Missed field packet test*/
- {
- JdpJmxPacket p1 = new JdpJmxPacket(UUID.randomUUID(), "fake://unit-test");
- p1.setMainClass("FakeUnitTest");
- p1.setInstanceName(null);
- byte[] b = p1.getPacketData();
-
- JdpJmxPacket p2 = new JdpJmxPacket(b);
- JdpDoSomething.printJdpPacket(p1);
- JdpDoSomething.compaireJdpPacketEx(p1, p2);
- }
-
- System.out.println("OK: Test passed");
-
- }
-
- public static void startFakeDiscoveryService()
- throws IOException, JdpException {
-
- String discoveryPort = System.getProperty("com.sun.management.jdp.port");
- String discoveryAddress = System.getProperty("com.sun.management.jdp.address");
- InetAddress address = InetAddress.getByName(discoveryAddress);
- int port = Integer.parseInt(discoveryPort);
- JdpController.startDiscoveryService(address, port, "FakeDiscovery", "fake://unit-test");
- }
-
- public static void main(String[] args) {
- try {
- PacketBuilderTest();
- startFakeDiscoveryService();
- JdpDoSomething.doSomething();
-
- } catch (Throwable e) {
- e.printStackTrace();
- System.out.println("Test failed. unexpected error " + e);
- }
- }
-}
--- a/jdk/test/sun/management/jdp/README Thu Oct 09 16:05:24 2014 +0800
+++ b/jdk/test/sun/management/jdp/README Thu Oct 09 06:49:13 2014 -0700
@@ -1,32 +1,4 @@
-The following test were contributed by dmitry.samersoff@oracle.com and will be ported in the near future:
-JdpClient.java
-JdpDoSomething.java
-JdpTest.sh
-JdpUnitTest.java
-
-
-JdpTest.sh:
--------------------------------------
-test_01 - basic test, check if JDP packet assembler and other
- parts of JDP is not broken
-
-test_02 - test if JDP starts with custom parameters. (disabled)
-
-test_03 - test if jcmd is able to start jdp with
- custom parameters (disabled)
-
-test_04 - test if JDP starts with default parameters (disabled)
-
-test_05 - test if jcmd is able to start jdp with default
- parameters (disabled)
-
-Only test_01 is enabled at the moment.
-
-JdpUnitTest.java: contains unit tests used under development.
-
-
-==========================================================================
-The other Java-based tests in this folder are contributed by alex.schenkman@oracle.com
+The tests in this folder are contributed by alex.schenkman@oracle.com
There are three Jdp test cases in this folder:
1) Jdp is turned off.