From fcf2a862535ed36225684c4f40352b95e0fcab16 Mon Sep 17 00:00:00 2001 From: Vikram Agrawal Date: Wed, 28 Aug 2019 22:12:23 +0530 Subject: [PATCH] Fix fileutility unit test --- .../java/org/apache/spark/io/FileUtilitySuite.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/core/src/test/java/org/apache/spark/io/FileUtilitySuite.java b/core/src/test/java/org/apache/spark/io/FileUtilitySuite.java index 2cfcbf760ec7f..99fb5e7107f22 100644 --- a/core/src/test/java/org/apache/spark/io/FileUtilitySuite.java +++ b/core/src/test/java/org/apache/spark/io/FileUtilitySuite.java @@ -18,12 +18,11 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.RandomUtils; -import org.apache.hadoop.fs.Path; +import org.apache.spark.util.Utils; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import sun.security.action.GetPropertyAction; import java.io.File; import java.io.IOException; @@ -39,19 +38,14 @@ public class FileUtilitySuite { @Before public void setUp() throws IOException { - File tmpLocation = new File( - GetPropertyAction.privilegedGetProperty("java.io.tmpdir")); - Path sourceFolderPath = new Path(tmpLocation.toString(), + sourceFolder = Utils.createTempDir(System.getProperty("java.io.tmpdir"), "FileUtilTest" + RandomUtils.nextLong()); - sourceFolder = new File(sourceFolderPath.toString()); - sourceFolder.mkdirs(); destTarLoc = File.createTempFile("dest-tar", ".tar"); destFile = File.createTempFile("dest-file", ".tmp"); } @After public void tearDown() { - sourceFolder.delete(); destTarLoc.delete(); destFile.delete(); }