WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 8bcec28c authored by john's avatar john
Browse files

added the property dacapo.callback.classpath which can be used to specify the...

added the property dacapo.callback.classpath which can be used to specify the path for finding user defined Callback classes
parent 961c1787
......@@ -8,39 +8,69 @@
* @date $Date: 2009-12-24 11:19:36 +1100 (Thu, 24 Dec 2009) $
* @id $Id: Harness.java 738 2009-12-24 00:19:36Z steveb-oss $
*/
import java.io.File;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
public class Harness {
// The DaCapo Harness is in a separate library within the dacapo.jar
// allowing a separate class loader to be used for loading the dacapo harness
private static final String HARNESS_PATH = "harness/";
private static final String HARNESS_CLASS = "org.dacapo.harness.TestHarness";
private static final String HARNESS_METHOD = "main";
public static void main(String[] args) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL harnessJarURL = classLoader.getResource(HARNESS_PATH);
ClassLoader harnessClassLoader = new URLClassLoader(new URL[] { harnessJarURL });
Thread.currentThread().setContextClassLoader(harnessClassLoader);
Class dacapoHarnessClass = harnessClassLoader.loadClass(HARNESS_CLASS);
Method harnessMain = dacapoHarnessClass.getDeclaredMethod(HARNESS_METHOD, String[].class);
harnessMain.invoke(null, new Object[] { args });
/* TestHarness.main(args); */
private static final String HARNESS_PATH = "harness/";
private static final String HARNESS_CLASS = "org.dacapo.harness.TestHarness";
private static final String HARNESS_METHOD = "main";
//
private static final String CALLBACK_CLASSPATH_PROPERTY = "dacapo.callback.classpath";
public static void main(String[] args) throws MalformedURLException,
URISyntaxException, ClassNotFoundException, SecurityException,
NoSuchMethodException, IllegalArgumentException, IllegalAccessException,
InvocationTargetException {
ClassLoader harnessClassLoader = makeHarnessClassLoader();
Thread.currentThread().setContextClassLoader(harnessClassLoader);
Class dacapoHarnessClass = harnessClassLoader.loadClass(HARNESS_CLASS);
Method harnessMain = dacapoHarnessClass.getDeclaredMethod(HARNESS_METHOD, String[].class);
harnessMain.invoke(null, new Object[] { args });
System.exit(0);
}
private static ClassLoader makeHarnessClassLoader() throws MalformedURLException, URISyntaxException {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
String dacapoCallbackClasspath = System
.getProperty(CALLBACK_CLASSPATH_PROPERTY);
URL harnessJarURL = classLoader.getResource(HARNESS_PATH);
URL[] urls = null;
if (dacapoCallbackClasspath != null) {
File file = new File(dacapoCallbackClasspath);
URI callbackClasspath = null;
if (file.isDirectory())
callbackClasspath = file.getAbsoluteFile().toURI();
else
callbackClasspath = new URI(dacapoCallbackClasspath);
if (callbackClasspath == null)
throw new URISyntaxException(dacapoCallbackClasspath, "is not a URI nor a directory nor a class file");
urls = new URL[] { harnessJarURL, callbackClasspath.toURL() };
} else
urls = new URL[] { harnessJarURL };
return new URLClassLoader(urls);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment