author | jbachorik |
Mon, 27 Apr 2015 10:13:21 +0200 | |
changeset 30360 | c34ae192d75f |
parent 30359 | b2b7b66cd9eb |
child 30365 | 551470085a1d |
permissions | -rw-r--r-- |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
1 |
/* |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
2 |
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
4 |
* |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
8 |
* |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
13 |
* accompanied this code). |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
14 |
* |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
18 |
* |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
21 |
* questions. |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
22 |
*/ |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
23 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
24 |
import java.io.File; |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
25 |
import java.io.IOException; |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
26 |
import java.lang.reflect.InvocationTargetException; |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
27 |
import java.lang.reflect.Method; |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
28 |
import java.net.BindException; |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
29 |
import java.net.ConnectException; |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
30 |
import java.net.ServerSocket; |
26365
a828828378f6
8057134: sun/management/jmxremote/startstop/JMXStartStopTest.java failing intermittently
jbachorik
parents:
26364
diff
changeset
|
31 |
import java.rmi.RemoteException; |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
32 |
import java.rmi.registry.LocateRegistry; |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
33 |
import java.rmi.registry.Registry; |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
34 |
import java.util.ArrayList; |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
35 |
import java.util.Arrays; |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
36 |
import java.util.List; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
37 |
import java.util.Objects; |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
38 |
import java.util.Set; |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
39 |
import java.util.concurrent.TimeUnit; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
40 |
import java.util.concurrent.TimeoutException; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
41 |
import java.util.concurrent.atomic.AtomicBoolean; |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
42 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
43 |
import javax.management.*; |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
44 |
import javax.management.remote.*; |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
45 |
import javax.net.ssl.SSLHandshakeException; |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
46 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
47 |
import jdk.testlibrary.ProcessTools; |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
48 |
import sun.management.Agent; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
49 |
import sun.management.AgentConfigurationError; |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
50 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
51 |
/** |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
52 |
* @test |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
53 |
* @bug 7110104 |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
54 |
* @library /lib/testlibrary |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
55 |
* @build jdk.testlibrary.* JMXStartStopTest PortAllocator TestApp ManagementAgentJcmd |
26195
64b54ed39429
8040692: [TESTBUG] sun/management/jmxremote/bootstrap/JvmstatCountersTest.java requires -XX:+UsePerfData option to pass on embedded platforms
jbachorik
parents:
25185
diff
changeset
|
56 |
* @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
57 |
* @summary Makes sure that enabling/disabling the management agent through JCMD |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
58 |
* achieves the desired results |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
59 |
*/ |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
60 |
public class JMXStartStopTest { |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
61 |
private static final String TEST_APP_NAME = "TestApp"; |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
62 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
63 |
private static final String TEST_SRC = System.getProperty("test.src"); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
64 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
65 |
private static final boolean verbose = false; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
66 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
67 |
private static ManagementAgentJcmd jcmd = new ManagementAgentJcmd(TEST_APP_NAME, verbose); |
23004
09124a80451a
8035395: sun/management/jmxremote/startstop/JMXStartStopTest.java fails intermittently: Port already in use
jbachorik
parents:
22975
diff
changeset
|
68 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
69 |
private static void dbg_print(String msg) { |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
70 |
if (verbose) { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
71 |
System.out.println("DBG: " + msg); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
72 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
73 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
74 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
75 |
private static int listMBeans(MBeanServerConnection server, |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
76 |
ObjectName pattern, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
77 |
QueryExp query) |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
78 |
throws Exception { |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
79 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
80 |
Set<ObjectName> names = server.queryNames(pattern,query); |
26453 | 81 |
for (ObjectName name : names) { |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
82 |
MBeanInfo info = server.getMBeanInfo(name); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
83 |
dbg_print("Got MBean: " + name); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
84 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
85 |
MBeanAttributeInfo[] attrs = info.getAttributes(); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
86 |
if (attrs == null) |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
87 |
continue; |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
88 |
for (MBeanAttributeInfo attr : attrs) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
89 |
if (attr.isReadable()) { |
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
90 |
server.getAttribute(name, attr.getName()); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
91 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
92 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
93 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
94 |
return names.size(); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
95 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
96 |
|
25182
1f6766bac82c
8048193: [tests] Replace JPS and stdout based PID retrieval by Process.getPid()
jbachorik
parents:
25168
diff
changeset
|
97 |
private static void testConnectLocal(long pid) |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
98 |
throws Exception { |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
99 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
100 |
String jmxUrlStr = null; |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
101 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
102 |
try { |
25182
1f6766bac82c
8048193: [tests] Replace JPS and stdout based PID retrieval by Process.getPid()
jbachorik
parents:
25168
diff
changeset
|
103 |
jmxUrlStr = sun.management.ConnectorAddressLink.importFrom((int)pid); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
104 |
dbg_print("Local Service URL: " +jmxUrlStr); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
105 |
if ( jmxUrlStr == null ) { |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
106 |
throw new Exception("No Service URL. Local agent not started?"); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
107 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
108 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
109 |
JMXServiceURL url = new JMXServiceURL(jmxUrlStr); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
110 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
111 |
JMXConnector c = JMXConnectorFactory.connect(url, null); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
112 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
113 |
MBeanServerConnection conn = c.getMBeanServerConnection(); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
114 |
ObjectName pattern = new ObjectName("java.lang:type=Memory,*"); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
115 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
116 |
int count = listMBeans(conn,pattern,null); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
117 |
if (count == 0) |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
118 |
throw new Exception("Expected at least one matching "+ |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
119 |
"MBean for "+pattern); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
120 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
121 |
} catch (IOException e) { |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
122 |
dbg_print("Cannot find process : " + pid); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
123 |
throw e; |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
124 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
125 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
126 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
127 |
private static void testNoConnect(int port) throws Exception { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
128 |
testNoConnect(port, 0); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
129 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
130 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
131 |
private static void testNoConnect(int port, int rmiPort) throws Exception { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
132 |
try { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
133 |
testConnect(port, rmiPort); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
134 |
throw new Exception("Didn't expect the management agent running"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
135 |
} catch (Exception e) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
136 |
Throwable t = e; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
137 |
while (t != null) { |
26365
a828828378f6
8057134: sun/management/jmxremote/startstop/JMXStartStopTest.java failing intermittently
jbachorik
parents:
26364
diff
changeset
|
138 |
if (t instanceof RemoteException || |
a828828378f6
8057134: sun/management/jmxremote/startstop/JMXStartStopTest.java failing intermittently
jbachorik
parents:
26364
diff
changeset
|
139 |
t instanceof SSLHandshakeException || |
a828828378f6
8057134: sun/management/jmxremote/startstop/JMXStartStopTest.java failing intermittently
jbachorik
parents:
26364
diff
changeset
|
140 |
t instanceof ConnectException) { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
141 |
break; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
142 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
143 |
t = t.getCause(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
144 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
145 |
if (t == null) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
146 |
throw new Exception("Unexpected exception", e); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
147 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
148 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
149 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
150 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
151 |
private static void testConnect(int port) throws Exception { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
152 |
testConnect(port, 0); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
153 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
154 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
155 |
private static void testConnect(int port, int rmiPort) throws Exception { |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
156 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
157 |
dbg_print("RmiRegistry lookup..."); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
158 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
159 |
dbg_print("Using port: " + port); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
160 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
161 |
dbg_print("Using rmi port: " + rmiPort); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
162 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
163 |
Registry registry = LocateRegistry.getRegistry(port); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
164 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
165 |
// "jmxrmi" |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
166 |
String[] relist = registry.list(); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
167 |
for (int i = 0; i < relist.length; ++i) { |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
168 |
dbg_print("Got registry: " + relist[i]); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
169 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
170 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
171 |
String jmxUrlStr = (rmiPort != 0) ? |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
172 |
String.format( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
173 |
"service:jmx:rmi://localhost:%d/jndi/rmi://localhost:%d/jmxrmi", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
174 |
rmiPort, |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
175 |
port) : |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
176 |
String.format( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
177 |
"service:jmx:rmi:///jndi/rmi://localhost:%d/jmxrmi", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
178 |
port); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
179 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
180 |
JMXServiceURL url = new JMXServiceURL(jmxUrlStr); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
181 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
182 |
JMXConnector c = JMXConnectorFactory.connect(url, null); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
183 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
184 |
MBeanServerConnection conn = c.getMBeanServerConnection(); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
185 |
ObjectName pattern = new ObjectName("java.lang:type=Memory,*"); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
186 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
187 |
int count = listMBeans(conn,pattern,null); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
188 |
if (count == 0) |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
189 |
throw new Exception("Expected at least one matching " + |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
190 |
"MBean for " + pattern); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
191 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
192 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
193 |
private static class Failure { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
194 |
private final Throwable cause; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
195 |
private final String msg; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
196 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
197 |
public Failure(Throwable cause, String msg) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
198 |
this.cause = cause; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
199 |
this.msg = msg; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
200 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
201 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
202 |
public Failure(String msg) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
203 |
this(null, msg); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
204 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
205 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
206 |
public Throwable getCause() { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
207 |
return cause; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
208 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
209 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
210 |
public String getMsg() { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
211 |
return msg; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
212 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
213 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
214 |
@Override |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
215 |
public int hashCode() { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
216 |
int hash = 7; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
217 |
hash = 97 * hash + Objects.hashCode(this.cause); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
218 |
hash = 97 * hash + Objects.hashCode(this.msg); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
219 |
return hash; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
220 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
221 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
222 |
@Override |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
223 |
public boolean equals(Object obj) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
224 |
if (obj == null) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
225 |
return false; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
226 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
227 |
if (getClass() != obj.getClass()) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
228 |
return false; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
229 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
230 |
final Failure other = (Failure) obj; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
231 |
if (!Objects.equals(this.cause, other.cause)) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
232 |
return false; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
233 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
234 |
if (!Objects.equals(this.msg, other.msg)) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
235 |
return false; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
236 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
237 |
return true; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
238 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
239 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
240 |
@Override |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
241 |
public String toString() { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
242 |
if (cause != null) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
243 |
return msg + "\n" + cause; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
244 |
} else { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
245 |
return msg; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
246 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
247 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
248 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
249 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
250 |
private static List<Failure> failures = new ArrayList<>(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
251 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
252 |
public static void main(String args[]) throws Exception { |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
253 |
for (Method m : JMXStartStopTest.class.getDeclaredMethods()) { |
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
254 |
if (m.getName().startsWith("test_")) { |
25165
b7751b856cae
8048005: Add test timing information to JMXStartStopTest
jbachorik
parents:
24870
diff
changeset
|
255 |
long t1 = System.currentTimeMillis(); |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
256 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
257 |
boolean retry = false; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
258 |
do { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
259 |
try { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
260 |
m.invoke(null); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
261 |
retry = false; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
262 |
} catch (InvocationTargetException e) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
263 |
if (e.getCause() instanceof BindException || |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
264 |
e.getCause() instanceof java.rmi.ConnectException) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
265 |
System.out.println("Failed to allocate ports. Retrying ..."); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
266 |
retry = true; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
267 |
} else { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
268 |
throw e; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
269 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
270 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
271 |
} while (retry); |
25165
b7751b856cae
8048005: Add test timing information to JMXStartStopTest
jbachorik
parents:
24870
diff
changeset
|
272 |
System.out.println("=== PASSED"); |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
273 |
} catch (Throwable e) { |
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
274 |
failures.add(new Failure(e, m.getName() + " failed")); |
25165
b7751b856cae
8048005: Add test timing information to JMXStartStopTest
jbachorik
parents:
24870
diff
changeset
|
275 |
} finally { |
b7751b856cae
8048005: Add test timing information to JMXStartStopTest
jbachorik
parents:
24870
diff
changeset
|
276 |
System.out.println("(took " + (System.currentTimeMillis() - t1) + "ms)\n"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
277 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
278 |
} |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
279 |
} |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
280 |
|
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
281 |
if (!failures.isEmpty()) { |
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
282 |
for(Failure f : failures) { |
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
283 |
System.err.println(f.getMsg()); |
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
284 |
f.getCause().printStackTrace(System.err); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
285 |
} |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
286 |
throw new Error(); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
287 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
288 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
289 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
290 |
private static class TestAppRun { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
291 |
private Process p; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
292 |
private final ProcessBuilder pb; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
293 |
private final String name; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
294 |
private final AtomicBoolean started = new AtomicBoolean(false); |
25182
1f6766bac82c
8048193: [tests] Replace JPS and stdout based PID retrieval by Process.getPid()
jbachorik
parents:
25168
diff
changeset
|
295 |
private volatile long pid = -1; |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
296 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
297 |
public TestAppRun(ProcessBuilder pb, String name) { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
298 |
this.pb = pb; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
299 |
this.name = name; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
300 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
301 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
302 |
public synchronized void start() throws InterruptedException, IOException, TimeoutException { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
303 |
if (started.compareAndSet(false, true)) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
304 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
305 |
AtomicBoolean error = new AtomicBoolean(false); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
306 |
p = ProcessTools.startProcess( |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
307 |
TEST_APP_NAME + "{" + name + "}", |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
308 |
pb, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
309 |
(line) -> { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
310 |
boolean ok = line.equals("main enter"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
311 |
error.set(line.contains("BindException")); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
312 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
313 |
return ok || error.get(); |
30359
b2b7b66cd9eb
8077402: JMXStartStopTest fails intermittently on slow hosts
jbachorik
parents:
30334
diff
changeset
|
314 |
} |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
315 |
); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
316 |
if (error.get()) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
317 |
throw new BindException("Starting process failed due to " + |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
318 |
"the requested port not being available"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
319 |
} |
25182
1f6766bac82c
8048193: [tests] Replace JPS and stdout based PID retrieval by Process.getPid()
jbachorik
parents:
25168
diff
changeset
|
320 |
pid = p.getPid(); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
321 |
} catch (TimeoutException e) { |
30359
b2b7b66cd9eb
8077402: JMXStartStopTest fails intermittently on slow hosts
jbachorik
parents:
30334
diff
changeset
|
322 |
if (p != null) { |
b2b7b66cd9eb
8077402: JMXStartStopTest fails intermittently on slow hosts
jbachorik
parents:
30334
diff
changeset
|
323 |
p.destroy(); |
b2b7b66cd9eb
8077402: JMXStartStopTest fails intermittently on slow hosts
jbachorik
parents:
30334
diff
changeset
|
324 |
p.waitFor(); |
b2b7b66cd9eb
8077402: JMXStartStopTest fails intermittently on slow hosts
jbachorik
parents:
30334
diff
changeset
|
325 |
} |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
326 |
throw e; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
327 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
328 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
329 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
330 |
|
25182
1f6766bac82c
8048193: [tests] Replace JPS and stdout based PID retrieval by Process.getPid()
jbachorik
parents:
25168
diff
changeset
|
331 |
public long getPid() { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
332 |
return pid; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
333 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
334 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
335 |
public synchronized void stop() |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
336 |
throws IOException, InterruptedException { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
337 |
if (started.compareAndSet(true, false)) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
338 |
p.getOutputStream().write(0); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
339 |
p.getOutputStream().flush(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
340 |
int ec = p.waitFor(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
341 |
if (ec != 0) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
342 |
StringBuilder msg = new StringBuilder(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
343 |
msg.append("Test application '").append(name); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
344 |
msg.append("' failed with exit code: "); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
345 |
msg.append(ec); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
346 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
347 |
failures.add(new Failure(msg.toString())); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
348 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
349 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
350 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
351 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
352 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
353 |
/** |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
354 |
* Runs the test application "TestApp" |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
355 |
* @param name Test run name |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
356 |
* @param args Additional arguments |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
357 |
* @return Returns a {@linkplain TestAppRun} instance representing the run |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
358 |
* @throws IOException |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
359 |
* @throws InterruptedException |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
360 |
* @throws TimeoutException |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
361 |
*/ |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
362 |
private static TestAppRun doTest(String name, String ... args) |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
363 |
throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
364 |
List<String> pbArgs = new ArrayList<>(Arrays.asList( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
365 |
"-cp", |
30360
c34ae192d75f
8076971: sun/management/jmxremote/startstop/JMXStatusTest.java failed with AssertionError
jbachorik
parents:
30359
diff
changeset
|
366 |
System.getProperty("test.class.path"), |
c34ae192d75f
8076971: sun/management/jmxremote/startstop/JMXStatusTest.java failed with AssertionError
jbachorik
parents:
30359
diff
changeset
|
367 |
"-XX:+UsePerfData" |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
368 |
)); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
369 |
pbArgs.addAll(Arrays.asList(args)); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
370 |
pbArgs.add(TEST_APP_NAME); |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
371 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
372 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
373 |
pbArgs.toArray(new String[pbArgs.size()]) |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
374 |
); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
375 |
TestAppRun s = new TestAppRun(pb, name); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
376 |
s.start(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
377 |
return s; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
378 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
379 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
380 |
static void test_01() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
381 |
// Run an app with JMX enabled stop it and |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
382 |
// restart on other port |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
383 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
384 |
System.out.println("**** Test one ****"); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
385 |
int ports[] = PortAllocator.allocatePorts(2); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
386 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
387 |
TestAppRun s = doTest( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
388 |
"test_01", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
389 |
"-Dcom.sun.management.jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
390 |
"-Dcom.sun.management.jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
391 |
"-Dcom.sun.management.jmxremote.ssl=false"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
392 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
393 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
394 |
testConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
395 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
396 |
jcmd.stop(); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
397 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
398 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
399 |
jcmd.start("jmxremote.port=" + ports[1]); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
400 |
testConnect(ports[1]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
401 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
402 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
403 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
404 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
405 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
406 |
static void test_02() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
407 |
// Run an app without JMX enabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
408 |
// start JMX by jcmd |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
409 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
410 |
System.out.println("**** Test two ****"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
411 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
412 |
int[] ports = PortAllocator.allocatePorts(1); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
413 |
TestAppRun s = doTest("test_02"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
414 |
try { |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
415 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
416 |
"jmxremote.port=" + ports[0], |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
417 |
"jmxremote.authenticate=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
418 |
"jmxremote.ssl=false" |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
419 |
); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
420 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
421 |
testConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
422 |
} finally { |
23004
09124a80451a
8035395: sun/management/jmxremote/startstop/JMXStartStopTest.java fails intermittently: Port already in use
jbachorik
parents:
22975
diff
changeset
|
423 |
// debugPortUsage(pa); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
424 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
425 |
} |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
426 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
427 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
428 |
static void test_03() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
429 |
// Run an app without JMX enabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
430 |
// start JMX by jcmd on one port than on other one |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
431 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
432 |
System.out.println("**** Test three ****"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
433 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
434 |
int[] ports = PortAllocator.allocatePorts(2); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
435 |
TestAppRun s = doTest("test_03"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
436 |
try { |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
437 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
438 |
"jmxremote.port=" + ports[0], |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
439 |
"jmxremote.authenticate=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
440 |
"jmxremote.ssl=false" |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
441 |
); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
442 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
443 |
// Second agent shouldn't start |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
444 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
445 |
"jmxremote.port=" + ports[1], |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
446 |
"jmxremote.authenticate=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
447 |
"jmxremote.ssl=false" |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
448 |
); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
449 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
450 |
// First agent should connect |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
451 |
testConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
452 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
453 |
// Second agent should not connect |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
454 |
testNoConnect(ports[1]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
455 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
456 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
457 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
458 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
459 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
460 |
static void test_04() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
461 |
// Run an app without JMX enabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
462 |
// start JMX by jcmd on one port, specify rmi port explicitly |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
463 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
464 |
System.out.println("**** Test four ****"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
465 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
466 |
int[] ports = PortAllocator.allocatePorts(2); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
467 |
TestAppRun s = doTest("test_04"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
468 |
try { |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
469 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
470 |
"jmxremote.port=" + ports[0], |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
471 |
"jmxremote.rmi.port=" + ports[1], |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
472 |
"jmxremote.authenticate=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
473 |
"jmxremote.ssl=false" |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
474 |
); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
475 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
476 |
testConnect(ports[0], ports[1]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
477 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
478 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
479 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
480 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
481 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
482 |
static void test_05() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
483 |
// Run an app without JMX enabled, it will enable local server |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
484 |
// but should leave remote server disabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
485 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
486 |
System.out.println("**** Test five ****"); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
487 |
int[] ports = PortAllocator.allocatePorts(1); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
488 |
TestAppRun s = doTest("test_05"); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
489 |
try { |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
490 |
jcmd.startLocal(); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
491 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
492 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
493 |
testConnectLocal(s.getPid()); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
494 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
495 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
496 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
497 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
498 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
499 |
static void test_06() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
500 |
// Run an app without JMX enabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
501 |
// start JMX by jcmd on one port, specify rmi port explicitly |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
502 |
// attempt to start it again with the same port |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
503 |
// Check for valid messages in the output |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
504 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
505 |
System.out.println("**** Test six ****"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
506 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
507 |
int[] ports = PortAllocator.allocatePorts(2); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
508 |
TestAppRun s = doTest("test_06"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
509 |
try { |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
510 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
511 |
"jmxremote.port=" + ports[0], |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
512 |
"jmxremote.authenticate=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
513 |
"jmxremote.ssl=false" |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
514 |
); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
515 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
516 |
testConnect(ports[0], ports[1]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
517 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
518 |
final AtomicBoolean checks = new AtomicBoolean(false); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
519 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
520 |
line -> { |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
521 |
if (line.contains("java.lang.RuntimeException: Invalid agent state")) { |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
522 |
checks.set(true); |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
523 |
} |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
524 |
}, |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
525 |
"jmxremote.port=" + ports[0], |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
526 |
"jmxremote.authenticate=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
527 |
"jmxremote.ssl=false" |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
528 |
); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
529 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
530 |
if (!checks.get()) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
531 |
throw new Exception("Starting agent on port " + ports[0] + " should " |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
532 |
+ "report an invalid agent state"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
533 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
534 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
535 |
s.stop(); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
536 |
} |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
537 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
538 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
539 |
static void test_07() throws Exception { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
540 |
// Run an app without JMX enabled |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
541 |
// start JMX by jcmd on one port, specify rmi port explicitly |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
542 |
// attempt to start it again with other port |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
543 |
// Check for valid messages in the output |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
544 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
545 |
System.out.println("**** Test seven ****"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
546 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
547 |
int[] ports = PortAllocator.allocatePorts(2); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
548 |
TestAppRun s = doTest("test_07"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
549 |
try { |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
550 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
551 |
"jmxremote.port=" + ports[0], |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
552 |
"jmxremote.authenticate=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
553 |
"jmxremote.ssl=false" |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
554 |
); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
555 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
556 |
testConnect(ports[0], ports[1]); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
557 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
558 |
final AtomicBoolean checks = new AtomicBoolean(false); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
559 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
560 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
561 |
line -> { |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
562 |
if (line.contains("java.lang.RuntimeException: Invalid agent state")) { |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
563 |
checks.set(true); |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
564 |
} |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
565 |
}, |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
566 |
"jmxremote.port=" + ports[1], |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
567 |
"jmxremote.authenticate=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
568 |
"jmxremote.ssl=false" |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
569 |
); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
570 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
571 |
if (!checks.get()) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
572 |
throw new Exception("Starting agent on poprt " + ports[1] + " should " |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
573 |
+ "report an invalid agent state"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
574 |
} |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
575 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
576 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
577 |
} |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
578 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
579 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
580 |
static void test_08() throws Exception { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
581 |
// Run an app without JMX enabled |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
582 |
// start JMX by jcmd on one port, specify rmi port explicitly |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
583 |
// attempt to stop it twice |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
584 |
// Check for valid messages in the output |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
585 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
586 |
System.out.println("**** Test eight ****"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
587 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
588 |
int[] ports = PortAllocator.allocatePorts(2); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
589 |
TestAppRun s = doTest("test_08"); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
590 |
try { |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
591 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
592 |
"jmxremote.port=" + ports[0], |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
593 |
"jmxremote.authenticate=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
594 |
"jmxremote.ssl=false" |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
595 |
); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
596 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
597 |
testConnect(ports[0], ports[1]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
598 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
599 |
jcmd.stop(); |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
600 |
jcmd.stop(); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
601 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
602 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
603 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
604 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
605 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
606 |
static void test_09() throws Exception { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
607 |
// Run an app without JMX enabled |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
608 |
// attempt to start JMX using a non-available port |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
609 |
// Check for valid messages in the output |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
610 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
611 |
System.out.println("**** Test nine ****"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
612 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
613 |
TestAppRun s = doTest("test_09"); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
614 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
615 |
try (ServerSocket ss = new ServerSocket(0)) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
616 |
int localPort = ss.getLocalPort(); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
617 |
int[] ports; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
618 |
do { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
619 |
ports = PortAllocator.allocatePorts(1); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
620 |
} while (localPort == ports[0]); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
621 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
622 |
final AtomicBoolean checks = new AtomicBoolean(false); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
623 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
624 |
int retryCntr = 1; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
625 |
do { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
626 |
final AtomicBoolean retry = new AtomicBoolean(false); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
627 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
628 |
try { |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
629 |
jcmd.start( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
630 |
line -> { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
631 |
if (line.contains(Agent.getText(AgentConfigurationError.AGENT_EXCEPTION))) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
632 |
retry.set(true); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
633 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
634 |
}, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
635 |
"jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
636 |
"jmxremote.rmi.port=" + localPort, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
637 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
638 |
"jmxremote.ssl=false" |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
639 |
); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
640 |
} catch (BindException e) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
641 |
checks.set(true); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
642 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
643 |
if (!retry.get()) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
644 |
break; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
645 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
646 |
System.out.println("Attempt " + retryCntr + " >>>"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
647 |
System.out.println("Unexpected reply from the agent. Retrying in 500ms ..."); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
648 |
Thread.sleep(500); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
649 |
} while (retryCntr++ < 10); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
650 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
651 |
if (!checks.get()) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
652 |
throw new Exception("Starting agent on port " + ports[0] + " should " |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
653 |
+ "report port in use"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
654 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
655 |
} finally { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
656 |
s.stop(); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
657 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
658 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
659 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
660 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
661 |
static void test_10() throws Exception { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
662 |
// Run an app without JMX enabled, but with some properties set |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
663 |
// in command line. |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
664 |
// make sure these properties overridden corectly |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
665 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
666 |
System.out.println("**** Test ten ****"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
667 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
668 |
int[] ports = PortAllocator.allocatePorts(2); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
669 |
TestAppRun s = doTest( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
670 |
"test_10", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
671 |
"-Dcom.sun.management.jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
672 |
"-Dcom.sun.management.jmxremote.ssl=true"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
673 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
674 |
try { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
675 |
testNoConnect(ports[0]); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
676 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
677 |
"jmxremote.port=" + ports[1], |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
678 |
"jmxremote.authenticate=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
679 |
"jmxremote.ssl=false" |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
680 |
); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
681 |
testConnect(ports[1]); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
682 |
} finally { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
683 |
s.stop(); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
684 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
685 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
686 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
687 |
static void test_11() throws Exception { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
688 |
// Run an app with JMX enabled and with some properties set |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
689 |
// in command line. |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
690 |
// stop JMX agent and then start it again with different property values |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
691 |
// make sure these properties overridden corectly |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
692 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
693 |
System.out.println("**** Test eleven ****"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
694 |
int[] ports = PortAllocator.allocatePorts(2); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
695 |
TestAppRun s = doTest( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
696 |
"test_11", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
697 |
"-Dcom.sun.management.jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
698 |
"-Dcom.sun.management.jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
699 |
"-Dcom.sun.management.jmxremote.ssl=true"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
700 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
701 |
try { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
702 |
testNoConnect(ports[0]); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
703 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
704 |
jcmd.stop(); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
705 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
706 |
testNoConnect(ports[0]); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
707 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
708 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
709 |
"jmxremote.port=" + ports[1], |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
710 |
"jmxremote.authenticate=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
711 |
"jmxremote.ssl=false" |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
712 |
); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
713 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
714 |
testConnect(ports[1]); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
715 |
} finally { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
716 |
s.stop(); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
717 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
718 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
719 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
720 |
static void test_12() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
721 |
// Run an app with JMX enabled and with some properties set |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
722 |
// in command line. |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
723 |
// stop JMX agent and then start it again with different property values |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
724 |
// specifing some property in management config file and some of them |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
725 |
// in command line |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
726 |
// make sure these properties overridden corectly |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
727 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
728 |
System.out.println("**** Test twelve ****"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
729 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
730 |
int[] ports = PortAllocator.allocatePorts(2); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
731 |
TestAppRun s = doTest("test_12", |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
732 |
"-Dcom.sun.management.config.file=" |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
733 |
+ TEST_SRC + File.separator + "management_cl.properties", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
734 |
"-Dcom.sun.management.jmxremote.authenticate=false" |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
735 |
); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
736 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
737 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
738 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
739 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
740 |
jcmd.stop(); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
741 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
742 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
743 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
744 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
745 |
"config.file=" + TEST_SRC + File.separator |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
746 |
+ "management_jcmd.properties", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
747 |
"jmxremote.authenticate=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
748 |
"jmxremote.port=" + ports[1] |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
749 |
); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
750 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
751 |
testConnect(ports[1]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
752 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
753 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
754 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
755 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
756 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
757 |
static void test_13() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
758 |
// Run an app with JMX enabled and with some properties set |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
759 |
// in command line. |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
760 |
// stop JMX agent and then start it again with different property values |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
761 |
// stop JMX agent again and then start it without property value |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
762 |
// make sure these properties overridden corectly |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
763 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
764 |
System.out.println("**** Test thirteen ****"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
765 |
int[] ports = PortAllocator.allocatePorts(1); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
766 |
TestAppRun s = doTest( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
767 |
"test_13", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
768 |
"-Dcom.sun.management.jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
769 |
"-Dcom.sun.management.jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
770 |
"-Dcom.sun.management.jmxremote.ssl=true"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
771 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
772 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
773 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
774 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
775 |
jcmd.stop(); |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
776 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
777 |
"jmxremote.ssl=false", |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
778 |
"jmxremote.port=" + ports[0] |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
779 |
); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
780 |
testConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
781 |
|
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
782 |
jcmd.stop(); |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
783 |
jcmd.start( |
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
784 |
"jmxremote.port=" + ports[0] |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
785 |
); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
786 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
787 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
788 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
789 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
790 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
791 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
792 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
793 |
static void test_14() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
794 |
// Run an app with JMX enabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
795 |
// stop remote agent |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
796 |
// make sure local agent is not affected |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
797 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
798 |
System.out.println("**** Test fourteen ****"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
799 |
int[] ports = PortAllocator.allocatePorts(1); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
800 |
TestAppRun s = doTest( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
801 |
"test_14", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
802 |
"-Dcom.sun.management.jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
803 |
"-Dcom.sun.management.jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
804 |
"-Dcom.sun.management.jmxremote.ssl=false"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
805 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
806 |
testConnect(ports[0]); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
807 |
jcmd.stop(); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
808 |
testConnectLocal(s.getPid()); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
809 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
810 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
811 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
812 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
813 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
814 |
static void test_15() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
815 |
// Run an app with JMX disabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
816 |
// start local agent only |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
817 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
818 |
System.out.println("**** Test fifteen ****"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
819 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
820 |
int[] ports = PortAllocator.allocatePorts(1); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
821 |
TestAppRun s = doTest("test_15"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
822 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
823 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
824 |
testNoConnect(ports[0]); |
30334
22a5f09f4da9
8023093: Add ManagementAgent.status diagnostic command
jbachorik
parents:
29605
diff
changeset
|
825 |
jcmd.startLocal(); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
826 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
827 |
testConnectLocal(s.getPid()); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
828 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
829 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
830 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
831 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
832 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
833 |
|
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
834 |
} |