| java.lang.Object org.hsqldb.test.ExecHarness
ExecHarness | public class ExecHarness (Code) | | Utilities that test classes can call to execute a specified command and to
evaluate the exit status and output of said execution.
harnessInstance.exec() executes the given program (Java or not).
Any time thereafter, harnessInstance can be interrogated for exit
status and text output.
ExecHarness can emulate user interaction with SqlTool, but you can
not use ExecHarness interactively.
To execute java classes, you can either give the classpath by setting the
environmental var before running this program, or by giving the classpath
switch to the target program. Classpath switches used for invoking
this ExecHarness class WILL NOT EFFECT java executions by ExecHarness.
E.g. the java invocation
"java org.hsqldb.test.ExecHarness java -cp newcp Cname" will give Cname
classpath of 'newcp', but the following WILL NOT:
"java -cp newcp org.hsqldb.test.ExecHarness java Cname".
It's often easier to just set (and export if necessary) CLASSPATH before
invoking ExecHarness.
Same applies to java System Properties. You must supply them after the
2nd "java".
See Also: main() for an example of use. |
Constructor Summary | |
public | ExecHarness(String inName) Create an ExecHarness instance which can invoke the given program. |
executed | boolean executed(Code) | | |
ExecHarness | public ExecHarness(String inName)(Code) | | Create an ExecHarness instance which can invoke the given program.
Parameters: inName - Name of the external program (like "cat" or "java"). |
clear | public void clear()(Code) | | |
listToPrimitiveArray | public static String[] listToPrimitiveArray(List list)(Code) | | |
main | public static void main(String[] sa) throws IOException, FileNotFoundException, InterruptedException(Code) | | To test the ExecHarness class itself.
(Basically, a sanity check).
Note that we always exec another process. This makes it safe to
execute Java classes which may call System.exit().
Parameters: sa - sa[0] is the program to be run.Remaining arguments will be passed as command-line argsto the sa[0] program. |
unshift | public static String[] unshift(String newHead, String[] saIn)(Code) | | These utility methods really belong in a class in the util package.
|
|
|