Skip to content

Commit

Permalink
Merge branch 'master' into wip-2974-escalate-uncaught-exceptions-√
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorklang committed Jan 29, 2013
2 parents ff540d7 + b0a9b9b commit 1c104c3
Show file tree
Hide file tree
Showing 15 changed files with 1,143 additions and 55 deletions.

This file was deleted.

24 changes: 12 additions & 12 deletions akka-actor-tests/src/test/scala/akka/actor/TypedActorSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)

import TypedActorSpec._

def newFooBar: Foo = newFooBar(Duration(2, "s"))
def newFooBar: Foo = newFooBar(timeout.duration)

def newFooBar(d: FiniteDuration): Foo =
TypedActor(system).typedActorOf(TypedProps[Bar](classOf[Foo], classOf[Bar]).withTimeout(Timeout(d)))
Expand All @@ -221,7 +221,7 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)

def newStacked(): Stacked =
TypedActor(system).typedActorOf(
TypedProps[StackedImpl](classOf[Stacked], classOf[StackedImpl]).withTimeout(Timeout(2000)))
TypedProps[StackedImpl](classOf[Stacked], classOf[StackedImpl]).withTimeout(timeout))

def mustStop(typedActor: AnyRef) = TypedActor(system).stop(typedActor) must be(true)

Expand Down Expand Up @@ -296,7 +296,7 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
t.nullJOption() must be === JOption.none
t.nullOption() must be === None
t.nullReturn() must be === null
Await.result(t.nullFuture(), remaining) must be === null
Await.result(t.nullFuture(), timeout.duration) must be === null
}

"be able to call Future-returning methods non-blockingly" in {
Expand All @@ -307,11 +307,11 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
mustStop(t)
}

"be able to call multiple Future-returning methods non-blockingly" in {
"be able to call multiple Future-returning methods non-blockingly" in within(timeout.duration) {
val t = newFooBar
val futures = for (i 1 to 20) yield (i, t.futurePigdog(20, i))
for ((i, f) futures) {
Await.result(f, timeout.duration) must be("Pigdog" + i)
Await.result(f, remaining) must be("Pigdog" + i)
}
mustStop(t)
}
Expand All @@ -330,11 +330,11 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
mustStop(t)
}

"be able to compose futures without blocking" in {
val t, t2 = newFooBar(2 seconds)
"be able to compose futures without blocking" in within(timeout.duration) {
val t, t2 = newFooBar(remaining)
val f = t.futureComposePigdogFrom(t2)
f.isCompleted must be(false)
Await.result(f, timeout.duration) must equal("PIGDOG")
Await.result(f, remaining) must equal("PIGDOG")
mustStop(t)
mustStop(t2)
}
Expand Down Expand Up @@ -391,13 +391,13 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
mustStop(t)
}

"be able to support implementation only typed actors" in {
"be able to support implementation only typed actors" in within(timeout.duration) {
val t: Foo = TypedActor(system).typedActorOf(TypedProps[Bar]())
val f = t.futurePigdog(200)
val f2 = t.futurePigdog(0)
f2.isCompleted must be(false)
f.isCompleted must be(false)
Await.result(f, timeout.duration) must equal(Await.result(f2, timeout.duration))
Await.result(f, remaining) must equal(Await.result(f2, remaining))
mustStop(t)
}

Expand All @@ -408,13 +408,13 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
mustStop(t)
}

"be able to use balancing dispatcher" in {
"be able to use balancing dispatcher" in within(timeout.duration) {
val thais = for (i 1 to 60) yield newFooBar("pooled-dispatcher", 6 seconds)
val iterator = new CyclicIterator(thais)

val results = for (i 1 to 120) yield (i, iterator.next.futurePigdog(200L, i))

for ((i, r) results) Await.result(r, timeout.duration) must be("Pigdog" + i)
for ((i, r) results) Await.result(r, remaining) must be("Pigdog" + i)

for (t thais) mustStop(t)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,26 +328,39 @@ class SerializationCompatibilitySpec extends AkkaSpec(SerializationTests.mostlyR
val ser = SerializationExtension(system)

"Cross-version serialization compatibility" must {
def verify(obj: Any, asExpected: String): Unit =
String.valueOf(encodeHex(ser.serialize(obj, obj.getClass).get)) must be(asExpected)

"be preserved for SystemMessages" in {
val objs = List[(String, Any)](
("akka.dispatch.Create", Create(1234)),
("akka.dispatch.Recreate", Recreate(FakeThrowable("x"))),
("akka.dispatch.Suspend", Suspend()),
("akka.dispatch.Resume", Resume(FakeThrowable("x"))),
("akka.dispatch.Terminate", Terminate()),
("akka.dispatch.Supervise", Supervise(FakeActorRef("child"), true, 2468)),
("akka.dispatch.ChildTerminated", ChildTerminated(FakeActorRef("child"))),
("akka.dispatch.Watch", Watch(FakeActorRef("watchee"), FakeActorRef("watcher"))),
("akka.dispatch.Unwatch", Unwatch(FakeActorRef("watchee"), FakeActorRef("watcher"))),
("akka.dispatch.NoMessage", NoMessage))
val expectedConf = ConfigFactory.load("akka/serialization/serialized.conf")
for ((key, obj) objs) {
val hex = new String(encodeHex(ser.serialize(obj, obj.getClass).get))
hex must be(expectedConf.getString(key))
}
"be preserved for the Create SystemMessage" in {
verify(Create(1234), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e0001787073720014616b6b612e64697370617463682e437265617465bcdf9f7f2675038d0200014900037569647870000004d27671007e0003")
}
"be preserved for the Recreate SystemMessage" in {
verify(Recreate(null), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e0001787073720016616b6b612e64697370617463682e52656372656174650987c65c8d378a800200014c000563617573657400154c6a6176612f6c616e672f5468726f7761626c653b7870707671007e0003")
}
"be preserved for the Suspend SystemMessage" in {
verify(Suspend(), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e0001787073720015616b6b612e64697370617463682e53757370656e6464e531d5d134b59902000078707671007e0003")
}
"be preserved for the Resume SystemMessage" in {
verify(Resume(null), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e0001787073720014616b6b612e64697370617463682e526573756d65dc5e646d445fcb010200014c000f63617573656442794661696c7572657400154c6a6176612f6c616e672f5468726f7761626c653b7870707671007e0003")
}
"be preserved for the Terminate SystemMessage" in {
verify(Terminate(), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e0001787073720017616b6b612e64697370617463682e5465726d696e61746509d66ca68318700f02000078707671007e0003")
}
"be preserved for the Supervise SystemMessage" in {
verify(Supervise(FakeActorRef("child"), true, 2468), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e0001787073720017616b6b612e64697370617463682e5375706572766973652d0b363f56ab5feb0200035a00056173796e634900037569644c00056368696c647400154c616b6b612f6163746f722f4163746f725265663b787001000009a47372001f616b6b612e73657269616c697a6174696f6e2e46616b654163746f7252656600000000000000010200014c00046e616d657400124c6a6176612f6c616e672f537472696e673b7872001b616b6b612e6163746f722e496e7465726e616c4163746f725265660d0aa2ca1e82097602000078720013616b6b612e6163746f722e4163746f72526566c3585dde655f469402000078707400056368696c647671007e0003")
}
"be preserved for the ChildTerminated SystemMessage" in {
verify(ChildTerminated(FakeActorRef("child")), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e000178707372001d616b6b612e64697370617463682e4368696c645465726d696e617465644c84222437ed5db40200014c00056368696c647400154c616b6b612f6163746f722f4163746f725265663b78707372001f616b6b612e73657269616c697a6174696f6e2e46616b654163746f7252656600000000000000010200014c00046e616d657400124c6a6176612f6c616e672f537472696e673b7872001b616b6b612e6163746f722e496e7465726e616c4163746f725265660d0aa2ca1e82097602000078720013616b6b612e6163746f722e4163746f72526566c3585dde655f469402000078707400056368696c647671007e0003")
}
"be preserved for the Watch SystemMessage" in {
verify(Watch(FakeActorRef("watchee"), FakeActorRef("watcher")), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e0001787073720013616b6b612e64697370617463682e57617463682e1e65bc74394fc40200024c0007776174636865657400154c616b6b612f6163746f722f4163746f725265663b4c00077761746368657271007e000478707372001f616b6b612e73657269616c697a6174696f6e2e46616b654163746f7252656600000000000000010200014c00046e616d657400124c6a6176612f6c616e672f537472696e673b7872001b616b6b612e6163746f722e496e7465726e616c4163746f725265660d0aa2ca1e82097602000078720013616b6b612e6163746f722e4163746f72526566c3585dde655f46940200007870740007776174636865657371007e0006740007776174636865727671007e0003")
}
"be preserved for the Unwatch SystemMessage" in {
verify(Unwatch(FakeActorRef("watchee"), FakeActorRef("watcher")), "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e0001787073720015616b6b612e64697370617463682e556e776174636858501f7ee63dc2100200024c0007776174636865657400154c616b6b612f6163746f722f4163746f725265663b4c00077761746368657271007e000478707372001f616b6b612e73657269616c697a6174696f6e2e46616b654163746f7252656600000000000000010200014c00046e616d657400124c6a6176612f6c616e672f537472696e673b7872001b616b6b612e6163746f722e496e7465726e616c4163746f725265660d0aa2ca1e82097602000078720013616b6b612e6163746f722e4163746f72526566c3585dde655f46940200007870740007776174636865657371007e0006740007776174636865727671007e0003")
}
"be preserved for the NoMessage SystemMessage" in {
verify(NoMessage, "aced00057372000c7363616c612e5475706c6532bc7daadf46211a990200024c00025f317400124c6a6176612f6c616e672f4f626a6563743b4c00025f3271007e0001787073720018616b6b612e64697370617463682e4e6f4d65737361676524b401a3610ccb70dd02000078707671007e0003")
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ class ByteStringSpec extends WordSpec with MustMatchers with Checkers {
check { (a: ByteString) a.asByteBuffers.foldLeft(ByteString.empty) { (bs, bb) bs ++ ByteString(bb) } == a }
check { (a: ByteString) a.asByteBuffers.forall(_.isReadOnly) }
check { (a: ByteString)
import scala.collection.JavaConverters.iterableAsScalaIterableConverter;
a.asByteBuffers.zip(a.getByteBuffers().asScala).forall(x x._1 == x._2)
import scala.collection.JavaConverters.iterableAsScalaIterableConverter;
a.asByteBuffers.zip(a.getByteBuffers().asScala).forall(x x._1 == x._2)
}
}
}
Expand Down
1 change: 0 additions & 1 deletion akka-actor/src/main/scala/akka/actor/ActorSystem.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import scala.concurrent.{ Await, Awaitable, CanAwait, Future, ExecutionContext }
import scala.util.{ Failure, Success }
import scala.util.control.{ NonFatal, ControlThrowable }


object ActorSystem {

val Version: String = "2.2-SNAPSHOT"
Expand Down
Loading

0 comments on commit 1c104c3

Please sign in to comment.