add constant for 1.4 compat, use to skip ipv6 addr

This commit is contained in:
Doug MacEachern 2007-04-07 03:00:26 +00:00
parent ba8d344da5
commit 2329d9b7f5
3 changed files with 15 additions and 12 deletions

View File

@ -38,6 +38,9 @@ public abstract class SigarTestCase extends TestCase {
private static boolean verbose =
"true".equals(System.getProperty("sigar.testVerbose"));
protected static final boolean JDK_14_COMPAT =
System.getProperty("java.specification.version").compareTo("1.4") >= 0;
private static PrintStream out = System.out;
public SigarTestCase(String name) {

View File

@ -19,6 +19,7 @@
package org.hyperic.sigar.test;
import java.net.InetAddress;
import java.util.ArrayList;
import org.hyperic.sigar.NetConnection;
import org.hyperic.sigar.NetFlags;
@ -62,13 +63,16 @@ public class TestNetStatPort extends SigarTestCase {
NetInterfaceConfig ifconfig =
sigar.getNetInterfaceConfig(null);
String[] addrs = {
ifconfig.getAddress(),
"0:0:0:0:0:0:0:1",
};
ArrayList addrs = new ArrayList();
addrs.add(ifconfig.getAddress());
addrs.add(NetFlags.LOOPBACK_ADDRESS);
if (JDK_14_COMPAT) {
addrs.add(NetFlags.LOOPBACK_ADDRESS_V6);
}
for (int i=0; i<addrs.length; i++) {
netstat(sigar, addrs[i], 22);
for (int i=0; i<addrs.size(); i++) {
String addr = (String)addrs.get(i);
netstat(sigar, addr, 22);
}
}
}

View File

@ -186,15 +186,11 @@ public class TestPTQL extends SigarTestCase {
SigarProxyCache.newInstance(getSigar());
testOK(proxy);
String spec =
System.getProperty("java.specification.version");
if (spec.compareTo("1.4") >= 0) {
if (JDK_14_COMPAT) {
testReOK(proxy);
}
else {
traceln("skipping re tests for " + spec);
}
testMalformed(proxy);
testLoadFailure(proxy);
}