tests for recent stuff

This commit is contained in:
Doug MacEachern 2005-07-17 20:09:25 +00:00
parent 3ff4089db1
commit 0410f0e457
5 changed files with 79 additions and 0 deletions

View File

@ -33,6 +33,8 @@ public class SigarTestRunner extends SigarCommandBase {
TestLoadAverage.class, TestLoadAverage.class,
TestMem.class, TestMem.class,
TestNetIf.class, TestNetIf.class,
TestNetInfo.class,
TestNetRoute.class,
TestNetStat.class, TestNetStat.class,
TestProcArgs.class, TestProcArgs.class,
TestProcEnv.class, TestProcEnv.class,
@ -44,9 +46,11 @@ public class SigarTestRunner extends SigarCommandBase {
TestProcState.class, TestProcState.class,
TestProcStat.class, TestProcStat.class,
TestProcTime.class, TestProcTime.class,
TestResourceLimit.class,
TestSwap.class, TestSwap.class,
TestThreadCpu.class, TestThreadCpu.class,
TestUptime.class, TestUptime.class,
TestWho.class,
}; };
private static final Class[] WIN32_TESTS = { private static final Class[] WIN32_TESTS = {

View File

@ -0,0 +1,15 @@
package net.hyperic.sigar.test;
import net.hyperic.sigar.NetInfo;
import net.hyperic.sigar.SigarException;
public class TestNetInfo extends SigarTestCase {
public TestNetInfo(String name) {
super(name);
}
public void testNetInfo() throws SigarException {
NetInfo info = getSigar().getNetInfo();
}
}

View File

@ -0,0 +1,25 @@
package net.hyperic.sigar.test;
import net.hyperic.sigar.NetRoute;
import net.hyperic.sigar.SigarException;
import net.hyperic.sigar.SigarNotImplementedException;
public class TestNetRoute extends SigarTestCase {
public TestNetRoute(String name) {
super(name);
}
public void testNetRoute() throws SigarException {
NetRoute[] routes;
try {
routes = getSigar().getNetRouteList();
} catch (SigarNotImplementedException e) {
return;
}
assertTrue(routes.length > 0);
for (int i=0; i<routes.length; i++) {
NetRoute route = routes[i];
}
}
}

View File

@ -0,0 +1,15 @@
package net.hyperic.sigar.test;
import net.hyperic.sigar.ResourceLimit;
import net.hyperic.sigar.SigarException;
public class TestResourceLimit extends SigarTestCase {
public TestResourceLimit(String name) {
super(name);
}
public void testResourceLimit() throws SigarException {
ResourceLimit limit = getSigar().getResourceLimit();
}
}

View File

@ -0,0 +1,20 @@
package net.hyperic.sigar.test;
import net.hyperic.sigar.OperatingSystem;
import net.hyperic.sigar.SigarException;
import net.hyperic.sigar.Who;
public class TestWho extends SigarTestCase {
public TestWho(String name) {
super(name);
}
public void testWho() throws SigarException {
if (OperatingSystem.IS_WIN32) {
return;
}
Who[] who = getSigar().getWhoList();
assertTrue(who.length > 0);
}
}