add constant for 1.4 compat, use to skip ipv6 addr
This commit is contained in:
		
							parent
							
								
									ba8d344da5
								
							
						
					
					
						commit
						2329d9b7f5
					
				@ -38,6 +38,9 @@ public abstract class SigarTestCase extends TestCase {
 | 
				
			|||||||
    private static boolean verbose =
 | 
					    private static boolean verbose =
 | 
				
			||||||
        "true".equals(System.getProperty("sigar.testVerbose"));
 | 
					        "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;
 | 
					    private static PrintStream out = System.out;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public SigarTestCase(String name) {
 | 
					    public SigarTestCase(String name) {
 | 
				
			||||||
 | 
				
			|||||||
@ -19,6 +19,7 @@
 | 
				
			|||||||
package org.hyperic.sigar.test;
 | 
					package org.hyperic.sigar.test;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.net.InetAddress;
 | 
					import java.net.InetAddress;
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.hyperic.sigar.NetConnection;
 | 
					import org.hyperic.sigar.NetConnection;
 | 
				
			||||||
import org.hyperic.sigar.NetFlags;
 | 
					import org.hyperic.sigar.NetFlags;
 | 
				
			||||||
@ -62,13 +63,16 @@ public class TestNetStatPort extends SigarTestCase {
 | 
				
			|||||||
        NetInterfaceConfig ifconfig =
 | 
					        NetInterfaceConfig ifconfig =
 | 
				
			||||||
            sigar.getNetInterfaceConfig(null);
 | 
					            sigar.getNetInterfaceConfig(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String[] addrs = {
 | 
					        ArrayList addrs = new ArrayList();
 | 
				
			||||||
            ifconfig.getAddress(),
 | 
					        addrs.add(ifconfig.getAddress());
 | 
				
			||||||
            "0:0:0:0:0:0:0:1",
 | 
					        addrs.add(NetFlags.LOOPBACK_ADDRESS);
 | 
				
			||||||
        };
 | 
					        if (JDK_14_COMPAT) {
 | 
				
			||||||
 | 
					            addrs.add(NetFlags.LOOPBACK_ADDRESS_V6);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (int i=0; i<addrs.length; i++) {
 | 
					        for (int i=0; i<addrs.size(); i++) {
 | 
				
			||||||
            netstat(sigar, addrs[i], 22);
 | 
					            String addr = (String)addrs.get(i);
 | 
				
			||||||
 | 
					            netstat(sigar, addr, 22);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -186,15 +186,11 @@ public class TestPTQL extends SigarTestCase {
 | 
				
			|||||||
            SigarProxyCache.newInstance(getSigar());
 | 
					            SigarProxyCache.newInstance(getSigar());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        testOK(proxy);
 | 
					        testOK(proxy);
 | 
				
			||||||
        String spec =
 | 
					 | 
				
			||||||
            System.getProperty("java.specification.version");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (spec.compareTo("1.4") >= 0) {
 | 
					        if (JDK_14_COMPAT) {
 | 
				
			||||||
            testReOK(proxy);
 | 
					            testReOK(proxy);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					
 | 
				
			||||||
            traceln("skipping re tests for " + spec);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        testMalformed(proxy);
 | 
					        testMalformed(proxy);
 | 
				
			||||||
        testLoadFailure(proxy);
 | 
					        testLoadFailure(proxy);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user