Tcp fields can be == FIELD_NOTIMPL

This commit is contained in:
Doug MacEachern 2008-07-13 04:12:05 +00:00
parent c1d79d091c
commit 61f443ba07
2 changed files with 15 additions and 9 deletions

View File

@ -152,6 +152,12 @@ public abstract class SigarTestCase extends TestCase {
assertTrue(msg, value >= 0); assertTrue(msg, value >= 0);
} }
public void assertValidFieldTrace(String msg, long value) {
if (value != Sigar.FIELD_NOTIMPL) {
assertGtEqZeroTrace(msg, value);
}
}
public void assertEqualsTrace(String msg, long expected, long actual) { public void assertEqualsTrace(String msg, long expected, long actual) {
traceln(msg + "=" + actual + "/" + expected); traceln(msg + "=" + actual + "/" + expected);
assertEquals(msg, expected, actual); assertEquals(msg, expected, actual);

View File

@ -39,14 +39,14 @@ public class TestTcpStat extends SigarTestCase {
} }
traceln(""); traceln("");
assertGtEqZeroTrace("ActiveOpens", tcp.getActiveOpens()); assertValidFieldTrace("ActiveOpens", tcp.getActiveOpens());
assertGtEqZeroTrace("PassiveOpens", tcp.getPassiveOpens()); assertValidFieldTrace("PassiveOpens", tcp.getPassiveOpens());
assertGtEqZeroTrace("AttemptFails", tcp.getAttemptFails()); assertValidFieldTrace("AttemptFails", tcp.getAttemptFails());
assertGtEqZeroTrace("EstabResets", tcp.getEstabResets()); assertValidFieldTrace("EstabResets", tcp.getEstabResets());
assertGtEqZeroTrace("CurrEstab", tcp.getCurrEstab()); assertValidFieldTrace("CurrEstab", tcp.getCurrEstab());
assertGtEqZeroTrace("InSegs", tcp.getInSegs()); assertValidFieldTrace("InSegs", tcp.getInSegs());
assertGtEqZeroTrace("OutSegs", tcp.getOutSegs()); assertValidFieldTrace("OutSegs", tcp.getOutSegs());
assertGtEqZeroTrace("RetransSegs", tcp.getRetransSegs()); assertValidFieldTrace("RetransSegs", tcp.getRetransSegs());
assertGtEqZeroTrace("OutRsts", tcp.getOutRsts()); assertValidFieldTrace("OutRsts", tcp.getOutRsts());
} }
} }