sigar.getLinkInfo(file);
}
public void testCreate() throws Exception {
Sigar sigar = getSigar();
String file;
File dir = new File(System.getProperty("user.dir"));
String[] entries = dir.list();
for (int i=0; i<entries.length; i++) {
file = entries[i];
File testFile = new File(dir, file);
if (!(testFile.exists() && testFile.canRead())) {
continue;
}
if (testFile.isHidden()) {
continue;
}
traceln(file + ":");
getFileInfo(sigar,
testFile.getAbsolutePath());
}
file = "NO SUCH FILE";
try {
getFileInfo(sigar, file);
assertTrue(false);
} catch (SigarNotImplementedException e) {
//XXX win32
} catch (SigarException e) {
traceln(file + ": " + e.getMessage());
assertTrue(true);
}
File tmp = File.createTempFile("sigar-", "");
file = tmp.getAbsolutePath();
tmp.deleteOnExit();
traceln("TMP=" + file);
try {
//stat() mtime is in seconds, this happens to quick to detect change.
Thread.sleep(1000 * 1);
} catch (InterruptedException e) {
}
try {
FileInfo info = sigar.getFileInfo(file);
FileOutputStream os = null;
try {
os = new FileOutputStream(file);
os.write(1);