backup of supervisor tests that are not yet ported to specs
This commit is contained in:
parent
d6b43b9181
commit
bcc7d5f8a7
5 changed files with 765 additions and 0 deletions
40
supervisor/test-code/test/scala/GenericServerSuite.scala
Executable file
40
supervisor/test-code/test/scala/GenericServerSuite.scala
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* Copyright (C) 2009 Scalable Solutions.
|
||||
*/
|
||||
|
||||
package com.scalablesolutions.akka.supervisor
|
||||
|
||||
import org.specs.runner.JUnit4
|
||||
import org.specs.Specification
|
||||
|
||||
import scala.actors._
|
||||
import scala.actors.Actor._
|
||||
|
||||
/**
|
||||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
class GenericServerTest extends JUnit4(genericServerSpec) // for JUnit4 and Maven
|
||||
object genericServerSpec extends Specification {
|
||||
|
||||
"server should respond to a regular message" in {
|
||||
val server = new TestGenericServerActor
|
||||
server.start
|
||||
server !? Ping match {
|
||||
case reply: String =>
|
||||
assert("got a ping" === server.log)
|
||||
assert("pong" === reply)
|
||||
case _ => fail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class TestGenericServerActor extends GenericServer {
|
||||
var log: String = ""
|
||||
|
||||
override def body: PartialFunction[Any, Unit] = {
|
||||
case Ping =>
|
||||
log = "got a ping"
|
||||
reply("pong")
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue