Using tempdir for stc CompilerTest

This fixes the problem when running multiple, parallel builds on
a machine with a shared /tmp (i.e. Jenkins)

Change-Id: Ib9ba840811ba95fa2cae50218732a2678900cda4
diff --git a/utils/stc/src/test/java/org/onlab/stc/CompilerTest.java b/utils/stc/src/test/java/org/onlab/stc/CompilerTest.java
index de6fa0e..7963d1f 100644
--- a/utils/stc/src/test/java/org/onlab/stc/CompilerTest.java
+++ b/utils/stc/src/test/java/org/onlab/stc/CompilerTest.java
@@ -15,9 +15,9 @@
  */
 package org.onlab.stc;
 
+import com.google.common.io.Files;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.onlab.util.Tools;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -35,12 +35,10 @@
  */
 public class CompilerTest {
 
-    static final File TEST_DIR = new File("/tmp/junit-stc");
+    static final File TEST_DIR = Files.createTempDir();
 
     @BeforeClass
     public static void setUpClass() throws IOException {
-        Tools.removeDirectory(TEST_DIR);
-        TEST_DIR.mkdirs();
         stageTestResource("scenario.xml");
         stageTestResource("simple-scenario.xml");
         stageTestResource("one-scenario.xml");
@@ -51,6 +49,7 @@
         System.setProperty("TOC1", "1.2.3.1");
         System.setProperty("TOC2", "1.2.3.2");
         System.setProperty("TOC3", "1.2.3.3");
+        System.setProperty("test.dir", TEST_DIR.getAbsolutePath());
     }
 
     public static FileInputStream getStream(String name) throws FileNotFoundException {
@@ -72,7 +71,8 @@
         assertSame("incorrect scenario", scenario, compiler.scenario());
         assertEquals("incorrect step count", 25, flow.getVertexes().size());
         assertEquals("incorrect dependency count", 21, flow.getEdges().size());
-        assertEquals("incorrect logDir", "/tmp/junit-stc/foo", compiler.logDir().getPath());
+        assertEquals("incorrect logDir",
+                     TEST_DIR.getAbsolutePath() + "/foo", compiler.logDir().getPath());
 
         Step step = compiler.getStep("there");
         assertEquals("incorrect edge count", 2, flow.getEdgesFrom(step).size());
diff --git a/utils/stc/src/test/resources/org/onlab/stc/scenario.xml b/utils/stc/src/test/resources/org/onlab/stc/scenario.xml
index 8e7f462..34e67fd 100644
--- a/utils/stc/src/test/resources/org/onlab/stc/scenario.xml
+++ b/utils/stc/src/test/resources/org/onlab/stc/scenario.xml
@@ -13,10 +13,10 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<scenario name="foo" description="Test Scenario" logDir="/tmp/junit-stc/foo">
-    <import file="/tmp/junit-stc/one-scenario.xml" namespace="foo"/>
+<scenario name="foo" description="Test Scenario" logDir="${test.dir}/foo">
+    <import file="${test.dir}/one-scenario.xml" namespace="foo"/>
 
-    <import file="/tmp/junit-stc/two-scenario.xml"/>
+    <import file="${test.dir}/two-scenario.xml"/>
 
     <dependency name="dude" requires="~yolo"/>