author | jbachorik |
Wed, 11 Mar 2015 15:32:17 +0100 | |
changeset 29605 | ab6b021128a7 |
parent 28860 | 1bd6abc33423 |
child 30334 | 22a5f09f4da9 |
child 30046 | cf2c86e1819e |
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; |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
38 |
import java.util.Random; |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
39 |
import java.util.Set; |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
40 |
import java.util.concurrent.TimeUnit; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
41 |
import java.util.concurrent.TimeoutException; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
42 |
import java.util.concurrent.atomic.AtomicBoolean; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
43 |
import java.util.function.Consumer; |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
44 |
import java.util.stream.Collectors; |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
45 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
46 |
import javax.management.*; |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
47 |
import javax.management.remote.*; |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
48 |
import javax.net.ssl.SSLHandshakeException; |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
49 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
50 |
import jdk.testlibrary.ProcessTools; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
51 |
import jdk.testlibrary.JDKToolLauncher; |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
52 |
import sun.management.Agent; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
53 |
import sun.management.AgentConfigurationError; |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
54 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
55 |
/** |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
56 |
* @test |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
57 |
* @bug 7110104 |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
58 |
* @library /lib/testlibrary |
24509
5d02a6d25f78
8043520: Serviceability tests using @library failing with java.lang.NoClassDefFoundError
ykantser
parents:
24363
diff
changeset
|
59 |
* @build jdk.testlibrary.* JMXStartStopTest JMXStartStopDoSomething |
26195
64b54ed39429
8040692: [TESTBUG] sun/management/jmxremote/bootstrap/JvmstatCountersTest.java requires -XX:+UsePerfData option to pass on embedded platforms
jbachorik
parents:
25185
diff
changeset
|
60 |
* @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
61 |
* @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
|
62 |
* achieves the desired results |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
63 |
*/ |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
64 |
public class JMXStartStopTest { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
65 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
66 |
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
|
67 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
68 |
private static final boolean verbose = false; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
69 |
|
23004
09124a80451a
8035395: sun/management/jmxremote/startstop/JMXStartStopTest.java fails intermittently: Port already in use
jbachorik
parents:
22975
diff
changeset
|
70 |
/** |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
71 |
* Dynamically allocates distinct ports from the ephemeral range 49152-65535 |
23004
09124a80451a
8035395: sun/management/jmxremote/startstop/JMXStartStopTest.java fails intermittently: Port already in use
jbachorik
parents:
22975
diff
changeset
|
72 |
*/ |
09124a80451a
8035395: sun/management/jmxremote/startstop/JMXStartStopTest.java fails intermittently: Port already in use
jbachorik
parents:
22975
diff
changeset
|
73 |
private static class PortAllocator { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
74 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
75 |
private final static int LOWER_BOUND = 49152; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
76 |
private final static int UPPER_BOUND = 65535; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
77 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
78 |
private final static Random RND = new Random(System.currentTimeMillis()); |
23004
09124a80451a
8035395: sun/management/jmxremote/startstop/JMXStartStopTest.java fails intermittently: Port already in use
jbachorik
parents:
22975
diff
changeset
|
79 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
80 |
private static int[] allocatePorts(final int numPorts) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
81 |
int[] ports = new int[numPorts]; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
82 |
for (int i = 0; i < numPorts; i++) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
83 |
int port = -1; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
84 |
while (port == -1) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
85 |
port = RND.nextInt(UPPER_BOUND - LOWER_BOUND + 1) + LOWER_BOUND; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
86 |
for (int j = 0; j < i; j++) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
87 |
if (ports[j] == port) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
88 |
port = -1; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
89 |
break; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
90 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
91 |
} |
23004
09124a80451a
8035395: sun/management/jmxremote/startstop/JMXStartStopTest.java fails intermittently: Port already in use
jbachorik
parents:
22975
diff
changeset
|
92 |
} |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
93 |
ports[i] = port; |
23004
09124a80451a
8035395: sun/management/jmxremote/startstop/JMXStartStopTest.java fails intermittently: Port already in use
jbachorik
parents:
22975
diff
changeset
|
94 |
} |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
95 |
return ports; |
23004
09124a80451a
8035395: sun/management/jmxremote/startstop/JMXStartStopTest.java fails intermittently: Port already in use
jbachorik
parents:
22975
diff
changeset
|
96 |
} |
09124a80451a
8035395: sun/management/jmxremote/startstop/JMXStartStopTest.java fails intermittently: Port already in use
jbachorik
parents:
22975
diff
changeset
|
97 |
} |
09124a80451a
8035395: sun/management/jmxremote/startstop/JMXStartStopTest.java fails intermittently: Port already in use
jbachorik
parents:
22975
diff
changeset
|
98 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
99 |
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
|
100 |
if (verbose) { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
101 |
System.out.println("DBG: " + msg); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
102 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
103 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
104 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
105 |
private static int listMBeans(MBeanServerConnection server, |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
106 |
ObjectName pattern, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
107 |
QueryExp query) |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
108 |
throws Exception { |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
109 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
110 |
Set<ObjectName> names = server.queryNames(pattern,query); |
26453 | 111 |
for (ObjectName name : names) { |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
112 |
MBeanInfo info = server.getMBeanInfo(name); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
113 |
dbg_print("Got MBean: " + name); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
114 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
115 |
MBeanAttributeInfo[] attrs = info.getAttributes(); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
116 |
if (attrs == null) |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
117 |
continue; |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
118 |
for (MBeanAttributeInfo attr : attrs) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
119 |
if (attr.isReadable()) { |
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
120 |
server.getAttribute(name, attr.getName()); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
121 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
122 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
123 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
124 |
return names.size(); |
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 |
|
25182
1f6766bac82c
8048193: [tests] Replace JPS and stdout based PID retrieval by Process.getPid()
jbachorik
parents:
25168
diff
changeset
|
127 |
private static void testConnectLocal(long pid) |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
128 |
throws Exception { |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
129 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
130 |
String jmxUrlStr = null; |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
131 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
132 |
try { |
25182
1f6766bac82c
8048193: [tests] Replace JPS and stdout based PID retrieval by Process.getPid()
jbachorik
parents:
25168
diff
changeset
|
133 |
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
|
134 |
dbg_print("Local Service URL: " +jmxUrlStr); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
135 |
if ( jmxUrlStr == null ) { |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
136 |
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
|
137 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
138 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
139 |
JMXServiceURL url = new JMXServiceURL(jmxUrlStr); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
140 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
141 |
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
|
142 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
143 |
MBeanServerConnection conn = c.getMBeanServerConnection(); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
144 |
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
|
145 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
146 |
int count = listMBeans(conn,pattern,null); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
147 |
if (count == 0) |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
148 |
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
|
149 |
"MBean for "+pattern); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
150 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
151 |
} catch (IOException e) { |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
152 |
dbg_print("Cannot find process : " + pid); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
153 |
throw e; |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
154 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
155 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
156 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
157 |
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
|
158 |
testNoConnect(port, 0); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
159 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
160 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
161 |
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
|
162 |
try { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
163 |
testConnect(port, rmiPort); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
164 |
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
|
165 |
} catch (Exception e) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
166 |
Throwable t = e; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
167 |
while (t != null) { |
26365
a828828378f6
8057134: sun/management/jmxremote/startstop/JMXStartStopTest.java failing intermittently
jbachorik
parents:
26364
diff
changeset
|
168 |
if (t instanceof RemoteException || |
a828828378f6
8057134: sun/management/jmxremote/startstop/JMXStartStopTest.java failing intermittently
jbachorik
parents:
26364
diff
changeset
|
169 |
t instanceof SSLHandshakeException || |
a828828378f6
8057134: sun/management/jmxremote/startstop/JMXStartStopTest.java failing intermittently
jbachorik
parents:
26364
diff
changeset
|
170 |
t instanceof ConnectException) { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
171 |
break; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
172 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
173 |
t = t.getCause(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
174 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
175 |
if (t == null) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
176 |
throw new Exception("Unexpected exception", e); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
177 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
178 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
179 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
180 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
181 |
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
|
182 |
testConnect(port, 0); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
183 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
184 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
185 |
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
|
186 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
187 |
dbg_print("RmiRegistry lookup..."); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
188 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
189 |
dbg_print("Using port: " + port); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
190 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
191 |
dbg_print("Using rmi port: " + rmiPort); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
192 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
193 |
Registry registry = LocateRegistry.getRegistry(port); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
194 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
195 |
// "jmxrmi" |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
196 |
String[] relist = registry.list(); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
197 |
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
|
198 |
dbg_print("Got registry: " + relist[i]); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
199 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
200 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
201 |
String jmxUrlStr = (rmiPort != 0) ? |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
202 |
String.format( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
203 |
"service:jmx:rmi://localhost:%d/jndi/rmi://localhost:%d/jmxrmi", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
204 |
rmiPort, |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
205 |
port) : |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
206 |
String.format( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
207 |
"service:jmx:rmi:///jndi/rmi://localhost:%d/jmxrmi", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
208 |
port); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
209 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
210 |
JMXServiceURL url = new JMXServiceURL(jmxUrlStr); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
211 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
212 |
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
|
213 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
214 |
MBeanServerConnection conn = c.getMBeanServerConnection(); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
215 |
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
|
216 |
|
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
217 |
int count = listMBeans(conn,pattern,null); |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
218 |
if (count == 0) |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
219 |
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
|
220 |
"MBean for " + pattern); |
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 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
223 |
private static class Failure { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
224 |
private final Throwable cause; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
225 |
private final String msg; |
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 |
public Failure(Throwable cause, String msg) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
228 |
this.cause = cause; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
229 |
this.msg = msg; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
230 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
231 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
232 |
public Failure(String msg) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
233 |
this(null, msg); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
234 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
235 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
236 |
public Throwable getCause() { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
237 |
return cause; |
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 |
public String getMsg() { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
241 |
return msg; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
242 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
243 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
244 |
@Override |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
245 |
public int hashCode() { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
246 |
int hash = 7; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
247 |
hash = 97 * hash + Objects.hashCode(this.cause); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
248 |
hash = 97 * hash + Objects.hashCode(this.msg); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
249 |
return hash; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
250 |
} |
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 |
@Override |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
253 |
public boolean equals(Object obj) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
254 |
if (obj == null) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
255 |
return false; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
256 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
257 |
if (getClass() != obj.getClass()) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
258 |
return false; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
259 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
260 |
final Failure other = (Failure) obj; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
261 |
if (!Objects.equals(this.cause, other.cause)) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
262 |
return false; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
263 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
264 |
if (!Objects.equals(this.msg, other.msg)) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
265 |
return false; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
266 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
267 |
return true; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
268 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
269 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
270 |
@Override |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
271 |
public String toString() { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
272 |
if (cause != null) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
273 |
return msg + "\n" + cause; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
274 |
} else { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
275 |
return msg; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
276 |
} |
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 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
279 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
280 |
private static List<Failure> failures = new ArrayList<>(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
281 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
282 |
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
|
283 |
for (Method m : JMXStartStopTest.class.getDeclaredMethods()) { |
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
284 |
if (m.getName().startsWith("test_")) { |
25165
b7751b856cae
8048005: Add test timing information to JMXStartStopTest
jbachorik
parents:
24870
diff
changeset
|
285 |
long t1 = System.currentTimeMillis(); |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
286 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
287 |
boolean retry = false; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
288 |
do { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
289 |
try { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
290 |
m.invoke(null); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
291 |
retry = false; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
292 |
} catch (InvocationTargetException e) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
293 |
if (e.getCause() instanceof BindException || |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
294 |
e.getCause() instanceof java.rmi.ConnectException) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
295 |
System.out.println("Failed to allocate ports. Retrying ..."); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
296 |
retry = true; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
297 |
} else { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
298 |
throw e; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
299 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
300 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
301 |
} while (retry); |
25165
b7751b856cae
8048005: Add test timing information to JMXStartStopTest
jbachorik
parents:
24870
diff
changeset
|
302 |
System.out.println("=== PASSED"); |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
303 |
} catch (Throwable e) { |
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
304 |
failures.add(new Failure(e, m.getName() + " failed")); |
25165
b7751b856cae
8048005: Add test timing information to JMXStartStopTest
jbachorik
parents:
24870
diff
changeset
|
305 |
} finally { |
b7751b856cae
8048005: Add test timing information to JMXStartStopTest
jbachorik
parents:
24870
diff
changeset
|
306 |
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
|
307 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
308 |
} |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
309 |
} |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
310 |
|
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
311 |
if (!failures.isEmpty()) { |
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
312 |
for(Failure f : failures) { |
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
313 |
System.err.println(f.getMsg()); |
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
314 |
f.getCause().printStackTrace(System.err); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
315 |
} |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
316 |
throw new Error(); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
317 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
318 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
319 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
320 |
private static class Something { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
321 |
private Process p; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
322 |
private final ProcessBuilder pb; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
323 |
private final String name; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
324 |
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
|
325 |
private volatile long pid = -1; |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
326 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
327 |
public Something(ProcessBuilder pb, String name) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
328 |
this.pb = pb; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
329 |
this.name = name; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
330 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
331 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
332 |
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
|
333 |
if (started.compareAndSet(false, true)) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
334 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
335 |
AtomicBoolean error = new AtomicBoolean(false); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
336 |
p = ProcessTools.startProcess( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
337 |
"JMXStartStopDoSomething{" + name + "}", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
338 |
pb, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
339 |
(line) -> { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
340 |
boolean ok = line.equals("main enter"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
341 |
error.set(line.contains("BindException")); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
342 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
343 |
return ok || error.get(); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
344 |
}, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
345 |
5, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
346 |
TimeUnit.SECONDS |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
347 |
); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
348 |
if (error.get()) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
349 |
throw new BindException("Starting process failed due to " + |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
350 |
"the requested port not being available"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
351 |
} |
25182
1f6766bac82c
8048193: [tests] Replace JPS and stdout based PID retrieval by Process.getPid()
jbachorik
parents:
25168
diff
changeset
|
352 |
pid = p.getPid(); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
353 |
} catch (TimeoutException e) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
354 |
p.destroy(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
355 |
p.waitFor(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
356 |
throw e; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
357 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
358 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
359 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
360 |
|
25182
1f6766bac82c
8048193: [tests] Replace JPS and stdout based PID retrieval by Process.getPid()
jbachorik
parents:
25168
diff
changeset
|
361 |
public long getPid() { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
362 |
return pid; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
363 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
364 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
365 |
public synchronized void stop() |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
366 |
throws IOException, InterruptedException { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
367 |
if (started.compareAndSet(true, false)) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
368 |
p.getOutputStream().write(0); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
369 |
p.getOutputStream().flush(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
370 |
int ec = p.waitFor(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
371 |
if (ec != 0) { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
372 |
StringBuilder msg = new StringBuilder(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
373 |
msg.append("Test application '").append(name); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
374 |
msg.append("' failed with exit code: "); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
375 |
msg.append(ec); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
376 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
377 |
failures.add(new Failure(msg.toString())); |
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 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
380 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
381 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
382 |
|
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 |
* Runs the test application "JMXStartStopDoSomething" |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
385 |
* @param name Test run name |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
386 |
* @param args Additional arguments |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
387 |
* @return Returns a {@linkplain Something} instance representing the run |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
388 |
* @throws IOException |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
389 |
* @throws InterruptedException |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
390 |
* @throws TimeoutException |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
391 |
*/ |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
392 |
private static Something doSomething(String name, String ... args) |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
393 |
throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
394 |
List<String> pbArgs = new ArrayList<>(Arrays.asList( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
395 |
"-cp", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
396 |
System.getProperty("test.class.path") |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
397 |
)); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
398 |
pbArgs.addAll(Arrays.asList(args)); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
399 |
pbArgs.add("JMXStartStopDoSomething"); |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
400 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
401 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
402 |
pbArgs.toArray(new String[pbArgs.size()]) |
22349
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 |
Something s = new Something(pb, name); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
405 |
s.start(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
406 |
return s; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
407 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
408 |
|
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 |
* Run the "jcmd" command |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
411 |
* |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
412 |
* @param command Command with parameters; space separated string |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
413 |
* @throws IOException |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
414 |
* @throws InterruptedException |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
415 |
*/ |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
416 |
private static void jcmd(String ... command) throws IOException, InterruptedException { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
417 |
if (command.length == 0) { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
418 |
jcmd(null, c->{}); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
419 |
} else { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
420 |
jcmd(null, command); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
421 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
422 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
423 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
424 |
/** |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
425 |
* Run the "jcmd" command |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
426 |
* |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
427 |
* @param c {@linkplain Consumer} instance |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
428 |
* @param command Command with parameters; space separated string |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
429 |
* @throws IOException |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
430 |
* @throws InterruptedException |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
431 |
*/ |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
432 |
private static void jcmd(Consumer<String> c, String ... command) throws IOException, InterruptedException { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
433 |
jcmd("JMXStartStopDoSomething", c, command); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
434 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
435 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
436 |
/** |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
437 |
* Run the "jcmd" command |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
438 |
* |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
439 |
* @param target The target application name (or PID) |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
440 |
* @param c {@linkplain Consumer} instance |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
441 |
* @param command Command with parameters; space separated string |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
442 |
* @throws IOException |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
443 |
* @throws InterruptedException |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
444 |
*/ |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
445 |
private static void jcmd(String target, final Consumer<String> c, String ... command) throws IOException, InterruptedException { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
446 |
dbg_print("[jcmd] " + (command.length > 0 ? command[0] : "list")); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
447 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
448 |
JDKToolLauncher l = JDKToolLauncher.createUsingTestJDK("jcmd"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
449 |
l.addToolArg(target); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
450 |
for (String cmd : command) { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
451 |
l.addToolArg(cmd); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
452 |
} |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
453 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
454 |
AtomicBoolean portUnavailable = new AtomicBoolean(false); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
455 |
Process p = ProcessTools.startProcess( |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
456 |
"jcmd", |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
457 |
new ProcessBuilder(l.getCommand()), |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
458 |
line -> { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
459 |
if (line.contains("BindException") || |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
460 |
line.contains(Agent.getText(AgentConfigurationError.CONNECTOR_SERVER_IO_ERROR))) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
461 |
portUnavailable.set(true); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
462 |
} else { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
463 |
c.accept(line); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
464 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
465 |
} |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
466 |
); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
467 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
468 |
p.waitFor(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
469 |
dbg_print("[jcmd] --------"); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
470 |
if (portUnavailable.get()) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
471 |
String cmd = Arrays.asList(l.getCommand()).stream() |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
472 |
.collect( |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
473 |
Collectors.joining(" ", "", ": Unable to bind address") |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
474 |
); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
475 |
throw new BindException(cmd); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
476 |
} |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
477 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
478 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
479 |
private static final String CMD_STOP = "ManagementAgent.stop"; |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
480 |
private static final String CMD_START = "ManagementAgent.start"; |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
481 |
private static final String CMD_START_LOCAL = "ManagementAgent.start_local"; |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
482 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
483 |
static void test_01() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
484 |
// 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
|
485 |
// restart on other port |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
486 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
487 |
System.out.println("**** Test one ****"); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
488 |
int ports[] = PortAllocator.allocatePorts(2); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
489 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
490 |
Something s = doSomething( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
491 |
"test_01", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
492 |
"-Dcom.sun.management.jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
493 |
"-Dcom.sun.management.jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
494 |
"-Dcom.sun.management.jmxremote.ssl=false"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
495 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
496 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
497 |
testConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
498 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
499 |
jcmd(CMD_STOP); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
500 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
501 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
502 |
jcmd(CMD_START, "jmxremote.port=" + ports[1]); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
503 |
testConnect(ports[1]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
504 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
505 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
506 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
507 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
508 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
509 |
static void test_02() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
510 |
// Run an app without JMX enabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
511 |
// start JMX by jcmd |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
512 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
513 |
System.out.println("**** Test two ****"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
514 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
515 |
int[] ports = PortAllocator.allocatePorts(1); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
516 |
Something s = doSomething("test_02"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
517 |
try { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
518 |
jcmd(CMD_START, |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
519 |
"jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
520 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
521 |
"jmxremote.ssl=false"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
522 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
523 |
testConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
524 |
} finally { |
23004
09124a80451a
8035395: sun/management/jmxremote/startstop/JMXStartStopTest.java fails intermittently: Port already in use
jbachorik
parents:
22975
diff
changeset
|
525 |
// debugPortUsage(pa); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
526 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
527 |
} |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
528 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
529 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
530 |
static void test_03() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
531 |
// Run an app without JMX enabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
532 |
// 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
|
533 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
534 |
System.out.println("**** Test three ****"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
535 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
536 |
int[] ports = PortAllocator.allocatePorts(2); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
537 |
Something s = doSomething("test_03"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
538 |
try { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
539 |
jcmd(CMD_START, |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
540 |
"jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
541 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
542 |
"jmxremote.ssl=false"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
543 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
544 |
// Second agent shouldn't start |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
545 |
jcmd(CMD_START, |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
546 |
"jmxremote.port=" + ports[1], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
547 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
548 |
"jmxremote.ssl=false"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
549 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
550 |
// First agent should connect |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
551 |
testConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
552 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
553 |
// Second agent should not connect |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
554 |
testNoConnect(ports[1]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
555 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
556 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
557 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
558 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
559 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
560 |
static void test_04() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
561 |
// Run an app without JMX enabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
562 |
// 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
|
563 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
564 |
System.out.println("**** Test four ****"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
565 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
566 |
int[] ports = PortAllocator.allocatePorts(2); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
567 |
Something s = doSomething("test_04"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
568 |
try { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
569 |
jcmd(CMD_START, |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
570 |
"jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
571 |
"jmxremote.rmi.port=" + ports[1], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
572 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
573 |
"jmxremote.ssl=false"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
574 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
575 |
testConnect(ports[0], ports[1]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
576 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
577 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
578 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
579 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
580 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
581 |
static void test_05() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
582 |
// 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
|
583 |
// but should leave remote server disabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
584 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
585 |
System.out.println("**** Test five ****"); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
586 |
int[] ports = PortAllocator.allocatePorts(1); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
587 |
Something s = doSomething("test_05"); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
588 |
try { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
589 |
jcmd(CMD_START_LOCAL); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
590 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
591 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
592 |
testConnectLocal(s.getPid()); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
593 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
594 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
595 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
596 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
597 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
598 |
static void test_06() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
599 |
// Run an app without JMX enabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
600 |
// 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
|
601 |
// 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
|
602 |
// Check for valid messages in the output |
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 |
System.out.println("**** Test six ****"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
605 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
606 |
int[] ports = PortAllocator.allocatePorts(2); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
607 |
Something s = doSomething("test_06"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
608 |
try { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
609 |
jcmd(CMD_START, |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
610 |
"jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
611 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
612 |
"jmxremote.ssl=false"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
613 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
614 |
testConnect(ports[0], ports[1]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
615 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
616 |
final AtomicBoolean checks = new AtomicBoolean(false); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
617 |
jcmd( |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
618 |
line -> { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
619 |
if (line.contains("java.lang.RuntimeException: Invalid agent state")) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
620 |
checks.set(true); |
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 |
}, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
623 |
CMD_START, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
624 |
"jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
625 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
626 |
"jmxremote.ssl=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 |
if (!checks.get()) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
629 |
throw new Exception("Starting agent on port " + ports[0] + " should " |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
630 |
+ "report an invalid agent state"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
631 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
632 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
633 |
s.stop(); |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
634 |
} |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
635 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
636 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
637 |
static void test_07() throws Exception { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
638 |
// Run an app without JMX enabled |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
639 |
// 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
|
640 |
// attempt to start it again with other port |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
641 |
// 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
|
642 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
643 |
System.out.println("**** Test seven ****"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
644 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
645 |
int[] ports = PortAllocator.allocatePorts(2); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
646 |
Something s = doSomething("test_07"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
647 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
648 |
jcmd(CMD_START, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
649 |
"jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
650 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
651 |
"jmxremote.ssl=false"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
652 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
653 |
testConnect(ports[0], ports[1]); |
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 |
final AtomicBoolean checks = new AtomicBoolean(false); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
656 |
|
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
657 |
jcmd( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
658 |
line -> { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
659 |
if (line.contains("java.lang.RuntimeException: Invalid agent state")) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
660 |
checks.set(true); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
661 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
662 |
}, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
663 |
CMD_START, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
664 |
"jmxremote.port=" + ports[1], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
665 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
666 |
"jmxremote.ssl=false"); |
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 |
if (!checks.get()) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
669 |
throw new Exception("Starting agent on poprt " + ports[1] + " should " |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
670 |
+ "report an invalid agent state"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
671 |
} |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
672 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
673 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
674 |
} |
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
675 |
} |
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
676 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
677 |
static void test_08() throws Exception { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
678 |
// Run an app without JMX enabled |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
679 |
// 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
|
680 |
// attempt to stop it twice |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
681 |
// 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
|
682 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
683 |
System.out.println("**** Test eight ****"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
684 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
685 |
int[] ports = PortAllocator.allocatePorts(2); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
686 |
Something s = doSomething("test_08"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
687 |
try { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
688 |
jcmd(CMD_START, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
689 |
"jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
690 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
691 |
"jmxremote.ssl=false"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
692 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
693 |
testConnect(ports[0], ports[1]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
694 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
695 |
jcmd(CMD_STOP); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
696 |
jcmd(CMD_STOP); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
697 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
698 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
699 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
700 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
701 |
|
24870
5d567113d043
8044135: Add API to start JMX agent from attach framework
sla
parents:
24509
diff
changeset
|
702 |
static void test_09() throws Exception { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
703 |
// Run an app without JMX enabled |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
704 |
// attempt to start JMX using a non-available port |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
705 |
// Check for valid messages in the output |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
706 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
707 |
System.out.println("**** Test nine ****"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
708 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
709 |
Something s = doSomething("test_09"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
710 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
711 |
try (ServerSocket ss = new ServerSocket(0)) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
712 |
int localPort = ss.getLocalPort(); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
713 |
int[] ports; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
714 |
do { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
715 |
ports = PortAllocator.allocatePorts(1); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
716 |
} while (localPort == ports[0]); |
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 |
final AtomicBoolean checks = new AtomicBoolean(false); |
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 |
int retryCntr = 1; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
721 |
do { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
722 |
final AtomicBoolean retry = new AtomicBoolean(false); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
723 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
724 |
try { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
725 |
jcmd( |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
726 |
line -> { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
727 |
if (line.contains(Agent.getText(AgentConfigurationError.AGENT_EXCEPTION))) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
728 |
retry.set(true); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
729 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
730 |
}, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
731 |
CMD_START, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
732 |
"jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
733 |
"jmxremote.rmi.port=" + localPort, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
734 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
735 |
"jmxremote.ssl=false" |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
736 |
); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
737 |
} catch (BindException e) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
738 |
checks.set(true); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
739 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
740 |
if (!retry.get()) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
741 |
break; |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
742 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
743 |
System.out.println("Attempt " + retryCntr + " >>>"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
744 |
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
|
745 |
Thread.sleep(500); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
746 |
} while (retryCntr++ < 10); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
747 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
748 |
if (!checks.get()) { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
749 |
throw new Exception("Starting agent on port " + ports[0] + " should " |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
750 |
+ "report port in use"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
751 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
752 |
} finally { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
753 |
s.stop(); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
754 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
755 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
756 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
757 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
758 |
static void test_10() throws Exception { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
759 |
// 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
|
760 |
// in command line. |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
761 |
// make sure these properties overridden corectly |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
762 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
763 |
System.out.println("**** Test ten ****"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
764 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
765 |
int[] ports = PortAllocator.allocatePorts(2); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
766 |
Something s = doSomething( |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
767 |
"test_10", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
768 |
"-Dcom.sun.management.jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
769 |
"-Dcom.sun.management.jmxremote.ssl=true"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
770 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
771 |
try { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
772 |
testNoConnect(ports[0]); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
773 |
jcmd( |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
774 |
CMD_START, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
775 |
"jmxremote.port=" + ports[1], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
776 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
777 |
"jmxremote.ssl=false" |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
778 |
); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
779 |
testConnect(ports[1]); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
780 |
} finally { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
781 |
s.stop(); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
782 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
783 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
784 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
785 |
static void test_11() throws Exception { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
786 |
// 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
|
787 |
// in command line. |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
788 |
// 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
|
789 |
// make sure these properties overridden corectly |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
790 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
791 |
System.out.println("**** Test eleven ****"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
792 |
int[] ports = PortAllocator.allocatePorts(2); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
793 |
Something s = doSomething( |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
794 |
"test_11", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
795 |
"-Dcom.sun.management.jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
796 |
"-Dcom.sun.management.jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
797 |
"-Dcom.sun.management.jmxremote.ssl=true"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
798 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
799 |
try { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
800 |
testNoConnect(ports[0]); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
801 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
802 |
jcmd(CMD_STOP); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
803 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
804 |
testNoConnect(ports[0]); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
805 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
806 |
jcmd( |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
807 |
CMD_START, |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
808 |
"jmxremote.port=" + ports[1], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
809 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
810 |
"jmxremote.ssl=false" |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
811 |
); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
812 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
813 |
testConnect(ports[1]); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
814 |
} finally { |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
815 |
s.stop(); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
816 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
817 |
} |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
818 |
|
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
819 |
static void test_12() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
820 |
// 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
|
821 |
// in command line. |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
822 |
// 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
|
823 |
// 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
|
824 |
// in command line |
22975
1a8002758a3d
8034177: sun/management/jmxremote/startstop/JMXStartStopTest.java should report port in use
jbachorik
parents:
22349
diff
changeset
|
825 |
// make sure these properties overridden corectly |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
826 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
827 |
System.out.println("**** Test twelve ****"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
828 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
829 |
int[] ports = PortAllocator.allocatePorts(2); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
830 |
Something s = doSomething("test_12", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
831 |
"-Dcom.sun.management.config.file=" |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
832 |
+ TEST_SRC + File.separator + "management_cl.properties", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
833 |
"-Dcom.sun.management.jmxremote.authenticate=false" |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
834 |
); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
835 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
836 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
837 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
838 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
839 |
jcmd(CMD_STOP); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
840 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
841 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
842 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
843 |
jcmd(CMD_START, |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
844 |
"config.file=" + TEST_SRC + File.separator |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
845 |
+ "management_jcmd.properties", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
846 |
"jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
847 |
"jmxremote.port=" + ports[1] |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
848 |
); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
849 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
850 |
testConnect(ports[1]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
851 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
852 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
853 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
854 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
855 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
856 |
static void test_13() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
857 |
// 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
|
858 |
// in command line. |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
859 |
// 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
|
860 |
// 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
|
861 |
// make sure these properties overridden corectly |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
862 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
863 |
System.out.println("**** Test thirteen ****"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
864 |
int[] ports = PortAllocator.allocatePorts(1); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
865 |
Something s = doSomething( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
866 |
"test_13", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
867 |
"-Dcom.sun.management.jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
868 |
"-Dcom.sun.management.jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
869 |
"-Dcom.sun.management.jmxremote.ssl=true"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
870 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
871 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
872 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
873 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
874 |
jcmd(CMD_STOP); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
875 |
jcmd(CMD_START, |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
876 |
"jmxremote.ssl=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
877 |
"jmxremote.port=" + ports[0] |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
878 |
); |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
879 |
testConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
880 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
881 |
jcmd(CMD_STOP); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
882 |
jcmd(CMD_START, |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
883 |
"jmxremote.port=" + ports[0] |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
884 |
); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
885 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
886 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
887 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
888 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
889 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
890 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
891 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
892 |
static void test_14() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
893 |
// Run an app with JMX enabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
894 |
// stop remote agent |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
895 |
// make sure local agent is not affected |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
896 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
897 |
System.out.println("**** Test fourteen ****"); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
898 |
int[] ports = PortAllocator.allocatePorts(1); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
899 |
Something s = doSomething( |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
900 |
"test_14", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
901 |
"-Dcom.sun.management.jmxremote.port=" + ports[0], |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
902 |
"-Dcom.sun.management.jmxremote.authenticate=false", |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
903 |
"-Dcom.sun.management.jmxremote.ssl=false"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
904 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
905 |
testConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
906 |
jcmd(CMD_STOP); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
907 |
testConnectLocal(s.getPid()); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
908 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
909 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
910 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
911 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
912 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
913 |
static void test_15() throws Exception { |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
914 |
// Run an app with JMX disabled |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
915 |
// start local agent only |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
916 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
917 |
System.out.println("**** Test fifteen ****"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
918 |
|
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
919 |
int[] ports = PortAllocator.allocatePorts(1); |
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
920 |
Something s = doSomething("test_15"); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
921 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
922 |
try { |
28860
1bd6abc33423
8066708: JMXStartStopTest fails to connect to port 38112
jbachorik
parents:
26729
diff
changeset
|
923 |
testNoConnect(ports[0]); |
22349
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
924 |
jcmd(CMD_START + "_local"); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
925 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
926 |
testConnectLocal(s.getPid()); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
927 |
|
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
928 |
} finally { |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
929 |
s.stop(); |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
930 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
931 |
} |
2aa385c1c4d8
8022221: Intermittent test failures in sun/management/jmxremote/startstop/JMXStartStopTest.sh
jbachorik
parents:
14013
diff
changeset
|
932 |
|
11991
800d0ff7b043
7110104: It should be possible to stop and start JMX Agent at runtime
dsamersoff
parents:
diff
changeset
|
933 |
} |