< prev index next >

test/sun/management/jmxremote/bootstrap/LocalManagementTest.java

Print this page
rev 11832 : 8078896: Add @modules as needed to the jdk_svc tests
Reviewed-by: alanb, mchung
   1 /*
   2  * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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.io.File;
  25 import java.lang.reflect.Method;
  26 import java.lang.reflect.Modifier;
  27 import java.util.ArrayList;
  28 import java.util.List;
  29 import java.util.concurrent.TimeUnit;
  30 import java.util.concurrent.atomic.AtomicReference;
  31 
  32 /**
  33  * @test
  34  * @library /lib/testlibrary
  35  * @bug 5016507 6173612 6319776 6342019 6484550 8004926
  36  * @summary Start a managed VM and test that a management tool can connect
  37  *          without connection or username/password details.
  38  *          TestManager will attempt a connection to the address obtained from
  39  *          both agent properties and jvmstat buffer.

  40  * @build jdk.testlibrary.* TestManager TestApplication
  41  * @run main/othervm/timeout=300 -XX:+UsePerfData LocalManagementTest
  42  */
  43 
  44 import jdk.testlibrary.ProcessTools;
  45 
  46 public class LocalManagementTest {
  47     private static final String TEST_CLASSPATH = System.getProperty("test.class.path");
  48     private static final String TEST_JDK = System.getProperty("test.jdk");
  49 
  50     public static void main(String[] args) throws Exception {
  51         int failures = 0;
  52         for(Method m : LocalManagementTest.class.getDeclaredMethods()) {
  53             if (Modifier.isStatic(m.getModifiers()) &&
  54                 m.getName().startsWith("test")) {
  55                 m.setAccessible(true);
  56                 try {
  57                     System.out.println(m.getName());
  58                     System.out.println("==========");
  59                     Boolean rslt = (Boolean)m.invoke(null);


   1 /*
   2  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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.io.File;
  25 import java.lang.reflect.Method;
  26 import java.lang.reflect.Modifier;
  27 import java.util.ArrayList;
  28 import java.util.List;
  29 import java.util.concurrent.TimeUnit;
  30 import java.util.concurrent.atomic.AtomicReference;
  31 
  32 /**
  33  * @test
  34  * @library /lib/testlibrary
  35  * @bug 5016507 6173612 6319776 6342019 6484550 8004926
  36  * @summary Start a managed VM and test that a management tool can connect
  37  *          without connection or username/password details.
  38  *          TestManager will attempt a connection to the address obtained from
  39  *          both agent properties and jvmstat buffer.
  40  * @modules java.management/sun.management
  41  * @build jdk.testlibrary.* TestManager TestApplication
  42  * @run main/othervm/timeout=300 -XX:+UsePerfData LocalManagementTest
  43  */
  44 
  45 import jdk.testlibrary.ProcessTools;
  46 
  47 public class LocalManagementTest {
  48     private static final String TEST_CLASSPATH = System.getProperty("test.class.path");
  49     private static final String TEST_JDK = System.getProperty("test.jdk");
  50 
  51     public static void main(String[] args) throws Exception {
  52         int failures = 0;
  53         for(Method m : LocalManagementTest.class.getDeclaredMethods()) {
  54             if (Modifier.isStatic(m.getModifiers()) &&
  55                 m.getName().startsWith("test")) {
  56                 m.setAccessible(true);
  57                 try {
  58                     System.out.println(m.getName());
  59                     System.out.println("==========");
  60                     Boolean rslt = (Boolean)m.invoke(null);


< prev index next >