Merge branch 'master' of github.com:jboner/akka
This commit is contained in:
commit
e557bd31e1
6 changed files with 60 additions and 14 deletions
|
|
@ -375,6 +375,19 @@ with message flows:
|
|||
This feature is useful e.g. when testing a logging system, where you want
|
||||
to ignore regular messages and are only interested in your specific ones.
|
||||
|
||||
Expecting Exceptions
|
||||
--------------------
|
||||
|
||||
One case which is not handled by the :obj:`testActor` is if an exception is
|
||||
thrown while processing the message sent to the actor under test. This can be
|
||||
tested by using a :class:`Future` based invocation::
|
||||
|
||||
// assuming ScalaTest ShouldMatchers
|
||||
|
||||
evaluating {
|
||||
(someActor ? badOperation).await.get
|
||||
} should produce [UnhandledMessageException]
|
||||
|
||||
.. _TestKit.within:
|
||||
|
||||
Timing Assertions
|
||||
|
|
@ -468,7 +481,7 @@ using a small example::
|
|||
var dest1 : ActorRef = _
|
||||
var dest2 : ActorRef = _
|
||||
def receive = {
|
||||
case (d1, d2) =>
|
||||
case (d1: ActorRef, d2: ActorRef) =>
|
||||
dest1 = d1
|
||||
dest2 = d2
|
||||
case x =>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ import org.apache.camel.spring.spi.ApplicationContextRegistry
|
|||
import org.springframework.context.support.ClassPathXmlApplicationContext
|
||||
|
||||
import akka.actor.Actor._
|
||||
import akka.actor.{TypedActor, Supervisor}
|
||||
import akka.actor.TypedActor
|
||||
import akka.actor.TypedActor.Configuration._
|
||||
import akka.camel.CamelContextManager
|
||||
import akka.config.Supervision._
|
||||
|
||||
|
|
@ -89,7 +90,8 @@ class Boot {
|
|||
// Active object example
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
//TypedActor.newInstance(classOf[TypedConsumer1], classOf[TypedConsumer1Impl])
|
||||
// TODO: investigate why this consumer is not published
|
||||
TypedActor.typedActorOf(classOf[TypedConsumer1], classOf[TypedConsumer1Impl], defaultConfiguration)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ class HttpConcurrencyTestStress extends JUnitSuite {
|
|||
import HttpConcurrencyTestStress._
|
||||
|
||||
@Test def shouldProcessMessagesConcurrently = {
|
||||
/* TODO: fix stress test
|
||||
|
||||
val num = 50
|
||||
val latch1 = new CountDownLatch(num)
|
||||
val latch2 = new CountDownLatch(num)
|
||||
|
|
@ -38,7 +40,7 @@ class HttpConcurrencyTestStress extends JUnitSuite {
|
|||
latch3.await
|
||||
assert(num == (client1 ? "getCorrelationIdCount").as[Int].get)
|
||||
assert(num == (client2 ? "getCorrelationIdCount").as[Int].get)
|
||||
assert(num == (client3 ? "getCorrelationIdCount").as[Int].get)
|
||||
assert(num == (client3 ? "getCorrelationIdCount").as[Int].get)*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -50,9 +52,9 @@ object HttpConcurrencyTestStress {
|
|||
val workers = for (i <- 1 to 8) yield actorOf[HttpServerWorker].start
|
||||
val balancer = loadBalancerActor(new CyclicIterator(workers.toList))
|
||||
|
||||
service.get.awaitEndpointActivation(1) {
|
||||
actorOf(new HttpServerActor(balancer)).start
|
||||
}
|
||||
//service.get.awaitEndpointActivation(1) {
|
||||
// actorOf(new HttpServerActor(balancer)).start
|
||||
//}
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import org.scalatest.{GivenWhenThen, BeforeAndAfterAll, FeatureSpec}
|
|||
import akka.actor.Actor._
|
||||
import akka.actor._
|
||||
import akka.camel._
|
||||
import akka.remote.netty.NettyRemoteSupport
|
||||
import akka.remoteinterface.RemoteServerModule
|
||||
//import akka.remote.netty.NettyRemoteSupport
|
||||
//import akka.remoteinterface.RemoteServerModule
|
||||
|
||||
/**
|
||||
* @author Martin Krasser
|
||||
|
|
|
|||
|
|
@ -378,11 +378,9 @@ trait TestKitLight {
|
|||
* given duration, with an AssertionFailure being thrown in case of timeout.
|
||||
*
|
||||
* <pre>
|
||||
* within(1 second) {
|
||||
* dispatcher ! SomeWork1()
|
||||
* dispatcher ! SomeWork2()
|
||||
* expectMsgAllOf(Result1(), Result2())
|
||||
* }
|
||||
* expectMsgAllOf(1 second, Result1(), Result2())
|
||||
* </pre>
|
||||
*/
|
||||
def expectMsgAllOf[T](max: Duration, obj: T*): Seq[T] = expectMsgAllOf_internal(max.dilated, obj: _*)
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ object AkkaBuild extends Build {
|
|||
id = "akka-samples",
|
||||
base = file("akka-samples"),
|
||||
settings = parentSettings,
|
||||
aggregate = Seq(fsmSample)
|
||||
aggregate = Seq(fsmSample, camelSample)
|
||||
)
|
||||
|
||||
// lazy val antsSample = Project(
|
||||
|
|
@ -224,6 +224,16 @@ object AkkaBuild extends Build {
|
|||
settings = defaultSettings
|
||||
)
|
||||
|
||||
lazy val camelSample = Project(
|
||||
id = "akka-sample-camel",
|
||||
base = file("akka-samples/akka-sample-camel"),
|
||||
dependencies = Seq(actor, camelTyped),
|
||||
settings = defaultSettings ++ Seq(
|
||||
ivyXML := Dependencies.sampleCamelXML,
|
||||
libraryDependencies ++= Dependencies.sampleCamel
|
||||
)
|
||||
)
|
||||
|
||||
// lazy val helloSample = Project(
|
||||
// id = "akka-sample-hello",
|
||||
// base = file("akka-samples/akka-sample-hello"),
|
||||
|
|
@ -356,6 +366,23 @@ object Dependencies {
|
|||
jettyUtil, jettyXml, jettyServlet, jerseyCore, jerseyJson, jerseyScala,
|
||||
jacksonCore, staxApi, Provided.jerseyServer
|
||||
)
|
||||
|
||||
val sampleCamel = Seq(camelCore, commonsCodec, Runtime.activemq, Runtime.springJms,
|
||||
Test.junit, Test.scalatest, Test.logback)
|
||||
|
||||
val sampleCamelXML =
|
||||
<dependencies>
|
||||
<dependency org="org.apache.camel" name="camel-jms" rev={V.Camel}>
|
||||
<exclude module="camel-core"/>
|
||||
</dependency>
|
||||
<dependency org="org.apache.camel" name="camel-spring" rev={V.Camel}>
|
||||
<exclude module="camel-core"/>
|
||||
</dependency>
|
||||
<!-- TODO: resolve Jetty version conflict -->
|
||||
<!--<dependency org="org.apache.camel" name="camel-jetty" rev={Dependency.V.CamelPatch}>
|
||||
<exclude module="camel-core"/>
|
||||
</dependency>-->
|
||||
</dependencies>
|
||||
}
|
||||
|
||||
object Dependency {
|
||||
|
|
@ -426,7 +453,11 @@ object Dependency {
|
|||
// Runtime
|
||||
|
||||
object Runtime {
|
||||
val logback = "ch.qos.logback" % "logback-classic" % V.Logback % "runtime" // MIT
|
||||
val activemq = "org.apache.activemq" % "activemq-core" % "5.4.2" % "runtime" // ApacheV2
|
||||
val camelJetty = "org.apache.camel" % "camel-jetty" % V.CamelPatch % "runtime" // ApacheV2
|
||||
val camelJms = "org.apache.camel" % "camel-jms" % V.Camel % "runtime" // ApacheV2
|
||||
val logback = "ch.qos.logback" % "logback-classic" % V.Logback % "runtime" // MIT
|
||||
val springJms = "org.springframework" % "spring-jms" % V.Spring % "runtime" // ApacheV2
|
||||
}
|
||||
|
||||
// Test
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue