[NO ISSUE][TEST] Use unique directory for external library tests

Enables external library tests on hosts w/ a shared home directory

Change-Id: I575cfc79f4df831783ce6551ae691d73410ca878
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3211
Reviewed-by: Michael Blow <mblow@apache.org>
Tested-by: Michael Blow <mblow@apache.org>
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java
index 4ed36c6..b4c5b26 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java
@@ -18,6 +18,8 @@
  */
 package org.apache.asterix.test.runtime;
 
+import static org.apache.hyracks.util.file.FileUtil.joinPath;
+
 import java.io.File;
 import java.nio.file.Paths;
 import java.util.ArrayList;
@@ -41,6 +43,15 @@
 
     protected static final Logger LOGGER = LogManager.getLogger();
 
+    static {
+        // hack to ensure we have a unique location for external libraries in our tests (asterix cluster has a shared home directory)
+        String appHome = joinPath(System.getProperty("app.home", System.getProperty("user.home")),
+                "appHome" + (int) (Math.random() * Integer.MAX_VALUE));
+        LOGGER.info("setting app.home to {}", appHome);
+        System.setProperty("app.home", appHome);
+        new File(appHome).deleteOnExit();
+    }
+
     protected static final String PATH_ACTUAL = "rttest" + File.separator;
 
     public static TestGroup FailedGroup;