Pdh test adjustments for windows 2000

This commit is contained in:
Doug MacEachern 2009-10-23 14:52:51 -07:00
parent 32040563ce
commit a96bd1bc04
1 changed files with 9 additions and 2 deletions

View File

@ -98,11 +98,11 @@ public class TestPdh extends SigarTestCase {
public void testValidate() {
Object[][] tests = {
{ "\\Does Not\\Exist", new Integer(Pdh.NO_OBJECT) },
{ "\\Does Not\\Exist", new Integer(Pdh.NO_OBJECT), new Integer(Pdh.BAD_COUNTERNAME) },
{ "Does Not Exist", new Integer(Pdh.BAD_COUNTERNAME) },
{ "\\System\\DoesNotExist", new Integer(Pdh.NO_COUNTER) },
{ "\\Processor(666)\\% User Time", new Integer(Pdh.NO_INSTANCE) },
{ "\\System\\Threads", new Integer(Pdh.VALID_DATA) },
{ "\\System\\Threads", new Integer(Pdh.VALID_DATA), new Integer(Pdh.BAD_COUNTERNAME) },
//slow
//{ "\\\\-\\System\\Threads", new Integer(Pdh.NO_MACHINE) },
};
@ -113,6 +113,13 @@ public class TestPdh extends SigarTestCase {
int status = Pdh.validate(path);
boolean expectedResult = (status == expect);
if (!expectedResult) {
if (tests[i].length == 3) {
expect = ((Integer)tests[i][2]).intValue();
expectedResult = (status == expect);
}
}
if (!expectedResult) {
traceln("[validate] " + path + "-->" +
Integer.toHexString(status).toUpperCase() +