diff options
Diffstat (limited to 'test/files/jvm/actmig-instantiation.scala')
-rw-r--r-- | test/files/jvm/actmig-instantiation.scala | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/test/files/jvm/actmig-instantiation.scala b/test/files/jvm/actmig-instantiation.scala index d54dff9558..2e3ffc3c30 100644 --- a/test/files/jvm/actmig-instantiation.scala +++ b/test/files/jvm/actmig-instantiation.scala @@ -2,7 +2,6 @@ * NOTE: Code snippets from this test are included in the Actor Migration Guide. In case you change * code in these tests prior to the 2.10.0 release please send the notification to @vjovanov. */ -import scala.actors.migration.MigrationSystem._ import scala.actors.migration._ import scala.actors.Actor._ import scala.actors._ @@ -35,53 +34,53 @@ object Test { a1 ! 100 // simple instantiation - val a2 = MigrationSystem.actorOf(Props(() => new TestStashingActor, "akka.actor.default-stash-dispatcher")) + val a2 = ActorDSL.actor(new TestStashingActor) a2 ! 200 toStop += a2 // actor of with scala actor - val a3 = MigrationSystem.actorOf(Props(() => actor { + val a3 = ActorDSL.actor(actor { react { case v: Int => Test.append(v); Test.latch.countDown() } - }, "akka.actor.default-stash-dispatcher")) + }) a3 ! 300 // using the manifest - val a4 = MigrationSystem.actorOf(Props(() => new TestStashingActor, "akka.actor.default-stash-dispatcher")) + val a4 = ActorDSL.actor(new TestStashingActor) a4 ! 400 toStop += a4 // deterministic part of a test - // creation without actorOf + // creation without actor try { val a3 = new TestStashingActor a3 ! -1 } catch { - case e => println("OK error: " + e) + case e: Throwable => println("OK error: " + e) } - // actorOf double creation + // actor double creation try { - val a3 = MigrationSystem.actorOf(Props(() => { + val a3 = ActorDSL.actor({ new TestStashingActor new TestStashingActor - }, "akka.actor.default-stash-dispatcher")) + }) a3 ! -1 } catch { - case e => println("OK error: " + e) + case e: Throwable => println("OK error: " + e) } - // actorOf nesting + // actor nesting try { - val a5 = MigrationSystem.actorOf(Props(() => { - val a6 = MigrationSystem.actorOf(Props(() => new TestStashingActor, "akka.actor.default-stash-dispatcher")) + val a5 = ActorDSL.actor({ + val a6 = ActorDSL.actor(new TestStashingActor) toStop += a6 new TestStashingActor - }, "akka.actor.default-stash-dispatcher")) + }) a5 ! 500 toStop += a5 } catch { - case e => println("Should not throw an exception: " + e) + case e: Throwable => println("Should not throw an exception: " + e) } // output @@ -93,4 +92,4 @@ object Test { buff.sorted.foreach(println) toStop.foreach(_ ! PoisonPill) } -}
\ No newline at end of file +} |