本文整理汇总了Scala中akka.actor.AddressFromURIString类的典型用法代码示例。如果您正苦于以下问题:Scala AddressFromURIString类的具体用法?Scala AddressFromURIString怎么用?Scala AddressFromURIString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AddressFromURIString类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: ControllerSpec
//设置package包名称以及导入依赖的类
package akka.remote.testconductor
import akka.testkit.AkkaSpec
import akka.actor.{ PoisonPill, Props, AddressFromURIString }
import akka.testkit.ImplicitSender
import akka.remote.testconductor.Controller.NodeInfo
import java.net.InetSocketAddress
import java.net.InetAddress
object ControllerSpec {
val config = """
akka.testconductor.barrier-timeout = 5s
akka.actor.provider = akka.remote.RemoteActorRefProvider
akka.actor.debug.fsm = on
akka.actor.debug.lifecycle = on
"""
}
class ControllerSpec extends AkkaSpec(ControllerSpec.config) with ImplicitSender {
val A = RoleName("a")
val B = RoleName("b")
"A Controller" must {
"publish its nodes" in {
val c = system.actorOf(Props(classOf[Controller], 1, new InetSocketAddress(InetAddress.getLocalHost, 0)))
c ! NodeInfo(A, AddressFromURIString("akka://sys"), testActor)
expectMsg(ToClient(Done))
c ! NodeInfo(B, AddressFromURIString("akka://sys"), testActor)
expectMsg(ToClient(Done))
c ! Controller.GetNodes
expectMsgType[Iterable[RoleName]].toSet should be(Set(A, B))
c ! PoisonPill // clean up so network connections don't accumulate during test run
}
}
}