Skip to content

Commit

Permalink
Correct test text
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrharr committed Jul 16, 2015
1 parent aff08ff commit fa8c752
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,8 @@ class StreamingContext private[streaming] (
zeroArgumentConstructor.get.newInstance()
} else {
throw new SparkException(
s"Exception when registering Streaming Listener:" +
" $className did not have a zero-argument constructor or a" +
"Exception when registering Streaming Listener:" +
s" $className did not have a zero-argument constructor or a" +
" single-argument constructor that accepts SparkConf. Note: if the class is" +
" defined inside of another Scala class, then its constructors may accept an" +
" implicit parameter that references the enclosing class; in this case, you must" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,15 @@ class StreamingListenerSuite extends TestSuiteBase with Matchers {
test("registering listeners via spark.streaming.extraListeners") {
// Test for success with zero-argument constructor and sparkConf constructor
val conf = new SparkConf().setMaster("local").setAppName("test")
.set("spark.streaming.extraListeners", classOf[StreamingListenerThatAcceptsSparkConf].getName + "," +
.set("spark.streaming.extraListeners",
classOf[StreamingListenerThatAcceptsSparkConf].getName + "," +
classOf[ReceiverInfoCollector].getName)
val scc = new StreamingContext(conf, Seconds(1))

scc.scheduler.listenerBus.listeners.exists { _.isInstanceOf[StreamingListenerThatAcceptsSparkConf] }
scc.scheduler.listenerBus.listeners.exists { _.isInstanceOf[ReceiverInfoCollector] }
scc.scheduler.listenerBus.listeners.exists {
_.isInstanceOf[StreamingListenerThatAcceptsSparkConf] }
scc.scheduler.listenerBus.listeners.exists {
_.isInstanceOf[ReceiverInfoCollector] }

// Test for failure with too many arguments in constructor
val failingConf = new SparkConf().setMaster("local").setAppName("failingTest")
Expand All @@ -159,8 +162,9 @@ class StreamingListenerSuite extends TestSuiteBase with Matchers {
val failingScc = new StreamingContext(failingConf, Seconds(1))
}
val expectedErrorMessage =
s"Exception when registering Streaming Listener:" +
" StreamingListenerTooManyArguments did not have a zero-argument constructor or a" +
"Exception when registering Streaming Listener:" +
" org.apache.spark.streaming.StreamingListenerTooManyArguments" +
" did not have a zero-argument constructor or a" +
" single-argument constructor that accepts SparkConf. Note: if the class is" +
" defined inside of another Scala class, then its constructors may accept an" +
" implicit parameter that references the enclosing class; in this case, you must" +
Expand Down

0 comments on commit fa8c752

Please sign in to comment.