diff --git a/bindings/java/src/org/hyperic/sigar/win32/test/TestPdh.java b/bindings/java/src/org/hyperic/sigar/win32/test/TestPdh.java index 67a9e0c0..d2ce8af9 100644 --- a/bindings/java/src/org/hyperic/sigar/win32/test/TestPdh.java +++ b/bindings/java/src/org/hyperic/sigar/win32/test/TestPdh.java @@ -32,13 +32,45 @@ public class TestPdh extends SigarTestCase { private void getValue(String key) throws Exception { Pdh pdh = new Pdh(); - assertGtEqZeroTrace("raw..." + key, + traceln(key); + assertGtEqZeroTrace("raw", (long)pdh.getRawValue(key)); - assertGtEqZeroTrace("fmt..." + key, + assertGtEqZeroTrace("fmt", (long)pdh.getFormattedValue(key)); } + private String getCounterName(String index) + throws Exception { + + String name = + Pdh.getCounterName(Integer.parseInt(index)); + + return name; + } + + private void getValue(String object, String counter) + throws Exception { + + object = getCounterName(object); + counter = getCounterName(counter); + getValue("\\" + object + "\\" + counter); + } + + //XXX restore original test below when this is handled internally public void testGetValue() throws Exception { + Map counters = Pdh.getEnglishPerflibCounterMap(); + String[][] keys = { + { "Memory", "Available Bytes" }, + { "Memory", "Pages/sec" }, + }; + for (int i=0; i