Skip to content

Commit

Permalink
Use Spark Utils class for directory creation/deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshRosen committed Dec 15, 2014
1 parent a693ddb commit f2307f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import java.io.File

import scala.util.Random

import com.google.common.io.Files
import org.apache.hadoop.conf.Configuration
import org.scalatest.{BeforeAndAfterEach, BeforeAndAfterAll, FunSuite}

import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.storage.{BlockId, BlockManager, StorageLevel, StreamBlockId}
import org.apache.spark.streaming.util.{WriteAheadLogFileSegment, WriteAheadLogWriter}
import org.apache.spark.util.Utils

class WriteAheadLogBackedBlockRDDSuite extends FunSuite with BeforeAndAfterAll with BeforeAndAfterEach {
val conf = new SparkConf()
Expand All @@ -39,11 +39,11 @@ class WriteAheadLogBackedBlockRDDSuite extends FunSuite with BeforeAndAfterAll w
var dir: File = null

override def beforeEach(): Unit = {
dir = Files.createTempDir()
dir = Utils.createTempDir()
}

override def afterEach(): Unit = {
dir.delete()
Utils.deleteRecursively(dir)
}

override def beforeAll(): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import scala.concurrent.duration._
import scala.language.{implicitConversions, postfixOps}

import WriteAheadLogSuite._
import com.google.common.io.Files
import org.apache.commons.io.FileUtils
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.Path
import org.apache.spark.util.Utils
Expand All @@ -41,7 +39,7 @@ class WriteAheadLogSuite extends FunSuite with BeforeAndAfter {
var manager: WriteAheadLogManager = null

before {
tempDir = Files.createTempDir()
tempDir = Utils.createTempDir()
testDir = tempDir.toString
testFile = new File(tempDir, "testFile").toString
if (manager != null) {
Expand All @@ -51,7 +49,7 @@ class WriteAheadLogSuite extends FunSuite with BeforeAndAfter {
}

after {
FileUtils.deleteQuietly(tempDir)
Utils.deleteRecursively(tempDir)
}

test("WriteAheadLogWriter - writing data") {
Expand Down

0 comments on commit f2307f5

Please sign in to comment.