12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.net.BindException;
25 import java.util.ArrayList;
26 import java.util.List;
27 import java.util.function.Predicate;
28 import java.util.regex.Pattern;
29 import org.testng.annotations.*;
30 import static org.testng.Assert.*;
31
32 import jdk.testlibrary.ProcessTools;
33
34 /**
35 * @test
36 * @bug 8023093 8138748 8142398
37 * @summary Performs a sanity test for the ManagementAgent.status diagnostic command.
38 * Management agent may be disabled, started (only local connections) and started.
39 * The test asserts that the expected text is being printed.
40 *
41 * @library /lib/testlibrary
42 *
43 * @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
44 * JMXStatusTest JMXStatus1Test JMXStatus2Test
45 * @run testng/othervm -XX:+UsePerfData JMXStatus1Test
46 * @run testng/othervm -XX:+UsePerfData JMXStatus2Test
47 */
48 abstract public class JMXStatusTest {
49 private final static String TEST_APP_NAME = "TestApp";
50
51 protected final static Pattern DISABLED_AGENT_STATUS = Pattern.compile(
52 "Agent\\s*\\: disabled$"
53 );
54
55 protected final static Pattern LOCAL_AGENT_STATUS = Pattern.compile(
56 "Agent\\s*\\:\\s*enabled\\n+" +
57 "Connection Type\\s*\\:\\s*local\\n+" +
58 "Protocol\\s*\\:\\s*[a-z]+\\n+" +
59 "Host\\s*\\:\\s*.+\\n+" +
60 "URL\\s*\\:\\s*service\\:jmx\\:.+\\n+" +
61 "Properties\\s*\\:\\n+(\\s*\\S+\\s*=\\s*\\S+(\\s+\\[default\\])?\\n*)+",
|
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.net.BindException;
25 import java.util.ArrayList;
26 import java.util.List;
27 import java.util.function.Predicate;
28 import java.util.regex.Pattern;
29 import org.testng.annotations.*;
30 import static org.testng.Assert.*;
31
32 import jdk.test.lib.process.ProcessTools;
33
34 /**
35 * @test
36 * @bug 8023093 8138748 8142398
37 * @summary Performs a sanity test for the ManagementAgent.status diagnostic command.
38 * Management agent may be disabled, started (only local connections) and started.
39 * The test asserts that the expected text is being printed.
40 *
41 * @library /lib/testlibrary
42 * @library /test/lib
43 *
44 * @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
45 * JMXStatusTest JMXStatus1Test JMXStatus2Test
46 * @run testng/othervm -XX:+UsePerfData JMXStatus1Test
47 * @run testng/othervm -XX:+UsePerfData JMXStatus2Test
48 */
49 abstract public class JMXStatusTest {
50 private final static String TEST_APP_NAME = "TestApp";
51
52 protected final static Pattern DISABLED_AGENT_STATUS = Pattern.compile(
53 "Agent\\s*\\: disabled$"
54 );
55
56 protected final static Pattern LOCAL_AGENT_STATUS = Pattern.compile(
57 "Agent\\s*\\:\\s*enabled\\n+" +
58 "Connection Type\\s*\\:\\s*local\\n+" +
59 "Protocol\\s*\\:\\s*[a-z]+\\n+" +
60 "Host\\s*\\:\\s*.+\\n+" +
61 "URL\\s*\\:\\s*service\\:jmx\\:.+\\n+" +
62 "Properties\\s*\\:\\n+(\\s*\\S+\\s*=\\s*\\S+(\\s+\\[default\\])?\\n*)+",
|