Skip to content
Snippets Groups Projects
Commit 6fcfefcb authored by Prashant Sharma's avatar Prashant Sharma
Browse files

Few more fixes to tests broken during merge

parent 4106ae9f
No related branches found
No related tags found
No related merge requests found
package org.apache.spark.repl
import java.io.BufferedReader
import java.io.PrintWriter
import java.io.StringReader
import java.io.StringWriter
import java.net.URLClassLoader
import scala.collection.mutable.ArrayBuffer
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.future
trait ReplSuiteMixin {
def runInterpreter(master: String, input: String): String = {
val in = new BufferedReader(new StringReader(input + "\n"))
val out = new StringWriter()
val cl = getClass.getClassLoader
var paths = new ArrayBuffer[String]
if (cl.isInstanceOf[URLClassLoader]) {
val urlLoader = cl.asInstanceOf[URLClassLoader]
for (url <- urlLoader.getURLs) {
if (url.getProtocol == "file") {
paths += url.getFile
}
}
}
val interp = new SparkILoop(in, new PrintWriter(out), master)
spark.repl.Main.interp = interp
val separator = System.getProperty("path.separator")
interp.process(Array("-classpath", paths.mkString(separator)))
if (interp != null) {
interp.closeInterpreter()
}
// To avoid Akka rebinding to the same port, since it doesn't unbind immediately on shutdown
System.clearProperty("spark.hostPort")
return out.toString
}
def assertContains(message: String, output: String) {
assert(output contains message,
"Interpreter output did not contain '" + message + "':\n" + output)
}
def assertDoesNotContain(message: String, output: String) {
assert(!(output contains message),
"Interpreter output contained '" + message + "':\n" + output)
}
}
...@@ -29,9 +29,9 @@ import org.scalatest.BeforeAndAfter ...@@ -29,9 +29,9 @@ import org.scalatest.BeforeAndAfter
import com.google.common.io.Files import com.google.common.io.Files
import spark.streaming.StreamingContext.toPairDStreamFunctions import org.apache.spark.streaming.StreamingContext.toPairDStreamFunctions
import spark.streaming.dstream.FileInputDStream import org.apache.spark.streaming.dstream.FileInputDStream
import spark.streaming.util.ManualClock import org.apache.spark.streaming.util.ManualClock
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment