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 /*
25 * @test
26 * @bug 6610094
27 * @summary Test the OperatingSystemMXBean instance returned by
28 * ManagementFactory.getPlatformMXBeans()
29 * @author Mandy Chung
30 *
31 * @modules java.management
32 * jdk.management
33 * @run main PlatformMXBeanTest
34 */
35
36 import java.lang.management.*;
37 import java.util.List;
38
39 public class PlatformMXBeanTest {
40 public static void main(String[] argv) throws Exception {
41 OperatingSystemMXBean osMBean = getOSPlatformMXBean(OperatingSystemMXBean.class);
42
43 // There should have only one single MXBean for the OS MXBean interfaces:
44 // java.lang.management.OperatingSystemMXBean
45 // com.sun.management.OperatingSystemMXBean
46 // com.sun.management.UnixOperatingSystemMXBean
47 if (osMBean != getOSPlatformMXBean(com.sun.management.OperatingSystemMXBean.class)) {
48 throw new RuntimeException(
49 "Invalid com.sun.management.OperatingSystemMXBean instance");
50 }
51
52 if (!System.getProperty("os.name").startsWith("Windows") &&
|
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 /*
25 * @test
26 * @bug 6610094
27 * @summary Test the OperatingSystemMXBean instance returned by
28 * ManagementFactory.getPlatformMXBeans()
29 * @author Mandy Chung
30 *
31 * @modules java.management
32 * jdk.management
33 *
34 * @run main PlatformMXBeanTest
35 */
36
37 import java.lang.management.*;
38 import java.util.List;
39
40 public class PlatformMXBeanTest {
41 public static void main(String[] argv) throws Exception {
42 OperatingSystemMXBean osMBean = getOSPlatformMXBean(OperatingSystemMXBean.class);
43
44 // There should have only one single MXBean for the OS MXBean interfaces:
45 // java.lang.management.OperatingSystemMXBean
46 // com.sun.management.OperatingSystemMXBean
47 // com.sun.management.UnixOperatingSystemMXBean
48 if (osMBean != getOSPlatformMXBean(com.sun.management.OperatingSystemMXBean.class)) {
49 throw new RuntimeException(
50 "Invalid com.sun.management.OperatingSystemMXBean instance");
51 }
52
53 if (!System.getProperty("os.name").startsWith("Windows") &&
|