From 916a46bce31ef9d27ceb867f7f43627464ccfc96 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Tue, 10 May 2005 20:32:52 +0000 Subject: [PATCH] add NetStat test --- .../hyperic/sigar/test/SigarTestRunner.java | 1 + .../net/hyperic/sigar/test/TestNetStat.java | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 bindings/java/src/net/hyperic/sigar/test/TestNetStat.java diff --git a/bindings/java/src/net/hyperic/sigar/test/SigarTestRunner.java b/bindings/java/src/net/hyperic/sigar/test/SigarTestRunner.java index f40d7c12..1ec547f9 100644 --- a/bindings/java/src/net/hyperic/sigar/test/SigarTestRunner.java +++ b/bindings/java/src/net/hyperic/sigar/test/SigarTestRunner.java @@ -33,6 +33,7 @@ public class SigarTestRunner extends SigarCommandBase { TestLoadAverage.class, TestMem.class, TestNetIf.class, + TestNetStat.class, TestProcArgs.class, TestProcEnv.class, TestProcExe.class, diff --git a/bindings/java/src/net/hyperic/sigar/test/TestNetStat.java b/bindings/java/src/net/hyperic/sigar/test/TestNetStat.java new file mode 100644 index 00000000..9b0f2779 --- /dev/null +++ b/bindings/java/src/net/hyperic/sigar/test/TestNetStat.java @@ -0,0 +1,27 @@ +package net.hyperic.sigar.test; + +import net.hyperic.sigar.NetStat; +import net.hyperic.sigar.Sigar; +import net.hyperic.sigar.SigarNotImplementedException; + +public class TestNetStat extends SigarTestCase { + + public TestNetStat(String name) { + super(name); + } + + public void testCreate() throws Exception { + Sigar sigar = getSigar(); + NetStat netstat; + + try { + netstat = sigar.getNetStat(); + } catch (SigarNotImplementedException e) { + return; + } + + assertGtEqZeroTrace("Outbound", netstat.getTcpOutboundTotal()); + assertGtEqZeroTrace("Inbound", netstat.getTcpInboundTotal()); + assertGtEqZeroTrace("Listen", netstat.getTcpListen()); + } +}