< prev index next >
application/tests/org.openjdk.jmc.rjmx.test/src/test/java/org/openjdk/jmc/rjmx/test/subscription/JmxOperatingSystemTest.java
Print this page
*** 47,101 ****
@Test
public void testGetCPULoad() {
try {
Object data = getMBeanServerConnection().getAttribute(ConnectionToolkit.OPERATING_SYSTEM_BEAN_NAME,
! "SystemCpuLoad"); //$NON-NLS-1$
double cpuLoad = ((Number) data).doubleValue();
// A negative value is returned if load is not available
! assertMax("CPU Load", 100.0, cpuLoad); //$NON-NLS-1$
! TestToolkit.println("CPU Load: " + cpuLoad); //$NON-NLS-1$
} catch (Exception e) {
fail(e.getMessage());
}
}
@Test
public void testGetCPUJVMLoad() {
try {
Object data = getMBeanServerConnection().getAttribute(ConnectionToolkit.OPERATING_SYSTEM_BEAN_NAME,
! "ProcessCpuLoad"); //$NON-NLS-1$
double jvmLoad = ((Number) data).doubleValue();
// A negative value is returned if load is not available
! assertMax("JVM Load", 100.0, jvmLoad); //$NON-NLS-1$
! TestToolkit.println("JVM Load: " + jvmLoad); //$NON-NLS-1$
} catch (Exception e) {
fail(e.getMessage());
}
}
@Test
public void testGetTotalPhysicalMemory() {
try {
Object data = getMBeanServerConnection().getAttribute(ConnectionToolkit.OPERATING_SYSTEM_BEAN_NAME,
! "TotalPhysicalMemorySize"); //$NON-NLS-1$
long totalPhysicalMemory = ((Number) data).longValue();
! assertMin("TotalPhysicalMemory", 256 * 1024 * 1024L, totalPhysicalMemory); //$NON-NLS-1$
} catch (Exception e) {
fail(e.getMessage());
}
}
@Test
public void testGetUsedPhysicalMemory() {
try {
Object data = getMBeanServerConnection().getAttribute(ConnectionToolkit.OPERATING_SYSTEM_BEAN_NAME,
! "UsedPhysicalMemorySize"); //$NON-NLS-1$
long usedPhysicalMemory = ((Number) data).longValue();
! assertMin("UsedPhysicalMemory", 16 * 1024 * 1024L, usedPhysicalMemory); //$NON-NLS-1$
} catch (Exception e) {
fail(e.getMessage());
}
}
}
--- 47,101 ----
@Test
public void testGetCPULoad() {
try {
Object data = getMBeanServerConnection().getAttribute(ConnectionToolkit.OPERATING_SYSTEM_BEAN_NAME,
! "SystemCpuLoad");
double cpuLoad = ((Number) data).doubleValue();
// A negative value is returned if load is not available
! assertMax("CPU Load", 100.0, cpuLoad);
! TestToolkit.println("CPU Load: " + cpuLoad);
} catch (Exception e) {
fail(e.getMessage());
}
}
@Test
public void testGetCPUJVMLoad() {
try {
Object data = getMBeanServerConnection().getAttribute(ConnectionToolkit.OPERATING_SYSTEM_BEAN_NAME,
! "ProcessCpuLoad");
double jvmLoad = ((Number) data).doubleValue();
// A negative value is returned if load is not available
! assertMax("JVM Load", 100.0, jvmLoad);
! TestToolkit.println("JVM Load: " + jvmLoad);
} catch (Exception e) {
fail(e.getMessage());
}
}
@Test
public void testGetTotalPhysicalMemory() {
try {
Object data = getMBeanServerConnection().getAttribute(ConnectionToolkit.OPERATING_SYSTEM_BEAN_NAME,
! "TotalPhysicalMemorySize");
long totalPhysicalMemory = ((Number) data).longValue();
! assertMin("TotalPhysicalMemory", 256 * 1024 * 1024L, totalPhysicalMemory);
} catch (Exception e) {
fail(e.getMessage());
}
}
@Test
public void testGetUsedPhysicalMemory() {
try {
Object data = getMBeanServerConnection().getAttribute(ConnectionToolkit.OPERATING_SYSTEM_BEAN_NAME,
! "UsedPhysicalMemorySize");
long usedPhysicalMemory = ((Number) data).longValue();
! assertMin("UsedPhysicalMemory", 16 * 1024 * 1024L, usedPhysicalMemory);
} catch (Exception e) {
fail(e.getMessage());
}
}
}
< prev index next >