Skip to content

Commit f2dd621

Browse files
committed
get rid of TestUtils.createResource() via inlining
1 parent 698159a commit f2dd621

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

core/src/main/scala/org/apache/spark/TestUtils.scala

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,6 @@ private[spark] object TestUtils {
159159
createCompiledClass(className, destDir, sourceFile, classpathUrls)
160160
}
161161

162-
def createResource(
163-
resourceName: String,
164-
destDir: File,
165-
fileContent: String = "test"): File = {
166-
val out: File = new File(destDir, resourceName)
167-
Files.write(fileContent.getBytes(StandardCharsets.UTF_8), out)
168-
assert(out.exists(), "Resource file is not written: " + out.getAbsolutePath())
169-
out
170-
}
171-
172162
/**
173163
* Run some code involving jobs submitted to the given context and assert that the jobs spilled.
174164
*/

repl/src/test/scala/org/apache/spark/repl/ExecutorClassLoaderSuite.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ package org.apache.spark.repl
1919

2020
import java.io.File
2121
import java.net.{URL, URLClassLoader}
22+
import java.nio.charset.StandardCharsets
2223
import java.util
2324

25+
import com.google.common.io.Files
26+
2427
import scala.concurrent.duration._
2528
import scala.io.Source
2629
import scala.language.implicitConversions
@@ -57,7 +60,8 @@ class ExecutorClassLoaderSuite
5760
url1 = "file://" + tempDir1
5861
urls2 = List(tempDir2.toURI.toURL).toArray
5962
childClassNames.foreach(TestUtils.createCompiledClass(_, tempDir1, "1"))
60-
parentResourceNames.foreach(TestUtils.createResource(_, tempDir2, "resource"))
63+
parentResourceNames.foreach(x =>
64+
Files.write("resource".getBytes(StandardCharsets.UTF_8), new File(tempDir2, x)))
6165
parentClassNames.foreach(TestUtils.createCompiledClass(_, tempDir2, "2"))
6266
}
6367

0 commit comments

Comments
 (0)