114 System.out.println("Test FAILED! The OOTB management " + |
114 System.out.println("Test FAILED! The OOTB management " + |
115 "agent didnn't publish the remote connector."); |
115 "agent didnn't publish the remote connector."); |
116 throw new IllegalArgumentException("Test case 3 failed"); |
116 throw new IllegalArgumentException("Test case 3 failed"); |
117 } |
117 } |
118 for (String key : remoteData.keySet()) { |
118 for (String key : remoteData.keySet()) { |
119 if (!key.startsWith("sun.management.JMXConnectorServer.0.")) { |
119 if (!isKeyAcceptable(key)) { |
120 System.out.println("Test FAILED! The OOTB management " + |
120 System.out.println("Test FAILED! The OOTB management " + |
121 "agent shouldn't publish anything which isn't " + |
121 "agent shouldn't publish anything which isn't " + |
122 "related to the remote connector."); |
122 "related to the remote connector (" + key + ")."); |
123 throw new IllegalArgumentException("Test case 3 failed"); |
123 throw new IllegalArgumentException("Test case 3 failed"); |
124 } |
124 } |
125 } |
125 } |
126 checkKey(remoteData, 0, "remoteAddress", null); |
126 checkKey(remoteData, 0, "remoteAddress", null); |
127 checkKey(remoteData, 0, "authenticate", "false"); |
127 checkKey(remoteData, 0, "authenticate", "false"); |
163 System.out.println("Test FAILED! The OOTB management " + |
163 System.out.println("Test FAILED! The OOTB management " + |
164 "agent didnn't publish the remote connector."); |
164 "agent didnn't publish the remote connector."); |
165 throw new IllegalArgumentException("Test case 4 failed"); |
165 throw new IllegalArgumentException("Test case 4 failed"); |
166 } |
166 } |
167 for (String key : remoteData2.keySet()) { |
167 for (String key : remoteData2.keySet()) { |
168 if (!key.startsWith("sun.management.JMXConnectorServer.0.")) { |
168 if (!isKeyAcceptable(key)) { |
169 System.out.println("Test FAILED! The OOTB management " + |
169 System.out.println("Test FAILED! The OOTB management " + |
170 "agent shouldn't publish anything which isn't " + |
170 "agent shouldn't publish anything which isn't " + |
171 "related to the remote connector."); |
171 "related to the remote connector (" + key + ")."); |
172 throw new IllegalArgumentException("Test case 4 failed"); |
172 throw new IllegalArgumentException("Test case 4 failed"); |
173 } |
173 } |
174 } |
174 } |
175 checkKey(remoteData2, 0, "remoteAddress", null); |
175 checkKey(remoteData2, 0, "remoteAddress", null); |
176 checkKey(remoteData2, 0, "authenticate", "false"); |
176 checkKey(remoteData2, 0, "authenticate", "false"); |
182 "info through jvmstat counters when the agent is " + |
182 "info through jvmstat counters when the agent is " + |
183 "loaded through the Attach API."); |
183 "loaded through the Attach API."); |
184 } |
184 } |
185 System.out.println("Bye! Bye!"); |
185 System.out.println("Bye! Bye!"); |
186 } |
186 } |
|
187 |
|
188 private static boolean isKeyAcceptable(String key) { |
|
189 return key.startsWith("sun.management.JMXConnectorServer.0.") || |
|
190 key.startsWith("sun.management.JMXConnectorServer.remote.enabled"); |
|
191 } |
187 } |
192 } |