Switched newActor for actorOf
This commit is contained in:
parent
fbefcee8ae
commit
7abb110b5c
37 changed files with 160 additions and 160 deletions
|
|
@ -20,7 +20,7 @@ trait CamelService extends Bootable with Logging {
|
|||
|
||||
import CamelContextManager._
|
||||
|
||||
private[camel] val consumerPublisher = newActor[ConsumerPublisher]
|
||||
private[camel] val consumerPublisher = actorOf[ConsumerPublisher]
|
||||
private[camel] val publishRequestor = actorOf(new PublishRequestor(consumerPublisher))
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class CamelServiceFeatureTest extends FeatureSpec with BeforeAndAfterAll with Gi
|
|||
scenario("access an actor from the custom Camel route") {
|
||||
|
||||
given("a registered actor and a custom route to that actor")
|
||||
val actor = newActor[TestActor].start
|
||||
val actor = actorOf[TestActor].start
|
||||
|
||||
when("sending a a message to that route")
|
||||
val response = CamelContextManager.template.requestBody("direct:custom-route-test-1", "msg3")
|
||||
|
|
|
|||
|
|
@ -29,23 +29,23 @@ class PublishTest extends JUnitSuite {
|
|||
import PublishTest._
|
||||
|
||||
@Test def shouldCreatePublishRequestList = {
|
||||
val publish = Publish.forConsumers(List(newActor[ConsumeAnnotatedActor]))
|
||||
val publish = Publish.forConsumers(List(actorOf[ConsumeAnnotatedActor]))
|
||||
assert(publish === List(Publish("mock:test1", "test", false)))
|
||||
}
|
||||
|
||||
@Test def shouldCreateSomePublishRequestWithActorId = {
|
||||
val publish = Publish.forConsumer(newActor[ConsumeAnnotatedActor])
|
||||
val publish = Publish.forConsumer(actorOf[ConsumeAnnotatedActor])
|
||||
assert(publish === Some(Publish("mock:test1", "test", false)))
|
||||
}
|
||||
|
||||
@Test def shouldCreateSomePublishRequestWithActorUuid = {
|
||||
val ca = newActor[ConsumerActor]
|
||||
val ca = actorOf[ConsumerActor]
|
||||
val publish = Publish.forConsumer(ca)
|
||||
assert(publish === Some(Publish("mock:test2", ca.uuid, true)))
|
||||
}
|
||||
|
||||
@Test def shouldCreateNone = {
|
||||
val publish = Publish.forConsumer(newActor[PlainActor])
|
||||
val publish = Publish.forConsumer(actorOf[PlainActor])
|
||||
assert(publish === None)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,13 +81,13 @@ object Actor extends Logging {
|
|||
* Creates a new ActorRef out of the Actor with type T.
|
||||
* <pre>
|
||||
* import Actor._
|
||||
* val actor = newActor[MyActor]
|
||||
* val actor = actorOf[MyActor]
|
||||
* actor.start
|
||||
* actor ! message
|
||||
* actor.stop
|
||||
* </pre>
|
||||
*/
|
||||
def newActor[T <: Actor: Manifest]: ActorRef = new ActorRef(manifest[T].erasure.asInstanceOf[Class[_ <: Actor]])
|
||||
def actorOf[T <: Actor: Manifest]: ActorRef = new ActorRef(manifest[T].erasure.asInstanceOf[Class[_ <: Actor]])
|
||||
|
||||
/**
|
||||
* Creates a new ActorRef out of the Actor. Allows you to pass in a factory function
|
||||
|
|
@ -279,7 +279,7 @@ object ActorRef {
|
|||
* <pre>
|
||||
* import Actor._
|
||||
*
|
||||
* val actor = newActor[MyActor]
|
||||
* val actor = actorOf[MyActor]
|
||||
* actor.start
|
||||
* actor ! message
|
||||
* actor.stop
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class ActorFireForgetRequestReplySpec extends JUnitSuite {
|
|||
@Test
|
||||
def shouldReplyToBangMessageUsingReply = {
|
||||
state.finished.reset
|
||||
val replyActor = newActor[ReplyActor]
|
||||
val replyActor = actorOf[ReplyActor]
|
||||
replyActor.start
|
||||
val senderActor = actorOf(new SenderActor(replyActor))
|
||||
senderActor.start
|
||||
|
|
@ -59,7 +59,7 @@ class ActorFireForgetRequestReplySpec extends JUnitSuite {
|
|||
@Test
|
||||
def shouldReplyToBangMessageUsingImplicitSender = {
|
||||
state.finished.reset
|
||||
val replyActor = newActor[ReplyActor]
|
||||
val replyActor = actorOf[ReplyActor]
|
||||
replyActor.start
|
||||
val senderActor = actorOf(new SenderActor(replyActor))
|
||||
senderActor.start
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class ActorRegistrySpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldGetActorByIdFromActorRegistry = {
|
||||
ActorRegistry.shutdownAll
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val actors = ActorRegistry.actorsFor("MyID")
|
||||
assert(actors.size === 1)
|
||||
|
|
@ -32,7 +32,7 @@ class ActorRegistrySpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldGetActorByUUIDFromActorRegistry = {
|
||||
ActorRegistry.shutdownAll
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
val uuid = actor.uuid
|
||||
actor.start
|
||||
val actorOrNone = ActorRegistry.actorFor(uuid)
|
||||
|
|
@ -43,7 +43,7 @@ class ActorRegistrySpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldGetActorByClassFromActorRegistry = {
|
||||
ActorRegistry.shutdownAll
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val actors = ActorRegistry.actorsFor(classOf[TestActor])
|
||||
assert(actors.size === 1)
|
||||
|
|
@ -54,7 +54,7 @@ class ActorRegistrySpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldGetActorByManifestFromActorRegistry = {
|
||||
ActorRegistry.shutdownAll
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val actors = ActorRegistry.actorsFor[TestActor]
|
||||
assert(actors.size === 1)
|
||||
|
|
@ -65,9 +65,9 @@ class ActorRegistrySpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldGetActorsByIdFromActorRegistry = {
|
||||
ActorRegistry.shutdownAll
|
||||
val actor1 = newActor[TestActor]
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = newActor[TestActor]
|
||||
val actor2 = actorOf[TestActor]
|
||||
actor2.start
|
||||
val actors = ActorRegistry.actorsFor("MyID")
|
||||
assert(actors.size === 2)
|
||||
|
|
@ -81,9 +81,9 @@ class ActorRegistrySpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldGetActorsByClassFromActorRegistry = {
|
||||
ActorRegistry.shutdownAll
|
||||
val actor1 = newActor[TestActor]
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = newActor[TestActor]
|
||||
val actor2 = actorOf[TestActor]
|
||||
actor2.start
|
||||
val actors = ActorRegistry.actorsFor(classOf[TestActor])
|
||||
assert(actors.size === 2)
|
||||
|
|
@ -97,9 +97,9 @@ class ActorRegistrySpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldGetActorsByManifestFromActorRegistry = {
|
||||
ActorRegistry.shutdownAll
|
||||
val actor1 = newActor[TestActor]
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = newActor[TestActor]
|
||||
val actor2 = actorOf[TestActor]
|
||||
actor2.start
|
||||
val actors = ActorRegistry.actorsFor[TestActor]
|
||||
assert(actors.size === 2)
|
||||
|
|
@ -113,9 +113,9 @@ class ActorRegistrySpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldGetAllActorsFromActorRegistry = {
|
||||
ActorRegistry.shutdownAll
|
||||
val actor1 = newActor[TestActor]
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = newActor[TestActor]
|
||||
val actor2 = actorOf[TestActor]
|
||||
actor2.start
|
||||
val actors = ActorRegistry.actors
|
||||
assert(actors.size === 2)
|
||||
|
|
@ -129,9 +129,9 @@ class ActorRegistrySpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldGetResponseByAllActorsInActorRegistryWhenInvokingForeach = {
|
||||
ActorRegistry.shutdownAll
|
||||
val actor1 = newActor[TestActor]
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = newActor[TestActor]
|
||||
val actor2 = actorOf[TestActor]
|
||||
actor2.start
|
||||
record = ""
|
||||
ActorRegistry.foreach(actor => actor !! "ping")
|
||||
|
|
@ -142,9 +142,9 @@ class ActorRegistrySpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldShutdownAllActorsInActorRegistry = {
|
||||
ActorRegistry.shutdownAll
|
||||
val actor1 = newActor[TestActor]
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = newActor[TestActor]
|
||||
val actor2 = actorOf[TestActor]
|
||||
actor2.start
|
||||
ActorRegistry.shutdownAll
|
||||
assert(ActorRegistry.actors.size === 0)
|
||||
|
|
@ -152,9 +152,9 @@ class ActorRegistrySpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldRemoveUnregisterActorInActorRegistry = {
|
||||
ActorRegistry.shutdownAll
|
||||
val actor1 = newActor[TestActor]
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = newActor[TestActor]
|
||||
val actor2 = actorOf[TestActor]
|
||||
actor2.start
|
||||
assert(ActorRegistry.actors.size === 2)
|
||||
ActorRegistry.unregister(actor1)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class ClientInitiatedRemoteActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def shouldSendOneWay = {
|
||||
val actor = newActor[RemoteActorSpecActorUnidirectional]
|
||||
val actor = actorOf[RemoteActorSpecActorUnidirectional]
|
||||
actor.makeRemote(HOSTNAME, PORT1)
|
||||
actor.start
|
||||
actor ! "OneWay"
|
||||
|
|
@ -100,10 +100,10 @@ class ClientInitiatedRemoteActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def shouldSendOneWayAndReceiveReply = {
|
||||
val actor = newActor[SendOneWayAndReplyReceiverActor]
|
||||
val actor = actorOf[SendOneWayAndReplyReceiverActor]
|
||||
actor.makeRemote(HOSTNAME, PORT1)
|
||||
actor.start
|
||||
val sender = newActor[SendOneWayAndReplySenderActor]
|
||||
val sender = actorOf[SendOneWayAndReplySenderActor]
|
||||
sender.setReplyToAddress(HOSTNAME, PORT2)
|
||||
sender.actor.asInstanceOf[SendOneWayAndReplySenderActor].sendTo = actor
|
||||
sender.start
|
||||
|
|
@ -117,7 +117,7 @@ class ClientInitiatedRemoteActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def shouldSendBangBangMessageAndReceiveReply = {
|
||||
val actor = newActor[RemoteActorSpecActorBidirectional]
|
||||
val actor = actorOf[RemoteActorSpecActorBidirectional]
|
||||
actor.makeRemote(HOSTNAME, PORT1)
|
||||
actor.start
|
||||
val result = actor !! "Hello"
|
||||
|
|
@ -128,7 +128,7 @@ class ClientInitiatedRemoteActorSpec extends JUnitSuite {
|
|||
@Test
|
||||
def shouldSendAndReceiveRemoteException = {
|
||||
implicit val timeout = 500000000L
|
||||
val actor = newActor[RemoteActorSpecActorBidirectional]
|
||||
val actor = actorOf[RemoteActorSpecActorBidirectional]
|
||||
actor.makeRemote(HOSTNAME, PORT1)
|
||||
actor.start
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class ExecutorBasedEventDrivenDispatcherActorSpec extends JUnitSuite {
|
|||
private val unit = TimeUnit.MILLISECONDS
|
||||
|
||||
@Test def shouldSendOneWay = {
|
||||
val actor = newActor[OneWayTestActor]
|
||||
val actor = actorOf[OneWayTestActor]
|
||||
actor.start
|
||||
val result = actor ! "OneWay"
|
||||
assert(OneWayTestActor.oneWay.await(1, TimeUnit.SECONDS))
|
||||
|
|
@ -41,7 +41,7 @@ class ExecutorBasedEventDrivenDispatcherActorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldSendReplySync = {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val result: String = (actor !! ("Hello", 10000)).get
|
||||
assert("World" === result)
|
||||
|
|
@ -49,7 +49,7 @@ class ExecutorBasedEventDrivenDispatcherActorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldSendReplyAsync = {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val result = actor !! "Hello"
|
||||
assert("World" === result.get.asInstanceOf[String])
|
||||
|
|
@ -57,7 +57,7 @@ class ExecutorBasedEventDrivenDispatcherActorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldSendReceiveException = {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
try {
|
||||
actor !! "Failure"
|
||||
|
|
|
|||
|
|
@ -84,8 +84,8 @@ class ExecutorBasedEventDrivenWorkStealingDispatcherSpec extends JUnitSuite with
|
|||
}
|
||||
|
||||
@Test def canNotUseActorsOfDifferentTypesInSameDispatcher: Unit = {
|
||||
val first = newActor[FirstActor]
|
||||
val second = newActor[SecondActor]
|
||||
val first = actorOf[FirstActor]
|
||||
val second = actorOf[SecondActor]
|
||||
|
||||
first.start
|
||||
intercept[IllegalStateException] {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ object ForwardActorSpec {
|
|||
|
||||
|
||||
class ForwardActor extends Actor {
|
||||
val receiverActor = newActor[ReceiverActor]
|
||||
val receiverActor = actorOf[ReceiverActor]
|
||||
receiverActor.start
|
||||
def receive = {
|
||||
case "SendBang" => receiverActor.forward("SendBang")
|
||||
|
|
@ -33,7 +33,7 @@ object ForwardActorSpec {
|
|||
}
|
||||
|
||||
class BangSenderActor extends Actor {
|
||||
val forwardActor = newActor[ForwardActor]
|
||||
val forwardActor = actorOf[ForwardActor]
|
||||
forwardActor.start
|
||||
forwardActor ! "SendBang"
|
||||
def receive = {
|
||||
|
|
@ -43,7 +43,7 @@ object ForwardActorSpec {
|
|||
|
||||
class BangBangSenderActor extends Actor {
|
||||
val latch = new CountDownLatch(1)
|
||||
val forwardActor = newActor[ForwardActor]
|
||||
val forwardActor = actorOf[ForwardActor]
|
||||
forwardActor.start
|
||||
(forwardActor !! "SendBangBang") match {
|
||||
case Some(_) => latch.countDown
|
||||
|
|
@ -60,7 +60,7 @@ class ForwardActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def shouldForwardActorReferenceWhenInvokingForwardOnBang {
|
||||
val senderActor = newActor[BangSenderActor]
|
||||
val senderActor = actorOf[BangSenderActor]
|
||||
val latch = senderActor.actor.asInstanceOf[BangSenderActor]
|
||||
.forwardActor.actor.asInstanceOf[ForwardActor]
|
||||
.receiverActor.actor.asInstanceOf[ReceiverActor]
|
||||
|
|
@ -73,7 +73,7 @@ class ForwardActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def shouldForwardActorReferenceWhenInvokingForwardOnBangBang {
|
||||
val senderActor = newActor[BangBangSenderActor]
|
||||
val senderActor = actorOf[BangBangSenderActor]
|
||||
senderActor.start
|
||||
val latch = senderActor.actor.asInstanceOf[BangBangSenderActor].latch
|
||||
assert(latch.await(1L, TimeUnit.SECONDS))
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class FutureSpec extends JUnitSuite {
|
|||
import FutureSpec._
|
||||
|
||||
@Test def shouldActorReplyResultThroughExplicitFuture {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val future = actor !!! "Hello"
|
||||
future.await
|
||||
|
|
@ -31,7 +31,7 @@ class FutureSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldActorReplyExceptionThroughExplicitFuture {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val future = actor !!! "Failure"
|
||||
future.await
|
||||
|
|
@ -42,9 +42,9 @@ class FutureSpec extends JUnitSuite {
|
|||
|
||||
/*
|
||||
@Test def shouldFutureAwaitEitherLeft = {
|
||||
val actor1 = newActor[TestActor]
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = newActor[TestActor]
|
||||
val actor2 = actorOf[TestActor]
|
||||
actor2.start
|
||||
val future1 = actor1 !!! "Hello"
|
||||
val future2 = actor2 !!! "NoReply"
|
||||
|
|
@ -56,9 +56,9 @@ class FutureSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldFutureAwaitEitherRight = {
|
||||
val actor1 = newActor[TestActor]
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = newActor[TestActor]
|
||||
val actor2 = actorOf[TestActor]
|
||||
actor2.start
|
||||
val future1 = actor1 !!! "NoReply"
|
||||
val future2 = actor2 !!! "Hello"
|
||||
|
|
@ -70,9 +70,9 @@ class FutureSpec extends JUnitSuite {
|
|||
}
|
||||
*/
|
||||
@Test def shouldFutureAwaitOneLeft = {
|
||||
val actor1 = newActor[TestActor]
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = newActor[TestActor]
|
||||
val actor2 = actorOf[TestActor]
|
||||
actor2.start
|
||||
val future1 = actor1 !!! "NoReply"
|
||||
val future2 = actor2 !!! "Hello"
|
||||
|
|
@ -84,9 +84,9 @@ class FutureSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldFutureAwaitOneRight = {
|
||||
val actor1 = newActor[TestActor]
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = newActor[TestActor]
|
||||
val actor2 = actorOf[TestActor]
|
||||
actor2.start
|
||||
val future1 = actor1 !!! "Hello"
|
||||
val future2 = actor2 !!! "NoReply"
|
||||
|
|
@ -98,9 +98,9 @@ class FutureSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldFutureAwaitAll = {
|
||||
val actor1 = newActor[TestActor]
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = newActor[TestActor]
|
||||
val actor2 = actorOf[TestActor]
|
||||
actor2.start
|
||||
val future1 = actor1 !!! "Hello"
|
||||
val future2 = actor2 !!! "Hello"
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def shouldMapShouldNotRollbackStateForStatefulServerInCaseOfSuccess = {
|
||||
val stateful = newActor[InMemStatefulActor]
|
||||
val stateful = actorOf[InMemStatefulActor]
|
||||
stateful.start
|
||||
stateful !! SetMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "init") // set init state
|
||||
stateful !! Success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired
|
||||
|
|
@ -132,7 +132,7 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
def shouldOneWayMapShouldRollbackStateForStatefulServerInCaseOfFailure = {
|
||||
val stateful = actorOf(new InMemStatefulActor(2))
|
||||
stateful.start
|
||||
val failer = newActor[InMemFailerActor]
|
||||
val failer = actorOf[InMemFailerActor]
|
||||
failer.start
|
||||
stateful ! SetMapStateOneWay("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") // set init state
|
||||
stateful ! FailureOneWay("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method
|
||||
|
|
@ -143,10 +143,10 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def shouldMapShouldRollbackStateForStatefulServerInCaseOfFailure = {
|
||||
val stateful = newActor[InMemStatefulActor]
|
||||
val stateful = actorOf[InMemStatefulActor]
|
||||
stateful.start
|
||||
stateful !! SetMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") // set init state
|
||||
val failer = newActor[InMemFailerActor]
|
||||
val failer = actorOf[InMemFailerActor]
|
||||
failer.start
|
||||
try {
|
||||
stateful !! Failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method
|
||||
|
|
@ -168,7 +168,7 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def shouldVectorShouldNotRollbackStateForStatefulServerInCaseOfSuccess = {
|
||||
val stateful = newActor[InMemStatefulActor]
|
||||
val stateful = actorOf[InMemStatefulActor]
|
||||
stateful.start
|
||||
stateful !! SetVectorState("init") // set init state
|
||||
stateful !! Success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired
|
||||
|
|
@ -181,7 +181,7 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
stateful.start
|
||||
stateful ! SetVectorStateOneWay("init") // set init state
|
||||
Thread.sleep(1000)
|
||||
val failer = newActor[InMemFailerActor]
|
||||
val failer = actorOf[InMemFailerActor]
|
||||
failer.start
|
||||
stateful ! FailureOneWay("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method
|
||||
val notifier: Option[CountDownLatch] = stateful !! GetNotifier
|
||||
|
|
@ -191,10 +191,10 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def shouldVectorShouldRollbackStateForStatefulServerInCaseOfFailure = {
|
||||
val stateful = newActor[InMemStatefulActor]
|
||||
val stateful = actorOf[InMemStatefulActor]
|
||||
stateful.start
|
||||
stateful !! SetVectorState("init") // set init state
|
||||
val failer = newActor[InMemFailerActor]
|
||||
val failer = actorOf[InMemFailerActor]
|
||||
failer.start
|
||||
try {
|
||||
stateful !! Failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method
|
||||
|
|
@ -216,7 +216,7 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def shouldRefShouldNotRollbackStateForStatefulServerInCaseOfSuccess = {
|
||||
val stateful = newActor[InMemStatefulActor]
|
||||
val stateful = actorOf[InMemStatefulActor]
|
||||
stateful.start
|
||||
stateful !! SetRefState("init") // set init state
|
||||
stateful !! Success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired
|
||||
|
|
@ -229,7 +229,7 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
stateful.start
|
||||
stateful ! SetRefStateOneWay("init") // set init state
|
||||
Thread.sleep(1000)
|
||||
val failer = newActor[InMemFailerActor]
|
||||
val failer = actorOf[InMemFailerActor]
|
||||
failer.start
|
||||
stateful ! FailureOneWay("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method
|
||||
val notifier: Option[CountDownLatch] = stateful !! GetNotifier
|
||||
|
|
@ -239,10 +239,10 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def shouldRefShouldRollbackStateForStatefulServerInCaseOfFailure = {
|
||||
val stateful = newActor[InMemStatefulActor]
|
||||
val stateful = actorOf[InMemStatefulActor]
|
||||
stateful.start
|
||||
stateful !! SetRefState("init") // set init state
|
||||
val failer = newActor[InMemFailerActor]
|
||||
val failer = actorOf[InMemFailerActor]
|
||||
failer.start
|
||||
try {
|
||||
stateful !! Failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class ProtobufActorMessageSerializationSpec extends JUnitSuite {
|
|||
def init() {
|
||||
server = new RemoteServer
|
||||
server.start(HOSTNAME, PORT)
|
||||
server.register("RemoteActorSpecActorBidirectional", newActor[RemoteActorSpecActorBidirectional])
|
||||
server.register("RemoteActorSpecActorBidirectional", actorOf[RemoteActorSpecActorBidirectional])
|
||||
Thread.sleep(1000)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class ReactorBasedSingleThreadEventDrivenDispatcherActorSpec extends JUnitSuite
|
|||
private val unit = TimeUnit.MILLISECONDS
|
||||
|
||||
@Test def shouldSendOneWay = {
|
||||
val actor = newActor[OneWayTestActor]
|
||||
val actor = actorOf[OneWayTestActor]
|
||||
actor.start
|
||||
val result = actor ! "OneWay"
|
||||
assert(OneWayTestActor.oneWay.await(1, TimeUnit.SECONDS))
|
||||
|
|
@ -44,7 +44,7 @@ class ReactorBasedSingleThreadEventDrivenDispatcherActorSpec extends JUnitSuite
|
|||
}
|
||||
|
||||
@Test def shouldSendReplySync = {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val result: String = (actor !! ("Hello", 10000)).get
|
||||
assert("World" === result)
|
||||
|
|
@ -52,7 +52,7 @@ class ReactorBasedSingleThreadEventDrivenDispatcherActorSpec extends JUnitSuite
|
|||
}
|
||||
|
||||
@Test def shouldSendReplyAsync = {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val result = actor !! "Hello"
|
||||
assert("World" === result.get.asInstanceOf[String])
|
||||
|
|
@ -60,7 +60,7 @@ class ReactorBasedSingleThreadEventDrivenDispatcherActorSpec extends JUnitSuite
|
|||
}
|
||||
|
||||
@Test def shouldSendReceiveException = {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
try {
|
||||
actor !! "Failure"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class ReactorBasedThreadPoolEventDrivenDispatcherActorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldSendReplySync = {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val result: String = (actor !! ("Hello", 10000)).get
|
||||
assert("World" === result)
|
||||
|
|
@ -47,7 +47,7 @@ class ReactorBasedThreadPoolEventDrivenDispatcherActorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldSendReplyAsync = {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val result = actor !! "Hello"
|
||||
assert("World" === result.get.asInstanceOf[String])
|
||||
|
|
@ -55,7 +55,7 @@ class ReactorBasedThreadPoolEventDrivenDispatcherActorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldSendReceiveException = {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
try {
|
||||
actor !! "Failure"
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ class RemoteSupervisorSpec extends JUnitSuite {
|
|||
// Then create a concrete container in which we mix in support for the specific
|
||||
// implementation of the Actors we want to use.
|
||||
|
||||
pingpong1 = newActor[RemotePingPong1Actor]
|
||||
pingpong1 = actorOf[RemotePingPong1Actor]
|
||||
pingpong1.makeRemote(RemoteServer.HOSTNAME, 9988)
|
||||
|
||||
val factory = SupervisorFactory(
|
||||
|
|
@ -350,7 +350,7 @@ class RemoteSupervisorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
def getSingleActorOneForOneSupervisor: Supervisor = {
|
||||
pingpong1 = newActor[RemotePingPong1Actor]
|
||||
pingpong1 = actorOf[RemotePingPong1Actor]
|
||||
pingpong1.makeRemote(RemoteServer.HOSTNAME, 9988)
|
||||
|
||||
val factory = SupervisorFactory(
|
||||
|
|
@ -364,11 +364,11 @@ class RemoteSupervisorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
def getMultipleActorsAllForOneConf: Supervisor = {
|
||||
pingpong1 = newActor[RemotePingPong1Actor]
|
||||
pingpong1 = actorOf[RemotePingPong1Actor]
|
||||
pingpong1.makeRemote(RemoteServer.HOSTNAME, 9988)
|
||||
pingpong2 = newActor[RemotePingPong2Actor]
|
||||
pingpong2 = actorOf[RemotePingPong2Actor]
|
||||
pingpong2.makeRemote(RemoteServer.HOSTNAME, 9988)
|
||||
pingpong3 = newActor[RemotePingPong3Actor]
|
||||
pingpong3 = actorOf[RemotePingPong3Actor]
|
||||
pingpong3.makeRemote(RemoteServer.HOSTNAME, 9988)
|
||||
|
||||
val factory = SupervisorFactory(
|
||||
|
|
@ -390,11 +390,11 @@ class RemoteSupervisorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
def getMultipleActorsOneForOneConf: Supervisor = {
|
||||
pingpong1 = newActor[RemotePingPong1Actor]
|
||||
pingpong1 = actorOf[RemotePingPong1Actor]
|
||||
pingpong1.makeRemote(RemoteServer.HOSTNAME, 9988)
|
||||
pingpong2 = newActor[RemotePingPong2Actor]
|
||||
pingpong2 = actorOf[RemotePingPong2Actor]
|
||||
pingpong2.makeRemote(RemoteServer.HOSTNAME, 9988)
|
||||
pingpong3 = newActor[RemotePingPong3Actor]
|
||||
pingpong3 = actorOf[RemotePingPong3Actor]
|
||||
pingpong3.makeRemote(RemoteServer.HOSTNAME, 9988)
|
||||
|
||||
val factory = SupervisorFactory(
|
||||
|
|
@ -416,11 +416,11 @@ class RemoteSupervisorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
def getNestedSupervisorsAllForOneConf: Supervisor = {
|
||||
pingpong1 = newActor[RemotePingPong1Actor]
|
||||
pingpong1 = actorOf[RemotePingPong1Actor]
|
||||
pingpong1.makeRemote(RemoteServer.HOSTNAME, 9988)
|
||||
pingpong2 = newActor[RemotePingPong2Actor]
|
||||
pingpong2 = actorOf[RemotePingPong2Actor]
|
||||
pingpong2.makeRemote(RemoteServer.HOSTNAME, 9988)
|
||||
pingpong3 = newActor[RemotePingPong3Actor]
|
||||
pingpong3 = actorOf[RemotePingPong3Actor]
|
||||
pingpong3.makeRemote(RemoteServer.HOSTNAME, 9988)
|
||||
|
||||
val factory = SupervisorFactory(
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ object ServerInitiatedRemoteActorServer {
|
|||
|
||||
def run = {
|
||||
RemoteNode.start("localhost", 9999)
|
||||
RemoteNode.register("hello-service", newActor[HelloWorldActor])
|
||||
RemoteNode.register("hello-service", actorOf[HelloWorldActor])
|
||||
}
|
||||
|
||||
def main(args: Array[String]) = run
|
||||
|
|
|
|||
|
|
@ -67,9 +67,9 @@ class ServerInitiatedRemoteActorSpec extends JUnitSuite {
|
|||
|
||||
server.start(HOSTNAME, PORT)
|
||||
|
||||
server.register(newActor[RemoteActorSpecActorUnidirectional])
|
||||
server.register(newActor[RemoteActorSpecActorBidirectional])
|
||||
server.register(newActor[RemoteActorSpecActorAsyncSender])
|
||||
server.register(actorOf[RemoteActorSpecActorUnidirectional])
|
||||
server.register(actorOf[RemoteActorSpecActorBidirectional])
|
||||
server.register(actorOf[RemoteActorSpecActorAsyncSender])
|
||||
|
||||
Thread.sleep(1000)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ object ActorShutdownRunner {
|
|||
}
|
||||
}
|
||||
|
||||
val myActor = newActor[MyActor]
|
||||
val myActor = actorOf[MyActor]
|
||||
myActor.start
|
||||
myActor ! "test"
|
||||
myActor.stop
|
||||
|
|
|
|||
|
|
@ -419,7 +419,7 @@ class SupervisorSpec extends JUnitSuite {
|
|||
// Creat some supervisors with different configurations
|
||||
|
||||
def getSingleActorAllForOneSupervisor: Supervisor = {
|
||||
pingpong1 = newActor[PingPong1Actor]
|
||||
pingpong1 = actorOf[PingPong1Actor]
|
||||
|
||||
val factory = SupervisorFactory(
|
||||
SupervisorConfig(
|
||||
|
|
@ -432,7 +432,7 @@ class SupervisorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
def getSingleActorOneForOneSupervisor: Supervisor = {
|
||||
pingpong1 = newActor[PingPong1Actor]
|
||||
pingpong1 = actorOf[PingPong1Actor]
|
||||
|
||||
val factory = SupervisorFactory(
|
||||
SupervisorConfig(
|
||||
|
|
@ -445,9 +445,9 @@ class SupervisorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
def getMultipleActorsAllForOneConf: Supervisor = {
|
||||
pingpong1 = newActor[PingPong1Actor]
|
||||
pingpong2 = newActor[PingPong2Actor]
|
||||
pingpong3 = newActor[PingPong3Actor]
|
||||
pingpong1 = actorOf[PingPong1Actor]
|
||||
pingpong2 = actorOf[PingPong2Actor]
|
||||
pingpong3 = actorOf[PingPong3Actor]
|
||||
|
||||
val factory = SupervisorFactory(
|
||||
SupervisorConfig(
|
||||
|
|
@ -468,9 +468,9 @@ class SupervisorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
def getMultipleActorsOneForOneConf: Supervisor = {
|
||||
pingpong1 = newActor[PingPong1Actor]
|
||||
pingpong2 = newActor[PingPong2Actor]
|
||||
pingpong3 = newActor[PingPong3Actor]
|
||||
pingpong1 = actorOf[PingPong1Actor]
|
||||
pingpong2 = actorOf[PingPong2Actor]
|
||||
pingpong3 = actorOf[PingPong3Actor]
|
||||
|
||||
val factory = SupervisorFactory(
|
||||
SupervisorConfig(
|
||||
|
|
@ -491,9 +491,9 @@ class SupervisorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
def getNestedSupervisorsAllForOneConf: Supervisor = {
|
||||
pingpong1 = newActor[PingPong1Actor]
|
||||
pingpong2 = newActor[PingPong2Actor]
|
||||
pingpong3 = newActor[PingPong3Actor]
|
||||
pingpong1 = actorOf[PingPong1Actor]
|
||||
pingpong2 = actorOf[PingPong2Actor]
|
||||
pingpong3 = actorOf[PingPong3Actor]
|
||||
|
||||
val factory = SupervisorFactory(
|
||||
SupervisorConfig(
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class ThreadBasedActorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldSendReplySync = {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val result: String = (actor !! ("Hello", 10000)).get
|
||||
assert("World" === result)
|
||||
|
|
@ -48,7 +48,7 @@ class ThreadBasedActorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldSendReplyAsync = {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
val result = actor !! "Hello"
|
||||
assert("World" === result.get.asInstanceOf[String])
|
||||
|
|
@ -56,7 +56,7 @@ class ThreadBasedActorSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test def shouldSendReceiveException = {
|
||||
val actor = newActor[TestActor]
|
||||
val actor = actorOf[TestActor]
|
||||
actor.start
|
||||
try {
|
||||
actor !! "Failure"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class BasicAuthenticatorSpec extends junit.framework.TestCase
|
|||
with Suite with MockitoSugar with MustMatchers {
|
||||
import BasicAuthenticatorSpec._
|
||||
|
||||
val authenticator = newActor[BasicAuthenticator]
|
||||
val authenticator = actorOf[BasicAuthenticator]
|
||||
authenticator.start
|
||||
|
||||
@Test def testChallenge = {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class CassandraPersistentActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testMapShouldNotRollbackStateForStatefulServerInCaseOfSuccess = {
|
||||
val stateful = newActor[CassandraPersistentActor]
|
||||
val stateful = actorOf[CassandraPersistentActor]
|
||||
stateful.start
|
||||
stateful !! SetMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "init") // set init state
|
||||
stateful !! Success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired
|
||||
|
|
@ -86,10 +86,10 @@ class CassandraPersistentActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testMapShouldRollbackStateForStatefulServerInCaseOfFailure = {
|
||||
val stateful = newActor[CassandraPersistentActor]
|
||||
val stateful = actorOf[CassandraPersistentActor]
|
||||
stateful.start
|
||||
stateful !! SetMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") // set init state
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
val failer = actorOf[PersistentFailerActor]
|
||||
failer.start
|
||||
try {
|
||||
stateful !! Failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method
|
||||
|
|
@ -101,7 +101,7 @@ class CassandraPersistentActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testVectorShouldNotRollbackStateForStatefulServerInCaseOfSuccess = {
|
||||
val stateful = newActor[CassandraPersistentActor]
|
||||
val stateful = actorOf[CassandraPersistentActor]
|
||||
stateful.start
|
||||
stateful !! SetVectorState("init") // set init state
|
||||
stateful !! Success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired
|
||||
|
|
@ -110,10 +110,10 @@ class CassandraPersistentActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testVectorShouldRollbackStateForStatefulServerInCaseOfFailure = {
|
||||
val stateful = newActor[CassandraPersistentActor]
|
||||
val stateful = actorOf[CassandraPersistentActor]
|
||||
stateful.start
|
||||
stateful !! SetVectorState("init") // set init state
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
val failer = actorOf[PersistentFailerActor]
|
||||
failer.start
|
||||
try {
|
||||
stateful !! Failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method
|
||||
|
|
@ -124,7 +124,7 @@ class CassandraPersistentActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testRefShouldNotRollbackStateForStatefulServerInCaseOfSuccess = {
|
||||
val stateful = newActor[CassandraPersistentActor]
|
||||
val stateful = actorOf[CassandraPersistentActor]
|
||||
stateful.start
|
||||
stateful !! SetRefState("init") // set init state
|
||||
stateful !! Success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired
|
||||
|
|
@ -134,10 +134,10 @@ class CassandraPersistentActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testRefShouldRollbackStateForStatefulServerInCaseOfFailure = {
|
||||
val stateful = newActor[CassandraPersistentActor]
|
||||
val stateful = actorOf[CassandraPersistentActor]
|
||||
stateful.start
|
||||
stateful !! SetRefState("init") // set init state
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
val failer = actorOf[PersistentFailerActor]
|
||||
failer.start
|
||||
try {
|
||||
stateful !! Failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method
|
||||
|
|
|
|||
|
|
@ -105,9 +105,9 @@ class BankAccountActor extends Transactor {
|
|||
class MongoPersistentActorSpec extends JUnitSuite {
|
||||
@Test
|
||||
def testSuccessfulDebit = {
|
||||
val bactor = newActor[BankAccountActor]
|
||||
val bactor = actorOf[BankAccountActor]
|
||||
bactor.start
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
val failer = actorOf[PersistentFailerActor]
|
||||
failer.start
|
||||
bactor !! Credit("a-123", 5000)
|
||||
bactor !! Debit("a-123", 3000, failer)
|
||||
|
|
@ -137,14 +137,14 @@ class MongoPersistentActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testUnsuccessfulDebit = {
|
||||
val bactor = newActor[BankAccountActor]
|
||||
val bactor = actorOf[BankAccountActor]
|
||||
bactor.start
|
||||
bactor !! Credit("a-123", 5000)
|
||||
|
||||
val JsNumber(b) = (bactor !! Balance("a-123")).get.asInstanceOf[JsValue]
|
||||
assertEquals(BigInt(5000), BigInt(b.intValue))
|
||||
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
val failer = actorOf[PersistentFailerActor]
|
||||
failer.start
|
||||
try {
|
||||
bactor !! Debit("a-123", 7000, failer)
|
||||
|
|
@ -160,14 +160,14 @@ class MongoPersistentActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testUnsuccessfulMultiDebit = {
|
||||
val bactor = newActor[BankAccountActor]
|
||||
val bactor = actorOf[BankAccountActor]
|
||||
bactor.start
|
||||
bactor !! Credit("a-123", 5000)
|
||||
|
||||
val JsNumber(b) = (bactor !! Balance("a-123")).get.asInstanceOf[JsValue]
|
||||
assertEquals(BigInt(5000), BigInt(b.intValue))
|
||||
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
val failer = actorOf[PersistentFailerActor]
|
||||
failer.start
|
||||
try {
|
||||
bactor !! MultiDebit("a-123", List(500, 2000, 1000, 3000), failer)
|
||||
|
|
|
|||
|
|
@ -101,9 +101,9 @@ import org.scalatest.junit.JUnitSuite
|
|||
class RedisPersistentActorSpec extends JUnitSuite {
|
||||
@Test
|
||||
def testSuccessfulDebit = {
|
||||
val bactor = newActor[AccountActor]
|
||||
val bactor = actorOf[AccountActor]
|
||||
bactor.start
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
val failer = actorOf[PersistentFailerActor]
|
||||
failer.start
|
||||
bactor !! Credit("a-123", 5000)
|
||||
bactor !! Debit("a-123", 3000, failer)
|
||||
|
|
@ -127,12 +127,12 @@ class RedisPersistentActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testUnsuccessfulDebit = {
|
||||
val bactor = newActor[AccountActor]
|
||||
val bactor = actorOf[AccountActor]
|
||||
bactor.start
|
||||
bactor !! Credit("a-123", 5000)
|
||||
assertEquals(BigInt(5000), (bactor !! Balance("a-123")).get)
|
||||
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
val failer = actorOf[PersistentFailerActor]
|
||||
failer.start
|
||||
try {
|
||||
bactor !! Debit("a-123", 7000, failer)
|
||||
|
|
@ -148,13 +148,13 @@ class RedisPersistentActorSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testUnsuccessfulMultiDebit = {
|
||||
val bactor = newActor[AccountActor]
|
||||
val bactor = actorOf[AccountActor]
|
||||
bactor.start
|
||||
bactor !! Credit("a-123", 5000)
|
||||
|
||||
assertEquals(BigInt(5000), (bactor !! (Balance("a-123"), 5000)).get)
|
||||
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
val failer = actorOf[PersistentFailerActor]
|
||||
failer.start
|
||||
try {
|
||||
bactor !! MultiDebit("a-123", List(500, 2000, 1000, 3000), failer)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ import org.scalatest.junit.JUnitSuite
|
|||
class RedisPersistentQSpec extends JUnitSuite {
|
||||
@Test
|
||||
def testSuccessfulNQ = {
|
||||
val qa = newActor[QueueActor]
|
||||
val qa = actorOf[QueueActor]
|
||||
qa.start
|
||||
qa !! NQ("a-123")
|
||||
qa !! NQ("a-124")
|
||||
|
|
@ -64,7 +64,7 @@ class RedisPersistentQSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testSuccessfulDQ = {
|
||||
val qa = newActor[QueueActor]
|
||||
val qa = actorOf[QueueActor]
|
||||
qa.start
|
||||
qa !! NQ("a-123")
|
||||
qa !! NQ("a-124")
|
||||
|
|
@ -80,9 +80,9 @@ class RedisPersistentQSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testSuccessfulMNDQ = {
|
||||
val qa = newActor[QueueActor]
|
||||
val qa = actorOf[QueueActor]
|
||||
qa.start
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
val failer = actorOf[PersistentFailerActor]
|
||||
failer.start
|
||||
|
||||
qa !! NQ("a-123")
|
||||
|
|
@ -100,9 +100,9 @@ class RedisPersistentQSpec extends JUnitSuite {
|
|||
|
||||
@Test
|
||||
def testMixedMNDQ = {
|
||||
val qa = newActor[QueueActor]
|
||||
val qa = actorOf[QueueActor]
|
||||
qa.start
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
val failer = actorOf[PersistentFailerActor]
|
||||
failer.start
|
||||
|
||||
// 3 enqueues
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class RedisPersistentSortedSetSpec extends
|
|||
val h6 = Hacker("Alan Turing", "1912")
|
||||
|
||||
describe("Add and report cardinality of the set") {
|
||||
val qa = newActor[SortedSetActor]
|
||||
val qa = actorOf[SortedSetActor]
|
||||
qa.start
|
||||
|
||||
it("should enter 6 hackers") {
|
||||
|
|
@ -167,10 +167,10 @@ class RedisPersistentSortedSetSpec extends
|
|||
|
||||
describe("Transaction semantics") {
|
||||
it("should rollback on exception") {
|
||||
val qa = newActor[SortedSetActor]
|
||||
val qa = actorOf[SortedSetActor]
|
||||
qa.start
|
||||
|
||||
val failer = newActor[PersistentFailerActor]
|
||||
val failer = actorOf[PersistentFailerActor]
|
||||
failer.start
|
||||
|
||||
(qa !! SIZE).get.asInstanceOf[Int] should equal(0)
|
||||
|
|
@ -195,7 +195,7 @@ class RedisPersistentSortedSetSpec extends
|
|||
|
||||
describe("zrange") {
|
||||
it ("should report proper range") {
|
||||
val qa = newActor[SortedSetActor]
|
||||
val qa = actorOf[SortedSetActor]
|
||||
qa.start
|
||||
qa !! ADD(h1)
|
||||
qa !! ADD(h2)
|
||||
|
|
@ -214,7 +214,7 @@ class RedisPersistentSortedSetSpec extends
|
|||
}
|
||||
|
||||
it ("should report proper rge") {
|
||||
val qa = newActor[SortedSetActor]
|
||||
val qa = actorOf[SortedSetActor]
|
||||
qa.start
|
||||
qa !! ADD(h1)
|
||||
qa !! ADD(h2)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ object Application1 {
|
|||
def main(args: Array[String]) {
|
||||
implicit val sender: Option[ActorRef] = None
|
||||
|
||||
val actor1 = newActor[RemoteActor1]
|
||||
val actor1 = actorOf[RemoteActor1]
|
||||
val actor2 = RemoteClient.actorFor("remote2", "localhost", 7777)
|
||||
|
||||
actor1.start
|
||||
|
|
|
|||
|
|
@ -17,6 +17,6 @@ object Application2 {
|
|||
val camelService = CamelService.newInstance
|
||||
camelService.load
|
||||
RemoteNode.start("localhost", 7777)
|
||||
RemoteNode.register("remote2", newActor[RemoteActor2].start)
|
||||
RemoteNode.register("remote2", actorOf[RemoteActor2].start)
|
||||
}
|
||||
}
|
||||
|
|
@ -28,13 +28,13 @@ class Boot {
|
|||
val factory = SupervisorFactory(
|
||||
SupervisorConfig(
|
||||
RestartStrategy(OneForOne, 3, 100, List(classOf[Exception])),
|
||||
Supervise(newActor[Consumer1], LifeCycle(Permanent)) ::
|
||||
Supervise(newActor[Consumer2], LifeCycle(Permanent)) :: Nil))
|
||||
Supervise(actorOf[Consumer1], LifeCycle(Permanent)) ::
|
||||
Supervise(actorOf[Consumer2], LifeCycle(Permanent)) :: Nil))
|
||||
factory.newInstance.start
|
||||
|
||||
// Routing example
|
||||
|
||||
val producer = newActor[Producer1]
|
||||
val producer = actorOf[Producer1]
|
||||
val mediator = actorOf(new Transformer(producer))
|
||||
val consumer = actorOf(new Consumer3(mediator))
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ Then to run the sample:
|
|||
4. In the first REPL you get execute:
|
||||
- scala> import sample.chat._
|
||||
- scala> import se.scalablesolutions.akka.actor.Actor._
|
||||
- scala> val chatService = newActor[ChatService].start
|
||||
- scala> val chatService = actorOf[ChatService].start
|
||||
5. In the second REPL you get execute:
|
||||
- scala> import sample.chat._
|
||||
- scala> Runner.run
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ Then to run the sample:
|
|||
2. In the first REPL you get execute:
|
||||
- scala> import sample.chat._
|
||||
- scala> import se.scalablesolutions.akka.actor.Actor._
|
||||
- scala> val chatService = newActor[ChatService].start
|
||||
- scala> val chatService = actorOf[ChatService].start
|
||||
3. In the second REPL you get execute:
|
||||
- scala> import sample.chat._
|
||||
- scala> Runner.run
|
||||
|
|
@ -197,7 +197,7 @@ trait ChatServer extends Actor {
|
|||
* Class encapsulating the full Chat Service.
|
||||
* Start service by invoking:
|
||||
* <pre>
|
||||
* val chatService = Actor.newActor[ChatService].start
|
||||
* val chatService = Actor.actorOf[ChatService].start
|
||||
* </pre>
|
||||
*/
|
||||
class ChatService extends
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ class Boot extends Logging {
|
|||
SupervisorConfig(
|
||||
RestartStrategy(OneForOne, 3, 100, List(classOf[Exception])),
|
||||
Supervise(
|
||||
newActor[SimpleService],
|
||||
actorOf[SimpleService],
|
||||
LifeCycle(Permanent)) ::
|
||||
Supervise(
|
||||
newActor[PersistentSimpleService],
|
||||
actorOf[PersistentSimpleService],
|
||||
LifeCycle(Permanent)) ::
|
||||
Nil))
|
||||
factory.newInstance.start
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ object ClientManagedRemoteActorServer extends Logging {
|
|||
object ClientManagedRemoteActorClient extends Logging {
|
||||
|
||||
def run = {
|
||||
val actor = newActor[RemoteHelloWorldActor]
|
||||
val actor = actorOf[RemoteHelloWorldActor]
|
||||
log.info("Remote actor created, moved to the server")
|
||||
log.info("Sending 'Hello' to remote actor")
|
||||
val result = actor !! "Hello"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ object ServerManagedRemoteActorServer extends Logging {
|
|||
def run = {
|
||||
RemoteNode.start("localhost", 9999)
|
||||
log.info("Remote node started")
|
||||
RemoteNode.register("hello-service", newActor[HelloWorldActor])
|
||||
RemoteNode.register("hello-service", actorOf[HelloWorldActor])
|
||||
log.info("Remote actor registered and started")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,16 +27,16 @@ class Boot {
|
|||
SupervisorConfig(
|
||||
RestartStrategy(OneForOne, 3, 100,List(classOf[Exception])),
|
||||
Supervise(
|
||||
newActor[SimpleService],
|
||||
actorOf[SimpleService],
|
||||
LifeCycle(Permanent)) ::
|
||||
Supervise(
|
||||
newActor[Chat],
|
||||
actorOf[Chat],
|
||||
LifeCycle(Permanent)) ::
|
||||
Supervise(
|
||||
newActor[PersistentSimpleService],
|
||||
actorOf[PersistentSimpleService],
|
||||
LifeCycle(Permanent)) ::
|
||||
Supervise(
|
||||
newActor[PubSub],
|
||||
actorOf[PubSub],
|
||||
LifeCycle(Permanent))
|
||||
:: Nil))
|
||||
factory.newInstance.start
|
||||
|
|
|
|||
|
|
@ -18,18 +18,18 @@ class Boot {
|
|||
// Dummy implementations of all authentication actors
|
||||
// see akka.conf to enable one of these for the AkkaSecurityFilterFactory
|
||||
Supervise(
|
||||
newActor[BasicAuthenticationService],
|
||||
actorOf[BasicAuthenticationService],
|
||||
LifeCycle(Permanent)) ::
|
||||
/**
|
||||
Supervise(
|
||||
newActor[DigestAuthenticationService],
|
||||
actorOf[DigestAuthenticationService],
|
||||
LifeCycle(Permanent)) ::
|
||||
Supervise(
|
||||
newActor[SpnegoAuthenticationService],
|
||||
actorOf[SpnegoAuthenticationService],
|
||||
LifeCycle(Permanent)) ::
|
||||
**/
|
||||
Supervise(
|
||||
newActor[SecureTickActor],
|
||||
actorOf[SecureTickActor],
|
||||
LifeCycle(Permanent)):: Nil))
|
||||
|
||||
val supervisor = factory.newInstance
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue