String[] ijarg = new String[3];
ijarg[0] = "-p";
ijarg[1] = propString;
ijarg[2] = scriptPath;
RunIJ ij = new RunIJ(ijarg);
Thread ijThread = new Thread(ij);
try
{
ijThread.start();
if (timeout < 0)
{
ijThread.join();
}
else
{
ijThread.join(timeout * 60 * 1000);
}
}
catch (Exception e)
{
System.out.println("Aiiie! Got some kind of exception " + e);
}
// Now make sure a shutdown is complete if necessary
if (shutdownurl != null)
{
String[] sdargs = new String[2];
sdargs[0] = systemHome;
sdargs[1] = shutdownurl;
shutdown.main(sdargs);
}
// Reset ij.defaultResourcePackage
ptmp = System.getProperties();
ptmp.put("ij.defaultResourcePackage", "/org/apache/derbyTesting/");
ptmp.put("usesystem", "");
System.setProperties(ptmp);
}
else if (testType.equals("java"))
{
sysProp.put("user.dir", outDir.getCanonicalPath());
javaPath = "org.apache.derbyTesting.functionTests.tests." + testDirName;
String[] args = new String[2];
args[0] = "-p";
args[1] = propString;
Class[] classArray = new Class[1];
classArray[0] = args.getClass();
String testName = javaPath + "." + testBase;
Class JavaTest = Class.forName(testName);
// Get the tests's main method and invoke it
Method testMain = JavaTest.getMethod("main", classArray);
Object[] argObj = new Object[1];
argObj[0] = args;
RunClass testObject = new RunClass(JavaTest, testMain, argObj);
Thread testThread = new Thread(testObject);
try
{
testThread.start();
if (timeout < 0)
{
testThread.join();
}
else
{
testThread.join(timeout * 1000);
}
}
catch(Exception e)
{
System.out.println("Exception upon invoking test..." + e);