package net.hyperic.sigar.test;

import java.io.File;
import java.io.FileInputStream;

import net.hyperic.sigar.Sigar;
import net.hyperic.sigar.SigarNotImplementedException;

public class TestProcFd extends SigarTestCase {

    public TestProcFd(String name) {
        super(name);
    }

    public void testCreate() throws Exception {
        Sigar sigar = new Sigar();

        traceln("");

        try {
            long pid = sigar.getPid();

            long total = sigar.getProcFd(pid).getTotal(); 

            File file = new File("bin", "run_tests.sh");
            if (!file.exists()) {
                file = new File("build.xml");
            }
            FileInputStream is = new FileInputStream(file);

            assertEqualsTrace("Total", total + 1,
                              sigar.getProcFd(pid).getTotal());

            is.close();

            assertEqualsTrace("Total", total,
                              sigar.getProcFd(pid).getTotal());
        } catch (SigarNotImplementedException e) {
            //ok
        }
    }
}

@@ -112,16 +112,54 @@
 .Sigar;%0A
+import net.hyperic.sigar.SigarLoader;%0A
 import n
@@ -539,17 +539,16 @@
 tal(); %0A
-%0A
         
@@ -555,90 +555,98 @@
     
-File file = new File(%22bin%22, %22run_tests.sh%22);%0A            if (!file.exists()) %7B%0A   
+String sigarJar =%0A                new SigarLoader(Sigar.class).findJarPath(%22sigar.jar%22);%0A%0A
     
@@ -653,16 +653,20 @@
         
+File
  file = 
@@ -678,22 +678,51 @@
 ile(
-%22build.xml
+sigarJar + File.separator + %22sigar.jar
 %22);%0A
+%0A
     
@@ -725,25 +725,52 @@
             
-%7D
+traceln(%22Opening %22 + file);%0A
 %0A           

use sigar.jar as a file to test with