Skip to content

Commit

Permalink
Enable not setting the cached classloader system properties so tests …
Browse files Browse the repository at this point in the history
…can be run from the IDE, system property to enforce the properties to be set which can be used on lightning
  • Loading branch information
kabir committed Mar 6, 2013
1 parent 176a923 commit 747b568
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
*/
public class ChildFirstClassLoaderBuilder {

//Use this property on the lightning runs to make sure that people have set the root and cache properties
private static final String STRICT_PROPERTY = "org.jboss.model.test.cache.strict";
private static final String ROOT_PROPERTY = "org.jboss.model.test.root";
private static final String CACHE_FOLDER_PROPERTY = "org.jboss.model.test.classpath.cache";

Expand All @@ -59,13 +61,15 @@ public ChildFirstClassLoaderBuilder() {
String root = System.getProperty(ROOT_PROPERTY);
String cacheFolderName = System.getProperty(CACHE_FOLDER_PROPERTY);
if (root == null && cacheFolderName == null) {
if (System.getProperty(STRICT_PROPERTY) != null) {
throw new IllegalStateException("Please use the " + ROOT_PROPERTY + " and " + CACHE_FOLDER_PROPERTY + " system properties to take advantage of cached classpaths");
}
cache = new File("target", "cached-classloader");
cache.mkdirs();
if (!cache.exists()) {
throw new IllegalStateException("Could not create cache file");
}
//TODO Get rid of this
throw new IllegalStateException("TODO use the project target directory");
System.out.println("To optimize this test use the " + ROOT_PROPERTY + " and " + CACHE_FOLDER_PROPERTY + " system properties to take advantage of cached classpaths");
} else if (root != null && cacheFolderName != null){
if (cacheFolderName.indexOf('/') != -1 && cacheFolderName.indexOf('\\') != -1){
throw new IllegalStateException("Please use either '/' or '\\' as a file separator");
Expand Down

0 comments on commit 747b568

Please sign in to comment.