ZeroMQ module's ConcurrentSocketActorSpec fails.

* Fixed usage of extension. See #1746
* Clarified usage of load extensions in docs. See #1745
This commit is contained in:
Patrik Nordwall 2012-01-30 16:47:33 +01:00
parent 945ab2c6ab
commit 269ff0aa96
4 changed files with 29 additions and 7 deletions

View file

@ -54,6 +54,12 @@ Loading from Configuration
To be able to load extensions from your Akka configuration you must add FQCNs of implementations of either ``ExtensionId`` or ``ExtensionIdProvider``
in the "akka.extensions" section of the config you provide to your ``ActorSystem``.
::
akka {
extensions = ["akka.docs.extension.ExtensionDocTestBase.CountExtension"]
}
Applicability
=============

View file

@ -41,6 +41,15 @@ object CountExtension
//#extensionid
object ExtensionDocSpec {
val config = """
//#config
akka {
extensions = ["akka.docs.extension.CountExtension$"]
}
//#config
"""
//#extension-usage-actor
class MyActor extends Actor {
@ -64,7 +73,7 @@ object ExtensionDocSpec {
//#extension-usage-actor-trait
}
class ExtensionDocSpec extends AkkaSpec {
class ExtensionDocSpec extends AkkaSpec(ExtensionDocSpec.config) {
import ExtensionDocSpec._
"demonstrate how to create an extension in Scala" in {
@ -73,4 +82,10 @@ class ExtensionDocSpec extends AkkaSpec {
//#extension-usage
}
"demonstrate how to lookup a configured extension in Scala" in {
//#extension-lookup
system.extension(CountExtension)
//#extension-lookup
}
}

View file

@ -48,6 +48,11 @@ Loading from Configuration
To be able to load extensions from your Akka configuration you must add FQCNs of implementations of either ``ExtensionId`` or ``ExtensionIdProvider``
in the ``akka.extensions`` section of the config you provide to your ``ActorSystem``.
.. includecode:: code/akka/docs/extension/ExtensionDocSpec.scala
:include: config
Note that in this case ``CountExtension`` is an object and therefore the class name ends with ``$``.
Applicability
=============

View file

@ -9,11 +9,7 @@ import akka.util.duration._
import akka.actor.{ Cancellable, Actor, Props, ActorRef }
object ConcurrentSocketActorSpec {
val config = """
akka {
extensions = ["akka.zeromq.ZeroMQExtension"]
}
"""
val config = ""
}
class ConcurrentSocketActorSpec
@ -23,7 +19,7 @@ class ConcurrentSocketActorSpec
val endpoint = "tcp://127.0.0.1:%s" format { val s = new java.net.ServerSocket(0); try s.getLocalPort finally s.close() }
def zmq = system.extension(ZeroMQExtension)
def zmq = ZeroMQExtension(system)
"ConcurrentSocketActor" should {
"support pub-sub connections" in {