Porting the tests from wip-628-629

This commit is contained in:
Viktor Klang 2011-01-26 14:06:40 +01:00
parent 54280decdb
commit b2b5113877

View file

@ -99,15 +99,21 @@ class TypedActorLifecycleSpec extends Spec with ShouldMatchers with BeforeAndAft
val conf = new TypedActorConfigurator().configure(OneForOneStrategy(Nil, 3, 500000), Array(actorSupervision)).inject.supervise
try {
val first = conf.getInstance(classOf[TypedActorFailer])
intercept[RuntimeException] {
try {
first.fail
fail("shouldn't get here")
} catch {
case r: RuntimeException if r.getMessage == "expected" => //expected
}
val second = conf.getInstance(classOf[TypedActorFailer])
first should be (second)
intercept[ActorInitializationException] {
try {
second.fail
fail("shouldn't get here")
} catch {
case r: ActorInitializationException if r.getMessage == "Actor has not been started, you need to invoke 'actor.start' before using it" => //expected
}
} finally {
conf.stop
@ -115,29 +121,29 @@ class TypedActorLifecycleSpec extends Spec with ShouldMatchers with BeforeAndAft
}
it("should be restarted when supervision handles the problem in") {
val actorSupervision = new SuperviseTypedActor(classOf[TypedActorFailer],classOf[TypedActorFailerImpl],permanent(),30000)
val conf = new TypedActorConfigurator().configure(OneForOneStrategy(classOf[Throwable] :: Nil, 3, 500000), Array(actorSupervision)).inject.supervise
try {
val first = conf.getInstance(classOf[TypedActorFailer])
try {
first.fail
fail("shouldn't get here")
} catch {
case r: RuntimeException if r.getMessage == "expected" => //expected
}
val second = conf.getInstance(classOf[TypedActorFailer])
val actorSupervision = new SuperviseTypedActor(classOf[TypedActorFailer],classOf[TypedActorFailerImpl],permanent(),30000)
val conf = new TypedActorConfigurator().configure(OneForOneStrategy(classOf[Throwable] :: Nil, 3, 500000), Array(actorSupervision)).inject.supervise
try {
val first = conf.getInstance(classOf[TypedActorFailer])
try {
first.fail
fail("shouldn't get here")
} catch {
case r: RuntimeException if r.getMessage == "expected" => //expected
}
val second = conf.getInstance(classOf[TypedActorFailer])
first should be (second)
first should be (second)
try {
first.fail
fail("shouldn't get here")
} catch {
case r: RuntimeException if r.getMessage == "expected" => //expected
}
} finally {
conf.stop
}
}
}
}
try {
second.fail
fail("shouldn't get here")
} catch {
case r: RuntimeException if r.getMessage == "expected" => //expected
}
} finally {
conf.stop
}
}
}
}