add getSigar method that enables logging if verbose
This commit is contained in:
parent
579cb164af
commit
99cc7b2f68
|
@ -3,9 +3,12 @@ package net.hyperic.sigar.test;
|
|||
import java.io.PrintStream;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import net.hyperic.sigar.Sigar;
|
||||
|
||||
//helper to add optional tracing.
|
||||
public abstract class SigarTestCase extends TestCase {
|
||||
|
||||
private Sigar sigar = null;
|
||||
private static boolean verbose = false;
|
||||
private static PrintStream out = System.out;
|
||||
|
||||
|
@ -13,6 +16,16 @@ public abstract class SigarTestCase extends TestCase {
|
|||
super(name);
|
||||
}
|
||||
|
||||
public Sigar getSigar() {
|
||||
if (this.sigar == null) {
|
||||
this.sigar = new Sigar();
|
||||
if (getVerbose()) {
|
||||
this.sigar.enableLogging(true);
|
||||
}
|
||||
}
|
||||
return this.sigar;
|
||||
}
|
||||
|
||||
public static void setVerbose(boolean value) {
|
||||
verbose = value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue