=tes Use ConversionCheckedTripleEquals

This commit is contained in:
Patrik Nordwall 2015-01-16 11:09:59 +01:00
parent 142d9a51af
commit 30df518421
196 changed files with 2275 additions and 2266 deletions

View file

@ -36,7 +36,7 @@ class ActorDSLSpec extends AkkaSpec {
//#inbox
implicit val i = inbox()
echo ! "hello"
i.receive() should be("hello")
i.receive() should ===("hello")
//#inbox
}
@ -50,7 +50,7 @@ class ActorDSLSpec extends AkkaSpec {
i watch target
//#watch
target ! PoisonPill
i receive 1.second should be(Terminated(target)(true, false))
i receive 1.second should ===(Terminated(target)(true, false))
}
"support queueing multiple queries" in {
@ -61,11 +61,11 @@ class ActorDSLSpec extends AkkaSpec {
Future { Thread.sleep(100); i.select() { case "world" 1 } } recover { case x x },
Future { Thread.sleep(200); i.select() { case "hello" 2 } } recover { case x x }))
Thread.sleep(1000)
res.isCompleted should be(false)
res.isCompleted should ===(false)
i.receiver ! 42
i.receiver ! "hello"
i.receiver ! "world"
Await.result(res, 5 second) should be(Seq(42, 1, 2))
Await.result(res, 5 second) should ===(Seq(42, 1, 2))
}
"support selective receives" in {
@ -75,8 +75,8 @@ class ActorDSLSpec extends AkkaSpec {
val result = i.select() {
case "world" true
}
result should be(true)
i.receive() should be("hello")
result should ===(true)
i.receive() should ===("hello")
}
"have a maximum queue size" in {
@ -92,7 +92,7 @@ class ActorDSLSpec extends AkkaSpec {
i.receiver ! 42
expectNoMsg(1 second)
val gotit = for (_ 1 to 1000) yield i.receive()
gotit should be((1 to 1000) map (_ 0))
gotit should ===((1 to 1000) map (_ 0))
intercept[TimeoutException] {
i.receive(1 second)
}
@ -126,7 +126,7 @@ class ActorDSLSpec extends AkkaSpec {
implicit val i = inbox()
a ! "hello"
i.receive() should be("hi")
i.receive() should ===("hi")
}
"support becomeStacked" in {
@ -231,7 +231,7 @@ class ActorDSLSpec extends AkkaSpec {
})
//#nested-actor
expectMsg("hello from akka://ActorDSLSpec/user/fred/barney")
lastSender should be(a)
lastSender should ===(a)
}
"support Stash" in {

View file

@ -56,14 +56,14 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
"An ActorSystem" must {
"find actors by looking up their path" in {
system.actorFor(c1.path) should be(c1)
system.actorFor(c2.path) should be(c2)
system.actorFor(c21.path) should be(c21)
system.actorFor(system / "c1") should be(c1)
system.actorFor(system / "c2") should be(c2)
system.actorFor(system / "c2" / "c21") should be(c21)
system.actorFor(system child "c2" child "c21") should be(c21) // test Java API
system.actorFor(system / Seq("c2", "c21")) should be(c21)
system.actorFor(c1.path) should ===(c1)
system.actorFor(c2.path) should ===(c2)
system.actorFor(c21.path) should ===(c21)
system.actorFor(system / "c1") should ===(c1)
system.actorFor(system / "c2") should ===(c2)
system.actorFor(system / "c2" / "c21") should ===(c21)
system.actorFor(system child "c2" child "c21") should ===(c21) // test Java API
system.actorFor(system / Seq("c2", "c21")) should ===(c21)
import scala.collection.JavaConverters._
system.actorFor(system descendant Seq("c2", "c21").asJava) // test Java API
@ -71,9 +71,9 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
"find actors by looking up their string representation" in {
// this is only true for local actor references
system.actorFor(c1.path.toString) should be(c1)
system.actorFor(c2.path.toString) should be(c2)
system.actorFor(c21.path.toString) should be(c21)
system.actorFor(c1.path.toString) should ===(c1)
system.actorFor(c2.path.toString) should ===(c2)
system.actorFor(c21.path.toString) should ===(c21)
}
"take actor incarnation into account when comparing actor references" in {
@ -90,8 +90,8 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
system.actorFor(a1.path.toString) should not be (a1)
val a2 = system.actorOf(p, name)
a2.path should be(a1.path)
a2.path.toString should be(a1.path.toString)
a2.path should ===(a1.path)
a2.path.toString should ===(a1.path.toString)
a2 should not be (a1)
a2.toString should not be (a1.toString)
@ -101,45 +101,45 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
}
"find actors by looking up their root-anchored relative path" in {
system.actorFor(c1.path.toStringWithoutAddress) should be(c1)
system.actorFor(c2.path.toStringWithoutAddress) should be(c2)
system.actorFor(c21.path.toStringWithoutAddress) should be(c21)
system.actorFor(c1.path.toStringWithoutAddress) should ===(c1)
system.actorFor(c2.path.toStringWithoutAddress) should ===(c2)
system.actorFor(c21.path.toStringWithoutAddress) should ===(c21)
}
"find actors by looking up their relative path" in {
system.actorFor(c1.path.elements.mkString("/")) should be(c1)
system.actorFor(c2.path.elements.mkString("/")) should be(c2)
system.actorFor(c21.path.elements.mkString("/")) should be(c21)
system.actorFor(c1.path.elements.mkString("/")) should ===(c1)
system.actorFor(c2.path.elements.mkString("/")) should ===(c2)
system.actorFor(c21.path.elements.mkString("/")) should ===(c21)
}
"find actors by looking up their path elements" in {
system.actorFor(c1.path.elements) should be(c1)
system.actorFor(c2.path.elements) should be(c2)
system.actorFor(c21.path.getElements) should be(c21) // test Java API
system.actorFor(c1.path.elements) should ===(c1)
system.actorFor(c2.path.elements) should ===(c2)
system.actorFor(c21.path.getElements) should ===(c21) // test Java API
}
"find system-generated actors" in {
system.actorFor("/user") should be(user)
system.actorFor("/deadLetters") should be(system.deadLetters)
system.actorFor("/system") should be(syst)
system.actorFor(syst.path) should be(syst)
system.actorFor(syst.path.toString) should be(syst)
system.actorFor("/") should be(root)
system.actorFor("..") should be(root)
system.actorFor(root.path) should be(root)
system.actorFor(root.path.toString) should be(root)
system.actorFor("user") should be(user)
system.actorFor("deadLetters") should be(system.deadLetters)
system.actorFor("system") should be(syst)
system.actorFor("user/") should be(user)
system.actorFor("deadLetters/") should be(system.deadLetters)
system.actorFor("system/") should be(syst)
system.actorFor("/user") should ===(user)
system.actorFor("/deadLetters") should ===(system.deadLetters)
system.actorFor("/system") should ===(syst)
system.actorFor(syst.path) should ===(syst)
system.actorFor(syst.path.toString) should ===(syst)
system.actorFor("/") should ===(root)
system.actorFor("..") should ===(root)
system.actorFor(root.path) should ===(root)
system.actorFor(root.path.toString) should ===(root)
system.actorFor("user") should ===(user)
system.actorFor("deadLetters") should ===(system.deadLetters)
system.actorFor("system") should ===(syst)
system.actorFor("user/") should ===(user)
system.actorFor("deadLetters/") should ===(system.deadLetters)
system.actorFor("system/") should ===(syst)
}
"return deadLetters or EmptyLocalActorRef, respectively, for non-existing paths" in {
def check(lookup: ActorRef, result: ActorRef) = {
lookup.getClass should be(result.getClass)
lookup should be(result)
lookup.getClass should ===(result.getClass)
lookup should ===(result)
}
check(system.actorFor("a/b/c"), empty("a/b/c"))
check(system.actorFor(""), system.deadLetters)
@ -153,17 +153,17 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
"find temporary actors" in {
val f = c1 ? GetSender(testActor)
val a = expectMsgType[ActorRef]
a.path.elements.head should be("temp")
system.actorFor(a.path) should be(a)
system.actorFor(a.path.toString) should be(a)
system.actorFor(a.path.elements) should be(a)
system.actorFor(a.path.toString + "/") should be(a)
system.actorFor(a.path.toString + "/hallo").isTerminated should be(true)
f.isCompleted should be(false)
a.isTerminated should be(false)
a.path.elements.head should ===("temp")
system.actorFor(a.path) should ===(a)
system.actorFor(a.path.toString) should ===(a)
system.actorFor(a.path.elements) should ===(a)
system.actorFor(a.path.toString + "/") should ===(a)
system.actorFor(a.path.toString + "/hallo").isTerminated should ===(true)
f.isCompleted should ===(false)
a.isTerminated should ===(false)
a ! 42
f.isCompleted should be(true)
Await.result(f, timeout.duration) should be(42)
f.isCompleted should ===(true)
Await.result(f, timeout.duration) should ===(42)
// clean-up is run as onComplete callback, i.e. dispatched on another thread
awaitCond(system.actorFor(a.path).isTerminated, 1 second)
}
@ -176,7 +176,7 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
"find actors by looking up their path" in {
def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) {
Await.result(looker ? LookupPath(pathOf.path), timeout.duration) should be(result)
Await.result(looker ? LookupPath(pathOf.path), timeout.duration) should ===(result)
}
for {
looker all
@ -186,11 +186,11 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
"find actors by looking up their string representation" in {
def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) {
Await.result(looker ? LookupString(pathOf.path.toString), timeout.duration) should be(result)
Await.result(looker ? LookupString(pathOf.path.toString), timeout.duration) should ===(result)
// with uid
Await.result(looker ? LookupString(pathOf.path.toSerializationFormat), timeout.duration) should be(result)
Await.result(looker ? LookupString(pathOf.path.toSerializationFormat), timeout.duration) should ===(result)
// with trailing /
Await.result(looker ? LookupString(pathOf.path.toString + "/"), timeout.duration) should be(result)
Await.result(looker ? LookupString(pathOf.path.toString + "/"), timeout.duration) should ===(result)
}
for {
looker all
@ -200,8 +200,8 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
"find actors by looking up their root-anchored relative path" in {
def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) {
Await.result(looker ? LookupString(pathOf.path.toStringWithoutAddress), timeout.duration) should be(result)
Await.result(looker ? LookupString(pathOf.path.elements.mkString("/", "/", "/")), timeout.duration) should be(result)
Await.result(looker ? LookupString(pathOf.path.toStringWithoutAddress), timeout.duration) should ===(result)
Await.result(looker ? LookupString(pathOf.path.elements.mkString("/", "/", "/")), timeout.duration) should ===(result)
}
for {
looker all
@ -211,9 +211,9 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
"find actors by looking up their relative path" in {
def check(looker: ActorRef, result: ActorRef, elems: String*) {
Await.result(looker ? LookupElems(elems), timeout.duration) should be(result)
Await.result(looker ? LookupString(elems mkString "/"), timeout.duration) should be(result)
Await.result(looker ? LookupString(elems mkString ("", "/", "/")), timeout.duration) should be(result)
Await.result(looker ? LookupElems(elems), timeout.duration) should ===(result)
Await.result(looker ? LookupString(elems mkString "/"), timeout.duration) should ===(result)
Await.result(looker ? LookupString(elems mkString ("", "/", "/")), timeout.duration) should ===(result)
}
check(c1, user, "..")
for {
@ -228,11 +228,11 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
"find system-generated actors" in {
def check(target: ActorRef) {
for (looker all) {
Await.result(looker ? LookupPath(target.path), timeout.duration) should be(target)
Await.result(looker ? LookupString(target.path.toString), timeout.duration) should be(target)
Await.result(looker ? LookupString(target.path.toString + "/"), timeout.duration) should be(target)
Await.result(looker ? LookupString(target.path.toStringWithoutAddress), timeout.duration) should be(target)
if (target != root) Await.result(looker ? LookupString(target.path.elements.mkString("/", "/", "/")), timeout.duration) should be(target)
Await.result(looker ? LookupPath(target.path), timeout.duration) should ===(target)
Await.result(looker ? LookupString(target.path.toString), timeout.duration) should ===(target)
Await.result(looker ? LookupString(target.path.toString + "/"), timeout.duration) should ===(target)
Await.result(looker ? LookupString(target.path.toStringWithoutAddress), timeout.duration) should ===(target)
if (target != root) Await.result(looker ? LookupString(target.path.elements.mkString("/", "/", "/")), timeout.duration) should ===(target)
}
}
for (target Seq(root, syst, user, system.deadLetters)) check(target)
@ -244,7 +244,7 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
def checkOne(looker: ActorRef, query: Query, result: ActorRef) {
val lookup = Await.result(looker ? query, timeout.duration)
lookup.getClass should be(result.getClass)
lookup should be(result)
lookup should ===(result)
}
def check(looker: ActorRef) {
val lookname = looker.path.elements.mkString("", "/", "/")
@ -266,21 +266,21 @@ class ActorLookupSpec extends AkkaSpec with DefaultTimeout {
"find temporary actors" in {
val f = c1 ? GetSender(testActor)
val a = expectMsgType[ActorRef]
a.path.elements.head should be("temp")
Await.result(c2 ? LookupPath(a.path), timeout.duration) should be(a)
Await.result(c2 ? LookupString(a.path.toString), timeout.duration) should be(a)
Await.result(c2 ? LookupString(a.path.toStringWithoutAddress), timeout.duration) should be(a)
Await.result(c2 ? LookupString("../../" + a.path.elements.mkString("/")), timeout.duration) should be(a)
Await.result(c2 ? LookupString(a.path.toString + "/"), timeout.duration) should be(a)
Await.result(c2 ? LookupString(a.path.toStringWithoutAddress + "/"), timeout.duration) should be(a)
Await.result(c2 ? LookupString("../../" + a.path.elements.mkString("/") + "/"), timeout.duration) should be(a)
Await.result(c2 ? LookupElems(Seq("..", "..") ++ a.path.elements), timeout.duration) should be(a)
Await.result(c2 ? LookupElems(Seq("..", "..") ++ a.path.elements :+ ""), timeout.duration) should be(a)
f.isCompleted should be(false)
a.isTerminated should be(false)
a.path.elements.head should ===("temp")
Await.result(c2 ? LookupPath(a.path), timeout.duration) should ===(a)
Await.result(c2 ? LookupString(a.path.toString), timeout.duration) should ===(a)
Await.result(c2 ? LookupString(a.path.toStringWithoutAddress), timeout.duration) should ===(a)
Await.result(c2 ? LookupString("../../" + a.path.elements.mkString("/")), timeout.duration) should ===(a)
Await.result(c2 ? LookupString(a.path.toString + "/"), timeout.duration) should ===(a)
Await.result(c2 ? LookupString(a.path.toStringWithoutAddress + "/"), timeout.duration) should ===(a)
Await.result(c2 ? LookupString("../../" + a.path.elements.mkString("/") + "/"), timeout.duration) should ===(a)
Await.result(c2 ? LookupElems(Seq("..", "..") ++ a.path.elements), timeout.duration) should ===(a)
Await.result(c2 ? LookupElems(Seq("..", "..") ++ a.path.elements :+ ""), timeout.duration) should ===(a)
f.isCompleted should ===(false)
a.isTerminated should ===(false)
a ! 42
f.isCompleted should be(true)
Await.result(f, timeout.duration) should be(42)
f.isCompleted should ===(true)
Await.result(f, timeout.duration) should ===(42)
// clean-up is run as onComplete callback, i.e. dispatched on another thread
awaitCond(Await.result(c2 ? LookupPath(a.path), timeout.duration).asInstanceOf[ActorRef].isTerminated, 1 second)
}

View file

@ -255,7 +255,7 @@ class ActorMailboxSpec(conf: Config) extends AkkaSpec(conf) with DefaultTimeout
"get a bounded message queue with 0 push timeout when defined in dispatcher" in {
val q = checkMailboxQueue(Props[QueueReportingActor], "default-bounded-mailbox-with-zero-pushtimeout", BoundedMailboxTypes)
q.asInstanceOf[BoundedMessageQueueSemantics].pushTimeOut should be(Duration.Zero)
q.asInstanceOf[BoundedMessageQueueSemantics].pushTimeOut should ===(Duration.Zero)
}
"get an unbounded message queue when it's configured as mailbox overriding bounded in dispatcher" in {

View file

@ -14,12 +14,12 @@ class ActorPathSpec extends WordSpec with Matchers {
"support parsing its String rep" in {
val path = RootActorPath(Address("akka.tcp", "mysys")) / "user"
ActorPath.fromString(path.toString) should be(path)
ActorPath.fromString(path.toString) should ===(path)
}
"support parsing remote paths" in {
val remote = "akka://my_sys@host:1234/some/ref"
ActorPath.fromString(remote).toString should be(remote)
ActorPath.fromString(remote).toString should ===(remote)
}
"throw exception upon malformed paths" in {
@ -32,22 +32,22 @@ class ActorPathSpec extends WordSpec with Matchers {
"create correct toString" in {
val a = Address("akka.tcp", "mysys")
RootActorPath(a).toString should be("akka.tcp://mysys/")
(RootActorPath(a) / "user").toString should be("akka.tcp://mysys/user")
(RootActorPath(a) / "user" / "foo").toString should be("akka.tcp://mysys/user/foo")
(RootActorPath(a) / "user" / "foo" / "bar").toString should be("akka.tcp://mysys/user/foo/bar")
RootActorPath(a).toString should ===("akka.tcp://mysys/")
(RootActorPath(a) / "user").toString should ===("akka.tcp://mysys/user")
(RootActorPath(a) / "user" / "foo").toString should ===("akka.tcp://mysys/user/foo")
(RootActorPath(a) / "user" / "foo" / "bar").toString should ===("akka.tcp://mysys/user/foo/bar")
}
"have correct path elements" in {
(RootActorPath(Address("akka.tcp", "mysys")) / "user" / "foo" / "bar").elements.toSeq should be(Seq("user", "foo", "bar"))
(RootActorPath(Address("akka.tcp", "mysys")) / "user" / "foo" / "bar").elements.toSeq should ===(Seq("user", "foo", "bar"))
}
"create correct toStringWithoutAddress" in {
val a = Address("akka.tcp", "mysys")
RootActorPath(a).toStringWithoutAddress should be("/")
(RootActorPath(a) / "user").toStringWithoutAddress should be("/user")
(RootActorPath(a) / "user" / "foo").toStringWithoutAddress should be("/user/foo")
(RootActorPath(a) / "user" / "foo" / "bar").toStringWithoutAddress should be("/user/foo/bar")
RootActorPath(a).toStringWithoutAddress should ===("/")
(RootActorPath(a) / "user").toStringWithoutAddress should ===("/user")
(RootActorPath(a) / "user" / "foo").toStringWithoutAddress should ===("/user/foo")
(RootActorPath(a) / "user" / "foo" / "bar").toStringWithoutAddress should ===("/user/foo/bar")
}
"create correct toStringWithAddress" in {
@ -56,22 +56,22 @@ class ActorPathSpec extends WordSpec with Matchers {
val b = a.copy(host = Some("bb"))
val c = a.copy(host = Some("cccc"))
val root = RootActorPath(local)
root.toStringWithAddress(a) should be("akka.tcp://mysys@aaa:2552/")
(root / "user").toStringWithAddress(a) should be("akka.tcp://mysys@aaa:2552/user")
(root / "user" / "foo").toStringWithAddress(a) should be("akka.tcp://mysys@aaa:2552/user/foo")
root.toStringWithAddress(a) should ===("akka.tcp://mysys@aaa:2552/")
(root / "user").toStringWithAddress(a) should ===("akka.tcp://mysys@aaa:2552/user")
(root / "user" / "foo").toStringWithAddress(a) should ===("akka.tcp://mysys@aaa:2552/user/foo")
// root.toStringWithAddress(b) should be("akka.tcp://mysys@bb:2552/")
(root / "user").toStringWithAddress(b) should be("akka.tcp://mysys@bb:2552/user")
(root / "user" / "foo").toStringWithAddress(b) should be("akka.tcp://mysys@bb:2552/user/foo")
// root.toStringWithAddress(b) should ===("akka.tcp://mysys@bb:2552/")
(root / "user").toStringWithAddress(b) should ===("akka.tcp://mysys@bb:2552/user")
(root / "user" / "foo").toStringWithAddress(b) should ===("akka.tcp://mysys@bb:2552/user/foo")
root.toStringWithAddress(c) should be("akka.tcp://mysys@cccc:2552/")
(root / "user").toStringWithAddress(c) should be("akka.tcp://mysys@cccc:2552/user")
(root / "user" / "foo").toStringWithAddress(c) should be("akka.tcp://mysys@cccc:2552/user/foo")
root.toStringWithAddress(c) should ===("akka.tcp://mysys@cccc:2552/")
(root / "user").toStringWithAddress(c) should ===("akka.tcp://mysys@cccc:2552/user")
(root / "user" / "foo").toStringWithAddress(c) should ===("akka.tcp://mysys@cccc:2552/user/foo")
val rootA = RootActorPath(a)
rootA.toStringWithAddress(b) should be("akka.tcp://mysys@aaa:2552/")
(rootA / "user").toStringWithAddress(b) should be("akka.tcp://mysys@aaa:2552/user")
(rootA / "user" / "foo").toStringWithAddress(b) should be("akka.tcp://mysys@aaa:2552/user/foo")
rootA.toStringWithAddress(b) should ===("akka.tcp://mysys@aaa:2552/")
(rootA / "user").toStringWithAddress(b) should ===("akka.tcp://mysys@aaa:2552/user")
(rootA / "user" / "foo").toStringWithAddress(b) should ===("akka.tcp://mysys@aaa:2552/user/foo")
}
}
}

View file

@ -139,7 +139,7 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout {
new Actor { def receive = { case _ } }
}
def contextStackMustBeEmpty(): Unit = ActorCell.contextStack.get.headOption should be(None)
def contextStackMustBeEmpty(): Unit = ActorCell.contextStack.get.headOption should ===(None)
EventFilter[ActorInitializationException](occurrences = 1) intercept {
intercept[akka.actor.ActorInitializationException] {
@ -249,7 +249,7 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout {
(intercept[java.lang.IllegalStateException] {
wrap(result
actorOf(Props(new OuterActor(actorOf(Props(promiseIntercept({ throw new IllegalStateException("Ur state be b0rked"); new InnerActor })(result)))))))
}).getMessage should be("Ur state be b0rked")
}).getMessage should ===("Ur state be b0rked")
contextStackMustBeEmpty()
}
@ -275,15 +275,15 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout {
val in = new ObjectInputStream(new ByteArrayInputStream(bytes))
val readA = in.readObject
a.isInstanceOf[ActorRefWithCell] should be(true)
readA.isInstanceOf[ActorRefWithCell] should be(true)
(readA eq a) should be(true)
a.isInstanceOf[ActorRefWithCell] should ===(true)
readA.isInstanceOf[ActorRefWithCell] should ===(true)
(readA eq a) should ===(true)
}
val ser = new JavaSerializer(esys)
val readA = ser.fromBinary(bytes, None)
readA.isInstanceOf[ActorRefWithCell] should be(true)
(readA eq a) should be(true)
readA.isInstanceOf[ActorRefWithCell] should ===(true)
(readA eq a) should ===(true)
}
"throw an exception on deserialize if no system in scope" in {
@ -303,7 +303,7 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout {
(intercept[java.lang.IllegalStateException] {
in.readObject
}).getMessage should be("Trying to deserialize a serialized ActorRef without an ActorSystem in scope." +
}).getMessage should ===("Trying to deserialize a serialized ActorRef without an ActorSystem in scope." +
" Use 'akka.serialization.Serialization.currentSystem.withValue(system) { ... }'")
}
@ -328,7 +328,7 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout {
JavaSerializer.currentSystem.withValue(sysImpl) {
val in = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray))
in.readObject should be(new EmptyLocalActorRef(sysImpl.provider, ref.path, system.eventStream))
in.readObject should ===(new EmptyLocalActorRef(sysImpl.provider, ref.path, system.eventStream))
}
}
@ -341,18 +341,18 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout {
val nested = Await.result((a ? "any").mapTo[ActorRef], timeout.duration)
a should not be null
nested should not be null
(a ne nested) should be(true)
(a ne nested) should ===(true)
}
"support advanced nested actorOfs" in {
val a = system.actorOf(Props(new OuterActor(system.actorOf(Props(new InnerActor)))))
val inner = Await.result(a ? "innerself", timeout.duration)
Await.result(a ? a, timeout.duration) should be(a)
Await.result(a ? "self", timeout.duration) should be(a)
Await.result(a ? a, timeout.duration) should ===(a)
Await.result(a ? "self", timeout.duration) should ===(a)
inner should not be a
Await.result(a ? "msg", timeout.duration) should be("msg")
Await.result(a ? "msg", timeout.duration) should ===("msg")
}
"support reply via sender" in {
@ -400,8 +400,8 @@ class ActorRefSpec extends AkkaSpec with DefaultTimeout {
val fnull = (ref.ask(0)(timeout)).mapTo[String]
ref ! PoisonPill
Await.result(ffive, timeout.duration) should be("five")
Await.result(fnull, timeout.duration) should be("null")
Await.result(ffive, timeout.duration) should ===("five")
Await.result(fnull, timeout.duration) should ===("null")
verifyActorTermination(ref)
}

View file

@ -62,13 +62,13 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
case ActorIdentity(`selection`, ref) ref
}
val asked = Await.result((selection ? Identify(selection)).mapTo[ActorIdentity], timeout.duration)
asked.ref should be(result)
asked.correlationId should be(selection)
asked.ref should ===(result)
asked.correlationId should ===(selection)
implicit val ec = system.dispatcher
val resolved = Await.result(selection.resolveOne(timeout.duration).mapTo[ActorRef] recover { case _ null },
timeout.duration)
Option(resolved) should be(result)
Option(resolved) should ===(result)
result
}
@ -86,27 +86,27 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
"An ActorSystem" must {
"select actors by their path" in {
identify(c1.path) should be(Some(c1))
identify(c2.path) should be(Some(c2))
identify(c21.path) should be(Some(c21))
identify(system / "c1") should be(Some(c1))
identify(system / "c2") should be(Some(c2))
identify(system / "c2" / "c21") should be(Some(c21))
identify(system child "c2" child "c21") should be(Some(c21)) // test Java API
identify(system / Seq("c2", "c21")) should be(Some(c21))
identify(c1.path) should ===(Some(c1))
identify(c2.path) should ===(Some(c2))
identify(c21.path) should ===(Some(c21))
identify(system / "c1") should ===(Some(c1))
identify(system / "c2") should ===(Some(c2))
identify(system / "c2" / "c21") should ===(Some(c21))
identify(system child "c2" child "c21") should ===(Some(c21)) // test Java API
identify(system / Seq("c2", "c21")) should ===(Some(c21))
import scala.collection.JavaConverters._
identify(system descendant Seq("c2", "c21").asJava) // test Java API
}
"select actors by their string path representation" in {
identify(c1.path.toString) should be(Some(c1))
identify(c2.path.toString) should be(Some(c2))
identify(c21.path.toString) should be(Some(c21))
identify(c1.path.toString) should ===(Some(c1))
identify(c2.path.toString) should ===(Some(c2))
identify(c21.path.toString) should ===(Some(c21))
identify(c1.path.toStringWithoutAddress) should be(Some(c1))
identify(c2.path.toStringWithoutAddress) should be(Some(c2))
identify(c21.path.toStringWithoutAddress) should be(Some(c21))
identify(c1.path.toStringWithoutAddress) should ===(Some(c1))
identify(c2.path.toStringWithoutAddress) should ===(Some(c2))
identify(c21.path.toStringWithoutAddress) should ===(Some(c21))
}
"take actor incarnation into account when comparing actor references" in {
@ -114,61 +114,61 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
val a1 = system.actorOf(p, name)
watch(a1)
a1 ! PoisonPill
expectMsgType[Terminated].actor should be(a1)
expectMsgType[Terminated].actor should ===(a1)
// not equal because it's terminated
identify(a1.path) should be(None)
identify(a1.path) should ===(None)
val a2 = system.actorOf(p, name)
a2.path should be(a1.path)
a2.path.toString should be(a1.path.toString)
a2.path should ===(a1.path)
a2.path.toString should ===(a1.path.toString)
a2 should not be (a1)
a2.toString should not be (a1.toString)
watch(a2)
a2 ! PoisonPill
expectMsgType[Terminated].actor should be(a2)
expectMsgType[Terminated].actor should ===(a2)
}
"select actors by their root-anchored relative path" in {
identify(c1.path.toStringWithoutAddress) should be(Some(c1))
identify(c2.path.toStringWithoutAddress) should be(Some(c2))
identify(c21.path.toStringWithoutAddress) should be(Some(c21))
identify(c1.path.toStringWithoutAddress) should ===(Some(c1))
identify(c2.path.toStringWithoutAddress) should ===(Some(c2))
identify(c21.path.toStringWithoutAddress) should ===(Some(c21))
}
"select actors by their relative path" in {
identify(c1.path.elements.mkString("/")) should be(Some(c1))
identify(c2.path.elements.mkString("/")) should be(Some(c2))
identify(c21.path.elements.mkString("/")) should be(Some(c21))
identify(c1.path.elements.mkString("/")) should ===(Some(c1))
identify(c2.path.elements.mkString("/")) should ===(Some(c2))
identify(c21.path.elements.mkString("/")) should ===(Some(c21))
}
"select system-generated actors" in {
identify("/user") should be(Some(user))
identify("/system") should be(Some(syst))
identify(syst.path) should be(Some(syst))
identify(syst.path.toStringWithoutAddress) should be(Some(syst))
identify("/") should be(Some(root))
identify("") should be(Some(root))
identify(RootActorPath(root.path.address)) should be(Some(root))
identify("..") should be(Some(root))
identify(root.path) should be(Some(root))
identify(root.path.toStringWithoutAddress) should be(Some(root))
identify("user") should be(Some(user))
identify("system") should be(Some(syst))
identify("user/") should be(Some(user))
identify("system/") should be(Some(syst))
identify("/user") should ===(Some(user))
identify("/system") should ===(Some(syst))
identify(syst.path) should ===(Some(syst))
identify(syst.path.toStringWithoutAddress) should ===(Some(syst))
identify("/") should ===(Some(root))
identify("") should ===(Some(root))
identify(RootActorPath(root.path.address)) should ===(Some(root))
identify("..") should ===(Some(root))
identify(root.path) should ===(Some(root))
identify(root.path.toStringWithoutAddress) should ===(Some(root))
identify("user") should ===(Some(user))
identify("system") should ===(Some(syst))
identify("user/") should ===(Some(user))
identify("system/") should ===(Some(syst))
}
"return ActorIdentity(None), respectively, for non-existing paths, and deadLetters" in {
identify("a/b/c") should be(None)
identify("a/b/c") should be(None)
identify("akka://all-systems/Nobody") should be(None)
identify("akka://all-systems/user") should be(None)
identify(system / "hallo") should be(None)
identify("foo://user") should be(None)
identify("/deadLetters") should be(None)
identify("deadLetters") should be(None)
identify("deadLetters/") should be(None)
identify("a/b/c") should ===(None)
identify("a/b/c") should ===(None)
identify("akka://all-systems/Nobody") should ===(None)
identify("akka://all-systems/user") should ===(None)
identify(system / "hallo") should ===(None)
identify("foo://user") should ===(None)
identify("/deadLetters") should ===(None)
identify("deadLetters") should ===(None)
identify("deadLetters/") should ===(None)
}
}
@ -179,7 +179,7 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
"select actors by their path" in {
def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) {
askNode(looker, SelectPath(pathOf.path)) should be(Some(result))
askNode(looker, SelectPath(pathOf.path)) should ===(Some(result))
}
for {
looker all
@ -189,9 +189,9 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
"select actors by their string path representation" in {
def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) {
askNode(looker, SelectString(pathOf.path.toStringWithoutAddress)) should be(Some(result))
askNode(looker, SelectString(pathOf.path.toStringWithoutAddress)) should ===(Some(result))
// with trailing /
askNode(looker, SelectString(pathOf.path.toStringWithoutAddress + "/")) should be(Some(result))
askNode(looker, SelectString(pathOf.path.toStringWithoutAddress + "/")) should ===(Some(result))
}
for {
looker all
@ -201,8 +201,8 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
"select actors by their root-anchored relative path" in {
def check(looker: ActorRef, pathOf: ActorRef, result: ActorRef) {
askNode(looker, SelectString(pathOf.path.toStringWithoutAddress)) should be(Some(result))
askNode(looker, SelectString(pathOf.path.elements.mkString("/", "/", "/"))) should be(Some(result))
askNode(looker, SelectString(pathOf.path.toStringWithoutAddress)) should ===(Some(result))
askNode(looker, SelectString(pathOf.path.elements.mkString("/", "/", "/"))) should ===(Some(result))
}
for {
looker all
@ -212,8 +212,8 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
"select actors by their relative path" in {
def check(looker: ActorRef, result: ActorRef, elems: String*) {
askNode(looker, SelectString(elems mkString "/")) should be(Some(result))
askNode(looker, SelectString(elems mkString ("", "/", "/"))) should be(Some(result))
askNode(looker, SelectString(elems mkString "/")) should ===(Some(result))
askNode(looker, SelectString(elems mkString ("", "/", "/"))) should ===(Some(result))
}
check(c1, user, "..")
for {
@ -228,12 +228,12 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
"find system-generated actors" in {
def check(target: ActorRef) {
for (looker all) {
askNode(looker, SelectPath(target.path)) should be(Some(target))
askNode(looker, SelectString(target.path.toString)) should be(Some(target))
askNode(looker, SelectString(target.path.toString + "/")) should be(Some(target))
askNode(looker, SelectPath(target.path)) should ===(Some(target))
askNode(looker, SelectString(target.path.toString)) should ===(Some(target))
askNode(looker, SelectString(target.path.toString + "/")) should ===(Some(target))
}
if (target != root)
askNode(c1, SelectString("../.." + target.path.elements.mkString("/", "/", "/"))) should be(Some(target))
askNode(c1, SelectString("../.." + target.path.elements.mkString("/", "/", "/"))) should ===(Some(target))
}
for (target Seq(root, syst, user)) check(target)
}
@ -243,7 +243,7 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
def checkOne(looker: ActorRef, query: Query, result: Option[ActorRef]) {
val lookup = askNode(looker, query)
lookup should be(result)
lookup should ===(result)
}
def check(looker: ActorRef) {
val lookname = looker.path.elements.mkString("", "/", "/")
@ -266,19 +266,19 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
"send messages directly" in {
ActorSelection(c1, "") ! GetSender(testActor)
expectMsg(system.deadLetters)
lastSender should be(c1)
lastSender should ===(c1)
}
"send messages to string path" in {
system.actorSelection("/user/c2/c21") ! GetSender(testActor)
expectMsg(system.deadLetters)
lastSender should be(c21)
lastSender should ===(c21)
}
"send messages to actor path" in {
system.actorSelection(system / "c2" / "c21") ! GetSender(testActor)
expectMsg(system.deadLetters)
lastSender should be(c21)
lastSender should ===(c21)
}
"send messages with correct sender" in {
@ -287,7 +287,7 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
val actors = Set() ++ receiveWhile(messages = 2) {
case `c1` lastSender
}
actors should be(Set(c1, c2))
actors should ===(Set(c1, c2))
expectNoMsg(1 second)
}
@ -297,20 +297,20 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
val actors = receiveWhile(messages = 2) {
case `c2` lastSender
}
actors should be(Seq(c21))
actors should ===(Seq(c21))
expectNoMsg(1 second)
}
"resolve one actor with explicit timeout" in {
val s = system.actorSelection(system / "c2")
// Java and Scala API
Await.result(s.resolveOne(1.second.dilated), timeout.duration) should be(c2)
Await.result(s.resolveOne(1.second.dilated), timeout.duration) should ===(c2)
}
"resolve one actor with implicit timeout" in {
val s = system.actorSelection(system / "c2")
// Scala API; implicit timeout from DefaultTimeout trait
Await.result(s.resolveOne(), timeout.duration) should be(c2)
Await.result(s.resolveOne(), timeout.duration) should ===(c2)
}
"resolve non-existing with Failure" in {
@ -320,8 +320,8 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
}
"compare equally" in {
ActorSelection(c21, "../*/hello") should be(ActorSelection(c21, "../*/hello"))
ActorSelection(c21, "../*/hello").## should be(ActorSelection(c21, "../*/hello").##)
ActorSelection(c21, "../*/hello") should ===(ActorSelection(c21, "../*/hello"))
ActorSelection(c21, "../*/hello").## should ===(ActorSelection(c21, "../*/hello").##)
ActorSelection(c2, "../*/hello") should not be ActorSelection(c21, "../*/hello")
ActorSelection(c2, "../*/hello").## should not be ActorSelection(c21, "../*/hello").##
ActorSelection(c21, "../*/hell") should not be ActorSelection(c21, "../*/hello")
@ -329,16 +329,16 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
}
"print nicely" in {
ActorSelection(c21, "../*/hello").toString should be(
ActorSelection(c21, "../*/hello").toString should ===(
s"ActorSelection[Anchor(akka://ActorSelectionSpec/user/c2/c21#${c21.path.uid}), Path(/../*/hello)]")
}
"have a stringly serializable path" in {
system.actorSelection(system / "c2").toSerializationFormat should be("akka://ActorSelectionSpec/user/c2")
system.actorSelection(system / "c2" / "c21").toSerializationFormat should be("akka://ActorSelectionSpec/user/c2/c21")
ActorSelection(c2, "/").toSerializationFormat should be("akka://ActorSelectionSpec/user/c2")
ActorSelection(c2, "../*/hello").toSerializationFormat should be("akka://ActorSelectionSpec/user/c2/../*/hello")
ActorSelection(c2, "/../*/hello").toSerializationFormat should be("akka://ActorSelectionSpec/user/c2/../*/hello")
system.actorSelection(system / "c2").toSerializationFormat should ===("akka://ActorSelectionSpec/user/c2")
system.actorSelection(system / "c2" / "c21").toSerializationFormat should ===("akka://ActorSelectionSpec/user/c2/c21")
ActorSelection(c2, "/").toSerializationFormat should ===("akka://ActorSelectionSpec/user/c2")
ActorSelection(c2, "../*/hello").toSerializationFormat should ===("akka://ActorSelectionSpec/user/c2/../*/hello")
ActorSelection(c2, "/../*/hello").toSerializationFormat should ===("akka://ActorSelectionSpec/user/c2/../*/hello")
}
"send ActorSelection targeted to missing actor to deadLetters" in {
@ -346,9 +346,9 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
system.eventStream.subscribe(p.ref, classOf[DeadLetter])
system.actorSelection("/user/missing").tell("boom", testActor)
val d = p.expectMsgType[DeadLetter]
d.message should be("boom")
d.sender should be(testActor)
d.recipient.path.toStringWithoutAddress should be("/user/missing")
d.message should ===("boom")
d.sender should ===(testActor)
d.recipient.path.toStringWithoutAddress should ===("/user/missing")
}
"identify actors with wildcard selection correctly" in {
@ -362,7 +362,7 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
val probe = TestProbe()
system.actorSelection("/user/a/*").tell(Identify(1), probe.ref)
probe.receiveN(2).map { case ActorIdentity(1, r) r }.toSet should be(Set(Some(b1), Some(b2)))
probe.receiveN(2).map { case ActorIdentity(1, r) r }.toSet should ===(Set[Option[ActorRef]](Some(b1), Some(b2)))
probe.expectNoMsg(200.millis)
system.actorSelection("/user/a/b1/*").tell(Identify(2), probe.ref)
@ -395,7 +395,7 @@ class ActorSelectionSpec extends AkkaSpec("akka.loglevel=DEBUG") with DefaultTim
"forward to selection" in {
c2.tell(Forward("c21", "hello"), testActor)
expectMsg("hello")
lastSender should be(c21)
lastSender should ===(c21)
}
}

View file

@ -138,7 +138,7 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend
"An ActorSystem" must {
"use scala.concurrent.Future's InternalCallbackEC" in {
system.asInstanceOf[ActorSystemImpl].internalCallingThreadExecutionContext.getClass.getName should be("scala.concurrent.Future$InternalCallbackExecutor$")
system.asInstanceOf[ActorSystemImpl].internalCallingThreadExecutionContext.getClass.getName should ===("scala.concurrent.Future$InternalCallbackExecutor$")
}
"reject invalid names" in {
@ -163,9 +163,9 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend
"support extensions" in {
// TestExtension is configured and should be loaded at startup
system.hasExtension(TestExtension) should be(true)
TestExtension(system).system should be(system)
system.extension(TestExtension).system should be(system)
system.hasExtension(TestExtension) should ===(true)
TestExtension(system).system should ===(system)
system.extension(TestExtension).system should ===(system)
}
"log dead letters" in {
@ -200,7 +200,7 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend
val expected = (for (i 1 to count) yield i).reverse
immutableSeq(result) should be(expected)
immutableSeq(result) should ===(expected)
}
"awaitTermination after termination callbacks" in {
@ -217,22 +217,22 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend
system2.awaitTermination(5 seconds)
Await.ready(system2.whenTerminated, 5 seconds)
callbackWasRun should be(true)
callbackWasRun should ===(true)
}
"return isTerminated status correctly" in {
val system = ActorSystem().asInstanceOf[ActorSystemImpl]
system.isTerminated should be(false)
system.isTerminated should ===(false)
val wt = system.whenTerminated
wt.isCompleted should be(false)
wt.isCompleted should ===(false)
val f = system.terminate()
val terminated = Await.result(wt, 10 seconds)
terminated.actor should be(system.provider.rootGuardian)
terminated.addressTerminated should be(true)
terminated.existenceConfirmed should be(true)
terminated.actor should ===(system.provider.rootGuardian)
terminated.addressTerminated should ===(true)
terminated.existenceConfirmed should ===(true)
terminated should be theSameInstanceAs Await.result(f, 10 seconds)
system.awaitTermination(10 seconds)
system.isTerminated should be(true)
system.isTerminated should ===(true)
}
"throw RejectedExecutionException when shutdown" in {
@ -242,19 +242,19 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend
intercept[RejectedExecutionException] {
system2.registerOnTermination { println("IF YOU SEE THIS THEN THERE'S A BUG HERE") }
}.getMessage should be("ActorSystem already terminated.")
}.getMessage should ===("ActorSystem already terminated.")
}
"reliably create waves of actors" in {
import system.dispatcher
implicit val timeout = Timeout((20 seconds).dilated)
val waves = for (i 1 to 3) yield system.actorOf(Props[ActorSystemSpec.Waves]) ? 50000
Await.result(Future.sequence(waves), timeout.duration + 5.seconds) should be(Seq("done", "done", "done"))
Await.result(Future.sequence(waves), timeout.duration + 5.seconds) should ===(Vector("done", "done", "done"))
}
"find actors that just have been created" in {
system.actorOf(Props(new FastActor(TestLatch(), testActor)).withDispatcher("slow"))
expectMsgType[Class[_]] should be(classOf[LocalActorRef])
expectMsgType[Class[_]] should ===(classOf[LocalActorRef])
}
"reliable deny creation of actors while shutting down" in {
@ -279,7 +279,7 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend
}
}
created filter (ref !ref.isTerminated && !ref.asInstanceOf[ActorRefWithCell].underlying.isInstanceOf[UnstartedCell]) should be(Seq())
created filter (ref !ref.isTerminated && !ref.asInstanceOf[ActorRefWithCell].underlying.isInstanceOf[UnstartedCell]) should ===(Seq.empty[ActorRef])
}
"shut down when /user fails" in {
@ -305,8 +305,8 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend
a ! "die"
}
val t = probe.expectMsg(Terminated(a)(existenceConfirmed = true, addressTerminated = false))
t.existenceConfirmed should be(true)
t.addressTerminated should be(false)
t.existenceConfirmed should ===(true)
t.addressTerminated should ===(false)
shutdown(system)
}

View file

@ -119,7 +119,7 @@ class ActorWithStashSpec extends AkkaSpec(ActorWithStashSpec.testConf) with Defa
stasher ! "bye"
stasher ! "hello"
state.finished.await
state.s should be("bye")
state.s should ===("bye")
}
"support protocols" in {

View file

@ -120,11 +120,11 @@ trait DeathWatchSpec { this: AkkaSpec with ImplicitSender with DefaultTimeout
terminal ! Kill
terminal ! Kill
Await.result(terminal ? "foo", timeout.duration) should be("foo")
Await.result(terminal ? "foo", timeout.duration) should ===("foo")
terminal ! Kill
expectTerminationOf(terminal)
terminal.isTerminated should be(true)
terminal.isTerminated should ===(true)
system.stop(supervisor)
}
@ -155,7 +155,7 @@ trait DeathWatchSpec { this: AkkaSpec with ImplicitSender with DefaultTimeout
case WrappedTerminated(Terminated(`brother`)) 3
}
testActor.isTerminated should not be true
result should be(Seq(1, 2, 3))
result should ===(Seq(1, 2, 3))
}
}

View file

@ -77,7 +77,7 @@ class DeployerSpec extends AkkaSpec(DeployerSpec.deployerConf) {
val service = "/service1"
val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1))
deployment should be(Some(
deployment should ===(Some(
Deploy(
service,
deployment.get.config,
@ -90,14 +90,14 @@ class DeployerSpec extends AkkaSpec(DeployerSpec.deployerConf) {
"use None deployment for undefined service" in {
val service = "/undefined"
val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1))
deployment should be(None)
deployment should ===(None)
}
"be able to parse 'akka.actor.deployment._' with dispatcher config" in {
val service = "/service3"
val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1))
deployment should be(Some(
deployment should ===(Some(
Deploy(
service,
deployment.get.config,
@ -111,7 +111,7 @@ class DeployerSpec extends AkkaSpec(DeployerSpec.deployerConf) {
val service = "/service4"
val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1))
deployment should be(Some(
deployment should ===(Some(
Deploy(
service,
deployment.get.config,
@ -189,28 +189,28 @@ class DeployerSpec extends AkkaSpec(DeployerSpec.deployerConf) {
"have correct router mappings" in {
val mapping = system.asInstanceOf[ActorSystemImpl].provider.deployer.routerTypeMapping
mapping("from-code") should be(classOf[akka.routing.NoRouter].getName)
mapping("round-robin-pool") should be(classOf[akka.routing.RoundRobinPool].getName)
mapping("round-robin-group") should be(classOf[akka.routing.RoundRobinGroup].getName)
mapping("random-pool") should be(classOf[akka.routing.RandomPool].getName)
mapping("random-group") should be(classOf[akka.routing.RandomGroup].getName)
mapping("balancing-pool") should be(classOf[akka.routing.BalancingPool].getName)
mapping("smallest-mailbox-pool") should be(classOf[akka.routing.SmallestMailboxPool].getName)
mapping("broadcast-pool") should be(classOf[akka.routing.BroadcastPool].getName)
mapping("broadcast-group") should be(classOf[akka.routing.BroadcastGroup].getName)
mapping("scatter-gather-pool") should be(classOf[akka.routing.ScatterGatherFirstCompletedPool].getName)
mapping("scatter-gather-group") should be(classOf[akka.routing.ScatterGatherFirstCompletedGroup].getName)
mapping("consistent-hashing-pool") should be(classOf[akka.routing.ConsistentHashingPool].getName)
mapping("consistent-hashing-group") should be(classOf[akka.routing.ConsistentHashingGroup].getName)
mapping("from-code") should ===(classOf[akka.routing.NoRouter].getName)
mapping("round-robin-pool") should ===(classOf[akka.routing.RoundRobinPool].getName)
mapping("round-robin-group") should ===(classOf[akka.routing.RoundRobinGroup].getName)
mapping("random-pool") should ===(classOf[akka.routing.RandomPool].getName)
mapping("random-group") should ===(classOf[akka.routing.RandomGroup].getName)
mapping("balancing-pool") should ===(classOf[akka.routing.BalancingPool].getName)
mapping("smallest-mailbox-pool") should ===(classOf[akka.routing.SmallestMailboxPool].getName)
mapping("broadcast-pool") should ===(classOf[akka.routing.BroadcastPool].getName)
mapping("broadcast-group") should ===(classOf[akka.routing.BroadcastGroup].getName)
mapping("scatter-gather-pool") should ===(classOf[akka.routing.ScatterGatherFirstCompletedPool].getName)
mapping("scatter-gather-group") should ===(classOf[akka.routing.ScatterGatherFirstCompletedGroup].getName)
mapping("consistent-hashing-pool") should ===(classOf[akka.routing.ConsistentHashingPool].getName)
mapping("consistent-hashing-group") should ===(classOf[akka.routing.ConsistentHashingGroup].getName)
}
def assertRouting(service: String, expected: RouterConfig, expectPath: String): Unit = {
val deployment = system.asInstanceOf[ActorSystemImpl].provider.deployer.lookup(service.split("/").drop(1))
deployment.map(_.path).getOrElse("NOT FOUND") should be(expectPath)
deployment.get.routerConfig.getClass should be(expected.getClass)
deployment.get.scope should be(NoScopeGiven)
deployment.map(_.path).getOrElse("NOT FOUND") should ===(expectPath)
deployment.get.routerConfig.getClass should ===(expected.getClass)
deployment.get.scope should ===(NoScopeGiven)
expected match {
case pool: Pool deployment.get.routerConfig.asInstanceOf[Pool].resizer should be(pool.resizer)
case pool: Pool deployment.get.routerConfig.asInstanceOf[Pool].resizer should ===(pool.resizer)
case _
}
}

View file

@ -239,8 +239,8 @@ class FSMActorSpec extends AkkaSpec(Map("akka.actor.debug.fsm" -> true)) with Im
})
def checkTimersActive(active: Boolean) {
for (timer timerNames) fsmref.isTimerActive(timer) should be(active)
fsmref.isStateTimerActive should be(active)
for (timer timerNames) fsmref.isTimerActive(timer) should ===(active)
fsmref.isStateTimerActive should ===(active)
}
checkTimersActive(false)

View file

@ -38,7 +38,7 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi
"find actor refs using actorFor" in {
val a = system.actorOf(Props(new Actor { def receive = { case _ } }))
val b = system.actorFor(a.path)
a should be(b)
a should ===(b)
}
"find child actor with URL encoded name using actorFor" in {
@ -53,8 +53,8 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi
}))
a.tell("lookup", testActor)
val b = expectMsgType[ActorRef]
b.isTerminated should be(false)
b.path.name should be(childName)
b.isTerminated should ===(false)
b.path.name should ===(childName)
}
}
@ -109,7 +109,7 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi
a.tell(GetChild, testActor)
val child = expectMsgType[ActorRef]
val childProps1 = child.asInstanceOf[LocalActorRef].underlying.props
childProps1 should be(Props.empty)
childProps1 should ===(Props.empty)
system stop a
expectTerminated(a)
// the fields are cleared after the Terminated message has been sent,
@ -128,7 +128,7 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi
val impl = system.asInstanceOf[ActorSystemImpl]
val provider = impl.provider
provider.isInstanceOf[LocalActorRefProvider] should be(true)
provider.isInstanceOf[LocalActorRefProvider] should ===(true)
for (i 0 until 100) {
val address = "new-actor" + i
@ -139,7 +139,7 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi
case Some(Failure(ex: InvalidActorNameException)) 2
case x x
})
set should be(Set(1, 2))
set should ===(Set[Any](1, 2))
}
}
@ -156,18 +156,18 @@ class LocalActorRefProviderSpec extends AkkaSpec(LocalActorRefProviderSpec.confi
}
"throw suitable exceptions for malformed actor names" in {
intercept[InvalidActorNameException](system.actorOf(Props.empty, null)).getMessage.contains("null") should be(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "")).getMessage.contains("empty") should be(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "$hallo")).getMessage.contains("not start with `$`") should be(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "a%")).getMessage.contains("Illegal actor name") should be(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "%3")).getMessage.contains("Illegal actor name") should be(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "%xx")).getMessage.contains("Illegal actor name") should be(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "%0G")).getMessage.contains("Illegal actor name") should be(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "%gg")).getMessage.contains("Illegal actor name") should be(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "%")).getMessage.contains("Illegal actor name") should be(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "%1t")).getMessage.contains("Illegal actor name") should be(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "a?")).getMessage.contains("Illegal actor name") should be(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "üß")).getMessage.contains("include only ASCII") should be(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, null)).getMessage.contains("null") should ===(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "")).getMessage.contains("empty") should ===(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "$hallo")).getMessage.contains("not start with `$`") should ===(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "a%")).getMessage.contains("Illegal actor name") should ===(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "%3")).getMessage.contains("Illegal actor name") should ===(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "%xx")).getMessage.contains("Illegal actor name") should ===(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "%0G")).getMessage.contains("Illegal actor name") should ===(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "%gg")).getMessage.contains("Illegal actor name") should ===(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "%")).getMessage.contains("Illegal actor name") should ===(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "%1t")).getMessage.contains("Illegal actor name") should ===(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "a?")).getMessage.contains("Illegal actor name") should ===(true)
intercept[InvalidActorNameException](system.actorOf(Props.empty, "üß")).getMessage.contains("include only ASCII") should ===(true)
}
}

View file

@ -73,7 +73,7 @@ class ReceiveTimeoutSpec extends AkkaSpec {
timeoutActor ! Tick
Await.ready(timeoutLatch, TestLatch.DefaultTimeout)
count.get should be(1)
count.get should ===(1)
system.stop(timeoutActor)
}

View file

@ -14,17 +14,17 @@ class RelativeActorPathSpec extends WordSpec with Matchers {
"RelativeActorPath" must {
"match single name" in {
elements("foo") should be(List("foo"))
elements("foo") should ===(List("foo"))
}
"match path separated names" in {
elements("foo/bar/baz") should be(List("foo", "bar", "baz"))
elements("foo/bar/baz") should ===(List("foo", "bar", "baz"))
}
"match url encoded name" in {
val name = URLEncoder.encode("akka://ClusterSystem@127.0.0.1:2552", "UTF-8")
elements(name) should be(List(name))
elements(name) should ===(List(name))
}
"match path with uid fragment" in {
elements("foo/bar/baz#1234") should be(List("foo", "bar", "baz#1234"))
elements("foo/bar/baz#1234") should ===(List("foo", "bar", "baz#1234"))
}
}
}

View file

@ -91,12 +91,12 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
// should not be run immediately
assert(countDownLatch.await(100, TimeUnit.MILLISECONDS) == false)
countDownLatch.getCount should be(3)
countDownLatch.getCount should ===(3)
// after 1 second the wait should fail
assert(countDownLatch.await(2, TimeUnit.SECONDS) == false)
// should still be 1 left
countDownLatch.getCount should be(1)
countDownLatch.getCount should ===(1)
}
/**
@ -120,7 +120,7 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
timeout.cancel()
Thread.sleep((initialDelay + 100.milliseconds.dilated).toMillis)
ticks.get should be(0)
ticks.get should ===(0)
}
"be cancellable after initial delay" taggedAs TimingTest in {
@ -135,25 +135,25 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
timeout.cancel()
Thread.sleep((delay + 100.milliseconds.dilated).toMillis)
ticks.get should be(1)
ticks.get should ===(1)
}
"be canceled if cancel is performed before execution" in {
val task = collectCancellable(system.scheduler.scheduleOnce(10 seconds)(()))
task.cancel() should be(true)
task.isCancelled should be(true)
task.cancel() should be(false)
task.isCancelled should be(true)
task.cancel() should ===(true)
task.isCancelled should ===(true)
task.cancel() should ===(false)
task.isCancelled should ===(true)
}
"not be canceled if cancel is performed after execution" in {
val latch = TestLatch(1)
val task = collectCancellable(system.scheduler.scheduleOnce(10 millis)(latch.countDown()))
Await.ready(latch, remainingOrDefault)
task.cancel() should be(false)
task.isCancelled should be(false)
task.cancel() should be(false)
task.isCancelled should be(false)
task.cancel() should ===(false)
task.isCancelled should ===(false)
task.cancel() should ===(false)
task.isCancelled should ===(false)
}
/**
@ -228,7 +228,7 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
// LARS is a bit more aggressive in scheduling recurring tasks at the right
// frequency and may execute them a little earlier; the actual expected timing
// is 1599ms on a fast machine or 1699ms on a loaded one (plus some room for jenkins)
(System.nanoTime() - startTime).nanos.toMillis should be(1750L +- 250)
(System.nanoTime() - startTime).nanos.toMillis should ===(1750L +- 250)
}
"adjust for scheduler inaccuracy" taggedAs TimingTest in {
@ -238,7 +238,7 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
system.scheduler.schedule(25.millis, 25.millis) { latch.countDown() }
Await.ready(latch, 6.seconds)
// Rate
n * 1000.0 / (System.nanoTime - startTime).nanos.toMillis should be(40.0 +- 4)
n * 1000.0 / (System.nanoTime - startTime).nanos.toMillis should ===(40.0 +- 4)
}
"not be affected by long running task" taggedAs TimingTest in {
@ -251,7 +251,7 @@ trait SchedulerSpec extends BeforeAndAfterEach with DefaultTimeout with Implicit
}
Await.ready(latch, 6.seconds)
// Rate
n * 1000.0 / (System.nanoTime - startTime).nanos.toMillis should be(4.4 +- 0.3)
n * 1000.0 / (System.nanoTime - startTime).nanos.toMillis should ===(4.4 +- 0.3)
}
"handle timeouts equal to multiple of wheel period" taggedAs TimingTest in {
@ -482,7 +482,7 @@ class LightArrayRevolverSchedulerSpec extends AkkaSpec(SchedulerSpec.testConfRev
val s = success.size
s should be < cap
awaitCond(s == counter.get, message = s"$s was not ${counter.get}")
failure.size should be(headroom)
failure.size should ===(headroom)
}
}
}
@ -490,7 +490,7 @@ class LightArrayRevolverSchedulerSpec extends AkkaSpec(SchedulerSpec.testConfRev
trait Driver {
def wakeUp(d: FiniteDuration): Unit
def expectWait(): FiniteDuration
def expectWait(d: FiniteDuration) { expectWait() should be(d) }
def expectWait(d: FiniteDuration) { expectWait() should ===(d) }
def probe: TestProbe
def step: FiniteDuration
def close(): Unit

View file

@ -859,9 +859,9 @@ class SupervisorHierarchySpec extends AkkaSpec(SupervisorHierarchySpec.config) w
failResumer ! "blahonga"
expectMsg("blahonga")
}
createAttempt.get should be(6)
preStartCalled.get should be(1)
postRestartCalled.get should be(0)
createAttempt.get should ===(6)
preStartCalled.get should ===(1)
postRestartCalled.get should ===(0)
}
"survive being stressed" in {

View file

@ -63,7 +63,7 @@ class SupervisorMiscSpec extends AkkaSpec(SupervisorMiscSpec.config) with Defaul
Seq("actor1" -> actor1, "actor2" -> actor2, "actor3" -> actor3, "actor4" -> actor4) map {
case (id, ref) (id, ref ? "status")
} foreach {
case (id, f) (id, Await.result(f, timeout.duration)) should be((id, "OK"))
case (id, f) (id, Await.result(f, timeout.duration)) should ===((id, "OK"))
}
}
}
@ -80,7 +80,7 @@ class SupervisorMiscSpec extends AkkaSpec(SupervisorMiscSpec.config) with Defaul
}
expectMsg("preStart")
expectMsg("preStart")
a.isTerminated should be(false)
a.isTerminated should ===(false)
}
"be able to recreate child when old child is Terminated" in {
@ -156,8 +156,8 @@ class SupervisorMiscSpec extends AkkaSpec(SupervisorMiscSpec.config) with Defaul
parent ! "doit"
}
val p = expectMsgType[ActorRef].path
p.parent should be(parent.path)
p.name should be("child")
p.parent should ===(parent.path)
p.name should ===("child")
}
}
}

View file

@ -139,7 +139,7 @@ class SupervisorSpec extends AkkaSpec("akka.actor.serialize-messages = off") wit
}
def ping(pingPongActor: ActorRef) = {
Await.result(pingPongActor.?(Ping)(DilatedTimeout), DilatedTimeout) should be(PongMessage)
Await.result(pingPongActor.?(Ping)(DilatedTimeout), DilatedTimeout) should ===(PongMessage)
expectMsg(Timeout, PingMessage)
}
@ -371,7 +371,7 @@ class SupervisorSpec extends AkkaSpec("akka.actor.serialize-messages = off") wit
dyingActor ! Ping
expectMsg(PongMessage)
inits.get should be(3)
inits.get should ===(3)
system.stop(supervisor)
}

View file

@ -224,13 +224,13 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
TypedActor(system).typedActorOf(
TypedProps[StackedImpl](classOf[Stacked], classOf[StackedImpl]).withTimeout(timeout))
def mustStop(typedActor: AnyRef) = TypedActor(system).stop(typedActor) should be(true)
def mustStop(typedActor: AnyRef) = TypedActor(system).stop(typedActor) should ===(true)
"TypedActors" must {
"be able to instantiate" in {
val t = newFooBar
TypedActor(system).isTypedActor(t) should be(true)
TypedActor(system).isTypedActor(t) should ===(true)
mustStop(t)
}
@ -240,62 +240,62 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
}
"not stop non-started ones" in {
TypedActor(system).stop(null) should be(false)
TypedActor(system).stop(null) should ===(false)
}
"throw an IllegalStateExcpetion when TypedActor.self is called in the wrong scope" in {
filterEvents(EventFilter[IllegalStateException]("Calling")) {
(intercept[IllegalStateException] {
TypedActor.self[Foo]
}).getMessage should be("Calling TypedActor.self outside of a TypedActor implementation method!")
}).getMessage should ===("Calling TypedActor.self outside of a TypedActor implementation method!")
}
}
"have access to itself when executing a method call" in {
val t = newFooBar
t.self should be(t)
t.self should ===(t)
mustStop(t)
}
"be able to call toString" in {
val t = newFooBar
t.toString should be(TypedActor(system).getActorRefFor(t).toString)
t.toString should ===(TypedActor(system).getActorRefFor(t).toString)
mustStop(t)
}
"be able to call equals" in {
val t = newFooBar
t should be(t)
t should ===(t)
t should not equal (null)
mustStop(t)
}
"be able to call hashCode" in {
val t = newFooBar
t.hashCode should be(TypedActor(system).getActorRefFor(t).hashCode)
t.hashCode should ===(TypedActor(system).getActorRefFor(t).hashCode)
mustStop(t)
}
"be able to call user-defined void-methods" in {
val t = newFooBar
t.incr()
t.read() should be(1)
t.read() should ===(1)
t.incr()
t.read() should be(2)
t.read() should be(2)
t.read() should ===(2)
t.read() should ===(2)
mustStop(t)
}
"be able to call normally returning methods" in {
val t = newFooBar
t.pigdog() should be("Pigdog")
t.pigdog() should ===("Pigdog")
mustStop(t)
}
"be able to call null returning methods" in {
val t = newFooBar
t.nullJOption() should be(JOption.none)
t.nullOption() should be(None)
t.nullOption() should ===(None)
t.nullReturn() should ===(null)
Await.result(t.nullFuture(), timeout.duration) should ===(null)
}
@ -303,8 +303,8 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
"be able to call Future-returning methods non-blockingly" in {
val t = newFooBar
val f = t.futurePigdog(200 millis)
f.isCompleted should be(false)
Await.result(f, timeout.duration) should be("Pigdog")
f.isCompleted should ===(false)
Await.result(f, timeout.duration) should ===("Pigdog")
mustStop(t)
}
@ -312,36 +312,36 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
val t = newFooBar
val futures = for (i 1 to 20) yield (i, t.futurePigdog(20 millis, i))
for ((i, f) futures) {
Await.result(f, remaining) should be("Pigdog" + i)
Await.result(f, remaining) should ===("Pigdog" + i)
}
mustStop(t)
}
"be able to call methods returning Java Options" taggedAs TimingTest in {
val t = newFooBar(1 second)
t.joptionPigdog(100 millis).get should be("Pigdog")
t.joptionPigdog(2 seconds) should be(JOption.none[String])
t.joptionPigdog(100 millis).get should ===("Pigdog")
t.joptionPigdog(2 seconds) should ===(JOption.none[String])
mustStop(t)
}
"be able to handle AskTimeoutException as None" taggedAs TimingTest in {
val t = newFooBar(200 millis)
t.joptionPigdog(600 millis) should be(JOption.none[String])
t.joptionPigdog(600 millis) should ===(JOption.none[String])
mustStop(t)
}
"be able to call methods returning Scala Options" taggedAs TimingTest in {
val t = newFooBar(1 second)
t.optionPigdog(100 millis).get should be("Pigdog")
t.optionPigdog(2 seconds) should be(None)
t.optionPigdog(100 millis).get should ===("Pigdog")
t.optionPigdog(2 seconds) should ===(None)
mustStop(t)
}
"be able to compose futures without blocking" in within(timeout.duration) {
val t, t2 = newFooBar(remaining)
val f = t.futureComposePigdogFrom(t2)
f.isCompleted should be(false)
Await.result(f, remaining) should be("PIGDOG")
f.isCompleted should ===(false)
Await.result(f, remaining) should ===("PIGDOG")
mustStop(t)
mustStop(t2)
}
@ -360,17 +360,17 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
t.incr()
t.failingPigdog()
t.read() should be(1) //Make sure state is not reset after failure
t.read() should ===(1) //Make sure state is not reset after failure
intercept[IllegalStateException] { Await.result(t.failingFuturePigdog, 2 seconds) }.getMessage should be("expected")
t.read() should be(1) //Make sure state is not reset after failure
intercept[IllegalStateException] { Await.result(t.failingFuturePigdog, 2 seconds) }.getMessage should ===("expected")
t.read() should ===(1) //Make sure state is not reset after failure
(intercept[IllegalStateException] { t.failingJOptionPigdog }).getMessage should be("expected")
t.read() should be(1) //Make sure state is not reset after failure
(intercept[IllegalStateException] { t.failingJOptionPigdog }).getMessage should ===("expected")
t.read() should ===(1) //Make sure state is not reset after failure
(intercept[IllegalStateException] { t.failingOptionPigdog }).getMessage should be("expected")
(intercept[IllegalStateException] { t.failingOptionPigdog }).getMessage should ===("expected")
t.read() should be(1) //Make sure state is not reset after failure
t.read() should ===(1) //Make sure state is not reset after failure
mustStop(t)
}
@ -379,13 +379,13 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
"be restarted on failure" in {
filterEvents(EventFilter[IllegalStateException]("expected")) {
val t = newFooBar(Duration(2, "s"))
intercept[IllegalStateException] { t.failingOptionPigdog() }.getMessage should be("expected")
t.optionPigdog() should be(Some("Pigdog"))
intercept[IllegalStateException] { t.failingOptionPigdog() }.getMessage should ===("expected")
t.optionPigdog() should ===(Some("Pigdog"))
mustStop(t)
val ta: F = TypedActor(system).typedActorOf(TypedProps[FI]())
intercept[IllegalStateException] { ta.f(true) }.getMessage should be("expected")
ta.f(false) should be(1)
intercept[IllegalStateException] { ta.f(true) }.getMessage should ===("expected")
ta.f(false) should ===(1)
mustStop(ta)
}
@ -393,8 +393,8 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
"be able to support stacked traits for the interface part" in {
val t = newStacked()
t.notOverriddenStacked should be("foobar")
t.stacked should be("FOOBAR")
t.notOverriddenStacked should ===("foobar")
t.stacked should ===("FOOBAR")
mustStop(t)
}
@ -402,16 +402,16 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
val t: Foo = TypedActor(system).typedActorOf(TypedProps[Bar]())
val f = t.futurePigdog(200 millis)
val f2 = t.futurePigdog(Duration.Zero)
f2.isCompleted should be(false)
f.isCompleted should be(false)
Await.result(f, remaining) should be(Await.result(f2, remaining))
f2.isCompleted should ===(false)
f.isCompleted should ===(false)
Await.result(f, remaining) should ===(Await.result(f2, remaining))
mustStop(t)
}
"be able to support implementation only typed actors with complex interfaces" in {
val t: Stackable1 with Stackable2 = TypedActor(system).typedActorOf(TypedProps[StackedImpl]())
t.stackable1 should be("foo")
t.stackable2 should be("bar")
t.stackable1 should ===("foo")
t.stackable2 should ===("bar")
mustStop(t)
}
@ -421,7 +421,7 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
val results = for (i 1 to 120) yield (i, iterator.next.futurePigdog(200 millis, i))
for ((i, r) results) Await.result(r, remaining) should be("Pigdog" + i)
for ((i, r) results) Await.result(r, remaining) should ===("Pigdog" + i)
for (t thais) mustStop(t)
}
@ -440,7 +440,7 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
val mNew = in.readObject().asInstanceOf[TypedActor.MethodCall]
mNew.method should be(m.method)
mNew.method should ===(m.method)
}
}
@ -459,13 +459,13 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
val mNew = in.readObject().asInstanceOf[TypedActor.MethodCall]
mNew.method should be(m.method)
mNew.method should ===(m.method)
mNew.parameters should have size 3
mNew.parameters(0) should not be null
mNew.parameters(0).getClass should be(classOf[Bar])
mNew.parameters(1) should be(null)
mNew.parameters(0).getClass should ===(classOf[Bar])
mNew.parameters(1) should ===(null)
mNew.parameters(2) should not be null
mNew.parameters(2).asInstanceOf[Int] should be(1)
mNew.parameters(2).asInstanceOf[Int] should ===(1)
}
}
@ -474,7 +474,7 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
JavaSerializer.currentSystem.withValue(system.asInstanceOf[ExtendedActorSystem]) {
val t = newFooBar(Duration(2, "s"))
t.optionPigdog() should be(Some("Pigdog"))
t.optionPigdog() should ===(Some("Pigdog"))
val baos = new ByteArrayOutputStream(8192 * 4)
val out = new ObjectOutputStream(baos)
@ -486,9 +486,9 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
val tNew = in.readObject().asInstanceOf[Foo]
tNew should be(t)
tNew should ===(t)
tNew.optionPigdog() should be(Some("Pigdog"))
tNew.optionPigdog() should ===(Some("Pigdog"))
mustStop(t)
}
@ -512,7 +512,7 @@ class TypedActorSpec extends AkkaSpec(TypedActorSpec.config)
//Done with that now
ta.poisonPill(t)
latch.await(10, TimeUnit.SECONDS) should be(true)
latch.await(10, TimeUnit.SECONDS) should ===(true)
}
}
}
@ -528,7 +528,7 @@ class TypedActorRouterSpec extends AkkaSpec(TypedActorSpec.config)
def newFooBar(d: FiniteDuration): Foo =
TypedActor(system).typedActorOf(TypedProps[Bar](classOf[Foo], classOf[Bar]).withTimeout(Timeout(d)))
def mustStop(typedActor: AnyRef) = TypedActor(system).stop(typedActor) should be(true)
def mustStop(typedActor: AnyRef) = TypedActor(system).stop(typedActor) should ===(true)
"TypedActor Router" must {
@ -539,8 +539,8 @@ class TypedActorRouterSpec extends AkkaSpec(TypedActorSpec.config)
val t4 = newFooBar
val routees = List(t1, t2, t3, t4) map { t TypedActor(system).getActorRefFor(t).path.toStringWithoutAddress }
TypedActor(system).isTypedActor(t1) should be(true)
TypedActor(system).isTypedActor(t2) should be(true)
TypedActor(system).isTypedActor(t1) should ===(true)
TypedActor(system).isTypedActor(t2) should ===(true)
val router = system.actorOf(RoundRobinGroup(routees).props(), "router")

View file

@ -80,8 +80,8 @@ class BalancingDispatcherSpec extends AkkaSpec(BalancingDispatcherSpec.config) {
}
finishedCounter.await(5, TimeUnit.SECONDS)
fast.underlying.asInstanceOf[ActorCell].mailbox.asInstanceOf[Mailbox].hasMessages should be(false)
slow.underlying.asInstanceOf[ActorCell].mailbox.asInstanceOf[Mailbox].hasMessages should be(false)
fast.underlying.asInstanceOf[ActorCell].mailbox.asInstanceOf[Mailbox].hasMessages should ===(false)
slow.underlying.asInstanceOf[ActorCell].mailbox.asInstanceOf[Mailbox].hasMessages should ===(false)
fast.underlying.asInstanceOf[ActorCell].actor.asInstanceOf[DelayableActor].invocationCount should be > sentToFast
fast.underlying.asInstanceOf[ActorCell].actor.asInstanceOf[DelayableActor].invocationCount should be >
(slow.underlying.asInstanceOf[ActorCell].actor.asInstanceOf[DelayableActor].invocationCount)

View file

@ -129,12 +129,12 @@ class DispatchersSpec extends AkkaSpec(DispatchersSpec.config) with ImplicitSend
"use defined properties" in {
val dispatcher = lookup("myapp.mydispatcher")
dispatcher.throughput should be(17)
dispatcher.throughput should ===(17)
}
"use specific id" in {
val dispatcher = lookup("myapp.mydispatcher")
dispatcher.id should be("myapp.mydispatcher")
dispatcher.id should ===("myapp.mydispatcher")
}
"complain about missing config" in {
@ -145,8 +145,8 @@ class DispatchersSpec extends AkkaSpec(DispatchersSpec.config) with ImplicitSend
"have only one default dispatcher" in {
val dispatcher = lookup(Dispatchers.DefaultDispatcherId)
dispatcher should be(defaultGlobalDispatcher)
dispatcher should be(system.dispatcher)
dispatcher should ===(defaultGlobalDispatcher)
dispatcher should ===(system.dispatcher)
}
"throw ConfigurationException if type does not exist" in {
@ -164,7 +164,7 @@ class DispatchersSpec extends AkkaSpec(DispatchersSpec.config) with ImplicitSend
"provide lookup of dispatchers by id" in {
val d1 = lookup("myapp.mydispatcher")
val d2 = lookup("myapp.mydispatcher")
d1 should be(d2)
d1 should ===(d2)
}
"include system name and dispatcher id in thread names for fork-join-executor" in {

View file

@ -47,7 +47,7 @@ class ListenerSpec extends AkkaSpec {
broadcast ! "foo"
Await.ready(barLatch, TestLatch.DefaultTimeout)
barCount.get should be(2)
barCount.get should ===(2)
Await.ready(fooLatch, TestLatch.DefaultTimeout)

View file

@ -26,46 +26,46 @@ class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference(ActorSystem.fin
{
import config._
getString("akka.version") should be("2.4-SNAPSHOT")
settings.ConfigVersion should be("2.4-SNAPSHOT")
getString("akka.version") should ===("2.4-SNAPSHOT")
settings.ConfigVersion should ===("2.4-SNAPSHOT")
getBoolean("akka.daemonic") should be(false)
getBoolean("akka.daemonic") should ===(false)
// WARNING: This setting should be off in the default reference.conf, but should be on when running
// the test suite.
getBoolean("akka.actor.serialize-messages") should be(true)
settings.SerializeAllMessages should be(true)
getBoolean("akka.actor.serialize-messages") should ===(true)
settings.SerializeAllMessages should ===(true)
getInt("akka.scheduler.ticks-per-wheel") should be(512)
getDuration("akka.scheduler.tick-duration", TimeUnit.MILLISECONDS) should be(10)
getString("akka.scheduler.implementation") should be("akka.actor.LightArrayRevolverScheduler")
getInt("akka.scheduler.ticks-per-wheel") should ===(512)
getDuration("akka.scheduler.tick-duration", TimeUnit.MILLISECONDS) should ===(10)
getString("akka.scheduler.implementation") should ===("akka.actor.LightArrayRevolverScheduler")
getBoolean("akka.daemonic") should be(false)
settings.Daemonicity should be(false)
getBoolean("akka.daemonic") should ===(false)
settings.Daemonicity should ===(false)
getBoolean("akka.jvm-exit-on-fatal-error") should be(true)
settings.JvmExitOnFatalError should be(true)
getBoolean("akka.jvm-exit-on-fatal-error") should ===(true)
settings.JvmExitOnFatalError should ===(true)
getInt("akka.actor.deployment.default.virtual-nodes-factor") should be(10)
settings.DefaultVirtualNodesFactor should be(10)
getInt("akka.actor.deployment.default.virtual-nodes-factor") should ===(10)
settings.DefaultVirtualNodesFactor should ===(10)
getDuration("akka.actor.unstarted-push-timeout", TimeUnit.MILLISECONDS) should be(10.seconds.toMillis)
settings.UnstartedPushTimeout.duration should be(10.seconds)
getDuration("akka.actor.unstarted-push-timeout", TimeUnit.MILLISECONDS) should ===(10.seconds.toMillis)
settings.UnstartedPushTimeout.duration should ===(10.seconds)
settings.Loggers.size should be(1)
settings.Loggers.head should be(classOf[DefaultLogger].getName)
getStringList("akka.loggers").get(0) should be(classOf[DefaultLogger].getName)
settings.Loggers.size should ===(1)
settings.Loggers.head should ===(classOf[DefaultLogger].getName)
getStringList("akka.loggers").get(0) should ===(classOf[DefaultLogger].getName)
getDuration("akka.logger-startup-timeout", TimeUnit.MILLISECONDS) should be(5.seconds.toMillis)
settings.LoggerStartTimeout.duration should be(5.seconds)
getDuration("akka.logger-startup-timeout", TimeUnit.MILLISECONDS) should ===(5.seconds.toMillis)
settings.LoggerStartTimeout.duration should ===(5.seconds)
getString("akka.logging-filter") should be(classOf[DefaultLoggingFilter].getName)
getString("akka.logging-filter") should ===(classOf[DefaultLoggingFilter].getName)
getInt("akka.log-dead-letters") should be(10)
settings.LogDeadLetters should be(10)
getInt("akka.log-dead-letters") should ===(10)
settings.LogDeadLetters should ===(10)
getBoolean("akka.log-dead-letters-during-shutdown") should be(true)
settings.LogDeadLettersDuringShutdown should be(true)
getBoolean("akka.log-dead-letters-during-shutdown") should ===(true)
settings.LogDeadLettersDuringShutdown should ===(true)
}
{
@ -74,27 +74,27 @@ class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference(ActorSystem.fin
//General dispatcher config
{
c.getString("type") should be("Dispatcher")
c.getString("executor") should be("default-executor")
c.getDuration("shutdown-timeout", TimeUnit.MILLISECONDS) should be(1 * 1000)
c.getInt("throughput") should be(5)
c.getDuration("throughput-deadline-time", TimeUnit.MILLISECONDS) should be(0)
c.getBoolean("attempt-teamwork") should be(true)
c.getString("type") should ===("Dispatcher")
c.getString("executor") should ===("default-executor")
c.getDuration("shutdown-timeout", TimeUnit.MILLISECONDS) should ===(1 * 1000)
c.getInt("throughput") should ===(5)
c.getDuration("throughput-deadline-time", TimeUnit.MILLISECONDS) should ===(0)
c.getBoolean("attempt-teamwork") should ===(true)
}
//Default executor config
{
val pool = c.getConfig("default-executor")
pool.getString("fallback") should be("fork-join-executor")
pool.getString("fallback") should ===("fork-join-executor")
}
//Fork join executor config
{
val pool = c.getConfig("fork-join-executor")
pool.getInt("parallelism-min") should be(8)
pool.getDouble("parallelism-factor") should be(3.0)
pool.getInt("parallelism-max") should be(64)
pool.getInt("parallelism-min") should ===(8)
pool.getDouble("parallelism-factor") should ===(3.0)
pool.getInt("parallelism-max") should ===(64)
}
//Thread pool executor config
@ -102,38 +102,38 @@ class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference(ActorSystem.fin
{
val pool = c.getConfig("thread-pool-executor")
import pool._
getDuration("keep-alive-time", TimeUnit.MILLISECONDS) should be(60 * 1000)
getDouble("core-pool-size-factor") should be(3.0)
getDouble("max-pool-size-factor") should be(3.0)
getInt("task-queue-size") should be(-1)
getString("task-queue-type") should be("linked")
getBoolean("allow-core-timeout") should be(true)
getDuration("keep-alive-time", TimeUnit.MILLISECONDS) should ===(60 * 1000)
getDouble("core-pool-size-factor") should ===(3.0)
getDouble("max-pool-size-factor") should ===(3.0)
getInt("task-queue-size") should ===(-1)
getString("task-queue-type") should ===("linked")
getBoolean("allow-core-timeout") should ===(true)
}
// Debug config
{
val debug = config.getConfig("akka.actor.debug")
import debug._
getBoolean("receive") should be(false)
settings.AddLoggingReceive should be(false)
getBoolean("receive") should ===(false)
settings.AddLoggingReceive should ===(false)
getBoolean("autoreceive") should be(false)
settings.DebugAutoReceive should be(false)
getBoolean("autoreceive") should ===(false)
settings.DebugAutoReceive should ===(false)
getBoolean("lifecycle") should be(false)
settings.DebugLifecycle should be(false)
getBoolean("lifecycle") should ===(false)
settings.DebugLifecycle should ===(false)
getBoolean("fsm") should be(false)
settings.FsmDebugEvent should be(false)
getBoolean("fsm") should ===(false)
settings.FsmDebugEvent should ===(false)
getBoolean("event-stream") should be(false)
settings.DebugEventStream should be(false)
getBoolean("event-stream") should ===(false)
settings.DebugEventStream should ===(false)
getBoolean("unhandled") should be(false)
settings.DebugUnhandledMessage should be(false)
getBoolean("unhandled") should ===(false)
settings.DebugUnhandledMessage should ===(false)
getBoolean("router-misconfiguration") should be(false)
settings.DebugRouterMisconfiguration should be(false)
getBoolean("router-misconfiguration") should ===(false)
settings.DebugRouterMisconfiguration should ===(false)
}
}
@ -144,9 +144,9 @@ class ConfigSpec extends AkkaSpec(ConfigFactory.defaultReference(ActorSystem.fin
// general mailbox config
{
c.getInt("mailbox-capacity") should be(1000)
c.getDuration("mailbox-push-timeout-time", TimeUnit.MILLISECONDS) should be(10 * 1000)
c.getString("mailbox-type") should be("akka.dispatch.UnboundedMailbox")
c.getInt("mailbox-capacity") should ===(1000)
c.getDuration("mailbox-push-timeout-time", TimeUnit.MILLISECONDS) should ===(10 * 1000)
c.getString("mailbox-type") should ===("akka.dispatch.UnboundedMailbox")
}
}
}

View file

@ -26,14 +26,14 @@ class Future2ActorSpec extends AkkaSpec with DefaultTimeout {
implicit val someActor = system.actorOf(Props(new Actor { def receive = Actor.emptyBehavior }))
Future(42) pipeTo testActor pipeTo testActor
expectMsgAllOf(1 second, 42, 42)
lastSender should be(someActor)
lastSender should ===(someActor)
}
"support convenient sending with explicit sender" in {
val someActor = system.actorOf(Props(new Actor { def receive = Actor.emptyBehavior }))
Future(42).to(testActor, someActor)
expectMsgAllOf(1 second, 42)
lastSender should be(someActor)
lastSender should ===(someActor)
}
"support reply via sender" in {
@ -43,10 +43,10 @@ class Future2ActorSpec extends AkkaSpec with DefaultTimeout {
case "ex" Future(throw new AssertionError) pipeTo context.sender()
}
}))
Await.result(actor ? "do", timeout.duration) should be(31)
Await.result(actor ? "do", timeout.duration) should ===(31)
intercept[ExecutionException] {
Await.result(actor ? "ex", timeout.duration)
}.getCause.isInstanceOf[AssertionError] should be(true)
}.getCause.isInstanceOf[AssertionError] should ===(true)
}
}
}

View file

@ -31,7 +31,7 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout {
}
"be able to use Batching" in {
system.dispatcher.isInstanceOf[BatchingExecutor] should be(true)
system.dispatcher.isInstanceOf[BatchingExecutor] should ===(true)
import system.dispatcher
@ -55,11 +55,11 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout {
}
callingThreadLock.compareAndSet(1, 0) // Disable the lock
}
Await.result(p.future, timeout.duration) should be(())
Await.result(p.future, timeout.duration) should ===(())
}
"be able to avoid starvation when Batching is used and Await/blocking is called" in {
system.dispatcher.isInstanceOf[BatchingExecutor] should be(true)
system.dispatcher.isInstanceOf[BatchingExecutor] should ===(true)
import system.dispatcher
def batchable[T](f: T)(implicit ec: ExecutionContext): Unit = ec.execute(new Batchable {
@ -93,15 +93,15 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout {
awaitCond(counter.get == 2)
perform(_ + 4)
perform(_ * 2)
sec.size should be(2)
sec.size should ===(2)
Thread.sleep(500)
sec.size should be(2)
counter.get should be(2)
sec.size should ===(2)
counter.get should ===(2)
sec.resume()
awaitCond(counter.get == 12)
perform(_ * 2)
awaitCond(counter.get == 24)
sec.isEmpty should be(true)
sec.isEmpty should ===(true)
}
"execute 'throughput' number of tasks per sweep" in {
@ -118,11 +118,11 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout {
val total = 1000
1 to total foreach { _ perform(_ + 1) }
sec.size() should be(total)
sec.size() should ===(total)
sec.resume()
awaitCond(counter.get == total)
submissions.get should be(total / throughput)
sec.isEmpty should be(true)
submissions.get should ===(total / throughput)
sec.isEmpty should ===(true)
}
"execute tasks in serial" in {
@ -133,7 +133,7 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout {
1 to total foreach { i perform(c if (c == (i - 1)) c + 1 else c) }
awaitCond(counter.get == total)
sec.isEmpty should be(true)
sec.isEmpty should ===(true)
}
"relinquish thread when suspended" in {
@ -151,13 +151,13 @@ class ExecutionContextSpec extends AkkaSpec with DefaultTimeout {
1 to 10 foreach { _ perform(identity) }
perform(x { sec.suspend(); x * 2 })
perform(_ + 8)
sec.size should be(13)
sec.size should ===(13)
sec.resume()
awaitCond(counter.get == 2)
sec.resume()
awaitCond(counter.get == 10)
sec.isEmpty should be(true)
submissions.get should be(2)
sec.isEmpty should ===(true)
submissions.get should ===(2)
}
}
}

View file

@ -89,12 +89,12 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
val empty = Promise[String]().future
val timedOut = Promise.successful[String]("Timedout").future
Await.result(failure fallbackTo timedOut, timeout.duration) should be("Timedout")
Await.result(timedOut fallbackTo empty, timeout.duration) should be("Timedout")
Await.result(failure fallbackTo failure fallbackTo timedOut, timeout.duration) should be("Timedout")
Await.result(failure fallbackTo timedOut, timeout.duration) should ===("Timedout")
Await.result(timedOut fallbackTo empty, timeout.duration) should ===("Timedout")
Await.result(failure fallbackTo failure fallbackTo timedOut, timeout.duration) should ===("Timedout")
intercept[RuntimeException] {
Await.result(failure fallbackTo otherFailure, timeout.duration)
}.getMessage should be("br0ken")
}.getMessage should ===("br0ken")
}
}
"completed with a result" must {
@ -138,7 +138,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
p.completeWith(Future { "Hi " }(B))
try {
Await.result(result, timeout.duration) should be("Hi A")
Await.result(result, timeout.duration) should ===("Hi A")
} finally {
A.shutdown()
B.shutdown()
@ -282,7 +282,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
c (actor ? 7).mapTo[String]
} yield b + "-" + c
Await.result(future1, timeout.duration) should be("10-14")
Await.result(future1, timeout.duration) should ===("10-14")
assert(checkType(future1, classTag[String]))
intercept[ClassCastException] { Await.result(future2, timeout.duration) }
system.stop(actor)
@ -310,7 +310,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
Res(c: Int) actor ? Req(7)
} yield b + "-" + c
Await.result(future1, timeout.duration) should be("10-14")
Await.result(future1, timeout.duration) should ===("10-14")
intercept[NoSuchElementException] { Await.result(future2, timeout.duration) }
system.stop(actor)
}
@ -347,17 +347,17 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
}
val future11 = actor ? "Failure" recover { case _ "Oops!" }
Await.result(future1, timeout.duration) should be(5)
Await.result(future1, timeout.duration) should ===(5)
intercept[ArithmeticException] { Await.result(future2, timeout.duration) }
intercept[ArithmeticException] { Await.result(future3, timeout.duration) }
Await.result(future4, timeout.duration) should be("5")
Await.result(future5, timeout.duration) should be("0")
Await.result(future4, timeout.duration) should ===("5")
Await.result(future5, timeout.duration) should ===("0")
intercept[ArithmeticException] { Await.result(future6, timeout.duration) }
Await.result(future7, timeout.duration) should be("You got ERROR")
Await.result(future7, timeout.duration) should ===("You got ERROR")
intercept[RuntimeException] { Await.result(future8, timeout.duration) }
Await.result(future9, timeout.duration) should be("FAIL!")
Await.result(future10, timeout.duration) should be("World")
Await.result(future11, timeout.duration) should be("Oops!")
Await.result(future9, timeout.duration) should ===("FAIL!")
Await.result(future10, timeout.duration) should ===("World")
Await.result(future11, timeout.duration) should ===("Oops!")
system.stop(actor)
}
@ -370,42 +370,42 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
intercept[IllegalStateException] {
Await.result(Promise.failed[String](o).future recoverWith { case _ if false == true yay }, timeout.duration)
} should be(o)
} should ===(o)
Await.result(Promise.failed[String](o).future recoverWith { case _ yay }, timeout.duration) should be("yay!")
Await.result(Promise.failed[String](o).future recoverWith { case _ yay }, timeout.duration) should ===("yay!")
intercept[IllegalStateException] {
Await.result(Promise.failed[String](o).future recoverWith { case _ Promise.failed[String](r).future }, timeout.duration)
} should be(r)
} should ===(r)
}
"andThen like a boss" in {
val q = new LinkedBlockingQueue[Int]
for (i 1 to 1000) {
Await.result(Future { q.add(1); 3 } andThen { case _ q.add(2) } andThen { case Success(0) q.add(Int.MaxValue) } andThen { case _ q.add(3); }, timeout.duration) should be(3)
q.poll() should be(1)
q.poll() should be(2)
q.poll() should be(3)
Await.result(Future { q.add(1); 3 } andThen { case _ q.add(2) } andThen { case Success(0) q.add(Int.MaxValue) } andThen { case _ q.add(3); }, timeout.duration) should ===(3)
q.poll() should ===(1)
q.poll() should ===(2)
q.poll() should ===(3)
q.clear()
}
}
"firstCompletedOf" in {
val futures = Vector.fill[Future[Int]](10)(Promise[Int]().future) :+ Promise.successful[Int](5).future
Await.result(Future.firstCompletedOf(futures), timeout.duration) should be(5)
Await.result(Future.firstCompletedOf(futures), timeout.duration) should ===(5)
}
"find" in {
val futures = for (i 1 to 10) yield Future { i }
val result = Future.find[Int](futures)(_ == 3)
Await.result(result, timeout.duration) should be(Some(3))
Await.result(result, timeout.duration) should ===(Some(3))
val notFound = Future.find[Int](futures)(_ == 11)
Await.result(notFound, timeout.duration) should be(None)
Await.result(notFound, timeout.duration) should ===(None)
}
"fold" in {
Await.result(Future.fold((1 to 10).toList map { i Future(i) })(0)(_ + _), remainingOrDefault) should be(55)
Await.result(Future.fold((1 to 10).toList map { i Future(i) })(0)(_ + _), remainingOrDefault) should ===(55)
}
"zip" in {
@ -413,22 +413,22 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
val f = new IllegalStateException("test")
intercept[IllegalStateException] {
Await.result(Promise.failed[String](f).future zip Promise.successful("foo").future, timeout)
} should be(f)
} should ===(f)
intercept[IllegalStateException] {
Await.result(Promise.successful("foo").future zip Promise.failed[String](f).future, timeout)
} should be(f)
} should ===(f)
intercept[IllegalStateException] {
Await.result(Promise.failed[String](f).future zip Promise.failed[String](f).future, timeout)
} should be(f)
} should ===(f)
Await.result(Promise.successful("foo").future zip Promise.successful("foo").future, timeout) should be(("foo", "foo"))
Await.result(Promise.successful("foo").future zip Promise.successful("foo").future, timeout) should ===(("foo", "foo"))
}
"fold by composing" in {
val futures = (1 to 10).toList map { i Future(i) }
Await.result(futures.foldLeft(Future(0))((fr, fa) for (r fr; a fa) yield (r + a)), timeout.duration) should be(55)
Await.result(futures.foldLeft(Future(0))((fr, fa) for (r fr; a fa) yield (r + a)), timeout.duration) should ===(55)
}
"fold with an exception" in {
@ -437,7 +437,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
case 6 Future(throw new IllegalArgumentException("shouldFoldResultsWithException: expected"))
case i Future(i)
}
intercept[Throwable] { Await.result(Future.fold(futures)(0)(_ + _), remainingOrDefault) }.getMessage should be("shouldFoldResultsWithException: expected")
intercept[Throwable] { Await.result(Future.fold(futures)(0)(_ + _), remainingOrDefault) }.getMessage should ===("shouldFoldResultsWithException: expected")
}
}
@ -458,7 +458,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
}
"return zero value if folding empty list" in {
Await.result(Future.fold(List[Future[Int]]())(0)(_ + _), timeout.duration) should be(0)
Await.result(Future.fold(List[Future[Int]]())(0)(_ + _), timeout.duration) should ===(0)
}
"reduce results" in {
@ -472,7 +472,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
case 6 Future(throw new IllegalArgumentException("shouldReduceResultsWithException: expected"))
case i Future(i)
}
intercept[Throwable] { Await.result(Future.reduce(futures)(_ + _), remainingOrDefault) }.getMessage should be("shouldReduceResultsWithException: expected")
intercept[Throwable] { Await.result(Future.reduce(futures)(_ + _), remainingOrDefault) }.getMessage should ===("shouldReduceResultsWithException: expected")
}
}
@ -629,7 +629,7 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
}
Await.ready(f, timeout.duration)
// TODO re-enable once we're using the batching dispatcher
// failCount.get should be(0)
// failCount.get should ===(0)
}
}
@ -637,52 +637,52 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
def emptyFuture(f: (Future[Any] Unit) Unit) {
"not be completed" in { f(_ should not be ('completed)) }
"not contain a value" in { f(_.value should be(None)) }
"not contain a value" in { f(_.value should ===(None)) }
}
def futureWithResult(f: ((Future[Any], Any) Unit) Unit) {
"be completed" in { f((future, _) future should be('completed)) }
"contain a value" in { f((future, result) future.value should be(Some(Success(result)))) }
"return result with 'get'" in { f((future, result) Await.result(future, timeout.duration) should be(result)) }
"return result with 'Await.result'" in { f((future, result) Await.result(future, timeout.duration) should be(result)) }
"contain a value" in { f((future, result) future.value should ===(Some(Success(result)))) }
"return result with 'get'" in { f((future, result) Await.result(future, timeout.duration) should ===(result)) }
"return result with 'Await.result'" in { f((future, result) Await.result(future, timeout.duration) should ===(result)) }
"not timeout" in { f((future, _) FutureSpec.ready(future, 0 millis)) }
"filter result" in {
f { (future, result)
Await.result((future filter (_ true)), timeout.duration) should be(result)
Await.result((future filter (_ true)), timeout.duration) should ===(result)
intercept[java.util.NoSuchElementException] { Await.result((future filter (_ false)), timeout.duration) }
}
}
"transform result with map" in { f((future, result) Await.result((future map (_.toString.length)), timeout.duration) should be(result.toString.length)) }
"transform result with map" in { f((future, result) Await.result((future map (_.toString.length)), timeout.duration) should ===(result.toString.length)) }
"compose result with flatMap" in {
f { (future, result)
val r = for (r future; p Promise.successful("foo").future) yield r.toString + p
Await.result(r, timeout.duration) should be(result.toString + "foo")
Await.result(r, timeout.duration) should ===(result.toString + "foo")
}
}
"perform action with foreach" in {
f { (future, result)
val p = Promise[Any]()
future foreach p.success
Await.result(p.future, timeout.duration) should be(result)
Await.result(p.future, timeout.duration) should ===(result)
}
}
"zip properly" in {
f { (future, result)
Await.result(future zip Promise.successful("foo").future, timeout.duration) should be((result, "foo"))
(intercept[RuntimeException] { Await.result(future zip Promise.failed(new RuntimeException("ohnoes")).future, timeout.duration) }).getMessage should be("ohnoes")
Await.result(future zip Promise.successful("foo").future, timeout.duration) should ===((result, "foo"))
(intercept[RuntimeException] { Await.result(future zip Promise.failed(new RuntimeException("ohnoes")).future, timeout.duration) }).getMessage should ===("ohnoes")
}
}
"not recover from exception" in { f((future, result) Await.result(future.recover({ case _ "pigdog" }), timeout.duration) should be(result)) }
"not recover from exception" in { f((future, result) Await.result(future.recover({ case _ "pigdog" }), timeout.duration) should ===(result)) }
"perform action on result" in {
f { (future, result)
val p = Promise[Any]()
future.onSuccess { case x p.success(x) }
Await.result(p.future, timeout.duration) should be(result)
Await.result(p.future, timeout.duration) should ===(result)
}
}
"not project a failure" in { f((future, result) (intercept[NoSuchElementException] { Await.result(future.failed, timeout.duration) }).getMessage should be("Future.failed not completed with a throwable.")) }
"not project a failure" in { f((future, result) (intercept[NoSuchElementException] { Await.result(future.failed, timeout.duration) }).getMessage should ===("Future.failed not completed with a throwable.")) }
"not perform action on exception" is pending
"cast using mapTo" in { f((future, result) Await.result(future.mapTo[Boolean].recover({ case _: ClassCastException false }), timeout.duration) should be(false)) }
"cast using mapTo" in { f((future, result) Await.result(future.mapTo[Boolean].recover({ case _: ClassCastException false }), timeout.duration) should ===(false)) }
}
def futureWithException[E <: Throwable: ClassTag](f: ((Future[Any], String) Unit) Unit) {
@ -692,35 +692,35 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa
future.value should be('defined)
future.value.get should be('failure)
val Failure(f) = future.value.get
f.getMessage should be(message)
f.getMessage should ===(message)
})
}
"throw exception with 'get'" in { f((future, message) (intercept[java.lang.Exception] { Await.result(future, timeout.duration) }).getMessage should be(message)) }
"throw exception with 'Await.result'" in { f((future, message) (intercept[java.lang.Exception] { Await.result(future, timeout.duration) }).getMessage should be(message)) }
"throw exception with 'get'" in { f((future, message) (intercept[java.lang.Exception] { Await.result(future, timeout.duration) }).getMessage should ===(message)) }
"throw exception with 'Await.result'" in { f((future, message) (intercept[java.lang.Exception] { Await.result(future, timeout.duration) }).getMessage should ===(message)) }
"retain exception with filter" in {
f { (future, message)
(intercept[java.lang.Exception] { Await.result(future filter (_ true), timeout.duration) }).getMessage should be(message)
(intercept[java.lang.Exception] { Await.result(future filter (_ false), timeout.duration) }).getMessage should be(message)
(intercept[java.lang.Exception] { Await.result(future filter (_ true), timeout.duration) }).getMessage should ===(message)
(intercept[java.lang.Exception] { Await.result(future filter (_ false), timeout.duration) }).getMessage should ===(message)
}
}
"retain exception with map" in { f((future, message) (intercept[java.lang.Exception] { Await.result(future map (_.toString.length), timeout.duration) }).getMessage should be(message)) }
"retain exception with flatMap" in { f((future, message) (intercept[java.lang.Exception] { Await.result(future flatMap (_ Promise.successful[Any]("foo").future), timeout.duration) }).getMessage should be(message)) }
"retain exception with map" in { f((future, message) (intercept[java.lang.Exception] { Await.result(future map (_.toString.length), timeout.duration) }).getMessage should ===(message)) }
"retain exception with flatMap" in { f((future, message) (intercept[java.lang.Exception] { Await.result(future flatMap (_ Promise.successful[Any]("foo").future), timeout.duration) }).getMessage should ===(message)) }
"not perform action with foreach" is pending
"zip properly" in {
f { (future, message) (intercept[java.lang.Exception] { Await.result(future zip Promise.successful("foo").future, timeout.duration) }).getMessage should be(message) }
f { (future, message) (intercept[java.lang.Exception] { Await.result(future zip Promise.successful("foo").future, timeout.duration) }).getMessage should ===(message) }
}
"recover from exception" in { f((future, message) Await.result(future.recover({ case e if e.getMessage == message "pigdog" }), timeout.duration) should be("pigdog")) }
"recover from exception" in { f((future, message) Await.result(future.recover({ case e if e.getMessage == message "pigdog" }), timeout.duration) should ===("pigdog")) }
"not perform action on result" is pending
"project a failure" in { f((future, message) Await.result(future.failed, timeout.duration).getMessage should be(message)) }
"project a failure" in { f((future, message) Await.result(future.failed, timeout.duration).getMessage should ===(message)) }
"perform action on exception" in {
f { (future, message)
val p = Promise[Any]()
future.onFailure { case _ p.success(message) }
Await.result(p.future, timeout.duration) should be(message)
Await.result(p.future, timeout.duration) should ===(message)
}
}
"always cast successfully using mapTo" in { f((future, message) (evaluating { Await.result(future.mapTo[java.lang.Thread], timeout.duration) } should produce[java.lang.Exception]).getMessage should be(message)) }
"always cast successfully using mapTo" in { f((future, message) (evaluating { Await.result(future.mapTo[java.lang.Thread], timeout.duration) } should produce[java.lang.Exception]).getMessage should ===(message)) }
}
implicit def arbFuture: Arbitrary[Future[Int]] = Arbitrary(for (n arbitrary[Int]) yield Future(n))

View file

@ -43,23 +43,23 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn
"create a bounded mailbox with 10 capacity and with push timeout" in {
val config = BoundedMailbox(10, 10 milliseconds)
config.capacity should be(10)
config.capacity should ===(10)
val q = factory(config)
ensureInitialMailboxState(config, q)
for (i 1 to config.capacity) q.enqueue(testActor, exampleMessage)
q.numberOfMessages should be(config.capacity)
q.hasMessages should be(true)
q.numberOfMessages should ===(config.capacity)
q.hasMessages should ===(true)
system.eventStream.subscribe(testActor, classOf[DeadLetter])
q.enqueue(testActor, exampleMessage)
expectMsg(DeadLetter(exampleMessage.message, system.deadLetters, testActor))
system.eventStream.unsubscribe(testActor, classOf[DeadLetter])
q.dequeue should be(exampleMessage)
q.numberOfMessages should be(config.capacity - 1)
q.hasMessages should be(true)
q.dequeue should ===(exampleMessage)
q.numberOfMessages should ===(config.capacity - 1)
q.hasMessages should ===(true)
}
"dequeue what was enqueued properly for unbounded mailboxes" in {
@ -86,16 +86,16 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn
def ensureMailboxSize(q: MessageQueue, expected: Int): Unit = q.numberOfMessages match {
case -1 | `expected`
q.hasMessages should be(expected != 0)
q.hasMessages should ===(expected != 0)
case other
other should be(expected)
q.hasMessages should be(expected != 0)
other should ===(expected)
q.hasMessages should ===(expected != 0)
}
def ensureSingleConsumerEnqueueDequeue(config: MailboxType) {
val q = factory(config)
ensureMailboxSize(q, 0)
q.dequeue should be(null)
q.dequeue should ===(null)
for (i 1 to 100) {
q.enqueue(testActor, exampleMessage)
ensureMailboxSize(q, i)
@ -104,11 +104,11 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn
ensureMailboxSize(q, 100)
for (i 99 to 0 by -1) {
q.dequeue() should be(exampleMessage)
q.dequeue() should ===(exampleMessage)
ensureMailboxSize(q, i)
}
q.dequeue should be(null)
q.dequeue should ===(null)
ensureMailboxSize(q, 0)
}
@ -117,13 +117,13 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn
q match {
case aQueue: BlockingQueue[_]
config match {
case BoundedMailbox(capacity, _) aQueue.remainingCapacity should be(capacity)
case UnboundedMailbox() aQueue.remainingCapacity should be(Int.MaxValue)
case BoundedMailbox(capacity, _) aQueue.remainingCapacity should ===(capacity)
case UnboundedMailbox() aQueue.remainingCapacity should ===(Int.MaxValue)
}
case _
}
q.numberOfMessages should be(0)
q.hasMessages should be(false)
q.numberOfMessages should ===(0)
q.hasMessages should ===(false)
}
def testEnqueueDequeue(config: MailboxType,
@ -166,14 +166,14 @@ abstract class MailboxSpec extends AkkaSpec with BeforeAndAfterAll with BeforeAn
val ps = producers.map(Await.result(_, remainingOrDefault))
val cs = consumers.map(Await.result(_, remainingOrDefault))
ps.map(_.size).sum should be(enqueueN) //Must have produced 1000 messages
cs.map(_.size).sum should be(dequeueN) //Must have consumed all produced messages
ps.map(_.size).sum should ===(enqueueN) //Must have produced 1000 messages
cs.map(_.size).sum should ===(dequeueN) //Must have consumed all produced messages
//No message is allowed to be consumed by more than one consumer
cs.flatten.distinct.size should be(dequeueN)
cs.flatten.distinct.size should ===(dequeueN)
//All consumed messages should have been produced
(cs.flatten diff ps.flatten).size should be(0)
(cs.flatten diff ps.flatten).size should ===(0)
//The ones that were produced and not consumed
(ps.flatten diff cs.flatten).size should be(enqueueN - dequeueN)
(ps.flatten diff cs.flatten).size should ===(enqueueN - dequeueN)
}
}
}
@ -241,7 +241,7 @@ class CustomMailboxSpec extends AkkaSpec(CustomMailboxSpec.config) {
case _ true
}, 1 second, 10 millis)
val queue = actor.asInstanceOf[ActorRefWithCell].underlying.asInstanceOf[ActorCell].mailbox.messageQueue
queue.getClass should be(classOf[CustomMailboxSpec.MyMailbox])
queue.getClass should ===(classOf[CustomMailboxSpec.MyMailbox])
}
}
}

View file

@ -74,7 +74,7 @@ class PriorityDispatcherSpec extends AkkaSpec(PriorityDispatcherSpec.config) wit
}))
expectMsgType[List[_]] should be(msgs)
expectMsgType[List[Int]] should ===(msgs)
}
}

View file

@ -82,7 +82,7 @@ class StablePriorityDispatcherSpec extends AkkaSpec(StablePriorityDispatcherSpec
// should come out in the same order in which they were sent.
val lo = (1 to 100) toList
val hi = shuffled filter { _ > 100 }
expectMsgType[List[_]] should be(lo ++ hi)
expectMsgType[List[Int]] should ===(lo ++ hi)
}
}
}
}

View file

@ -12,22 +12,22 @@ class SystemMessageListSpec extends AkkaSpec {
"The SystemMessageList value class" must {
"handle empty lists correctly" in {
LNil.head should be(null)
LNil.isEmpty should be(true)
(LNil.reverse == ENil) should be(true)
LNil.head should ===(null)
LNil.isEmpty should ===(true)
(LNil.reverse == ENil) should ===(true)
}
"able to append messages" in {
val create0 = Failed(null, null, 0)
val create1 = Failed(null, null, 1)
val create2 = Failed(null, null, 2)
((create0 :: LNil).head eq create0) should be(true)
((create1 :: create0 :: LNil).head eq create1) should be(true)
((create2 :: create1 :: create0 :: LNil).head eq create2) should be(true)
((create0 :: LNil).head eq create0) should ===(true)
((create1 :: create0 :: LNil).head eq create1) should ===(true)
((create2 :: create1 :: create0 :: LNil).head eq create2) should ===(true)
(create2.next eq create1) should be(true)
(create1.next eq create0) should be(true)
(create0.next eq null) should be(true)
(create2.next eq create1) should ===(true)
(create1.next eq create0) should ===(true)
(create0.next eq null) should ===(true)
}
"able to deconstruct head and tail" in {
@ -36,10 +36,10 @@ class SystemMessageListSpec extends AkkaSpec {
val create2 = Failed(null, null, 2)
val list = create2 :: create1 :: create0 :: LNil
(list.head eq create2) should be(true)
(list.tail.head eq create1) should be(true)
(list.tail.tail.head eq create0) should be(true)
(list.tail.tail.tail.head eq null) should be(true)
(list.head eq create2) should ===(true)
(list.tail.head eq create1) should ===(true)
(list.tail.tail.head eq create0) should ===(true)
(list.tail.tail.tail.head eq null) should ===(true)
}
"properly report size and emptyness" in {
@ -48,17 +48,17 @@ class SystemMessageListSpec extends AkkaSpec {
val create2 = Failed(null, null, 2)
val list = create2 :: create1 :: create0 :: LNil
list.size should be(3)
list.isEmpty should be(false)
list.size should ===(3)
list.isEmpty should ===(false)
list.tail.size should be(2)
list.tail.isEmpty should be(false)
list.tail.size should ===(2)
list.tail.isEmpty should ===(false)
list.tail.tail.size should be(1)
list.tail.tail.isEmpty should be(false)
list.tail.tail.size should ===(1)
list.tail.tail.isEmpty should ===(false)
list.tail.tail.tail.size should be(0)
list.tail.tail.tail.isEmpty should be(true)
list.tail.tail.tail.size should ===(0)
list.tail.tail.tail.isEmpty should ===(true)
}
@ -69,17 +69,17 @@ class SystemMessageListSpec extends AkkaSpec {
val list = create2 :: create1 :: create0 :: LNil
val listRev: EarliestFirstSystemMessageList = list.reverse
listRev.isEmpty should be(false)
listRev.size should be(3)
listRev.isEmpty should ===(false)
listRev.size should ===(3)
(listRev.head eq create0) should be(true)
(listRev.tail.head eq create1) should be(true)
(listRev.tail.tail.head eq create2) should be(true)
(listRev.tail.tail.tail.head eq null) should be(true)
(listRev.head eq create0) should ===(true)
(listRev.tail.head eq create1) should ===(true)
(listRev.tail.tail.head eq create2) should ===(true)
(listRev.tail.tail.tail.head eq null) should ===(true)
(create0.next eq create1) should be(true)
(create1.next eq create2) should be(true)
(create2.next eq null) should be(true)
(create0.next eq create1) should ===(true)
(create1.next eq create2) should ===(true)
(create2.next eq null) should ===(true)
}
}
@ -99,17 +99,17 @@ class SystemMessageListSpec extends AkkaSpec {
val list = revList reverse_::: fwdList
(list.head eq create0) should be(true)
(list.tail.head eq create1) should be(true)
(list.tail.tail.head eq create2) should be(true)
(list.tail.tail.tail.head eq create3) should be(true)
(list.tail.tail.tail.tail.head eq create4) should be(true)
(list.tail.tail.tail.tail.tail.head eq create5) should be(true)
(list.tail.tail.tail.tail.tail.tail.head eq null) should be(true)
(list.head eq create0) should ===(true)
(list.tail.head eq create1) should ===(true)
(list.tail.tail.head eq create2) should ===(true)
(list.tail.tail.tail.head eq create3) should ===(true)
(list.tail.tail.tail.tail.head eq create4) should ===(true)
(list.tail.tail.tail.tail.tail.head eq create5) should ===(true)
(list.tail.tail.tail.tail.tail.tail.head eq null) should ===(true)
(LNil reverse_::: ENil) == ENil should be(true)
((create0 :: LNil reverse_::: ENil).head eq create0) should be(true)
((LNil reverse_::: create0 :: ENil).head eq create0) should be(true)
(LNil reverse_::: ENil) == ENil should ===(true)
((create0 :: LNil reverse_::: ENil).head eq create0) should ===(true)
((LNil reverse_::: create0 :: ENil).head eq create0) should ===(true)
}
}

View file

@ -52,37 +52,37 @@ abstract class EventBusSpec(busName: String, conf: Config = ConfigFactory.empty(
val subscriber = createNewSubscriber()
"allow subscribers" in {
bus.subscribe(subscriber, classifier) should be(true)
bus.subscribe(subscriber, classifier) should ===(true)
}
"allow to unsubscribe already existing subscriber" in {
bus.unsubscribe(subscriber, classifier) should be(true)
bus.unsubscribe(subscriber, classifier) should ===(true)
}
"not allow to unsubscribe non-existing subscriber" in {
val sub = createNewSubscriber()
bus.unsubscribe(sub, classifier) should be(false)
bus.unsubscribe(sub, classifier) should ===(false)
disposeSubscriber(system, sub)
}
"not allow for the same subscriber to subscribe to the same channel twice" in {
bus.subscribe(subscriber, classifier) should be(true)
bus.subscribe(subscriber, classifier) should be(false)
bus.unsubscribe(subscriber, classifier) should be(true)
bus.subscribe(subscriber, classifier) should ===(true)
bus.subscribe(subscriber, classifier) should ===(false)
bus.unsubscribe(subscriber, classifier) should ===(true)
}
"not allow for the same subscriber to unsubscribe to the same channel twice" in {
bus.subscribe(subscriber, classifier) should be(true)
bus.unsubscribe(subscriber, classifier) should be(true)
bus.unsubscribe(subscriber, classifier) should be(false)
bus.subscribe(subscriber, classifier) should ===(true)
bus.unsubscribe(subscriber, classifier) should ===(true)
bus.unsubscribe(subscriber, classifier) should ===(false)
}
"allow to add multiple subscribers" in {
val subscribers = (1 to 10) map { _ createNewSubscriber() }
val events = createEvents(10)
val classifiers = events map getClassifierFor
subscribers.zip(classifiers) forall { case (s, c) bus.subscribe(s, c) } should be(true)
subscribers.zip(classifiers) forall { case (s, c) bus.unsubscribe(s, c) } should be(true)
subscribers.zip(classifiers) forall { case (s, c) bus.subscribe(s, c) } should ===(true)
subscribers.zip(classifiers) forall { case (s, c) bus.unsubscribe(s, c) } should ===(true)
subscribers foreach (disposeSubscriber(system, _))
}
@ -114,10 +114,10 @@ abstract class EventBusSpec(busName: String, conf: Config = ConfigFactory.empty(
"publish the given event to all intended subscribers" in {
val range = 0 until 10
val subscribers = range map (_ createNewSubscriber())
subscribers foreach { s bus.subscribe(s, classifier) should be(true) }
subscribers foreach { s bus.subscribe(s, classifier) should ===(true) }
bus.publish(event)
range foreach { _ expectMsg(event) }
subscribers foreach { s bus.unsubscribe(s, classifier) should be(true); disposeSubscriber(system, s) }
subscribers foreach { s bus.unsubscribe(s, classifier) should ===(true); disposeSubscriber(system, s) }
}
"not publish the given event to any other subscribers than the intended ones" in {

View file

@ -96,13 +96,13 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) {
"not allow null as subscriber" in {
val bus = new EventStream(system, true)
intercept[IllegalArgumentException] { bus.subscribe(null, classOf[M]) }.getMessage should be("subscriber is null")
intercept[IllegalArgumentException] { bus.subscribe(null, classOf[M]) }.getMessage should ===("subscriber is null")
}
"not allow null as unsubscriber" in {
val bus = new EventStream(system, true)
intercept[IllegalArgumentException] { bus.unsubscribe(null, classOf[M]) }.getMessage should be("subscriber is null")
intercept[IllegalArgumentException] { bus.unsubscribe(null) }.getMessage should be("subscriber is null")
intercept[IllegalArgumentException] { bus.unsubscribe(null, classOf[M]) }.getMessage should ===("subscriber is null")
intercept[IllegalArgumentException] { bus.unsubscribe(null) }.getMessage should ===("subscriber is null")
}
"be able to log unhandled messages" in {
@ -142,16 +142,16 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) {
val c = new C
val bus = new EventStream(system, false)
within(2 seconds) {
bus.subscribe(testActor, classOf[B3]) should be(true)
bus.subscribe(testActor, classOf[B3]) should ===(true)
bus.publish(c)
bus.publish(b2)
expectMsg(b2)
bus.subscribe(testActor, classOf[A]) should be(true)
bus.subscribe(testActor, classOf[A]) should ===(true)
bus.publish(c)
expectMsg(c)
bus.publish(b1)
expectMsg(b1)
bus.unsubscribe(testActor, classOf[B2]) should be(true)
bus.unsubscribe(testActor, classOf[B2]) should ===(true)
bus.publish(c)
bus.publish(b2)
bus.publish(a)
@ -167,21 +167,21 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) {
val tm2 = new CCATBT
val a1, a2, a3, a4 = TestProbe()
es.subscribe(a1.ref, classOf[AT]) should be(true)
es.subscribe(a2.ref, classOf[BT]) should be(true)
es.subscribe(a3.ref, classOf[CC]) should be(true)
es.subscribe(a4.ref, classOf[CCATBT]) should be(true)
es.subscribe(a1.ref, classOf[AT]) should ===(true)
es.subscribe(a2.ref, classOf[BT]) should ===(true)
es.subscribe(a3.ref, classOf[CC]) should ===(true)
es.subscribe(a4.ref, classOf[CCATBT]) should ===(true)
es.publish(tm1)
es.publish(tm2)
a1.expectMsgType[AT] should be(tm2)
a2.expectMsgType[BT] should be(tm2)
a3.expectMsgType[CC] should be(tm1)
a3.expectMsgType[CC] should be(tm2)
a4.expectMsgType[CCATBT] should be(tm2)
es.unsubscribe(a1.ref, classOf[AT]) should be(true)
es.unsubscribe(a2.ref, classOf[BT]) should be(true)
es.unsubscribe(a3.ref, classOf[CC]) should be(true)
es.unsubscribe(a4.ref, classOf[CCATBT]) should be(true)
a1.expectMsgType[AT] should ===(tm2)
a2.expectMsgType[BT] should ===(tm2)
a3.expectMsgType[CC] should ===(tm1)
a3.expectMsgType[CC] should ===(tm2)
a4.expectMsgType[CCATBT] should ===(tm2)
es.unsubscribe(a1.ref, classOf[AT]) should ===(true)
es.unsubscribe(a2.ref, classOf[BT]) should ===(true)
es.unsubscribe(a3.ref, classOf[CC]) should ===(true)
es.unsubscribe(a4.ref, classOf[CCATBT]) should ===(true)
}
"manage sub-channels using classes and traits (update on unsubscribe)" in {
@ -190,20 +190,20 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) {
val tm2 = new CCATBT
val a1, a2, a3, a4 = TestProbe()
es.subscribe(a1.ref, classOf[AT]) should be(true)
es.subscribe(a2.ref, classOf[BT]) should be(true)
es.subscribe(a3.ref, classOf[CC]) should be(true)
es.subscribe(a4.ref, classOf[CCATBT]) should be(true)
es.unsubscribe(a3.ref, classOf[CC]) should be(true)
es.subscribe(a1.ref, classOf[AT]) should ===(true)
es.subscribe(a2.ref, classOf[BT]) should ===(true)
es.subscribe(a3.ref, classOf[CC]) should ===(true)
es.subscribe(a4.ref, classOf[CCATBT]) should ===(true)
es.unsubscribe(a3.ref, classOf[CC]) should ===(true)
es.publish(tm1)
es.publish(tm2)
a1.expectMsgType[AT] should be(tm2)
a2.expectMsgType[BT] should be(tm2)
a1.expectMsgType[AT] should ===(tm2)
a2.expectMsgType[BT] should ===(tm2)
a3.expectNoMsg(1 second)
a4.expectMsgType[CCATBT] should be(tm2)
es.unsubscribe(a1.ref, classOf[AT]) should be(true)
es.unsubscribe(a2.ref, classOf[BT]) should be(true)
es.unsubscribe(a4.ref, classOf[CCATBT]) should be(true)
a4.expectMsgType[CCATBT] should ===(tm2)
es.unsubscribe(a1.ref, classOf[AT]) should ===(true)
es.unsubscribe(a2.ref, classOf[BT]) should ===(true)
es.unsubscribe(a4.ref, classOf[CCATBT]) should ===(true)
}
"manage sub-channels using classes and traits (update on unsubscribe all)" in {
@ -212,20 +212,20 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) {
val tm2 = new CCATBT
val a1, a2, a3, a4 = TestProbe()
es.subscribe(a1.ref, classOf[AT]) should be(true)
es.subscribe(a2.ref, classOf[BT]) should be(true)
es.subscribe(a3.ref, classOf[CC]) should be(true)
es.subscribe(a4.ref, classOf[CCATBT]) should be(true)
es.subscribe(a1.ref, classOf[AT]) should ===(true)
es.subscribe(a2.ref, classOf[BT]) should ===(true)
es.subscribe(a3.ref, classOf[CC]) should ===(true)
es.subscribe(a4.ref, classOf[CCATBT]) should ===(true)
es.unsubscribe(a3.ref)
es.publish(tm1)
es.publish(tm2)
a1.expectMsgType[AT] should be(tm2)
a2.expectMsgType[BT] should be(tm2)
a1.expectMsgType[AT] should ===(tm2)
a2.expectMsgType[BT] should ===(tm2)
a3.expectNoMsg(1 second)
a4.expectMsgType[CCATBT] should be(tm2)
es.unsubscribe(a1.ref, classOf[AT]) should be(true)
es.unsubscribe(a2.ref, classOf[BT]) should be(true)
es.unsubscribe(a4.ref, classOf[CCATBT]) should be(true)
a4.expectMsgType[CCATBT] should ===(tm2)
es.unsubscribe(a1.ref, classOf[AT]) should ===(true)
es.unsubscribe(a2.ref, classOf[BT]) should ===(true)
es.unsubscribe(a4.ref, classOf[CCATBT]) should ===(true)
}
"manage sub-channels using classes and traits (update on publish)" in {
@ -234,14 +234,14 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) {
val tm2 = new CCATBT
val a1, a2 = TestProbe()
es.subscribe(a1.ref, classOf[AT]) should be(true)
es.subscribe(a2.ref, classOf[BT]) should be(true)
es.subscribe(a1.ref, classOf[AT]) should ===(true)
es.subscribe(a2.ref, classOf[BT]) should ===(true)
es.publish(tm1)
es.publish(tm2)
a1.expectMsgType[AT] should be(tm2)
a2.expectMsgType[BT] should be(tm2)
es.unsubscribe(a1.ref, classOf[AT]) should be(true)
es.unsubscribe(a2.ref, classOf[BT]) should be(true)
a1.expectMsgType[AT] should ===(tm2)
a2.expectMsgType[BT] should ===(tm2)
es.unsubscribe(a1.ref, classOf[AT]) should ===(true)
es.unsubscribe(a2.ref, classOf[BT]) should ===(true)
}
"manage sub-channels using classes and traits (unsubscribe classes used with trait)" in {
@ -250,20 +250,20 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) {
val tm2 = new CCATBT
val a1, a2, a3 = TestProbe()
es.subscribe(a1.ref, classOf[AT]) should be(true)
es.subscribe(a2.ref, classOf[BT]) should be(true)
es.subscribe(a2.ref, classOf[CC]) should be(true)
es.subscribe(a3.ref, classOf[CC]) should be(true)
es.unsubscribe(a2.ref, classOf[CC]) should be(true)
es.unsubscribe(a3.ref, classOf[CCATBT]) should be(true)
es.subscribe(a1.ref, classOf[AT]) should ===(true)
es.subscribe(a2.ref, classOf[BT]) should ===(true)
es.subscribe(a2.ref, classOf[CC]) should ===(true)
es.subscribe(a3.ref, classOf[CC]) should ===(true)
es.unsubscribe(a2.ref, classOf[CC]) should ===(true)
es.unsubscribe(a3.ref, classOf[CCATBT]) should ===(true)
es.publish(tm1)
es.publish(tm2)
a1.expectMsgType[AT] should be(tm2)
a2.expectMsgType[BT] should be(tm2)
a3.expectMsgType[CC] should be(tm1)
es.unsubscribe(a1.ref, classOf[AT]) should be(true)
es.unsubscribe(a2.ref, classOf[BT]) should be(true)
es.unsubscribe(a3.ref, classOf[CC]) should be(true)
a1.expectMsgType[AT] should ===(tm2)
a2.expectMsgType[BT] should ===(tm2)
a3.expectMsgType[CC] should ===(tm1)
es.unsubscribe(a1.ref, classOf[AT]) should ===(true)
es.unsubscribe(a2.ref, classOf[BT]) should ===(true)
es.unsubscribe(a3.ref, classOf[CC]) should ===(true)
}
"manage sub-channels using classes and traits (subscribe after publish)" in {
@ -271,16 +271,16 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) {
val tm1 = new CCATBT
val a1, a2 = TestProbe()
es.subscribe(a1.ref, classOf[AT]) should be(true)
es.subscribe(a1.ref, classOf[AT]) should ===(true)
es.publish(tm1)
a1.expectMsgType[AT] should be(tm1)
a1.expectMsgType[AT] should ===(tm1)
a2.expectNoMsg(1 second)
es.subscribe(a2.ref, classOf[BTT]) should be(true)
es.subscribe(a2.ref, classOf[BTT]) should ===(true)
es.publish(tm1)
a1.expectMsgType[AT] should be(tm1)
a2.expectMsgType[BTT] should be(tm1)
es.unsubscribe(a1.ref, classOf[AT]) should be(true)
es.unsubscribe(a2.ref, classOf[BTT]) should be(true)
a1.expectMsgType[AT] should ===(tm1)
a2.expectMsgType[BTT] should ===(tm1)
es.unsubscribe(a1.ref, classOf[AT]) should ===(true)
es.unsubscribe(a2.ref, classOf[BTT]) should ===(true)
}
"unsubscribe an actor on its termination" in {
@ -296,8 +296,8 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) {
}), "to-be-killed")
es.subscribe(a2.ref, classOf[Any])
es.subscribe(target, classOf[A]) should be(true)
es.subscribe(target, classOf[A]) should be(false)
es.subscribe(target, classOf[A]) should ===(true)
es.subscribe(target, classOf[A]) should ===(false)
target ! PoisonPill
fishForDebugMessage(a2, s"unsubscribing $target from all channels")
@ -330,10 +330,10 @@ class EventStreamSpec extends AkkaSpec(EventStreamSpec.config) {
es.subscribe(a2.ref, classOf[Any])
// target1 is Terminated; When subscribing, it will be unsubscribed by the Unsubscriber right away
es.subscribe(target, classOf[A]) should be(true)
es.subscribe(target, classOf[A]) should ===(true)
fishForDebugMessage(a2, s"unsubscribing $target from all channels")
es.subscribe(target, classOf[A]) should be(true)
es.subscribe(target, classOf[A]) should ===(true)
fishForDebugMessage(a2, s"unsubscribing $target from all channels")
} finally {
shutdown(sys)

View file

@ -154,7 +154,7 @@ class LoggerSpec extends WordSpec with Matchers {
"not log messages to standard output" in {
val out = createSystemAndLogToBuffer("noLogging", noLoggingConfig, false)
out.size should be(0)
out.size should ===(0)
}
}
@ -231,7 +231,7 @@ class LoggerSpec extends WordSpec with Matchers {
val minutes = c.get(Calendar.MINUTE)
val seconds = c.get(Calendar.SECOND)
val ms = c.get(Calendar.MILLISECOND)
Helpers.currentTimeMillisToUTCString(timestamp) should be(f"$hours%02d:$minutes%02d:$seconds%02d.$ms%03dUTC")
Helpers.currentTimeMillisToUTCString(timestamp) should ===(f"$hours%02d:$minutes%02d:$seconds%02d.$ms%03dUTC")
}
}

View file

@ -83,7 +83,7 @@ class TcpConnectionSpec extends AkkaSpec("""
run {
val connectionActor = createConnectionActor(options = Vector(Inet.SO.ReuseAddress(true)))
val clientChannel = connectionActor.underlyingActor.channel
clientChannel.socket.getReuseAddress should be(true)
clientChannel.socket.getReuseAddress should ===(true)
}
}
@ -92,10 +92,10 @@ class TcpConnectionSpec extends AkkaSpec("""
// Workaround for systems where SO_KEEPALIVE is true by default
val connectionActor = createConnectionActor(options = Vector(SO.KeepAlive(false)))
val clientChannel = connectionActor.underlyingActor.channel
clientChannel.socket.getKeepAlive should be(true) // only set after connection is established
clientChannel.socket.getKeepAlive should ===(true) // only set after connection is established
EventFilter.warning(pattern = "registration timeout", occurrences = 1) intercept {
selector.send(connectionActor, ChannelConnectable)
clientChannel.socket.getKeepAlive should be(false)
clientChannel.socket.getKeepAlive should ===(false)
}
}
}
@ -125,14 +125,14 @@ class TcpConnectionSpec extends AkkaSpec("""
serverSideChannel.socket.setSendBufferSize(150000)
val wrote = serverSideChannel.write(buffer)
wrote should be(DataSize)
wrote should ===(DataSize)
expectNoMsg(1000.millis) // data should have been transferred fully by now
selector.send(connectionActor, ChannelReadable)
connectionHandler.expectMsgType[Received].data.length should be(bufferSize)
connectionHandler.expectMsgType[Received].data.length should be(1500)
connectionHandler.expectMsgType[Received].data.length should ===(bufferSize)
connectionHandler.expectMsgType[Received].data.length should ===(1500)
}
}
@ -148,7 +148,7 @@ class TcpConnectionSpec extends AkkaSpec("""
userHandler.expectMsg(Connected(serverAddress, clientSideChannel.socket.getLocalSocketAddress.asInstanceOf[InetSocketAddress]))
userHandler.send(connectionActor, Register(userHandler.ref))
userHandler.expectMsgType[Received].data.decodeString("ASCII") should be("immediatedata")
userHandler.expectMsgType[Received].data.decodeString("ASCII") should ===("immediatedata")
ignoreWindowsWorkaroundForTicket15766()
interestCallReceiver.expectMsg(OP_READ)
}
@ -161,22 +161,22 @@ class TcpConnectionSpec extends AkkaSpec("""
// reply to write commander with Ack
val ackedWrite = Write(ByteString("testdata"), Ack)
val buffer = ByteBuffer.allocate(100)
serverSideChannel.read(buffer) should be(0)
serverSideChannel.read(buffer) should ===(0)
writer.send(connectionActor, ackedWrite)
writer.expectMsg(Ack)
pullFromServerSide(remaining = 8, into = buffer)
buffer.flip()
buffer.limit should be(8)
buffer.limit should ===(8)
// not reply to write commander for writes without Ack
val unackedWrite = Write(ByteString("morestuff!"))
buffer.clear()
serverSideChannel.read(buffer) should be(0)
serverSideChannel.read(buffer) should ===(0)
writer.send(connectionActor, unackedWrite)
writer.expectNoMsg(500.millis)
pullFromServerSide(remaining = 10, into = buffer)
buffer.flip()
ByteString(buffer).utf8String should be("morestuff!")
ByteString(buffer).utf8String should ===("morestuff!")
}
}
@ -192,13 +192,13 @@ class TcpConnectionSpec extends AkkaSpec("""
val write = Write(testData, Ack)
val buffer = ByteBuffer.allocate(bufferSize)
serverSideChannel.read(buffer) should be(0)
serverSideChannel.read(buffer) should ===(0)
writer.send(connectionActor, write)
pullFromServerSide(remaining = bufferSize, into = buffer)
buffer.flip()
buffer.limit should be(bufferSize)
buffer.limit should ===(bufferSize)
ByteString(buffer) should be(testData)
ByteString(buffer) should ===(testData)
}
}
@ -261,12 +261,12 @@ class TcpConnectionSpec extends AkkaSpec("""
// reply to write commander with Ack
val buffer = ByteBuffer.allocate(100)
serverSideChannel.read(buffer) should be(0)
serverSideChannel.read(buffer) should ===(0)
writer.send(connectionActor, compoundWrite)
pullFromServerSide(remaining = 15, into = buffer)
buffer.flip()
ByteString(buffer).utf8String should be("test1test2test4")
ByteString(buffer).utf8String should ===("test1test2test4")
writer.expectMsg(Ack(1))
writer.expectMsg(Ack(3))
writer.expectMsg(Ack(4))
@ -379,7 +379,7 @@ class TcpConnectionSpec extends AkkaSpec("""
connectionActor ! ResumeReading
interestCallReceiver.expectMsg(OP_READ)
selector.send(connectionActor, ChannelReadable)
connectionHandler.expectMsgType[Received].data.decodeString("ASCII") should be(ts)
connectionHandler.expectMsgType[Received].data.decodeString("ASCII") should ===(ts)
interestCallReceiver.expectNoMsg(100.millis)
connectionHandler.expectNoMsg(100.millis)
@ -387,7 +387,7 @@ class TcpConnectionSpec extends AkkaSpec("""
connectionActor ! ResumeReading
interestCallReceiver.expectMsg(OP_READ)
selector.send(connectionActor, ChannelReadable)
connectionHandler.expectMsgType[Received].data.decodeString("ASCII") should be(us)
connectionHandler.expectMsgType[Received].data.decodeString("ASCII") should ===(us)
// make sure that after reading all pending data we don't yet register for reading more data
interestCallReceiver.expectNoMsg(100.millis)
@ -400,7 +400,7 @@ class TcpConnectionSpec extends AkkaSpec("""
interestCallReceiver.expectMsg(OP_READ)
selector.send(connectionActor, ChannelReadable)
connectionHandler.expectMsgType[Received].data.decodeString("ASCII") should be(vs)
connectionHandler.expectMsgType[Received].data.decodeString("ASCII") should ===(vs)
}
finally system.shutdown()
}
@ -428,7 +428,7 @@ class TcpConnectionSpec extends AkkaSpec("""
serverSelectionKey should be(selectedAs(OP_READ, 2.seconds))
val buffer = ByteBuffer.allocate(1)
serverSideChannel.read(buffer) should be(-1)
serverSideChannel.read(buffer) should ===(-1)
}
}
@ -454,7 +454,7 @@ class TcpConnectionSpec extends AkkaSpec("""
windowsWorkaroundToDetectAbort()
serverSideChannel.read(buffer)
} should produce[IOException]
thrown.getMessage should be(ConnectionResetByPeerMessage)
thrown.getMessage should ===(ConnectionResetByPeerMessage)
}
}
@ -490,7 +490,7 @@ class TcpConnectionSpec extends AkkaSpec("""
val buffer = ByteBuffer.allocate(1)
serverSelectionKey should be(selectedAs(OP_READ, 2.seconds))
serverSideChannel.read(buffer) should be(-1)
serverSideChannel.read(buffer) should ===(-1)
closeServerSideAndWaitForClientReadable()
@ -525,7 +525,7 @@ class TcpConnectionSpec extends AkkaSpec("""
val buffer = ByteBuffer.allocate(1)
serverSelectionKey should be(selectedAs(SelectionKey.OP_READ, 2.seconds))
serverSideChannel.read(buffer) should be(-1)
serverSideChannel.read(buffer) should ===(-1)
closeServerSideAndWaitForClientReadable()
@ -588,7 +588,7 @@ class TcpConnectionSpec extends AkkaSpec("""
abortClose(serverSideChannel)
selector.send(connectionActor, ChannelReadable)
val err = connectionHandler.expectMsgType[ErrorClosed]
err.cause should be(ConnectionResetByPeerMessage)
err.cause should ===(ConnectionResetByPeerMessage)
// wait a while
connectionHandler.expectNoMsg(200.millis)
@ -623,7 +623,7 @@ class TcpConnectionSpec extends AkkaSpec("""
// This timeout should be large enough to work on Windows
sel.select(3000)
key.isConnectable should be(true)
key.isConnectable should ===(true)
val forceThisLazyVal = connectionActor.toString
Thread.sleep(300)
selector.send(connectionActor, ChannelConnectable)
@ -682,7 +682,7 @@ class TcpConnectionSpec extends AkkaSpec("""
EventFilter[DeathPactException](occurrences = 1) intercept {
system.stop(connectionHandler.ref)
val deaths = Set(expectMsgType[Terminated].actor, expectMsgType[Terminated].actor)
deaths should be(Set(connectionHandler.ref, connectionActor))
deaths should ===(Set(connectionHandler.ref, connectionActor))
}
}
}
@ -702,7 +702,7 @@ class TcpConnectionSpec extends AkkaSpec("""
writer.receiveWhile(1.second) {
case CommandFailed(write) written -= 1
}
writer.msgAvailable should be(false)
writer.msgAvailable should ===(false)
// writes must fail now
writer.send(connectionActor, write)
@ -776,7 +776,7 @@ class TcpConnectionSpec extends AkkaSpec("""
writer.receiveWhile(1.second) {
case CommandFailed(write) written -= 1
}
writer.msgAvailable should be(false)
writer.msgAvailable should ===(false)
// writes must fail now
writer.send(connectionActor, write)
@ -920,7 +920,7 @@ class TcpConnectionSpec extends AkkaSpec("""
override def run(body: Unit): Unit = super.run {
registerCallReceiver.expectMsg(Registration(clientSideChannel, 0))
registerCallReceiver.sender should be(connectionActor)
registerCallReceiver.sender should ===(connectionActor)
body
}
}
@ -981,7 +981,7 @@ class TcpConnectionSpec extends AkkaSpec("""
def closeServerSideAndWaitForClientReadable(fullClose: Boolean = true): Unit = {
if (fullClose) serverSideChannel.close() else serverSideChannel.socket.shutdownOutput()
checkFor(clientSelectionKey, OP_READ, 3.seconds.toMillis.toInt) should be(true)
checkFor(clientSelectionKey, OP_READ, 3.seconds.toMillis.toInt) should ===(true)
}
def registerChannel(channel: SocketChannel, name: String): SelectionKey = {
@ -1049,7 +1049,7 @@ class TcpConnectionSpec extends AkkaSpec("""
val gotReceived = connectionHandler.expectMsgType[Received]
val receivedString = gotReceived.data.decodeString("ASCII")
data.startsWith(receivedString) should be(true)
data.startsWith(receivedString) should ===(true)
if (receivedString.length < data.length)
expectReceivedString(data.drop(receivedString.length))
}

View file

@ -122,11 +122,11 @@ class TcpIntegrationSpec extends AkkaSpec("""
clientHandler.send(clientConnection, Write(ByteString("Captain on the bridge!"), Aye))
clientHandler.expectMsg(Aye)
serverHandler.expectMsgType[Received].data.decodeString("ASCII") should be("Captain on the bridge!")
serverHandler.expectMsgType[Received].data.decodeString("ASCII") should ===("Captain on the bridge!")
serverHandler.send(serverConnection, Write(ByteString("For the king!"), Yes))
serverHandler.expectMsg(Yes)
clientHandler.expectMsgType[Received].data.decodeString("ASCII") should be("For the king!")
clientHandler.expectMsgType[Received].data.decodeString("ASCII") should ===("For the king!")
serverHandler.send(serverConnection, Close)
serverHandler.expectMsg(Closed)
@ -157,7 +157,7 @@ class TcpIntegrationSpec extends AkkaSpec("""
connectCommander.send(IO(Tcp), Connect(endpoint))
// expecting CommandFailed or no reply (within timeout)
val replies = connectCommander.receiveWhile(1.second) { case m: Connected m }
replies should be(Nil)
replies should ===(Nil)
}
"handle tcp connection actor death properly" in new TestSetup(shouldBindServer = false) {
@ -166,12 +166,12 @@ class TcpIntegrationSpec extends AkkaSpec("""
connectCommander.send(IO(Tcp), Connect(endpoint))
val accept = serverSocket.accept()
connectCommander.expectMsgType[Connected].remoteAddress should be(endpoint)
connectCommander.expectMsgType[Connected].remoteAddress should ===(endpoint)
val connectionActor = connectCommander.lastSender
connectCommander.send(connectionActor, PoisonPill)
failAfter(3 seconds) {
try {
accept.getInputStream.read() should be(-1)
accept.getInputStream.read() should ===(-1)
} catch {
case e: IOException // this is also fine
}

View file

@ -159,8 +159,8 @@ class TcpListenerSpec extends AkkaSpec("""
def expectWorkerForCommand: SocketChannel =
selectorRouter.expectMsgPF() {
case WorkerForCommand(RegisterIncoming(chan), commander, _)
chan.isOpen should be(true)
commander should be(listener)
chan.isOpen should ===(true)
commander should ===(listener)
chan
}

View file

@ -41,13 +41,13 @@ class UdpConnectedIntegrationSpec extends AkkaSpec("""
val clientAddress = expectMsgPF() {
case Udp.Received(d, a)
d should be(data1)
d should ===(data1)
a
}
server ! Udp.Send(data2, clientAddress)
expectMsgType[UdpConnected.Received].data should be(data2)
expectMsgType[UdpConnected.Received].data should ===(data2)
}
"be able to send and receive with binding" in {
@ -60,13 +60,13 @@ class UdpConnectedIntegrationSpec extends AkkaSpec("""
expectMsgPF() {
case Udp.Received(d, a)
d should be(data1)
a should be(clientAddress)
d should ===(data1)
a should ===(clientAddress)
}
server ! Udp.Send(data2, clientAddress)
expectMsgType[UdpConnected.Received].data should be(data2)
expectMsgType[UdpConnected.Received].data should ===(data2)
}
}

View file

@ -40,7 +40,7 @@ class UdpIntegrationSpec extends AkkaSpec("""
val data = ByteString("To infinity and beyond!")
simpleSender ! Send(data, serverAddress)
expectMsgType[Received].data should be(data)
expectMsgType[Received].data should ===(data)
}
@ -55,16 +55,16 @@ class UdpIntegrationSpec extends AkkaSpec("""
server ! Send(data, clientAddress)
expectMsgPF() {
case Received(d, a)
d should be(data)
a should be(serverAddress)
d should ===(data)
a should ===(serverAddress)
}
}
def checkSendingToServer(): Unit = {
client ! Send(data, serverAddress)
expectMsgPF() {
case Received(d, a)
d should be(data)
a should be(clientAddress)
d should ===(data)
a should ===(clientAddress)
}
}

View file

@ -20,7 +20,7 @@ class AskSpec extends AkkaSpec {
implicit val timeout = Timeout(5 seconds)
val dead = system.actorFor("/system/deadLetters")
val f = dead.ask(42)(1 second)
f.isCompleted should be(true)
f.isCompleted should ===(true)
f.value.get match {
case Failure(_: AskTimeoutException)
case v fail(v + " was not Left(AskTimeoutException)")
@ -31,7 +31,7 @@ class AskSpec extends AkkaSpec {
implicit val timeout = Timeout(5 seconds)
val empty = system.actorFor("unknown")
val f = empty ? 3.14
f.isCompleted should be(true)
f.isCompleted should ===(true)
f.value.get match {
case Failure(_: AskTimeoutException)
case v fail(v + " was not Left(AskTimeoutException)")
@ -41,10 +41,10 @@ class AskSpec extends AkkaSpec {
"return broken promises on unsupported ActorRefs" in {
implicit val timeout = Timeout(5 seconds)
val f = ask(null: ActorRef, 3.14)
f.isCompleted should be(true)
f.isCompleted should ===(true)
intercept[IllegalArgumentException] {
Await.result(f, timeout.duration)
}.getMessage should be("Unsupported recipient ActorRef type, question not sent to [null]. Sender[null] sent the message of type \"java.lang.Double\".")
}.getMessage should ===("Unsupported recipient ActorRef type, question not sent to [null]. Sender[null] sent the message of type \"java.lang.Double\".")
}
"return broken promises on 0 timeout" in {
@ -54,7 +54,7 @@ class AskSpec extends AkkaSpec {
val expectedMsg = "Timeout length must not be negative, question not sent to [%s]. Sender[null] sent the message of type \"java.lang.String\"." format echo
intercept[IllegalArgumentException] {
Await.result(f, timeout.duration)
}.getMessage should be(expectedMsg)
}.getMessage should ===(expectedMsg)
}
"return broken promises on < 0 timeout" in {
@ -64,7 +64,7 @@ class AskSpec extends AkkaSpec {
val expectedMsg = "Timeout length must not be negative, question not sent to [%s]. Sender[null] sent the message of type \"java.lang.String\"." format echo
intercept[IllegalArgumentException] {
Await.result(f, timeout.duration)
}.getMessage should be(expectedMsg)
}.getMessage should ===(expectedMsg)
}
"include target information in AskTimeout" in {
@ -73,7 +73,7 @@ class AskSpec extends AkkaSpec {
val f = silentOne ? "noreply"
intercept[AskTimeoutException] {
Await.result(f, 1 second)
}.getMessage.contains("/user/silent") should be(true)
}.getMessage.contains("/user/silent") should ===(true)
}
"include timeout information in AskTimeout" in {
@ -90,7 +90,7 @@ class AskSpec extends AkkaSpec {
val f = system.actorOf(Props.empty) ? "noreply"
intercept[AskTimeoutException] {
Await.result(f, 1 second)
}.getMessage.contains(sender.toString) should be(true)
}.getMessage.contains(sender.toString) should ===(true)
}
"include message class information in AskTimeout" in {
@ -98,7 +98,7 @@ class AskSpec extends AkkaSpec {
val f = system.actorOf(Props.empty) ? "noreply"
intercept[AskTimeoutException] {
Await.result(f, 1 second)
}.getMessage.contains("\"java.lang.String\"") should be(true)
}.getMessage.contains("\"java.lang.String\"") should ===(true)
}
"work for ActorSelection" in {
@ -108,7 +108,7 @@ class AskSpec extends AkkaSpec {
val identityFuture = (system.actorSelection("/user/select-echo") ? Identify(None))
.mapTo[ActorIdentity].map(_.ref.get)
Await.result(identityFuture, 5 seconds) should be(echo)
Await.result(identityFuture, 5 seconds) should ===(echo)
}
"work when reply uses actor selection" in {
@ -119,7 +119,7 @@ class AskSpec extends AkkaSpec {
val echo = system.actorOf(Props(new Actor { def receive = { case x context.actorSelection(sender().path) ! x } }), "select-echo2")
val f = echo ? "hi"
Await.result(f, 1 seconds) should be("hi")
Await.result(f, 1 seconds) should ===("hi")
deadListener.expectNoMsg(200 milliseconds)
}
@ -153,7 +153,7 @@ class AskSpec extends AkkaSpec {
}), "select-echo4")
val f = echo ? "hi"
intercept[AskTimeoutException] {
Await.result(f, 1 seconds) should be("hi")
Await.result(f, 1 seconds) should ===("hi")
}
deadListener.expectMsgClass(200 milliseconds, classOf[DeadLetter])
@ -174,7 +174,7 @@ class AskSpec extends AkkaSpec {
}), "select-echo5")
val f = echo ? "hi"
intercept[AskTimeoutException] {
Await.result(f, 1 seconds) should be("hi")
Await.result(f, 1 seconds) should ===("hi")
}
deadListener.expectMsgClass(200 milliseconds, classOf[DeadLetter])
}
@ -194,7 +194,7 @@ class AskSpec extends AkkaSpec {
}), "select-echo6")
val f = echo ? "hi"
intercept[AskTimeoutException] {
Await.result(f, 1 seconds) should be(ActorSelectionMessage("hi", Vector(SelectChildName("missing")), false))
Await.result(f, 1 seconds) should ===(ActorSelectionMessage("hi", Vector(SelectChildName("missing")), false))
}
deadListener.expectMsgClass(200 milliseconds, classOf[DeadLetter])
}

View file

@ -48,16 +48,16 @@ class CircuitBreakerMTSpec extends AkkaSpec {
"allow many calls while in closed state with no errors" in {
val futures = testCallsWithBreaker()
val result = Await.result(Future.sequence(futures), 5.second.dilated)
result.size should be(numberOfTestCalls)
result.toSet should be(Set("succeed"))
result.size should ===(numberOfTestCalls)
result.toSet should ===(Set("succeed"))
}
"transition to open state upon reaching failure limit and fail-fast" in {
openBreaker()
val futures = testCallsWithBreaker()
val result = Await.result(Future.sequence(futures), 5.second.dilated)
result.size should be(numberOfTestCalls)
result.toSet should be(Set("CBO"))
result.size should ===(numberOfTestCalls)
result.toSet should ===(Set("CBO"))
}
"allow a single call through in half-open state" in {
@ -71,8 +71,8 @@ class CircuitBreakerMTSpec extends AkkaSpec {
val futures = testCallsWithBreaker()
val result = Await.result(Future.sequence(futures), 5.second.dilated)
result.size should be(numberOfTestCalls)
result.toSet should be(Set("succeed", "CBO"))
result.size should ===(numberOfTestCalls)
result.toSet should ===(Set("succeed", "CBO"))
}
"recover and reset the breaker after the reset timeout" in {
@ -91,8 +91,8 @@ class CircuitBreakerMTSpec extends AkkaSpec {
val futures = testCallsWithBreaker()
val result = Await.result(Future.sequence(futures), 5.second.dilated)
result.size should be(numberOfTestCalls)
result.toSet should be(Set("succeed"))
result.size should ===(numberOfTestCalls)
result.toSet should ===(Set("succeed"))
}
}
}

View file

@ -65,8 +65,8 @@ class CircuitBreakerSpec extends AkkaSpec with BeforeAndAfter {
checkLatch(breaker.openLatch)
val e = intercept[CircuitBreakerOpenException] { breaker().withSyncCircuitBreaker(sayHi) }
(e.remainingDuration > Duration.Zero) should be(true)
(e.remainingDuration <= CircuitBreakerSpec.longResetTimeout) should be(true)
(e.remainingDuration > Duration.Zero) should ===(true)
(e.remainingDuration <= CircuitBreakerSpec.longResetTimeout) should ===(true)
}
"transition to half-open on reset timeout" in {
@ -97,27 +97,27 @@ class CircuitBreakerSpec extends AkkaSpec with BeforeAndAfter {
"A synchronous circuit breaker that is closed" must {
"allow calls through" in {
val breaker = CircuitBreakerSpec.longCallTimeoutCb()
breaker().withSyncCircuitBreaker(sayHi) should be("hi")
breaker().withSyncCircuitBreaker(sayHi) should ===("hi")
}
"increment failure count on failure" in {
val breaker = CircuitBreakerSpec.longCallTimeoutCb()
breaker().currentFailureCount should be(0)
breaker().currentFailureCount should ===(0)
intercept[TestException] { breaker().withSyncCircuitBreaker(throwException) }
checkLatch(breaker.openLatch)
breaker().currentFailureCount should be(1)
breaker().currentFailureCount should ===(1)
}
"reset failure count after success" in {
val breaker = CircuitBreakerSpec.multiFailureCb()
breaker().currentFailureCount should be(0)
breaker().currentFailureCount should ===(0)
intercept[TestException] {
val ct = Thread.currentThread() // Ensure that the thunk is executed in the tests thread
breaker().withSyncCircuitBreaker({ if (Thread.currentThread() eq ct) throwException else "fail" })
}
breaker().currentFailureCount should be(1)
breaker().currentFailureCount should ===(1)
breaker().withSyncCircuitBreaker(sayHi)
breaker().currentFailureCount should be(0)
breaker().currentFailureCount should ===(0)
}
"throw TimeoutException on callTimeout" in {
@ -127,7 +127,7 @@ class CircuitBreakerSpec extends AkkaSpec with BeforeAndAfter {
Thread.sleep(200.millis.dilated.toMillis)
}
}
breaker().currentFailureCount should be(1)
breaker().currentFailureCount should ===(1)
}
"increment failure count on callTimeout before call finishes" in {
@ -165,7 +165,7 @@ class CircuitBreakerSpec extends AkkaSpec with BeforeAndAfter {
val breaker = CircuitBreakerSpec.shortResetTimeoutCb()
breaker().withCircuitBreaker(Future(throwException))
checkLatch(breaker.halfOpenLatch)
Await.result(breaker().withCircuitBreaker(Future(sayHi)), awaitTimeout) should be("hi")
Await.result(breaker().withCircuitBreaker(Future(sayHi)), awaitTimeout) should ===("hi")
checkLatch(breaker.closedLatch)
}
@ -190,21 +190,21 @@ class CircuitBreakerSpec extends AkkaSpec with BeforeAndAfter {
"An asynchronous circuit breaker that is closed" must {
"allow calls through" in {
val breaker = CircuitBreakerSpec.longCallTimeoutCb()
Await.result(breaker().withCircuitBreaker(Future(sayHi)), awaitTimeout) should be("hi")
Await.result(breaker().withCircuitBreaker(Future(sayHi)), awaitTimeout) should ===("hi")
}
"increment failure count on exception" in {
val breaker = CircuitBreakerSpec.longCallTimeoutCb()
intercept[TestException] { Await.result(breaker().withCircuitBreaker(Future(throwException)), awaitTimeout) }
checkLatch(breaker.openLatch)
breaker().currentFailureCount should be(1)
breaker().currentFailureCount should ===(1)
}
"increment failure count on async failure" in {
val breaker = CircuitBreakerSpec.longCallTimeoutCb()
breaker().withCircuitBreaker(Future(throwException))
checkLatch(breaker.openLatch)
breaker().currentFailureCount should be(1)
breaker().currentFailureCount should ===(1)
}
"reset failure count after success" in {
@ -224,7 +224,7 @@ class CircuitBreakerSpec extends AkkaSpec with BeforeAndAfter {
throwException
})
checkLatch(breaker.openLatch)
breaker().currentFailureCount should be(1)
breaker().currentFailureCount should ===(1)
// Since the timeout should have happend before the inner code finishes
// we expect a timeout, not TestException
intercept[TimeoutException] {

View file

@ -32,7 +32,7 @@ class PatternSpec extends AkkaSpec("akka.actor.serialize-messages = off") {
"provide Future for stopping an actor" in {
val target = system.actorOf(Props[TargetActor])
val result = gracefulStop(target, 5 seconds)
Await.result(result, 6 seconds) should be(true)
Await.result(result, 6 seconds) should ===(true)
}
"complete Future when actor already terminated" in {
@ -56,7 +56,7 @@ class PatternSpec extends AkkaSpec("akka.actor.serialize-messages = off") {
val f = akka.pattern.after(1 second, using = system.scheduler)(Promise.successful(5).future)
val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f))
Await.result(r, remainingOrDefault) should be(5)
Await.result(r, remainingOrDefault) should ===(5)
}
"be completed abnormally eventually" in {
@ -64,7 +64,7 @@ class PatternSpec extends AkkaSpec("akka.actor.serialize-messages = off") {
val f = akka.pattern.after(1 second, using = system.scheduler)(Promise.failed(new IllegalStateException("Mexico")).future)
val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f))
intercept[IllegalStateException] { Await.result(r, remainingOrDefault) }.getMessage should be("Mexico")
intercept[IllegalStateException] { Await.result(r, remainingOrDefault) }.getMessage should ===("Mexico")
}
}
}

View file

@ -24,7 +24,7 @@ class PipeToSpec extends AkkaSpec {
"signal failure" in {
val p = TestProbe()
Future.failed(new Exception("failed")) pipeTo p.ref
p.expectMsgType[Status.Failure].cause.getMessage should be("failed")
p.expectMsgType[Status.Failure].cause.getMessage should ===("failed")
}
"pick up an implicit sender()" in {
@ -32,7 +32,7 @@ class PipeToSpec extends AkkaSpec {
implicit val s = testActor
Future(42) pipeTo p.ref
p.expectMsg(42)
p.lastSender should be(s)
p.lastSender should ===(s)
}
"work in Java form" in {
@ -45,7 +45,7 @@ class PipeToSpec extends AkkaSpec {
val p = TestProbe()
pipe(Future(42)) to (p.ref, testActor)
p.expectMsg(42)
p.lastSender should be(testActor)
p.lastSender should ===(testActor)
}
}
@ -63,7 +63,7 @@ class PipeToSpec extends AkkaSpec {
val p = TestProbe()
val sel = system.actorSelection(p.ref.path)
Future.failed(new Exception("failed")) pipeToSelection sel
p.expectMsgType[Status.Failure].cause.getMessage should be("failed")
p.expectMsgType[Status.Failure].cause.getMessage should ===("failed")
}
"pick up an implicit sender()" in {
@ -72,7 +72,7 @@ class PipeToSpec extends AkkaSpec {
implicit val s = testActor
Future(42) pipeToSelection sel
p.expectMsg(42)
p.lastSender should be(s)
p.lastSender should ===(s)
}
"work in Java form" in {
@ -87,7 +87,7 @@ class PipeToSpec extends AkkaSpec {
val sel = system.actorSelection(p.ref.path)
pipe(Future(42)) to (sel, testActor)
p.expectMsg(42)
p.lastSender should be(testActor)
p.lastSender should ===(testActor)
}
}

View file

@ -79,7 +79,7 @@ class BalancingSpec extends AkkaSpec(
latch.countDown()
val replies2 = receiveN(poolSize - 1)
// the remaining replies come from the blocked
// the remaining replies come from the blocked
replies2.toSet should be((2 to poolSize).toSet)
expectNoMsg(500.millis)
@ -109,14 +109,14 @@ class BalancingSpec extends AkkaSpec(
}
"work with anonymous actor names" in {
// the dispatcher-id must not contain invalid config key characters (e.g. $a)
// the dispatcher-id must not contain invalid config key characters (e.g. $a)
system.actorOf(Props[Parent]) ! "hello"
expectMsgType[Int]
}
"work with encoded actor names" in {
val encName = URLEncoder.encode("abcå6#$€xyz", "utf-8")
// % is a valid config key character (e.g. %C3%A5)
// % is a valid config key character (e.g. %C3%A5)
system.actorOf(Props[Parent], encName) ! "hello"
expectMsgType[Int]
}

View file

@ -48,8 +48,8 @@ class BroadcastSpec extends AkkaSpec with DefaultTimeout with ImplicitSender {
Await.ready(doneLatch, remainingOrDefault)
counter1.get should be(1)
counter2.get should be(1)
counter1.get should ===(1)
counter2.get should ===(1)
}
"broadcast message using ?" in {
@ -80,8 +80,8 @@ class BroadcastSpec extends AkkaSpec with DefaultTimeout with ImplicitSender {
Await.ready(doneLatch, remainingOrDefault)
counter1.get should be(1)
counter2.get should be(1)
counter1.get should ===(1)
counter2.get should ===(1)
}
}

View file

@ -99,33 +99,33 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec(ConfiguredLocalRoutingSpec.con
"be picked up from Props" in {
val actor = system.actorOf(RoundRobinPool(12).props(routeeProps = Props[EchoProps]), "someOther")
routerConfig(actor) should be(RoundRobinPool(12))
routerConfig(actor) should ===(RoundRobinPool(12))
Await.result(gracefulStop(actor, 3 seconds), 3 seconds)
}
"be overridable in config" in {
val actor = system.actorOf(RoundRobinPool(12).props(routeeProps = Props[EchoProps]), "config")
routerConfig(actor) should be(RandomPool(nrOfInstances = 4, usePoolDispatcher = true))
routerConfig(actor) should ===(RandomPool(nrOfInstances = 4, usePoolDispatcher = true))
Await.result(gracefulStop(actor, 3 seconds), 3 seconds)
}
"use routees.paths from config" in {
val actor = system.actorOf(RandomPool(12).props(routeeProps = Props[EchoProps]), "paths")
routerConfig(actor) should be(RandomGroup(List("/user/service1", "/user/service2")))
routerConfig(actor) should ===(RandomGroup(List("/user/service1", "/user/service2")))
Await.result(gracefulStop(actor, 3 seconds), 3 seconds)
}
"be overridable in explicit deployment" in {
val actor = system.actorOf(FromConfig.props(routeeProps = Props[EchoProps]).
withDeploy(Deploy(routerConfig = RoundRobinPool(12))), "someOther")
routerConfig(actor) should be(RoundRobinPool(12))
routerConfig(actor) should ===(RoundRobinPool(12))
Await.result(gracefulStop(actor, 3 seconds), 3 seconds)
}
"be overridable in config even with explicit deployment" in {
val actor = system.actorOf(FromConfig.props(routeeProps = Props[EchoProps]).
withDeploy(Deploy(routerConfig = RoundRobinPool(12))), "config")
routerConfig(actor) should be(RandomPool(nrOfInstances = 4, usePoolDispatcher = true))
routerConfig(actor) should ===(RandomPool(nrOfInstances = 4, usePoolDispatcher = true))
Await.result(gracefulStop(actor, 3 seconds), 3 seconds)
}
@ -139,7 +139,7 @@ class ConfiguredLocalRoutingSpec extends AkkaSpec(ConfiguredLocalRoutingSpec.con
val router = system.actorOf(FromConfig.props(routeeProps = Props(classOf[SendRefAtStartup], testActor)), "weird")
val recv = Set() ++ (for (_ 1 to 3) yield expectMsgType[ActorRef])
val expc = Set('a', 'b', 'c') map (i system.actorFor("/user/weird/$" + i))
recv should be(expc)
recv should ===(expc)
expectNoMsg(1 second)
}

View file

@ -56,7 +56,7 @@ class ConsistentHashingRouterSpec extends AkkaSpec(ConsistentHashingRouterSpec.c
"consistent hashing router" must {
"create routees from configuration" in {
val currentRoutees = Await.result(router1 ? GetRoutees, timeout.duration).asInstanceOf[Routees]
currentRoutees.routees.size should be(3)
currentRoutees.routees.size should ===(3)
}
"select destination based on consistentHashKey of the message" in {

View file

@ -70,13 +70,13 @@ class RandomSpec extends AkkaSpec with DefaultTimeout with ImplicitSender {
}
}
counter.get should be(connectionCount)
counter.get should ===(connectionCount)
actor ! akka.routing.Broadcast("end")
Await.ready(doneLatch, 5 seconds)
replies.values foreach { _ should be > (0) }
replies.values.sum should be(iterationCount * connectionCount)
replies.values.sum should ===(iterationCount * connectionCount)
}
"deliver a broadcast message using the !" in {

View file

@ -58,13 +58,13 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with
upperBound = 3)
val c1 = resizer.capacity(Vector.empty[Routee])
c1 should be(2)
c1 should ===(2)
val current = Vector(
ActorRefRoutee(system.actorOf(Props[TestActor])),
ActorRefRoutee(system.actorOf(Props[TestActor])))
val c2 = resizer.capacity(current)
c2 should be(0)
c2 should ===(0)
}
"use settings to evaluate rampUp" in {
@ -73,9 +73,9 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with
upperBound = 10,
rampupRate = 0.2)
resizer.rampup(pressure = 9, capacity = 10) should be(0)
resizer.rampup(pressure = 5, capacity = 5) should be(1)
resizer.rampup(pressure = 6, capacity = 6) should be(2)
resizer.rampup(pressure = 9, capacity = 10) should ===(0)
resizer.rampup(pressure = 5, capacity = 5) should ===(1)
resizer.rampup(pressure = 6, capacity = 6) should ===(2)
}
"use settings to evaluate backoff" in {
@ -85,13 +85,13 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with
backoffThreshold = 0.3,
backoffRate = 0.1)
resizer.backoff(pressure = 10, capacity = 10) should be(0)
resizer.backoff(pressure = 4, capacity = 10) should be(0)
resizer.backoff(pressure = 3, capacity = 10) should be(0)
resizer.backoff(pressure = 2, capacity = 10) should be(-1)
resizer.backoff(pressure = 0, capacity = 10) should be(-1)
resizer.backoff(pressure = 1, capacity = 9) should be(-1)
resizer.backoff(pressure = 0, capacity = 9) should be(-1)
resizer.backoff(pressure = 10, capacity = 10) should ===(0)
resizer.backoff(pressure = 4, capacity = 10) should ===(0)
resizer.backoff(pressure = 3, capacity = 10) should ===(0)
resizer.backoff(pressure = 2, capacity = 10) should ===(-1)
resizer.backoff(pressure = 0, capacity = 10) should ===(-1)
resizer.backoff(pressure = 1, capacity = 9) should ===(-1)
resizer.backoff(pressure = 0, capacity = 9) should ===(-1)
}
"be possible to define programmatically" in {
@ -110,7 +110,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with
Await.ready(latch, remainingOrDefault)
// messagesPerResize is 10 so there is no risk of additional resize
routeeSize(router) should be(2)
routeeSize(router) should ===(2)
}
"be possible to define in configuration" in {
@ -124,7 +124,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with
Await.ready(latch, remainingOrDefault)
routeeSize(router) should be(2)
routeeSize(router) should ===(2)
}
"grow as needed under pressure" in {
@ -153,7 +153,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with
router ! "echo"
expectMsg("reply")
routeeSize(router) should be(resizer.lowerBound)
routeeSize(router) should ===(resizer.lowerBound)
def loop(loops: Int, d: FiniteDuration) = {
for (m 0 until loops) {
@ -168,11 +168,11 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with
// 2 more should go thru without triggering more
loop(2, 200 millis)
routeeSize(router) should be(resizer.lowerBound)
routeeSize(router) should ===(resizer.lowerBound)
// a whole bunch should max it out
loop(20, 500 millis)
routeeSize(router) should be(resizer.upperBound)
routeeSize(router) should ===(resizer.upperBound)
}
"backoff" in within(10 seconds) {

View file

@ -68,12 +68,12 @@ class RoundRobinSpec extends AkkaSpec with DefaultTimeout with ImplicitSender {
replies = replies + (id -> (replies(id) + 1))
}
counter.get should be(connectionCount)
counter.get should ===(connectionCount)
actor ! akka.routing.Broadcast("end")
Await.ready(doneLatch, 5 seconds)
replies.values foreach { _ should be(iterationCount) }
replies.values foreach { _ should ===(iterationCount) }
}
"deliver a broadcast message using the !" in {
@ -102,17 +102,17 @@ class RoundRobinSpec extends AkkaSpec with DefaultTimeout with ImplicitSender {
def receive = Actor.emptyBehavior
})), "round-robin-managed")
routeeSize(actor) should be(3)
routeeSize(actor) should ===(3)
actor ! AdjustPoolSize(+4)
routeeSize(actor) should be(7)
routeeSize(actor) should ===(7)
actor ! AdjustPoolSize(-2)
routeeSize(actor) should be(5)
routeeSize(actor) should ===(5)
val other = ActorSelectionRoutee(system.actorSelection("/user/other"))
actor ! AddRoutee(other)
routeeSize(actor) should be(6)
routeeSize(actor) should ===(6)
actor ! RemoveRoutee(other)
routeeSize(actor) should be(5)
routeeSize(actor) should ===(5)
}
}
@ -145,7 +145,7 @@ class RoundRobinSpec extends AkkaSpec with DefaultTimeout with ImplicitSender {
actor ! akka.routing.Broadcast("end")
Await.ready(doneLatch, 5 seconds)
replies.values foreach { _ should be(iterationCount) }
replies.values foreach { _ should ===(iterationCount) }
}
}
@ -192,7 +192,7 @@ class RoundRobinSpec extends AkkaSpec with DefaultTimeout with ImplicitSender {
actor ! akka.routing.Broadcast("end")
expectTerminated(actor)
replies.values foreach { _ should be(iterationCount) }
replies.values foreach { _ should ===(iterationCount) }
}
}

View file

@ -70,7 +70,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with
watch(router)
watch(c2)
system.stop(c2)
expectTerminated(c2).existenceConfirmed should be(true)
expectTerminated(c2).existenceConfirmed should ===(true)
// it might take a while until the Router has actually processed the Terminated message
awaitCond {
router ! ""
@ -81,7 +81,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with
res == Seq(c1, c1)
}
system.stop(c1)
expectTerminated(router).existenceConfirmed should be(true)
expectTerminated(router).existenceConfirmed should ===(true)
}
"not terminate when resizer is used" in {
@ -99,7 +99,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with
Await.ready(latch, remainingOrDefault)
router ! GetRoutees
val routees = expectMsgType[Routees].routees
routees.size should be(2)
routees.size should ===(2)
routees foreach { _.send(PoisonPill, testActor) }
// expect no Terminated
expectNoMsg(2.seconds)
@ -108,7 +108,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with
"use configured nr-of-instances when FromConfig" in {
val router = system.actorOf(FromConfig.props(routeeProps = Props[TestActor]), "router1")
router ! GetRoutees
expectMsgType[Routees].routees.size should be(3)
expectMsgType[Routees].routees.size should ===(3)
watch(router)
system.stop(router)
expectTerminated(router)
@ -117,7 +117,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with
"use configured nr-of-instances when router is specified" in {
val router = system.actorOf(RoundRobinPool(nrOfInstances = 2).props(routeeProps = Props[TestActor]), "router2")
router ! GetRoutees
expectMsgType[Routees].routees.size should be(3)
expectMsgType[Routees].routees.size should ===(3)
system.stop(router)
}
@ -134,7 +134,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with
routeeProps = Props[TestActor]), "router3")
Await.ready(latch, remainingOrDefault)
router ! GetRoutees
expectMsgType[Routees].routees.size should be(3)
expectMsgType[Routees].routees.size should ===(3)
system.stop(router)
}
@ -191,7 +191,7 @@ class RoutingSpec extends AkkaSpec(RoutingSpec.config) with DefaultTimeout with
EventFilter[Exception]("die", occurrences = 1) intercept {
router ! "die"
}
expectMsgType[Exception].getMessage should be("die")
expectMsgType[Exception].getMessage should ===("die")
expectMsg("restarted")
expectMsg("restarted")
expectMsg("restarted")

View file

@ -68,8 +68,8 @@ class ScatterGatherFirstCompletedSpec extends AkkaSpec with DefaultTimeout with
Await.ready(doneLatch, TestLatch.DefaultTimeout)
counter1.get should be(1)
counter2.get should be(1)
counter1.get should ===(1)
counter2.get should ===(1)
}
"return response, even if one of the actors has stopped" in {
@ -81,7 +81,7 @@ class ScatterGatherFirstCompletedSpec extends AkkaSpec with DefaultTimeout with
routedActor ! Broadcast(Stop(Some(1)))
Await.ready(shutdownLatch, TestLatch.DefaultTimeout)
Await.result(routedActor ? Broadcast(0), timeout.duration) should be(14)
Await.result(routedActor ? Broadcast(0), timeout.duration) should ===(14)
}
}

View file

@ -70,8 +70,8 @@ class TailChoppingSpec extends AkkaSpec with DefaultTimeout with ImplicitSender
Await.ready(doneLatch, TestLatch.DefaultTimeout)
counter1.get should be(1)
counter2.get should be(1)
counter1.get should ===(1)
counter2.get should ===(1)
}
"return response from second actor after inactivity from first one" in {

View file

@ -141,8 +141,8 @@ class SerializeSpec extends AkkaSpec(SerializationTests.serializeConf) {
"Serialization" must {
"have correct bindings" in {
ser.bindings.collectFirst { case (c, s) if c == addr.getClass s.getClass } should be(Some(classOf[JavaSerializer]))
ser.bindings.collectFirst { case (c, s) if c == classOf[PlainMessage] s.getClass } should be(Some(classOf[TestSerializer]))
ser.bindings.collectFirst { case (c, s) if c == addr.getClass s.getClass } should ===(Some(classOf[JavaSerializer]))
ser.bindings.collectFirst { case (c, s) if c == classOf[PlainMessage] s.getClass } should ===(Some(classOf[TestSerializer]))
}
"serialize Address" in {
@ -182,7 +182,7 @@ class SerializeSpec extends AkkaSpec(SerializationTests.serializeConf) {
val in = new ObjectInputStream(new ByteArrayInputStream(outbuf.toByteArray))
JavaSerializer.currentSystem.withValue(a.asInstanceOf[ActorSystemImpl]) {
val deadLetters = in.readObject().asInstanceOf[DeadLetterActorRef]
(deadLetters eq a.deadLetters) should be(true)
(deadLetters eq a.deadLetters) should ===(true)
}
} finally {
shutdown(a)
@ -190,27 +190,27 @@ class SerializeSpec extends AkkaSpec(SerializationTests.serializeConf) {
}
"resolve serializer by direct interface" in {
ser.serializerFor(classOf[SimpleMessage]).getClass should be(classOf[TestSerializer])
ser.serializerFor(classOf[SimpleMessage]).getClass should ===(classOf[TestSerializer])
}
"resolve serializer by interface implemented by super class" in {
ser.serializerFor(classOf[ExtendedSimpleMessage]).getClass should be(classOf[TestSerializer])
ser.serializerFor(classOf[ExtendedSimpleMessage]).getClass should ===(classOf[TestSerializer])
}
"resolve serializer by indirect interface" in {
ser.serializerFor(classOf[AnotherMessage]).getClass should be(classOf[TestSerializer])
ser.serializerFor(classOf[AnotherMessage]).getClass should ===(classOf[TestSerializer])
}
"resolve serializer by indirect interface implemented by super class" in {
ser.serializerFor(classOf[ExtendedAnotherMessage]).getClass should be(classOf[TestSerializer])
ser.serializerFor(classOf[ExtendedAnotherMessage]).getClass should ===(classOf[TestSerializer])
}
"resolve serializer for message with binding" in {
ser.serializerFor(classOf[PlainMessage]).getClass should be(classOf[TestSerializer])
ser.serializerFor(classOf[PlainMessage]).getClass should ===(classOf[TestSerializer])
}
"resolve serializer for message extending class with with binding" in {
ser.serializerFor(classOf[ExtendedPlainMessage]).getClass should be(classOf[TestSerializer])
ser.serializerFor(classOf[ExtendedPlainMessage]).getClass should ===(classOf[TestSerializer])
}
"give warning for message with several bindings" in {
@ -220,17 +220,17 @@ class SerializeSpec extends AkkaSpec(SerializationTests.serializeConf) {
}
"resolve serializer in the order of the bindings" in {
ser.serializerFor(classOf[A]).getClass should be(classOf[JavaSerializer])
ser.serializerFor(classOf[B]).getClass should be(classOf[TestSerializer])
ser.serializerFor(classOf[A]).getClass should ===(classOf[JavaSerializer])
ser.serializerFor(classOf[B]).getClass should ===(classOf[TestSerializer])
EventFilter.warning(start = "Multiple serializers found", occurrences = 1) intercept {
ser.serializerFor(classOf[C]).getClass should (be(classOf[TestSerializer]) or be(classOf[JavaSerializer]))
}
}
"resolve serializer in the order of most specific binding first" in {
ser.serializerFor(classOf[A]).getClass should be(classOf[JavaSerializer])
ser.serializerFor(classOf[D]).getClass should be(classOf[TestSerializer])
ser.serializerFor(classOf[E]).getClass should be(classOf[TestSerializer])
ser.serializerFor(classOf[A]).getClass should ===(classOf[JavaSerializer])
ser.serializerFor(classOf[D]).getClass should ===(classOf[TestSerializer])
ser.serializerFor(classOf[E]).getClass should ===(classOf[TestSerializer])
}
"throw java.io.NotSerializableException when no binding" in {
@ -248,7 +248,7 @@ class SerializeSpec extends AkkaSpec(SerializationTests.serializeConf) {
intercept[IllegalArgumentException] {
byteSerializer.toBinary("pigdog")
}.getMessage should be("ByteArraySerializer only serializes byte arrays, not [pigdog]")
}.getMessage should ===("ByteArraySerializer only serializes byte arrays, not [pigdog]")
}
}
}
@ -259,8 +259,8 @@ class VerifySerializabilitySpec extends AkkaSpec(SerializationTests.verifySerial
implicit val timeout = Timeout(5 seconds)
"verify config" in {
system.settings.SerializeAllCreators should be(true)
system.settings.SerializeAllMessages should be(true)
system.settings.SerializeAllCreators should ===(true)
system.settings.SerializeAllMessages should ===(true)
}
"verify creators" in {
@ -278,7 +278,7 @@ class VerifySerializabilitySpec extends AkkaSpec(SerializationTests.verifySerial
"verify messages" in {
val a = system.actorOf(Props[FooActor])
Await.result(a ? "pigdog", timeout.duration) should be("pigdog")
Await.result(a ? "pigdog", timeout.duration) should ===("pigdog")
EventFilter[NotSerializableException](occurrences = 1) intercept {
a ! (new AnyRef)
@ -293,7 +293,7 @@ class ReferenceSerializationSpec extends AkkaSpec(SerializationTests.mostlyRefer
val ser = SerializationExtension(system)
def serializerMustBe(toSerialize: Class[_], expectedSerializer: Class[_]) =
ser.serializerFor(toSerialize).getClass should be(expectedSerializer)
ser.serializerFor(toSerialize).getClass should ===(expectedSerializer)
"Serialization settings from reference.conf" must {
@ -324,7 +324,7 @@ class SerializationCompatibilitySpec extends AkkaSpec(SerializationTests.mostlyR
"Cross-version serialization compatibility" must {
def verify(obj: SystemMessage, asExpected: String): Unit =
String.valueOf(ser.serialize(obj).map(encodeHex).get) should be(asExpected)
String.valueOf(ser.serialize(obj).map(encodeHex).get) should ===(asExpected)
"be preserved for the Create SystemMessage" in {
// Using null as the cause to avoid a large serialized message and JDK differences
@ -408,7 +408,7 @@ class OverriddenSystemMessageSerializationSpec extends AkkaSpec(SerializationTes
"resolve to a single serializer" in {
EventFilter.warning(start = "Multiple serializers found", occurrences = 0) intercept {
for (smc systemMessageClasses) {
ser.serializerFor(smc).getClass should be(classOf[TestSerializer])
ser.serializerFor(smc).getClass should ===(classOf[TestSerializer])
}
}
}

View file

@ -18,13 +18,13 @@ class DurationSpec extends AkkaSpec {
val one = 1 second
val two = one + one
val three = 3 * one
(0 * one) should be(zero)
(2 * one) should be(two)
(three - two) should be(one)
(three / 3) should be(one)
(two / one) should be(2)
(one + zero) should be(one)
(one / 1000000) should be(1.micro)
(0 * one) should ===(zero)
(2 * one) should ===(two)
(three - two) should ===(one)
(three / 3) should ===(one)
(two / one) should ===(2)
(one + zero) should ===(one)
(one / 1000000) should ===(1.micro)
}
"respect correct treatment of infinities" in {
@ -32,21 +32,21 @@ class DurationSpec extends AkkaSpec {
val inf = Duration.Inf
val minf = Duration.MinusInf
val undefined = Duration.Undefined
(-inf) should be(minf)
(minf + inf) should be(undefined)
(inf - inf) should be(undefined)
(inf + minf) should be(undefined)
(minf - minf) should be(undefined)
(inf + inf) should be(inf)
(inf - minf) should be(inf)
(minf - inf) should be(minf)
(minf + minf) should be(minf)
(-inf) should ===(minf)
(minf + inf) should ===(undefined)
(inf - inf) should ===(undefined)
(inf + minf) should ===(undefined)
(minf - minf) should ===(undefined)
(inf + inf) should ===(inf)
(inf - minf) should ===(inf)
(minf - inf) should ===(minf)
(minf + minf) should ===(minf)
assert(inf == inf)
assert(minf == minf)
inf.compareTo(inf) should be(0)
inf.compareTo(one) should be(1)
minf.compareTo(minf) should be(0)
minf.compareTo(one) should be(-1)
inf.compareTo(inf) should ===(0)
inf.compareTo(one) should ===(1)
minf.compareTo(minf) should ===(0)
minf.compareTo(one) should ===(-1)
assert(inf != minf)
assert(minf != inf)
assert(one != inf)
@ -58,7 +58,7 @@ class DurationSpec extends AkkaSpec {
val x = unit.convert(Long.MaxValue, NANOSECONDS)
val dur = Duration(x, unit)
val mdur = Duration(-x, unit)
-mdur should be(dur)
-mdur should ===(dur)
intercept[IllegalArgumentException] { Duration(x + 10000000d, unit) }
intercept[IllegalArgumentException] { Duration(-x - 10000000d, unit) }
if (unit != NANOSECONDS) {

View file

@ -35,13 +35,13 @@ class IndexSpec extends AkkaSpec with Matchers with DefaultTimeout {
}
"take and return several values" in {
val index = emptyIndex
index.put("s1", 1) should be(true)
index.put("s1", 1) should be(false)
index.put("s1", 1) should ===(true)
index.put("s1", 1) should ===(false)
index.put("s1", 2)
index.put("s1", 3)
index.put("s2", 4)
index.valueIterator("s1").toSet should be(Set(1, 2, 3))
index.valueIterator("s2").toSet should be(Set(4))
index.valueIterator("s1").toSet should ===(Set(1, 2, 3))
index.valueIterator("s2").toSet should ===(Set(4))
}
"remove values" in {
val index = emptyIndex
@ -50,16 +50,16 @@ class IndexSpec extends AkkaSpec with Matchers with DefaultTimeout {
index.put("s2", 1)
index.put("s2", 2)
//Remove value
index.remove("s1", 1) should be(true)
index.remove("s1", 1) should be(false)
index.valueIterator("s1").toSet should be(Set(2))
index.remove("s1", 1) should ===(true)
index.remove("s1", 1) should ===(false)
index.valueIterator("s1").toSet should ===(Set(2))
//Remove key
index.remove("s2") match {
case Some(iter) iter.toSet should be(Set(1, 2))
case Some(iter) iter.toSet should ===(Set(1, 2))
case None fail()
}
index.remove("s2") should be(None)
index.valueIterator("s2").toSet should be(Set())
index.remove("s2") should ===(None)
index.valueIterator("s2").toSet should ===(Set.empty[Int])
}
"remove the specified value" in {
val index = emptyIndex
@ -71,9 +71,9 @@ class IndexSpec extends AkkaSpec with Matchers with DefaultTimeout {
index.put("s3", 2)
index.removeValue(1)
index.valueIterator("s1").toSet should be(Set(2, 3))
index.valueIterator("s2").toSet should be(Set(2))
index.valueIterator("s3").toSet should be(Set(2))
index.valueIterator("s1").toSet should ===(Set(2, 3))
index.valueIterator("s2").toSet should ===(Set(2))
index.valueIterator("s3").toSet should ===(Set(2))
}
"apply a function for all key-value pairs and find every value" in {
val index = indexWithValues
@ -81,15 +81,15 @@ class IndexSpec extends AkkaSpec with Matchers with DefaultTimeout {
var valueCount = 0
index.foreach((key, value) {
valueCount = valueCount + 1
index.findValue(key)(_ == value) should be(Some(value))
index.findValue(key)(_ == value) should ===(Some(value))
})
valueCount should be(6)
valueCount should ===(6)
}
"be cleared" in {
val index = indexWithValues
index.isEmpty should be(false)
index.isEmpty should ===(false)
index.clear()
index.isEmpty should be(true)
index.isEmpty should ===(true)
}
"be able to be accessed in parallel" in {
val index = new Index[Int, Int](100, _ compareTo _)
@ -113,7 +113,7 @@ class IndexSpec extends AkkaSpec with Matchers with DefaultTimeout {
val key = Random.nextInt(nrOfKeys)
val values = index.valueIterator(key)
if (key >= nrOfKeys / 2) {
values.isEmpty should be(false)
values.isEmpty should ===(false)
}
}

View file

@ -14,22 +14,22 @@ class SwitchSpec extends WordSpec with Matchers {
"on and off" in {
val s = new Switch(false)
s.isOff should be(true)
s.isOn should be(false)
s.isOff should ===(true)
s.isOn should ===(false)
s.switchOn(()) should be(true)
s.isOn should be(true)
s.isOff should be(false)
s.switchOn(()) should be(false)
s.isOn should be(true)
s.isOff should be(false)
s.switchOn(()) should ===(true)
s.isOn should ===(true)
s.isOff should ===(false)
s.switchOn(()) should ===(false)
s.isOn should ===(true)
s.isOff should ===(false)
s.switchOff(()) should be(true)
s.isOff should be(true)
s.isOn should be(false)
s.switchOff(()) should be(false)
s.isOff should be(true)
s.isOn should be(false)
s.switchOff(()) should ===(true)
s.isOff should ===(true)
s.isOn should ===(false)
s.switchOff(()) should ===(false)
s.isOff should ===(true)
s.isOn should ===(false)
}
"revert when exception" in {
@ -37,42 +37,42 @@ class SwitchSpec extends WordSpec with Matchers {
intercept[RuntimeException] {
s.switchOn(throw new RuntimeException)
}
s.isOff should be(true)
s.isOff should ===(true)
}
"run action without locking" in {
val s = new Switch(false)
s.ifOffYield("yes") should be(Some("yes"))
s.ifOnYield("no") should be(None)
s.ifOff(()) should be(true)
s.ifOn(()) should be(false)
s.ifOffYield("yes") should ===(Some("yes"))
s.ifOnYield("no") should ===(None)
s.ifOff(()) should ===(true)
s.ifOn(()) should ===(false)
s.switchOn(())
s.ifOnYield("yes") should be(Some("yes"))
s.ifOffYield("no") should be(None)
s.ifOn(()) should be(true)
s.ifOff(()) should be(false)
s.ifOnYield("yes") should ===(Some("yes"))
s.ifOffYield("no") should ===(None)
s.ifOn(()) should ===(true)
s.ifOff(()) should ===(false)
}
"run action with locking" in {
val s = new Switch(false)
s.whileOffYield("yes") should be(Some("yes"))
s.whileOnYield("no") should be(None)
s.whileOff(()) should be(true)
s.whileOn(()) should be(false)
s.whileOffYield("yes") should ===(Some("yes"))
s.whileOnYield("no") should ===(None)
s.whileOff(()) should ===(true)
s.whileOn(()) should ===(false)
s.switchOn(())
s.whileOnYield("yes") should be(Some("yes"))
s.whileOffYield("no") should be(None)
s.whileOn(()) should be(true)
s.whileOff(()) should be(false)
s.whileOnYield("yes") should ===(Some("yes"))
s.whileOffYield("no") should ===(None)
s.whileOn(()) should ===(true)
s.whileOff(()) should ===(false)
}
"run first or second action depending on state" in {
val s = new Switch(false)
s.fold("on")("off") should be("off")
s.fold("on")("off") should ===("off")
s.switchOn(())
s.fold("on")("off") should be("on")
s.fold("on")("off") should ===("on")
}
"do proper locking" in {
@ -81,7 +81,7 @@ class SwitchSpec extends WordSpec with Matchers {
s.locked {
Thread.sleep(500)
s.switchOn(())
s.isOn should be(true)
s.isOn should ===(true)
}
val latch = new CountDownLatch(1)
@ -93,7 +93,7 @@ class SwitchSpec extends WordSpec with Matchers {
}.start()
latch.await(5, TimeUnit.SECONDS)
s.isOff should be(true)
s.isOff should ===(true)
}
}
}

View file

@ -31,7 +31,7 @@ class AgentSpec extends AkkaSpec {
agent send countDown
countDown.await(5 seconds)
agent() should be("abcd")
agent() should ===("abcd")
}
"maintain order between send and sendOff" in {
@ -45,7 +45,7 @@ class AgentSpec extends AkkaSpec {
agent send countDown
l2.countDown
countDown.await(5 seconds)
agent() should be("abcd")
agent() should ===("abcd")
}
"maintain order between alter and alterOff" in {
@ -59,9 +59,9 @@ class AgentSpec extends AkkaSpec {
val result = Future.sequence(Seq(r1, r2, r3)).map(_.mkString(":"))
l2.countDown
Await.result(result, 5 seconds) should be("ab:abc:abcd")
Await.result(result, 5 seconds) should ===("ab:abc:abcd")
agent() should be("abcd")
agent() should ===("abcd")
}
"be immediately readable" in {
@ -80,14 +80,14 @@ class AgentSpec extends AkkaSpec {
agent send countDown
countDown.await(5 seconds)
read should be(5)
agent() should be(10)
read should ===(5)
agent() should ===(10)
}
"be readable within a transaction" in {
val agent = Agent(5)
val value = atomic { t agent() }
value should be(5)
value should ===(5)
}
"dispatch sends in successful transactions" in {
@ -100,7 +100,7 @@ class AgentSpec extends AkkaSpec {
agent send countDown
countDown.await(5 seconds)
agent() should be(10)
agent() should ===(10)
}
"not dispatch sends in aborted transactions" in {
@ -118,7 +118,7 @@ class AgentSpec extends AkkaSpec {
agent send countDown
countDown.await(5 seconds)
agent() should be(5)
agent() should ===(5)
}
"be able to return a 'queued' future" in {
@ -126,7 +126,7 @@ class AgentSpec extends AkkaSpec {
agent send (_ + "b")
agent send (_ + "c")
Await.result(agent.future, timeout.duration) should be("abc")
Await.result(agent.future, timeout.duration) should ===("abc")
}
"be able to await the value after updates have completed" in {
@ -134,15 +134,15 @@ class AgentSpec extends AkkaSpec {
agent send (_ + "b")
agent send (_ + "c")
Await.result(agent.future, timeout.duration) should be("abc")
Await.result(agent.future, timeout.duration) should ===("abc")
}
"be able to be mapped" in {
val agent1 = Agent(5)
val agent2 = agent1 map (_ * 2)
agent1() should be(5)
agent2() should be(10)
agent1() should ===(5)
agent2() should ===(10)
}
"be able to be used in a 'foreach' for comprehension" in {
@ -153,15 +153,15 @@ class AgentSpec extends AkkaSpec {
result += value
}
result should be(3)
result should ===(3)
}
"be able to be used in a 'map' for comprehension" in {
val agent1 = Agent(5)
val agent2 = for (value agent1) yield value * 2
agent1() should be(5)
agent2() should be(10)
agent1() should ===(5)
agent2() should ===(10)
}
"be able to be used in a 'flatMap' for comprehension" in {
@ -173,9 +173,9 @@ class AgentSpec extends AkkaSpec {
value2 agent2
} yield value1 + value2
agent1() should be(1)
agent2() should be(2)
agent3() should be(3)
agent1() should ===(1)
agent2() should ===(2)
agent3() should ===(3)
}
}
}

View file

@ -26,9 +26,9 @@ class ActivationIntegrationTest extends WordSpec with Matchers with SharedCamelS
"ActivationAware should be notified when endpoint is activated" in {
val latch = new TestLatch(0)
val actor = system.actorOf(Props(new TestConsumer("direct:actor-1", latch)), "act-direct-actor-1")
Await.result(camel.activationFutureFor(actor), 10 seconds) should be(actor)
Await.result(camel.activationFutureFor(actor), 10 seconds) should ===(actor)
template.requestBody("direct:actor-1", "test") should be("received test")
template.requestBody("direct:actor-1", "test") should ===("received test")
}
"ActivationAware should be notified when endpoint is de-activated" in {

View file

@ -21,34 +21,34 @@ class CamelConfigSpec extends WordSpec with Matchers {
}
"CamelConfigSpec" must {
"have correct activationTimeout config" in {
settings.ActivationTimeout should be(config.getMillisDuration("akka.camel.consumer.activation-timeout"))
settings.ActivationTimeout should ===(config.getMillisDuration("akka.camel.consumer.activation-timeout"))
}
"have correct autoAck config" in {
settings.AutoAck should be(config.getBoolean("akka.camel.consumer.auto-ack"))
settings.AutoAck should ===(config.getBoolean("akka.camel.consumer.auto-ack"))
}
"have correct replyTimeout config" in {
settings.ReplyTimeout should be(config.getMillisDuration("akka.camel.consumer.reply-timeout"))
settings.ReplyTimeout should ===(config.getMillisDuration("akka.camel.consumer.reply-timeout"))
}
"have correct streamingCache config" in {
settings.StreamingCache should be(config.getBoolean("akka.camel.streamingCache"))
settings.StreamingCache should ===(config.getBoolean("akka.camel.streamingCache"))
}
"have correct jmxStatistics config" in {
settings.JmxStatistics should be(config.getBoolean("akka.camel.jmx"))
settings.JmxStatistics should ===(config.getBoolean("akka.camel.jmx"))
}
"have correct body conversions config" in {
val conversions = config.getConfig("akka.camel.conversions")
conversions.getString("file") should be("java.io.InputStream")
conversions.entrySet.size should be(1)
conversions.getString("file") should ===("java.io.InputStream")
conversions.entrySet.size should ===(1)
}
"have correct Context Provider" in {
settings.ContextProvider.isInstanceOf[DefaultContextProvider] should be(true)
settings.ContextProvider.isInstanceOf[DefaultContextProvider] should ===(true)
}
}
}

View file

@ -58,13 +58,13 @@ class ConcurrentActivationTest extends WordSpec with Matchers with NonSharedCame
}
val (activations, deactivations) = Await.result(allRefsFuture, 10.seconds.dilated)
// should be the size of the activated activated producers and consumers
activations.size should be(2 * number * number)
activations.size should ===(2 * number * number)
// should be the size of the activated activated producers and consumers
deactivations.size should be(2 * number * number)
deactivations.size should ===(2 * number * number)
def partitionNames(refs: immutable.Seq[ActorRef]) = refs.map(_.path.name).partition(_.startsWith("concurrent-test-echo-consumer"))
def assertContainsSameElements(lists: (Seq[_], Seq[_])) {
val (a, b) = lists
a.intersect(b).size should be(a.size)
a.intersect(b).size should ===(a.size)
}
val (activatedConsumerNames, activatedProducerNames) = partitionNames(activations)
val (deactivatedConsumerNames, deactivatedProducerNames) = partitionNames(deactivations)

View file

@ -44,7 +44,7 @@ class ConsumerIntegrationTest extends WordSpec with Matchers with NonSharedCamel
case m: CamelMessage sender() ! "received " + m.bodyAs[String]
}
}, name = "direct-a1")
camel.sendTo("direct:a1", msg = "some message") should be("received some message")
camel.sendTo("direct:a1", msg = "some message") should ===("received some message")
}
"Consumer must time-out if consumer is slow" taggedAs TimingTest in {
@ -59,7 +59,7 @@ class ConsumerIntegrationTest extends WordSpec with Matchers with NonSharedCamel
intercept[CamelExecutionException] {
camel.sendTo("direct:a3", msg = "some msg 3")
}.getCause.getClass should be(classOf[TimeoutException])
}.getCause.getClass should ===(classOf[TimeoutException])
stop(ref)
}
@ -82,7 +82,7 @@ class ConsumerIntegrationTest extends WordSpec with Matchers with NonSharedCamel
consumer ! "throw"
Await.ready(restarted, defaultTimeoutDuration)
camel.sendTo("direct:a2", msg = "xyz") should be("received xyz")
camel.sendTo("direct:a2", msg = "xyz") should ===("received xyz")
}
stop(consumer)
}
@ -96,7 +96,7 @@ class ConsumerIntegrationTest extends WordSpec with Matchers with NonSharedCamel
system.stop(consumer)
Await.result(camel.deactivationFutureFor(consumer), defaultTimeoutDuration)
camel.routeCount should be(0)
camel.routeCount should ===(0)
}
"Consumer must register on uri passed in through constructor" in {
@ -104,10 +104,10 @@ class ConsumerIntegrationTest extends WordSpec with Matchers with NonSharedCamel
Await.result(camel.activationFutureFor(consumer), defaultTimeoutDuration)
camel.routeCount should be > (0)
camel.routes.get(0).getEndpoint.getEndpointUri should be("direct://test")
camel.routes.get(0).getEndpoint.getEndpointUri should ===("direct://test")
system.stop(consumer)
Await.result(camel.deactivationFutureFor(consumer), defaultTimeoutDuration)
camel.routeCount should be(0)
camel.routeCount should ===(0)
stop(consumer)
}
@ -118,7 +118,7 @@ class ConsumerIntegrationTest extends WordSpec with Matchers with NonSharedCamel
}
}, name = "direct-error-handler-test")
filterEvents(EventFilter[TestException](occurrences = 1)) {
camel.sendTo("direct:error-handler-test", msg = "hello") should be("error: hello")
camel.sendTo("direct:error-handler-test", msg = "hello") should ===("error: hello")
}
stop(ref)
}
@ -130,7 +130,7 @@ class ConsumerIntegrationTest extends WordSpec with Matchers with NonSharedCamel
}
}, name = "direct-failing-once-consumer")
filterEvents(EventFilter[TestException](occurrences = 1)) {
camel.sendTo("direct:failing-once-concumer", msg = "hello") should be("accepted: hello")
camel.sendTo("direct:failing-once-concumer", msg = "hello") should ===("accepted: hello")
}
stop(ref)
}
@ -140,7 +140,7 @@ class ConsumerIntegrationTest extends WordSpec with Matchers with NonSharedCamel
def endpointUri = "direct:manual-ack"
def receive = { case _ sender() ! Ack }
}, name = "direct-manual-ack-1")
camel.template.asyncSendBody("direct:manual-ack", "some message").get(defaultTimeoutDuration.toSeconds, TimeUnit.SECONDS) should be(null) //should not timeout
camel.template.asyncSendBody("direct:manual-ack", "some message").get(defaultTimeoutDuration.toSeconds, TimeUnit.SECONDS) should ===(null) //should not timeout
stop(ref)
}
@ -153,7 +153,7 @@ class ConsumerIntegrationTest extends WordSpec with Matchers with NonSharedCamel
intercept[ExecutionException] {
camel.template.asyncSendBody("direct:manual-ack", "some message").get(defaultTimeoutDuration.toSeconds, TimeUnit.SECONDS)
}.getCause.getCause should be(someException)
}.getCause.getCause should ===(someException)
stop(ref)
}
@ -173,7 +173,7 @@ class ConsumerIntegrationTest extends WordSpec with Matchers with NonSharedCamel
val ref = start(new ErrorRespondingConsumer("direct:error-responding-consumer-1"), "error-responding-consumer")
filterEvents(EventFilter[TestException](occurrences = 1)) {
val response = camel.sendTo("direct:error-responding-consumer-1", "some body")
response should be("some body has an error")
response should ===("some body has an error")
}
stop(ref)
}

View file

@ -43,7 +43,7 @@ class DefaultCamelTest extends WordSpec with SharedCamelSystem with Matchers wit
}
"throws exception thrown by context.stop()" in {
exception.getMessage() should be("context");
exception.getMessage() should ===("context");
}
"tries to stop both template and context" in {

View file

@ -14,7 +14,7 @@ import org.apache.camel.converter.stream.InputStreamCache
class MessageScalaTest extends FunSuite with Matchers with SharedCamelSystem {
implicit def camelContext = camel.context
test("mustConvertDoubleBodyToString") {
CamelMessage(1.4, Map.empty).bodyAs[String] should be("1.4")
CamelMessage(1.4, Map.empty).bodyAs[String] should ===("1.4")
}
test("mustThrowExceptionWhenConvertingDoubleBodyToInputStream") {
@ -25,36 +25,36 @@ class MessageScalaTest extends FunSuite with Matchers with SharedCamelSystem {
test("mustConvertDoubleHeaderToString") {
val message = CamelMessage("test", Map("test" -> 1.4))
message.headerAs[String]("test").get should be("1.4")
message.headerAs[String]("test").get should ===("1.4")
}
test("mustReturnSubsetOfHeaders") {
val message = CamelMessage("test", Map("A" -> "1", "B" -> "2"))
message.headers(Set("B")) should be(Map("B" -> "2"))
message.headers(Set("B")) should ===(Map("B" -> "2"))
}
test("mustTransformBodyAndPreserveHeaders") {
CamelMessage("a", Map("A" -> "1")).mapBody((body: String) body + "b") should be(CamelMessage("ab", Map("A" -> "1")))
CamelMessage("a", Map("A" -> "1")).mapBody((body: String) body + "b") should ===(CamelMessage("ab", Map("A" -> "1")))
}
test("mustConvertBodyAndPreserveHeaders") {
CamelMessage(1.4, Map("A" -> "1")).withBodyAs[String] should be(CamelMessage("1.4", Map("A" -> "1")))
CamelMessage(1.4, Map("A" -> "1")).withBodyAs[String] should ===(CamelMessage("1.4", Map("A" -> "1")))
}
test("mustSetBodyAndPreserveHeaders") {
CamelMessage("test1", Map("A" -> "1")).copy(body = "test2") should be(
CamelMessage("test1", Map("A" -> "1")).copy(body = "test2") should ===(
CamelMessage("test2", Map("A" -> "1")))
}
test("mustSetHeadersAndPreserveBody") {
CamelMessage("test1", Map("A" -> "1")).copy(headers = Map("C" -> "3")) should be(
CamelMessage("test1", Map("A" -> "1")).copy(headers = Map("C" -> "3")) should ===(
CamelMessage("test1", Map("C" -> "3")))
}
test("mustBeAbleToReReadStreamCacheBody") {
val msg = CamelMessage(new InputStreamCache("test1".getBytes("utf-8")), Map.empty)
msg.bodyAs[String] should be("test1")
msg.bodyAs[String] should ===("test1")
// re-read
msg.bodyAs[String] should be("test1")
msg.bodyAs[String] should ===("test1")
}
}

View file

@ -79,12 +79,12 @@ class ProducerFeatureTest extends TestKit(ActorSystem("ProducerFeatureTest", Akk
producer.tell(message, testActor)
expectMsgPF(timeoutDuration) {
case Failure(e: AkkaCamelException)
e.getMessage should be("failure")
e.headers should be(Map(CamelMessage.MessageExchangeId -> "123"))
e.getMessage should ===("failure")
e.headers should ===(Map(CamelMessage.MessageExchangeId -> "123"))
}
}
Await.ready(latch, timeoutDuration)
deadActor should be(Some(producer))
deadActor should ===(Some(producer))
}
"03 produce a message oneway" in {
@ -121,8 +121,8 @@ class ProducerFeatureTest extends TestKit(ActorSystem("ProducerFeatureTest", Akk
producer.tell(message, testActor)
expectMsgPF(timeoutDuration) {
case Failure(e: AkkaCamelException)
e.getMessage should be("failure")
e.headers should be(Map(CamelMessage.MessageExchangeId -> "123"))
e.getMessage should ===("failure")
e.headers should ===(Map(CamelMessage.MessageExchangeId -> "123"))
}
}
}
@ -144,8 +144,8 @@ class ProducerFeatureTest extends TestKit(ActorSystem("ProducerFeatureTest", Akk
producer.tell(message, testActor)
expectMsgPF(timeoutDuration) {
case Failure(e: AkkaCamelException)
e.getMessage should be("failure")
e.headers should be(Map(CamelMessage.MessageExchangeId -> "123", "test" -> "failure"))
e.getMessage should ===("failure")
e.headers should ===(Map(CamelMessage.MessageExchangeId -> "123", "test" -> "failure"))
}
}
}
@ -187,8 +187,8 @@ class ProducerFeatureTest extends TestKit(ActorSystem("ProducerFeatureTest", Akk
producer.tell(message, testActor)
expectMsgPF(timeoutDuration) {
case Failure(e: AkkaCamelException)
e.getMessage should be("failure")
e.headers should be(Map(CamelMessage.MessageExchangeId -> "123", "test" -> "failure"))
e.getMessage should ===("failure")
e.headers should ===(Map(CamelMessage.MessageExchangeId -> "123", "test" -> "failure"))
}
}
}
@ -220,7 +220,7 @@ class ProducerFeatureTest extends TestKit(ActorSystem("ProducerFeatureTest", Akk
val futureFailed = producer.tell("fail", testActor)
expectMsgPF(timeoutDuration) {
case Failure(e)
e.getMessage should be("fail")
e.getMessage should ===("fail")
}
producer.tell("OK", testActor)
expectMsg("OK")

View file

@ -40,7 +40,7 @@ class UntypedProducerTest extends WordSpec with Matchers with BeforeAndAfterAll
val expected = CamelMessage("received test", Map(CamelMessage.MessageExchangeId -> "123"))
Await.result(future, timeout) match {
case result: CamelMessage result should be(expected)
case result: CamelMessage result should ===(expected)
case unexpected fail("Actor responded with unexpected message:" + unexpected)
}
@ -55,8 +55,8 @@ class UntypedProducerTest extends WordSpec with Matchers with BeforeAndAfterAll
Await.result(future, timeout) match {
case e: AkkaCamelException
e.getMessage should be("failure")
e.headers should be(Map(CamelMessage.MessageExchangeId -> "123"))
e.getMessage should ===("failure")
e.headers should ===(Map(CamelMessage.MessageExchangeId -> "123"))
case unexpected fail("Actor responded with unexpected message:" + unexpected)
}
}

View file

@ -20,7 +20,7 @@ class ActorEndpointPathTest extends WordSpec with SharedCamelSystem with Matcher
}
"findActorIn returns None" when {
"non existing valid path" in { find("akka://system/user/unknownactor") should be(None) }
"non existing valid path" in { find("akka://system/user/unknownactor") should ===(None) }
}
"fromCamelPath throws IllegalArgumentException" when {
"invalid path" in {
@ -29,4 +29,4 @@ class ActorEndpointPathTest extends WordSpec with SharedCamelSystem with Matcher
}
}
}
}
}

View file

@ -175,7 +175,7 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike w
probe.expectMsgType[CamelMessage]
probe.sender() ! "some message"
}
doneSync should be(false)
doneSync should ===(false)
info("done async")
asyncCallback.expectDoneAsyncWithin(1 second)
@ -237,7 +237,7 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike w
producer = given(outCapable = false, autoAck = true)
val doneSync = producer.processExchangeAdapter(exchange, asyncCallback)
doneSync should be(true)
doneSync should ===(true)
info("done sync")
asyncCallback.expectDoneSyncWithin(1 second)
info("async callback called")
@ -255,7 +255,7 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike w
val doneSync = producer.processExchangeAdapter(exchange, asyncCallback)
doneSync should be(false)
doneSync should ===(false)
within(1 second) {
probe.expectMsgType[CamelMessage]
info("message sent to consumer")
@ -306,7 +306,7 @@ class ActorProducerTest extends TestKit(ActorSystem("test")) with WordSpecLike w
val doneSync = producer.processExchangeAdapter(exchange, asyncCallback)
doneSync should be(false)
doneSync should ===(false)
within(1 second) {
probe.expectMsgType[CamelMessage]
info("message sent to consumer")

View file

@ -15,27 +15,27 @@ class DurationConverterSpec extends WordSpec with Matchers {
import DurationTypeConverter._
"DurationTypeConverter must convert '10 nanos'" in {
convertTo(classOf[Duration], "10 nanos") should be(10 nanos)
convertTo(classOf[Duration], "10 nanos") should ===(10 nanos)
}
"DurationTypeConverter must do the roundtrip" in {
convertTo(classOf[Duration], (10 seconds).toString()) should be(10 seconds)
convertTo(classOf[Duration], (10 seconds).toString()) should ===(10 seconds)
}
"DurationTypeConverter must throw if invalid format" in {
tryConvertTo(classOf[Duration], "abc nanos") should be(null)
tryConvertTo(classOf[Duration], "abc nanos") should ===(null)
intercept[TypeConversionException] {
mandatoryConvertTo(classOf[Duration], "abc nanos") should be(10 nanos)
}.getValue should be("abc nanos")
mandatoryConvertTo(classOf[Duration], "abc nanos") should ===(10 nanos)
}.getValue should ===("abc nanos")
}
"DurationTypeConverter must throw if doesn't end with time unit" in {
tryConvertTo(classOf[Duration], "10233") should be(null)
tryConvertTo(classOf[Duration], "10233") should ===(null)
intercept[TypeConversionException] {
mandatoryConvertTo(classOf[Duration], "10233") should be(10 nanos)
}.getValue should be("10233")
mandatoryConvertTo(classOf[Duration], "10233") should ===(10 nanos)
}.getValue should ===("10233")
}
}

View file

@ -109,10 +109,10 @@ abstract class ClusterMetricsEnabledSpec extends MultiNodeSpec(ClusterMetricsEna
"and gossip metrics around the node ring" taggedAs LongRunningTest in within(60 seconds) {
awaitClusterUp(roles: _*)
enterBarrier("cluster-started")
awaitAssert(clusterView.members.count(_.status == MemberStatus.Up) should be(roles.size))
awaitAssert(clusterView.members.count(_.status == MemberStatus.Up) should ===(roles.size))
// TODO ensure same contract
//awaitAssert(clusterView.clusterMetrics.size should be(roles.size))
awaitAssert(metricsView.clusterMetrics.size should be(roles.size))
//awaitAssert(clusterView.clusterMetrics.size should ===(roles.size))
awaitAssert(metricsView.clusterMetrics.size should ===(roles.size))
val collector = MetricsCollector(cluster.system)
collector.sample.metrics.size should be > (3)
enterBarrier("after")
@ -125,8 +125,8 @@ abstract class ClusterMetricsEnabledSpec extends MultiNodeSpec(ClusterMetricsEna
runOn(node2, node3, node4, node5) {
markNodeAsUnavailable(node1)
// TODO ensure same contract
//awaitAssert(clusterView.clusterMetrics.size should be(roles.size - 1))
awaitAssert(metricsView.clusterMetrics.size should be(roles.size - 1))
//awaitAssert(clusterView.clusterMetrics.size should ===(roles.size - 1))
awaitAssert(metricsView.clusterMetrics.size should ===(roles.size - 1))
}
enterBarrier("finished")
}
@ -149,14 +149,14 @@ abstract class ClusterMetricsDisabledSpec extends MultiNodeSpec(ClusterMetricsDi
"not collect metrics, not publish metrics events, and not gossip metrics" taggedAs LongRunningTest in {
awaitClusterUp(roles: _*)
// TODO ensure same contract
//clusterView.clusterMetrics.size should be(0)
metricsView.clusterMetrics.size should be(0)
//clusterView.clusterMetrics.size should ===(0)
metricsView.clusterMetrics.size should ===(0)
cluster.subscribe(testActor, classOf[ClusterMetricsChanged])
expectMsgType[CurrentClusterState]
expectNoMsg
// TODO ensure same contract
//clusterView.clusterMetrics.size should be(0)
metricsView.clusterMetrics.size should be(0)
//clusterView.clusterMetrics.size should ===(0)
metricsView.clusterMetrics.size should ===(0)
enterBarrier("after")
}
}

View file

@ -143,9 +143,9 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa
props(Props[Echo]),
name)
// it may take some time until router receives cluster member events
awaitAssert { currentRoutees(router).size should be(roles.size) }
awaitAssert { currentRoutees(router).size should ===(roles.size) }
val routees = currentRoutees(router)
routees.map { case ActorRefRoutee(ref) fullAddress(ref) }.toSet should be(roles.map(address).toSet)
routees.map { case ActorRefRoutee(ref) fullAddress(ref) }.toSet should ===(roles.map(address).toSet)
router
}
@ -178,7 +178,7 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa
replies(node1) should be > (0)
replies(node2) should be > (0)
replies(node3) should be > (0)
replies.values.sum should be(iterationCount)
replies.values.sum should ===(iterationCount)
}
@ -211,7 +211,7 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa
val replies = receiveReplies(iterationCount)
replies(node3) should be > (replies(node2))
replies.values.sum should be(iterationCount)
replies.values.sum should ===(iterationCount)
}
@ -222,9 +222,9 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa
runOn(node1) {
val router3 = system.actorOf(FromConfig.props(Props[Memory]), "router3")
// it may take some time until router receives cluster member events
awaitAssert { currentRoutees(router3).size should be(9) }
awaitAssert { currentRoutees(router3).size should ===(9) }
val routees = currentRoutees(router3)
routees.map { case ActorRefRoutee(ref) fullAddress(ref) }.toSet should be(Set(address(node1)))
routees.map { case ActorRefRoutee(ref) fullAddress(ref) }.toSet should ===(Set(address(node1)))
}
enterBarrier("after-4")
}
@ -233,9 +233,9 @@ abstract class AdaptiveLoadBalancingRouterSpec extends MultiNodeSpec(AdaptiveLoa
runOn(node1) {
val router4 = system.actorOf(FromConfig.props(Props[Memory]), "router4")
// it may take some time until router receives cluster member events
awaitAssert { currentRoutees(router4).size should be(6) }
awaitAssert { currentRoutees(router4).size should ===(6) }
val routees = currentRoutees(router4)
routees.map { case ActorRefRoutee(ref) fullAddress(ref) }.toSet should be(Set(
routees.map { case ActorRefRoutee(ref) fullAddress(ref) }.toSet should ===(Set(
address(node1), address(node2), address(node3)))
}
enterBarrier("after-5")

View file

@ -49,14 +49,14 @@ class MetricsExtensionSpec extends AkkaSpec(MetricsConfig.clusterSigarMock)
"collect metrics after start command" in {
extension.supervisor ! CollectionStartMessage
awaitAssert(metricsNodeCount should be(nodeCount), 15 seconds)
awaitAssert(metricsNodeCount should ===(nodeCount), 15 seconds)
}
"collect mock sample during a time window" in {
awaitAssert(metricsHistorySize should be(sampleCount), 15 seconds)
awaitAssert(metricsHistorySize should ===(sampleCount), 15 seconds)
extension.supervisor ! CollectionStopMessage
awaitSample()
metricsNodeCount should be(nodeCount)
metricsNodeCount should ===(nodeCount)
metricsHistorySize should be >= (sampleCount)
}
@ -76,16 +76,16 @@ class MetricsExtensionSpec extends AkkaSpec(MetricsConfig.clusterSigarMock)
(0.700, 0.343, 0.137),
(0.700, 0.372, 0.148))
expected.size should be(sampleCount)
expected.size should ===(sampleCount)
history.zip(expected) foreach {
case (mockMetrics, expectedData)
(mockMetrics, expectedData) match {
case (Cpu(_, _, loadAverageMock, cpuCombinedMock, cpuStolenMock, _),
(loadAverageEwma, cpuCombinedEwma, cpuStolenEwma))
loadAverageMock.get should be(loadAverageEwma +- epsilon)
cpuCombinedMock.get should be(cpuCombinedEwma +- epsilon)
cpuStolenMock.get should be(cpuStolenEwma +- epsilon)
loadAverageMock.get should ===(loadAverageEwma +- epsilon)
cpuCombinedMock.get should ===(cpuCombinedEwma +- epsilon)
cpuStolenMock.get should ===(cpuStolenEwma +- epsilon)
}
}
}
@ -97,7 +97,7 @@ class MetricsExtensionSpec extends AkkaSpec(MetricsConfig.clusterSigarMock)
val size1 = metricsHistorySize
awaitSample()
val size2 = metricsHistorySize
size1 should be(size2)
size1 should ===(size2)
extension.supervisor ! CollectionStartMessage
awaitSample()
@ -111,7 +111,7 @@ class MetricsExtensionSpec extends AkkaSpec(MetricsConfig.clusterSigarMock)
awaitSample()
val size5 = metricsHistorySize
size5 should be(size4)
size5 should ===(size4)
}

View file

@ -65,13 +65,13 @@ class MetricsSelectorSpec extends WordSpec with Matchers {
"calculate weights from capacity" in {
val capacity = Map(a1 -> 0.6, b1 -> 0.3, c1 -> 0.1)
val weights = abstractSelector.weights(capacity)
weights should be(Map(c1 -> 1, b1 -> 3, a1 -> 6))
weights should ===(Map(c1 -> 1, b1 -> 3, a1 -> 6))
}
"handle low and zero capacity" in {
val capacity = Map(a1 -> 0.0, b1 -> 1.0, c1 -> 0.005, d1 -> 0.004)
val weights = abstractSelector.weights(capacity)
weights should be(Map(a1 -> 0, b1 -> 100, c1 -> 1, d1 -> 0))
weights should ===(Map(a1 -> 0, b1 -> 100, c1 -> 1, d1 -> 0))
}
}
@ -79,40 +79,40 @@ class MetricsSelectorSpec extends WordSpec with Matchers {
"HeapMetricsSelector" must {
"calculate capacity of heap metrics" in {
val capacity = HeapMetricsSelector.capacity(nodeMetrics)
capacity(a1) should be(0.75 +- 0.0001)
capacity(b1) should be(0.75 +- 0.0001)
capacity(c1) should be(0.0 +- 0.0001)
capacity(d1) should be(0.001953125 +- 0.0001)
capacity(a1) should ===(0.75 +- 0.0001)
capacity(b1) should ===(0.75 +- 0.0001)
capacity(c1) should ===(0.0 +- 0.0001)
capacity(d1) should ===(0.001953125 +- 0.0001)
}
}
"CpuMetricsSelector" must {
"calculate capacity of cpuCombined metrics" in {
val capacity = CpuMetricsSelector.capacity(nodeMetrics)
capacity(a1) should be(1.0 - 0.2 - 0.1 * (1.0 + factor) +- 0.0001)
capacity(b1) should be(1.0 - 0.4 - 0.2 * (1.0 + factor) +- 0.0001)
capacity(c1) should be(1.0 - 0.6 - 0.3 * (1.0 + factor) +- 0.0001)
capacity.contains(d1) should be(false)
capacity(a1) should ===(1.0 - 0.2 - 0.1 * (1.0 + factor) +- 0.0001)
capacity(b1) should ===(1.0 - 0.4 - 0.2 * (1.0 + factor) +- 0.0001)
capacity(c1) should ===(1.0 - 0.6 - 0.3 * (1.0 + factor) +- 0.0001)
capacity.contains(d1) should ===(false)
}
}
"SystemLoadAverageMetricsSelector" must {
"calculate capacity of systemLoadAverage metrics" in {
val capacity = SystemLoadAverageMetricsSelector.capacity(nodeMetrics)
capacity(a1) should be(0.9375 +- 0.0001)
capacity(b1) should be(0.9375 +- 0.0001)
capacity(c1) should be(0.0 +- 0.0001)
capacity.contains(d1) should be(false)
capacity(a1) should ===(0.9375 +- 0.0001)
capacity(b1) should ===(0.9375 +- 0.0001)
capacity(c1) should ===(0.0 +- 0.0001)
capacity.contains(d1) should ===(false)
}
}
"MixMetricsSelector" must {
"aggregate capacity of all metrics" in {
val capacity = MixMetricsSelector.capacity(nodeMetrics)
capacity(a1) should be((0.75 + 0.67 + 0.9375) / 3 +- 0.0001)
capacity(b1) should be((0.75 + 0.34 + 0.9375) / 3 +- 0.0001)
capacity(c1) should be((0.0 + 0.01 + 0.0) / 3 +- 0.0001)
capacity(d1) should be((0.001953125) / 1 +- 0.0001)
capacity(a1) should ===((0.75 + 0.67 + 0.9375) / 3 +- 0.0001)
capacity(b1) should ===((0.75 + 0.34 + 0.9375) / 3 +- 0.0001)
capacity(c1) should ===((0.0 + 0.01 + 0.0) / 3 +- 0.0001)
capacity(d1) should ===((0.001953125) / 1 +- 0.0001)
}
}

View file

@ -22,22 +22,22 @@ class ClusterMetricsSettingsSpec extends AkkaSpec {
import settings._
// Extension.
MetricsDispatcher should be(Dispatchers.DefaultDispatcherId)
PeriodicTasksInitialDelay should be(1 second)
NativeLibraryExtractFolder should be(System.getProperty("user.dir") + "/native")
MetricsDispatcher should ===(Dispatchers.DefaultDispatcherId)
PeriodicTasksInitialDelay should ===(1 second)
NativeLibraryExtractFolder should ===(System.getProperty("user.dir") + "/native")
// Supervisor.
SupervisorName should be("cluster-metrics")
SupervisorStrategyProvider should be(classOf[ClusterMetricsStrategy].getName)
SupervisorStrategyConfiguration should be(
SupervisorName should ===("cluster-metrics")
SupervisorStrategyProvider should ===(classOf[ClusterMetricsStrategy].getName)
SupervisorStrategyConfiguration should ===(
ConfigFactory.parseString("loggingEnabled=true,maxNrOfRetries=3,withinTimeRange=3s"))
// Collector.
CollectorEnabled should be(true)
CollectorProvider should be("")
CollectorSampleInterval should be(3 seconds)
CollectorGossipInterval should be(3 seconds)
CollectorMovingAverageHalfLife should be(12 seconds)
CollectorEnabled should ===(true)
CollectorProvider should ===("")
CollectorSampleInterval should ===(3 seconds)
CollectorGossipInterval should ===(3 seconds)
CollectorMovingAverageHalfLife should ===(12 seconds)
}
}
}

View file

@ -20,34 +20,34 @@ class EWMASpec extends AkkaSpec(MetricsConfig.defaultEnabled) with MetricsCollec
"calcualate same ewma for constant values" in {
val ds = EWMA(value = 100.0, alpha = 0.18) :+
100.0 :+ 100.0 :+ 100.0
ds.value should be(100.0 +- 0.001)
ds.value should ===(100.0 +- 0.001)
}
"calcualate correct ewma for normal decay" in {
val d0 = EWMA(value = 1000.0, alpha = 2.0 / (1 + 10))
d0.value should be(1000.0 +- 0.01)
d0.value should ===(1000.0 +- 0.01)
val d1 = d0 :+ 10.0
d1.value should be(820.0 +- 0.01)
d1.value should ===(820.0 +- 0.01)
val d2 = d1 :+ 10.0
d2.value should be(672.73 +- 0.01)
d2.value should ===(672.73 +- 0.01)
val d3 = d2 :+ 10.0
d3.value should be(552.23 +- 0.01)
d3.value should ===(552.23 +- 0.01)
val d4 = d3 :+ 10.0
d4.value should be(453.64 +- 0.01)
d4.value should ===(453.64 +- 0.01)
val dn = (1 to 100).foldLeft(d0)((d, _) d :+ 10.0)
dn.value should be(10.0 +- 0.1)
dn.value should ===(10.0 +- 0.1)
}
"calculate ewma for alpha 1.0, max bias towards latest value" in {
val d0 = EWMA(value = 100.0, alpha = 1.0)
d0.value should be(100.0 +- 0.01)
d0.value should ===(100.0 +- 0.01)
val d1 = d0 :+ 1.0
d1.value should be(1.0 +- 0.01)
d1.value should ===(1.0 +- 0.01)
val d2 = d1 :+ 57.0
d2.value should be(57.0 +- 0.01)
d2.value should ===(57.0 +- 0.01)
val d3 = d2 :+ 10.0
d3.value should be(10.0 +- 0.01)
d3.value should ===(10.0 +- 0.01)
}
"calculate alpha from half-life and collect interval" in {
@ -58,21 +58,21 @@ class EWMASpec extends AkkaSpec(MetricsConfig.defaultEnabled) with MetricsCollec
val halfLife = n.toDouble / 2.8854
val collectInterval = 1.second
val halfLifeDuration = (halfLife * 1000).millis
EWMA.alpha(halfLifeDuration, collectInterval) should be(expectedAlpha +- 0.001)
EWMA.alpha(halfLifeDuration, collectInterval) should ===(expectedAlpha +- 0.001)
}
"calculate sane alpha from short half-life" in {
val alpha = EWMA.alpha(1.millis, 3.seconds)
alpha should be <= (1.0)
alpha should be >= (0.0)
alpha should be(1.0 +- 0.001)
alpha should ===(1.0 +- 0.001)
}
"calculate sane alpha from long half-life" in {
val alpha = EWMA.alpha(1.day, 3.seconds)
alpha should be <= (1.0)
alpha should be >= (0.0)
alpha should be(0.0 +- 0.001)
alpha should ===(0.0 +- 0.001)
}
"calculate the ewma for multiple, variable, data streams" taggedAs LongRunningTest in {
@ -88,7 +88,7 @@ class EWMASpec extends AkkaSpec(MetricsConfig.defaultEnabled) with MetricsCollec
case Some(previous)
if (latest.isSmooth && latest.value != previous.value) {
val updated = previous :+ latest
updated.isSmooth should be(true)
updated.isSmooth should ===(true)
updated.smoothValue should not be (previous.smoothValue)
Some(updated)
} else None

View file

@ -19,35 +19,35 @@ class MetricNumericConverterSpec extends WordSpec with Matchers with MetricNumer
"MetricNumericConverter" must {
"convert" in {
convertNumber(0).isLeft should be(true)
convertNumber(1).left.get should be(1)
convertNumber(1L).isLeft should be(true)
convertNumber(0.0).isRight should be(true)
convertNumber(0).isLeft should ===(true)
convertNumber(1).left.get should ===(1)
convertNumber(1L).isLeft should ===(true)
convertNumber(0.0).isRight should ===(true)
}
"define a new metric" in {
val Some(metric) = Metric.create(HeapMemoryUsed, 256L, decayFactor = Some(0.18))
metric.name should be(HeapMemoryUsed)
metric.value should be(256L)
metric.isSmooth should be(true)
metric.smoothValue should be(256.0 +- 0.0001)
metric.name should ===(HeapMemoryUsed)
metric.value should ===(256L)
metric.isSmooth should ===(true)
metric.smoothValue should ===(256.0 +- 0.0001)
}
"define an undefined value with a None " in {
Metric.create("x", -1, None).isDefined should be(false)
Metric.create("x", java.lang.Double.NaN, None).isDefined should be(false)
Metric.create("x", Failure(new RuntimeException), None).isDefined should be(false)
Metric.create("x", -1, None).isDefined should ===(false)
Metric.create("x", java.lang.Double.NaN, None).isDefined should ===(false)
Metric.create("x", Failure(new RuntimeException), None).isDefined should ===(false)
}
"recognize whether a metric value is defined" in {
defined(0) should be(true)
defined(0.0) should be(true)
defined(0) should ===(true)
defined(0.0) should ===(true)
}
"recognize whether a metric value is not defined" in {
defined(-1) should be(false)
defined(-1.0) should be(false)
defined(Double.NaN) should be(false)
defined(-1) should ===(false)
defined(-1.0) should ===(false)
defined(Double.NaN) should ===(false)
}
}
}
@ -61,11 +61,11 @@ class NodeMetricsSpec extends WordSpec with Matchers {
"NodeMetrics must" must {
"return correct result for 2 'same' nodes" in {
(NodeMetrics(node1, 0) sameAs NodeMetrics(node1, 0)) should be(true)
(NodeMetrics(node1, 0) sameAs NodeMetrics(node1, 0)) should ===(true)
}
"return correct result for 2 not 'same' nodes" in {
(NodeMetrics(node1, 0) sameAs NodeMetrics(node2, 0)) should be(false)
(NodeMetrics(node1, 0) sameAs NodeMetrics(node2, 0)) should ===(false)
}
"merge 2 NodeMetrics by most recent" in {
@ -73,10 +73,10 @@ class NodeMetricsSpec extends WordSpec with Matchers {
val sample2 = NodeMetrics(node1, 2, Set(Metric.create("a", 11, None), Metric.create("c", 30, None)).flatten)
val merged = sample1 merge sample2
merged.timestamp should be(sample2.timestamp)
merged.metric("a").map(_.value) should be(Some(11))
merged.metric("b").map(_.value) should be(Some(20))
merged.metric("c").map(_.value) should be(Some(30))
merged.timestamp should ===(sample2.timestamp)
merged.metric("a").map(_.value) should ===(Some(11))
merged.metric("b").map(_.value) should ===(Some(20))
merged.metric("c").map(_.value) should ===(Some(30))
}
"not merge 2 NodeMetrics if master is more recent" in {
@ -84,8 +84,8 @@ class NodeMetricsSpec extends WordSpec with Matchers {
val sample2 = NodeMetrics(node1, 0, Set(Metric.create("a", 11, None), Metric.create("c", 30, None)).flatten)
val merged = sample1 merge sample2 // older and not same
merged.timestamp should be(sample1.timestamp)
merged.metrics should be(sample1.metrics)
merged.timestamp should ===(sample1.timestamp)
merged.metrics should ===(sample1.metrics)
}
"update 2 NodeMetrics by most recent" in {
@ -94,11 +94,11 @@ class NodeMetricsSpec extends WordSpec with Matchers {
val updated = sample1 update sample2
updated.metrics.size should be(3)
updated.timestamp should be(sample2.timestamp)
updated.metric("a").map(_.value) should be(Some(11))
updated.metric("b").map(_.value) should be(Some(20))
updated.metric("c").map(_.value) should be(Some(30))
updated.metrics.size should ===(3)
updated.timestamp should ===(sample2.timestamp)
updated.metric("a").map(_.value) should ===(Some(11))
updated.metric("b").map(_.value) should ===(Some(20))
updated.metric("c").map(_.value) should ===(Some(30))
}
"update 3 NodeMetrics with ewma applied" in {
@ -113,18 +113,18 @@ class NodeMetricsSpec extends WordSpec with Matchers {
val updated = sample1 update sample2 update sample3
updated.metrics.size should be(4)
updated.timestamp should be(sample3.timestamp)
updated.metrics.size should ===(4)
updated.timestamp should ===(sample3.timestamp)
updated.metric("a").map(_.value).get should be(3)
updated.metric("b").map(_.value).get should be(4)
updated.metric("c").map(_.value).get should be(5)
updated.metric("d").map(_.value).get should be(6)
updated.metric("a").map(_.value).get should ===(3)
updated.metric("b").map(_.value).get should ===(4)
updated.metric("c").map(_.value).get should ===(5)
updated.metric("d").map(_.value).get should ===(6)
updated.metric("a").map(_.smoothValue).get should be(1.512 +- epsilon)
updated.metric("b").map(_.smoothValue).get should be(4.000 +- epsilon)
updated.metric("c").map(_.smoothValue).get should be(5.000 +- epsilon)
updated.metric("d").map(_.smoothValue).get should be(6.000 +- epsilon)
updated.metric("a").map(_.smoothValue).get should ===(1.512 +- epsilon)
updated.metric("b").map(_.smoothValue).get should ===(4.000 +- epsilon)
updated.metric("c").map(_.smoothValue).get should ===(5.000 +- epsilon)
updated.metric("d").map(_.smoothValue).get should ===(6.000 +- epsilon)
}
}
@ -144,13 +144,13 @@ class MetricsGossipSpec extends AkkaSpec(MetricsConfig.defaultEnabled) with Impl
m2.metrics.size should be > (3)
val g1 = MetricsGossip.empty :+ m1
g1.nodes.size should be(1)
g1.nodeMetricsFor(m1.address).map(_.metrics) should be(Some(m1.metrics))
g1.nodes.size should ===(1)
g1.nodeMetricsFor(m1.address).map(_.metrics) should ===(Some(m1.metrics))
val g2 = g1 :+ m2
g2.nodes.size should be(2)
g2.nodeMetricsFor(m1.address).map(_.metrics) should be(Some(m1.metrics))
g2.nodeMetricsFor(m2.address).map(_.metrics) should be(Some(m2.metrics))
g2.nodes.size should ===(2)
g2.nodeMetricsFor(m1.address).map(_.metrics) should ===(Some(m1.metrics))
g2.nodeMetricsFor(m2.address).map(_.metrics) should ===(Some(m2.metrics))
}
"merge peer metrics" in {
@ -158,15 +158,15 @@ class MetricsGossipSpec extends AkkaSpec(MetricsConfig.defaultEnabled) with Impl
val m2 = NodeMetrics(Address("akka.tcp", "sys", "a", 2555), newTimestamp, collector.sample.metrics)
val g1 = MetricsGossip.empty :+ m1 :+ m2
g1.nodes.size should be(2)
g1.nodes.size should ===(2)
val beforeMergeNodes = g1.nodes
val m2Updated = m2 copy (metrics = collector.sample.metrics, timestamp = m2.timestamp + 1000)
val g2 = g1 :+ m2Updated // merge peers
g2.nodes.size should be(2)
g2.nodeMetricsFor(m1.address).map(_.metrics) should be(Some(m1.metrics))
g2.nodeMetricsFor(m2.address).map(_.metrics) should be(Some(m2Updated.metrics))
g2.nodes collect { case peer if peer.address == m2.address peer.timestamp should be(m2Updated.timestamp) }
g2.nodes.size should ===(2)
g2.nodeMetricsFor(m1.address).map(_.metrics) should ===(Some(m1.metrics))
g2.nodeMetricsFor(m2.address).map(_.metrics) should ===(Some(m2Updated.metrics))
g2.nodes collect { case peer if peer.address == m2.address peer.timestamp should ===(m2Updated.timestamp) }
}
"merge an existing metric set for a node and update node ring" in {
@ -178,22 +178,22 @@ class MetricsGossipSpec extends AkkaSpec(MetricsConfig.defaultEnabled) with Impl
val g1 = MetricsGossip.empty :+ m1 :+ m2
val g2 = MetricsGossip.empty :+ m3 :+ m2Updated
g1.nodes.map(_.address) should be(Set(m1.address, m2.address))
g1.nodes.map(_.address) should ===(Set(m1.address, m2.address))
// should contain nodes 1,3, and the most recent version of 2
val mergedGossip = g1 merge g2
mergedGossip.nodes.map(_.address) should be(Set(m1.address, m2.address, m3.address))
mergedGossip.nodeMetricsFor(m1.address).map(_.metrics) should be(Some(m1.metrics))
mergedGossip.nodeMetricsFor(m2.address).map(_.metrics) should be(Some(m2Updated.metrics))
mergedGossip.nodeMetricsFor(m3.address).map(_.metrics) should be(Some(m3.metrics))
mergedGossip.nodes.map(_.address) should ===(Set(m1.address, m2.address, m3.address))
mergedGossip.nodeMetricsFor(m1.address).map(_.metrics) should ===(Some(m1.metrics))
mergedGossip.nodeMetricsFor(m2.address).map(_.metrics) should ===(Some(m2Updated.metrics))
mergedGossip.nodeMetricsFor(m3.address).map(_.metrics) should ===(Some(m3.metrics))
mergedGossip.nodes.foreach(_.metrics.size should be > (3))
mergedGossip.nodeMetricsFor(m2.address).map(_.timestamp) should be(Some(m2Updated.timestamp))
mergedGossip.nodeMetricsFor(m2.address).map(_.timestamp) should ===(Some(m2Updated.timestamp))
}
"get the current NodeMetrics if it exists in the local nodes" in {
val m1 = NodeMetrics(Address("akka.tcp", "sys", "a", 2554), newTimestamp, collector.sample.metrics)
val g1 = MetricsGossip.empty :+ m1
g1.nodeMetricsFor(m1.address).map(_.metrics) should be(Some(m1.metrics))
g1.nodeMetricsFor(m1.address).map(_.metrics) should ===(Some(m1.metrics))
}
"remove a node if it is no longer Up" in {
@ -201,12 +201,12 @@ class MetricsGossipSpec extends AkkaSpec(MetricsConfig.defaultEnabled) with Impl
val m2 = NodeMetrics(Address("akka.tcp", "sys", "a", 2555), newTimestamp, collector.sample.metrics)
val g1 = MetricsGossip.empty :+ m1 :+ m2
g1.nodes.size should be(2)
g1.nodes.size should ===(2)
val g2 = g1 remove m1.address
g2.nodes.size should be(1)
g2.nodes.exists(_.address == m1.address) should be(false)
g2.nodeMetricsFor(m1.address) should be(None)
g2.nodeMetricsFor(m2.address).map(_.metrics) should be(Some(m2.metrics))
g2.nodes.size should ===(1)
g2.nodes.exists(_.address == m1.address) should ===(false)
g2.nodeMetricsFor(m1.address) should ===(None)
g2.nodeMetricsFor(m2.address).map(_.metrics) should ===(Some(m2.metrics))
}
"filter nodes" in {
@ -214,12 +214,12 @@ class MetricsGossipSpec extends AkkaSpec(MetricsConfig.defaultEnabled) with Impl
val m2 = NodeMetrics(Address("akka.tcp", "sys", "a", 2555), newTimestamp, collector.sample.metrics)
val g1 = MetricsGossip.empty :+ m1 :+ m2
g1.nodes.size should be(2)
g1.nodes.size should ===(2)
val g2 = g1 filter Set(m2.address)
g2.nodes.size should be(1)
g2.nodes.exists(_.address == m1.address) should be(false)
g2.nodeMetricsFor(m1.address) should be(None)
g2.nodeMetricsFor(m2.address).map(_.metrics) should be(Some(m2.metrics))
g2.nodes.size should ===(1)
g2.nodes.exists(_.address == m1.address) should ===(false)
g2.nodeMetricsFor(m1.address) should ===(None)
g2.nodeMetricsFor(m2.address).map(_.metrics) should ===(Some(m2.metrics))
}
}
}

View file

@ -32,8 +32,8 @@ class MetricsCollectorSpec extends AkkaSpec(MetricsConfig.defaultEnabled) with I
val merged12 = sample2 flatMap (latest sample1 collect {
case peer if latest sameAs peer
val m = peer :+ latest
m.value should be(latest.value)
m.isSmooth should be(peer.isSmooth || latest.isSmooth)
m.value should ===(latest.value)
m.isSmooth should ===(peer.isSmooth || latest.isSmooth)
m
})
@ -42,8 +42,8 @@ class MetricsCollectorSpec extends AkkaSpec(MetricsConfig.defaultEnabled) with I
val merged34 = sample4 flatMap (latest sample3 collect {
case peer if latest sameAs peer
val m = peer :+ latest
m.value should be(latest.value)
m.isSmooth should be(peer.isSmooth || latest.isSmooth)
m.value should ===(latest.value)
m.isSmooth should ===(peer.isSmooth || latest.isSmooth)
m
})
}
@ -86,9 +86,9 @@ class MetricsCollectorSpec extends AkkaSpec(MetricsConfig.defaultEnabled) with I
// it's not present on all platforms
val c = collector.asInstanceOf[JmxMetricsCollector]
val heap = c.heapMemoryUsage
c.heapUsed(heap).isDefined should be(true)
c.heapCommitted(heap).isDefined should be(true)
c.processors.isDefined should be(true)
c.heapUsed(heap).isDefined should ===(true)
c.heapCommitted(heap).isDefined should ===(true)
c.processors.isDefined should ===(true)
}
"collect 50 node metrics samples in an acceptable duration" taggedAs LongRunningTest in within(10 seconds) {

View file

@ -27,7 +27,7 @@ class MessageSerializerSpec extends AkkaSpec(
val ref = serializer.fromBinary(blob, obj.getClass)
obj match {
case _
ref should be(obj)
ref should ===(obj)
}
}

View file

@ -53,7 +53,7 @@ abstract class ClientDowningNodeThatIsUnreachableSpec(multiNodeConfig: ClientDow
enterBarrier("down-third-node")
awaitMembersUp(numberOfMembers = 3, canNotBePartOfMemberRing = Set(thirdAddress))
clusterView.members.exists(_.address == thirdAddress) should be(false)
clusterView.members.exists(_.address == thirdAddress) should ===(false)
}
runOn(third) {

View file

@ -52,7 +52,7 @@ abstract class ClientDowningNodeThatIsUpSpec(multiNodeConfig: ClientDowningNodeT
markNodeAsUnavailable(thirdAddress)
awaitMembersUp(numberOfMembers = 3, canNotBePartOfMemberRing = Set(thirdAddress))
clusterView.members.exists(_.address == thirdAddress) should be(false)
clusterView.members.exists(_.address == thirdAddress) should ===(false)
}
runOn(third) {

View file

@ -40,9 +40,9 @@ abstract class ClusterAccrualFailureDetectorSpec
awaitClusterUp(first, second, third)
Thread.sleep(5.seconds.dilated.toMillis) // let them heartbeat
cluster.failureDetector.isAvailable(first) should be(true)
cluster.failureDetector.isAvailable(second) should be(true)
cluster.failureDetector.isAvailable(third) should be(true)
cluster.failureDetector.isAvailable(first) should ===(true)
cluster.failureDetector.isAvailable(second) should ===(true)
cluster.failureDetector.isAvailable(third) should ===(true)
enterBarrier("after-1")
}
@ -59,14 +59,14 @@ abstract class ClusterAccrualFailureDetectorSpec
// detect failure...
awaitCond(!cluster.failureDetector.isAvailable(second), 15.seconds)
// other connections still ok
cluster.failureDetector.isAvailable(third) should be(true)
cluster.failureDetector.isAvailable(third) should ===(true)
}
runOn(second) {
// detect failure...
awaitCond(!cluster.failureDetector.isAvailable(first), 15.seconds)
// other connections still ok
cluster.failureDetector.isAvailable(third) should be(true)
cluster.failureDetector.isAvailable(third) should ===(true)
}
enterBarrier("partitioned")
@ -99,8 +99,8 @@ abstract class ClusterAccrualFailureDetectorSpec
// remaning nodes should detect failure...
awaitCond(!cluster.failureDetector.isAvailable(third), 15.seconds)
// other connections still ok
cluster.failureDetector.isAvailable(first) should be(true)
cluster.failureDetector.isAvailable(second) should be(true)
cluster.failureDetector.isAvailable(first) should ===(true)
cluster.failureDetector.isAvailable(second) should ===(true)
}
enterBarrier("after-3")

View file

@ -204,7 +204,7 @@ abstract class ClusterDeathWatchSpec
enterBarrier("fifth-terminated")
runOn(first) {
expectMsgType[Terminated].actor.path.name should be("subject5")
expectMsgType[Terminated].actor.path.name should ===("subject5")
}
enterBarrier("after-3")
@ -221,8 +221,8 @@ abstract class ClusterDeathWatchSpec
runOn(fourth) {
val hello = system.actorOf(Props[Hello], "hello")
hello.isInstanceOf[RemoteActorRef] should be(true)
hello.path.address should be(address(first))
hello.isInstanceOf[RemoteActorRef] should ===(true)
hello.path.address should ===(address(first))
watch(hello)
enterBarrier("hello-deployed")

View file

@ -25,11 +25,11 @@ abstract class ClusterMetricsDisabledSpec extends MultiNodeSpec(ClusterMetricsDi
"Cluster metrics" must {
"not collect metrics, not publish ClusterMetricsChanged, and not gossip metrics" taggedAs LongRunningTest in {
awaitClusterUp(roles: _*)
clusterView.clusterMetrics.size should be(0)
clusterView.clusterMetrics.size should ===(0)
cluster.subscribe(testActor, classOf[ClusterMetricsChanged])
expectMsgType[CurrentClusterState]
expectNoMsg
clusterView.clusterMetrics.size should be(0)
clusterView.clusterMetrics.size should ===(0)
enterBarrier("after")
}
}

View file

@ -40,8 +40,8 @@ abstract class ClusterMetricsSpec extends MultiNodeSpec(ClusterMetricsMultiJvmSp
"and gossip metrics around the node ring" taggedAs LongRunningTest in within(60 seconds) {
awaitClusterUp(roles: _*)
enterBarrier("cluster-started")
awaitAssert(clusterView.members.count(_.status == MemberStatus.Up) should be(roles.size))
awaitAssert(clusterView.clusterMetrics.size should be(roles.size))
awaitAssert(clusterView.members.count(_.status == MemberStatus.Up) should ===(roles.size))
awaitAssert(clusterView.clusterMetrics.size should ===(roles.size))
val collector = MetricsCollector(cluster.system, cluster.settings)
collector.sample.metrics.size should be > (3)
enterBarrier("after")
@ -53,7 +53,7 @@ abstract class ClusterMetricsSpec extends MultiNodeSpec(ClusterMetricsMultiJvmSp
enterBarrier("first-left")
runOn(second, third, fourth, fifth) {
markNodeAsUnavailable(first)
awaitAssert(clusterView.clusterMetrics.size should be(roles.size - 1))
awaitAssert(clusterView.clusterMetrics.size should ===(roles.size - 1))
}
enterBarrier("finished")
}

View file

@ -69,12 +69,12 @@ abstract class ConvergenceSpec(multiNodeConfig: ConvergenceMultiNodeConfig)
within(28 seconds) {
// third becomes unreachable
awaitAssert(clusterView.unreachableMembers.size should be(1))
awaitAssert(clusterView.unreachableMembers.size should ===(1))
awaitSeenSameState(first, second)
// still one unreachable
clusterView.unreachableMembers.size should be(1)
clusterView.unreachableMembers.head.address should be(thirdAddress)
clusterView.members.size should be(3)
clusterView.unreachableMembers.size should ===(1)
clusterView.unreachableMembers.head.address should ===(thirdAddress)
clusterView.members.size should ===(3)
}
}
@ -95,11 +95,11 @@ abstract class ConvergenceSpec(multiNodeConfig: ConvergenceMultiNodeConfig)
runOn(first, second, fourth) {
for (n 1 to 5) {
awaitAssert(clusterView.members.size should be(3))
awaitAssert(clusterView.members.size should ===(3))
awaitSeenSameState(first, second, fourth)
memberStatus(first) should be(Some(MemberStatus.Up))
memberStatus(second) should be(Some(MemberStatus.Up))
memberStatus(fourth) should be(None)
memberStatus(first) should ===(Some(MemberStatus.Up))
memberStatus(second) should ===(Some(MemberStatus.Up))
memberStatus(fourth) should ===(None)
// wait and then check again
Thread.sleep(1.second.dilated.toMillis)
}

View file

@ -67,7 +67,7 @@ abstract class DisallowJoinOfTwoClustersSpec
// no change expected
1 to 5 foreach { _
clusterView.members.size should be(expectedSize)
clusterView.members.size should ===(expectedSize)
Thread.sleep(1000)
}

View file

@ -54,7 +54,7 @@ abstract class JoinInProgressSpec
val until = Deadline.now + 5.seconds
while (!until.isOverdue) {
Thread.sleep(200)
cluster.failureDetector.isAvailable(second) should be(true)
cluster.failureDetector.isAvailable(second) should ===(true)
}
}

View file

@ -51,7 +51,7 @@ abstract class LeaderElectionSpec(multiNodeConfig: LeaderElectionMultiNodeConfig
awaitClusterUp(first, second, third, fourth)
if (myself != controller) {
clusterView.isLeader should be(myself == sortedRoles.head)
clusterView.isLeader should ===(myself == sortedRoles.head)
assertLeaderIn(sortedRoles)
}
@ -104,7 +104,7 @@ abstract class LeaderElectionSpec(multiNodeConfig: LeaderElectionMultiNodeConfig
enterBarrier("after-down" + n)
awaitMembersUp(currentRoles.size - 1)
val nextExpectedLeader = remainingRoles.head
clusterView.isLeader should be(myself == nextExpectedLeader)
clusterView.isLeader should ===(myself == nextExpectedLeader)
assertLeaderIn(remainingRoles)
enterBarrier("completed" + n)

View file

@ -45,35 +45,35 @@ abstract class MBeanSpec
"Cluster MBean" must {
"expose attributes" taggedAs LongRunningTest in {
val info = mbeanServer.getMBeanInfo(mbeanName)
info.getAttributes.map(_.getName).toSet should be(Set(
info.getAttributes.map(_.getName).toSet should ===(Set(
"ClusterStatus", "Members", "Unreachable", "MemberStatus", "Leader", "Singleton", "Available"))
enterBarrier("after-1")
}
"expose operations" taggedAs LongRunningTest in {
val info = mbeanServer.getMBeanInfo(mbeanName)
info.getOperations.map(_.getName).toSet should be(Set(
info.getOperations.map(_.getName).toSet should ===(Set(
"join", "leave", "down"))
enterBarrier("after-2")
}
"change attributes after startup" taggedAs LongRunningTest in {
runOn(first) {
mbeanServer.getAttribute(mbeanName, "Available").asInstanceOf[Boolean] should be(false)
mbeanServer.getAttribute(mbeanName, "Singleton").asInstanceOf[Boolean] should be(false)
mbeanServer.getAttribute(mbeanName, "Leader") should be("")
mbeanServer.getAttribute(mbeanName, "Members") should be("")
mbeanServer.getAttribute(mbeanName, "Unreachable") should be("")
mbeanServer.getAttribute(mbeanName, "MemberStatus") should be("Removed")
mbeanServer.getAttribute(mbeanName, "Available").asInstanceOf[Boolean] should ===(false)
mbeanServer.getAttribute(mbeanName, "Singleton").asInstanceOf[Boolean] should ===(false)
mbeanServer.getAttribute(mbeanName, "Leader") should ===("")
mbeanServer.getAttribute(mbeanName, "Members") should ===("")
mbeanServer.getAttribute(mbeanName, "Unreachable") should ===("")
mbeanServer.getAttribute(mbeanName, "MemberStatus") should ===("Removed")
}
awaitClusterUp(first)
runOn(first) {
awaitAssert(mbeanServer.getAttribute(mbeanName, "MemberStatus") should be("Up"))
awaitAssert(mbeanServer.getAttribute(mbeanName, "Leader") should be(address(first).toString))
mbeanServer.getAttribute(mbeanName, "Singleton").asInstanceOf[Boolean] should be(true)
mbeanServer.getAttribute(mbeanName, "Members") should be(address(first).toString)
mbeanServer.getAttribute(mbeanName, "Unreachable") should be("")
mbeanServer.getAttribute(mbeanName, "Available").asInstanceOf[Boolean] should be(true)
awaitAssert(mbeanServer.getAttribute(mbeanName, "MemberStatus") should ===("Up"))
awaitAssert(mbeanServer.getAttribute(mbeanName, "Leader") should ===(address(first).toString))
mbeanServer.getAttribute(mbeanName, "Singleton").asInstanceOf[Boolean] should ===(true)
mbeanServer.getAttribute(mbeanName, "Members") should ===(address(first).toString)
mbeanServer.getAttribute(mbeanName, "Unreachable") should ===("")
mbeanServer.getAttribute(mbeanName, "Available").asInstanceOf[Boolean] should ===(true)
}
enterBarrier("after-3")
}
@ -86,12 +86,12 @@ abstract class MBeanSpec
awaitMembersUp(4)
assertMembers(clusterView.members, roles.map(address(_)): _*)
awaitAssert(mbeanServer.getAttribute(mbeanName, "MemberStatus") should be("Up"))
awaitAssert(mbeanServer.getAttribute(mbeanName, "MemberStatus") should ===("Up"))
val expectedMembers = roles.sorted.map(address(_)).mkString(",")
awaitAssert(mbeanServer.getAttribute(mbeanName, "Members") should be(expectedMembers))
awaitAssert(mbeanServer.getAttribute(mbeanName, "Members") should ===(expectedMembers))
val expectedLeader = address(roleOfLeader())
awaitAssert(mbeanServer.getAttribute(mbeanName, "Leader") should be(expectedLeader.toString))
mbeanServer.getAttribute(mbeanName, "Singleton").asInstanceOf[Boolean] should be(false)
awaitAssert(mbeanServer.getAttribute(mbeanName, "Leader") should ===(expectedLeader.toString))
mbeanServer.getAttribute(mbeanName, "Singleton").asInstanceOf[Boolean] should ===(false)
enterBarrier("after-4")
}
@ -105,9 +105,9 @@ abstract class MBeanSpec
enterBarrier("fourth-shutdown")
runOn(first, second, third) {
awaitAssert(mbeanServer.getAttribute(mbeanName, "Unreachable") should be(fourthAddress.toString))
awaitAssert(mbeanServer.getAttribute(mbeanName, "Unreachable") should ===(fourthAddress.toString))
val expectedMembers = Seq(first, second, third, fourth).sorted.map(address(_)).mkString(",")
awaitAssert(mbeanServer.getAttribute(mbeanName, "Members") should be(expectedMembers))
awaitAssert(mbeanServer.getAttribute(mbeanName, "Members") should ===(expectedMembers))
}
enterBarrier("fourth-unreachable")
@ -162,7 +162,7 @@ abstract class MBeanSpec
// awaitAssert to make sure that all nodes detects unreachable
within(15.seconds) {
awaitAssert(mbeanServer.getAttribute(mbeanName, "ClusterStatus") should be(expectedJson))
awaitAssert(mbeanServer.getAttribute(mbeanName, "ClusterStatus") should ===(expectedJson))
}
}
@ -182,7 +182,7 @@ abstract class MBeanSpec
runOn(first, second, third) {
awaitMembersUp(3, canNotBePartOfMemberRing = Set(fourthAddress))
assertMembers(clusterView.members, first, second, third)
awaitAssert(mbeanServer.getAttribute(mbeanName, "Unreachable") should be(""))
awaitAssert(mbeanServer.getAttribute(mbeanName, "Unreachable") should ===(""))
}
enterBarrier("after-6")
@ -197,7 +197,7 @@ abstract class MBeanSpec
awaitMembersUp(2)
assertMembers(clusterView.members, first, second)
val expectedMembers = Seq(first, second).sorted.map(address(_)).mkString(",")
awaitAssert(mbeanServer.getAttribute(mbeanName, "Members") should be(expectedMembers))
awaitAssert(mbeanServer.getAttribute(mbeanName, "Members") should ===(expectedMembers))
}
runOn(third) {
awaitCond(cluster.isTerminated)

View file

@ -94,12 +94,12 @@ abstract class MinMembersBeforeUpBase(multiNodeConfig: MultiNodeConfig)
cluster join myself
awaitAssert {
clusterView.refreshCurrentState()
clusterView.status should be(Joining)
clusterView.status should ===(Joining)
}
}
enterBarrier("first-started")
onUpLatch.isOpen should be(false)
onUpLatch.isOpen should ===(false)
runOn(second) {
cluster.join(first)
@ -108,14 +108,14 @@ abstract class MinMembersBeforeUpBase(multiNodeConfig: MultiNodeConfig)
val expectedAddresses = Set(first, second) map address
awaitAssert {
clusterView.refreshCurrentState()
clusterView.members.map(_.address) should be(expectedAddresses)
clusterView.members.map(_.address) should ===(expectedAddresses)
}
clusterView.members.map(_.status) should be(Set(Joining))
clusterView.members.map(_.status) should ===(Set(Joining))
// and it should not change
1 to 5 foreach { _
Thread.sleep(1000)
clusterView.members.map(_.address) should be(expectedAddresses)
clusterView.members.map(_.status) should be(Set(Joining))
clusterView.members.map(_.address) should ===(expectedAddresses)
clusterView.members.map(_.status) should ===(Set(Joining))
}
}
enterBarrier("second-joined")

View file

@ -241,8 +241,8 @@ trait MultiNodeClusterSpec extends Suite with STMultiNodeSpec with WatchedByCoro
def assertMembers(gotMembers: Iterable[Member], expectedAddresses: Address*): Unit = {
import Member.addressOrdering
val members = gotMembers.toIndexedSeq
members.size should be(expectedAddresses.length)
expectedAddresses.sorted.zipWithIndex.foreach { case (a, i) members(i).address should be(a) }
members.size should ===(expectedAddresses.length)
expectedAddresses.sorted.zipWithIndex.foreach { case (a, i) members(i).address should ===(a) }
}
/**
@ -288,22 +288,22 @@ trait MultiNodeClusterSpec extends Suite with STMultiNodeSpec with WatchedByCoro
within(timeout) {
if (!canNotBePartOfMemberRing.isEmpty) // don't run this on an empty set
awaitAssert(canNotBePartOfMemberRing foreach (a clusterView.members.map(_.address) should not contain (a)))
awaitAssert(clusterView.members.size should be(numberOfMembers))
awaitAssert(clusterView.members.map(_.status) should be(Set(MemberStatus.Up)))
awaitAssert(clusterView.members.size should ===(numberOfMembers))
awaitAssert(clusterView.members.map(_.status) should ===(Set(MemberStatus.Up)))
// clusterView.leader is updated by LeaderChanged, await that to be updated also
val expectedLeader = clusterView.members.headOption.map(_.address)
awaitAssert(clusterView.leader should be(expectedLeader))
awaitAssert(clusterView.leader should ===(expectedLeader))
}
}
def awaitAllReachable(): Unit =
awaitAssert(clusterView.unreachableMembers should be(Set.empty))
awaitAssert(clusterView.unreachableMembers should ===(Set.empty))
/**
* Wait until the specified nodes have seen the same gossip overview.
*/
def awaitSeenSameState(addresses: Address*): Unit =
awaitAssert((addresses.toSet -- clusterView.seenBy) should be(Set.empty))
awaitAssert((addresses.toSet -- clusterView.seenBy) should ===(Set.empty))
/**
* Leader according to the address ordering of the roles.

View file

@ -38,9 +38,9 @@ abstract class NodeMembershipSpec
runOn(first, second) {
cluster.join(first)
awaitAssert(clusterView.members.size should be(2))
awaitAssert(clusterView.members.size should ===(2))
assertMembers(clusterView.members, first, second)
awaitAssert(clusterView.members.map(_.status) should be(Set(MemberStatus.Up)))
awaitAssert(clusterView.members.map(_.status) should ===(Set(MemberStatus.Up)))
}
enterBarrier("after-1")
@ -52,9 +52,9 @@ abstract class NodeMembershipSpec
cluster.join(first)
}
awaitAssert(clusterView.members.size should be(3))
awaitAssert(clusterView.members.size should ===(3))
assertMembers(clusterView.members, first, second, third)
awaitAssert(clusterView.members.map(_.status) should be(Set(MemberStatus.Up)))
awaitAssert(clusterView.members.map(_.status) should ===(Set(MemberStatus.Up)))
enterBarrier("after-2")
}
@ -63,10 +63,10 @@ abstract class NodeMembershipSpec
val firstMember = clusterView.members.find(_.address == address(first)).get
val secondMember = clusterView.members.find(_.address == address(second)).get
val thirdMember = clusterView.members.find(_.address == address(third)).get
firstMember.isOlderThan(thirdMember) should be(true)
thirdMember.isOlderThan(firstMember) should be(false)
secondMember.isOlderThan(thirdMember) should be(true)
thirdMember.isOlderThan(secondMember) should be(false)
firstMember.isOlderThan(thirdMember) should ===(true)
thirdMember.isOlderThan(firstMember) should ===(false)
secondMember.isOlderThan(thirdMember) should ===(true)
thirdMember.isOlderThan(secondMember) should ===(false)
enterBarrier("after-3")

View file

@ -40,7 +40,7 @@ abstract class NodeUpSpec
enterBarrier("first-join-attempt")
Thread.sleep(2000)
clusterView.members should be(Set.empty)
clusterView.members should ===(Set.empty)
enterBarrier("after-0")
}
@ -70,8 +70,8 @@ abstract class NodeUpSpec
// let it run for a while to make sure that nothing bad happens
for (n 1 to 20) {
Thread.sleep(100.millis.dilated.toMillis)
unexpected.get should be(SortedSet.empty)
clusterView.members.forall(_.status == MemberStatus.Up) should be(true)
unexpected.get should ===(SortedSet.empty)
clusterView.members.forall(_.status == MemberStatus.Up) should ===(true)
}
enterBarrier("after-2")

View file

@ -90,8 +90,8 @@ abstract class RestartFirstSeedNodeSpec
// now we can join seed1System, seed2, seed3 together
runOn(seed1) {
Cluster(seed1System).joinSeedNodes(seedNodes)
awaitAssert(Cluster(seed1System).readView.members.size should be(3))
awaitAssert(Cluster(seed1System).readView.members.map(_.status) should be(Set(Up)))
awaitAssert(Cluster(seed1System).readView.members.size should ===(3))
awaitAssert(Cluster(seed1System).readView.members.map(_.status) should ===(Set(Up)))
}
runOn(seed2, seed3) {
cluster.joinSeedNodes(seedNodes)
@ -109,8 +109,8 @@ abstract class RestartFirstSeedNodeSpec
runOn(seed1) {
Cluster(restartedSeed1System).joinSeedNodes(seedNodes)
within(20.seconds) {
awaitAssert(Cluster(restartedSeed1System).readView.members.size should be(3))
awaitAssert(Cluster(restartedSeed1System).readView.members.map(_.status) should be(Set(Up)))
awaitAssert(Cluster(restartedSeed1System).readView.members.size should ===(3))
awaitAssert(Cluster(restartedSeed1System).readView.members.map(_.status) should ===(Set(Up)))
}
}
runOn(seed2, seed3) {

View file

@ -92,8 +92,8 @@ abstract class RestartNodeSpec
}
runOn(second) {
Cluster(secondSystem).joinSeedNodes(seedNodes)
awaitAssert(Cluster(secondSystem).readView.members.size should be(3))
awaitAssert(Cluster(secondSystem).readView.members.map(_.status) should be(Set(Up)))
awaitAssert(Cluster(secondSystem).readView.members.size should ===(3))
awaitAssert(Cluster(secondSystem).readView.members.map(_.status) should ===(Set(Up)))
}
enterBarrier("started")
@ -106,12 +106,12 @@ abstract class RestartNodeSpec
// then immediately start restartedSecondSystem, which has the same address as secondSystem
runOn(second) {
Cluster(restartedSecondSystem).joinSeedNodes(seedNodes)
awaitAssert(Cluster(restartedSecondSystem).readView.members.size should be(3))
awaitAssert(Cluster(restartedSecondSystem).readView.members.map(_.status) should be(Set(Up)))
awaitAssert(Cluster(restartedSecondSystem).readView.members.size should ===(3))
awaitAssert(Cluster(restartedSecondSystem).readView.members.map(_.status) should ===(Set(Up)))
}
runOn(first, third) {
awaitAssert {
Cluster(system).readView.members.size should be(3)
Cluster(system).readView.members.size should ===(3)
Cluster(system).readView.members.exists { m
m.address == secondUniqueAddress.address && m.uniqueAddress.uid != secondUniqueAddress.uid
}

View file

@ -47,7 +47,7 @@ abstract class SingletonClusterSpec(multiNodeConfig: SingletonClusterMultiNodeCo
runOn(first) {
cluster.joinSeedNodes(Vector(first))
awaitMembersUp(1)
clusterView.isSingletonCluster should be(true)
clusterView.isSingletonCluster should ===(true)
}
enterBarrier("after-1")
@ -55,7 +55,7 @@ abstract class SingletonClusterSpec(multiNodeConfig: SingletonClusterMultiNodeCo
"not be singleton cluster when joined with other node" taggedAs LongRunningTest in {
awaitClusterUp(first, second)
clusterView.isSingletonCluster should be(false)
clusterView.isSingletonCluster should ===(false)
assertLeader(first, second)
enterBarrier("after-2")
@ -69,7 +69,7 @@ abstract class SingletonClusterSpec(multiNodeConfig: SingletonClusterMultiNodeCo
markNodeAsUnavailable(secondAddress)
awaitMembersUp(numberOfMembers = 1, canNotBePartOfMemberRing = Set(secondAddress), 30.seconds)
clusterView.isSingletonCluster should be(true)
clusterView.isSingletonCluster should ===(true)
awaitCond(clusterView.isLeader)
}

View file

@ -986,7 +986,7 @@ abstract class StressSpec
}
val nextAddresses = clusterView.members.map(_.address) -- usedAddresses
runOn(usedRoles: _*) {
nextAddresses.size should be(numberOfNodesJoinRemove)
nextAddresses.size should ===(numberOfNodesJoinRemove)
}
enterBarrier("join-remove-" + step)
@ -1023,7 +1023,7 @@ abstract class StressSpec
def exerciseRouters(title: String, duration: FiniteDuration, batchInterval: FiniteDuration,
expectDroppedMessages: Boolean, tree: Boolean): Unit =
within(duration + 10.seconds) {
nbrUsedRoles should be(totalNumberOfNodes)
nbrUsedRoles should ===(totalNumberOfNodes)
createResultAggregator(title, expectedResults = nbrUsedRoles, includeInHistory = false)
val (masterRoles, otherRoles) = roles.take(nbrUsedRoles).splitAt(3)
@ -1040,7 +1040,7 @@ abstract class StressSpec
workResult.sendCount should be > (0L)
workResult.ackCount should be > (0L)
if (!expectDroppedMessages)
workResult.retryCount should be(0)
workResult.retryCount should ===(0)
enterBarrier("routers-done-" + step)
}
@ -1079,13 +1079,13 @@ abstract class StressSpec
supervisor ! Props[RemoteChild].withDeploy(Deploy(scope = RemoteScope(address(r))))
}
supervisor ! GetChildrenCount
expectMsgType[ChildrenCount] should be(ChildrenCount(nbrUsedRoles, 0))
expectMsgType[ChildrenCount] should ===(ChildrenCount(nbrUsedRoles, 0))
1 to 5 foreach { _ supervisor ! new RuntimeException("Simulated exception") }
awaitAssert {
supervisor ! GetChildrenCount
val c = expectMsgType[ChildrenCount]
c should be(ChildrenCount(nbrUsedRoles, 5 * nbrUsedRoles))
c should ===(ChildrenCount(nbrUsedRoles, 5 * nbrUsedRoles))
}
// after 5 restart attempts the children should be stopped
@ -1094,7 +1094,7 @@ abstract class StressSpec
supervisor ! GetChildrenCount
val c = expectMsgType[ChildrenCount]
// zero children
c should be(ChildrenCount(0, 6 * nbrUsedRoles))
c should ===(ChildrenCount(0, 6 * nbrUsedRoles))
}
supervisor ! Reset
@ -1116,9 +1116,9 @@ abstract class StressSpec
def idleGossip(title: String): Unit = {
createResultAggregator(title, expectedResults = nbrUsedRoles, includeInHistory = true)
reportResult {
clusterView.members.size should be(nbrUsedRoles)
clusterView.members.size should ===(nbrUsedRoles)
Thread.sleep(idleGossipDuration.toMillis)
clusterView.members.size should be(nbrUsedRoles)
clusterView.members.size should ===(nbrUsedRoles)
}
awaitClusterResult()
}
@ -1193,7 +1193,7 @@ abstract class StressSpec
case Some(m)
m.tell(End, testActor)
val workResult = awaitWorkResult(m)
workResult.retryCount should be(0)
workResult.retryCount should ===(0)
workResult.sendCount should be > (0L)
workResult.ackCount should be > (0L)
case None fail("master not running")

View file

@ -70,7 +70,7 @@ abstract class SunnyWeatherSpec
for (n 1 to 30) {
enterBarrier("period-" + n)
unexpected.get should be(SortedSet.empty)
unexpected.get should ===(SortedSet.empty)
awaitMembersUp(roles.size)
assertLeaderIn(roles)
if (n % 5 == 0) log.debug("Passed period [{}]", n)

View file

@ -87,7 +87,7 @@ abstract class SurviveNetworkInstabilitySpec
def assertUnreachable(subjects: RoleName*): Unit = {
val expected = subjects.toSet map address
awaitAssert(clusterView.unreachableMembers.map(_.address) should be(expected))
awaitAssert(clusterView.unreachableMembers.map(_.address) should ===(expected))
}
system.actorOf(Props[Echo], "echo")
@ -281,7 +281,7 @@ abstract class SurviveNetworkInstabilitySpec
// system messages and quarantine
system.actorSelection("/user/watcher") ! "boom"
within(10.seconds) {
expectMsgType[QuarantinedEvent].address should be(address(second))
expectMsgType[QuarantinedEvent].address should ===(address(second))
}
system.eventStream.unsubscribe(testActor, classOf[QuarantinedEvent])
}
@ -327,8 +327,8 @@ abstract class SurviveNetworkInstabilitySpec
runOn(side1AfterJoin: _*) {
// side2 removed
val expected = (side1AfterJoin map address).toSet
awaitAssert(clusterView.members.map(_.address) should be(expected))
awaitAssert(clusterView.members.collectFirst { case m if m.address == address(eighth) m.status } should be(
awaitAssert(clusterView.members.map(_.address) should ===(expected))
awaitAssert(clusterView.members.collectFirst { case m if m.address == address(eighth) m.status } should ===(
Some(MemberStatus.Up)))
}
@ -346,12 +346,12 @@ abstract class SurviveNetworkInstabilitySpec
runOn(side1AfterJoin: _*) {
val expected = (side1AfterJoin map address).toSet
clusterView.members.map(_.address) should be(expected)
clusterView.members.map(_.address) should ===(expected)
}
runOn(side2: _*) {
val expected = ((side2 ++ side1) map address).toSet
clusterView.members.map(_.address) should be(expected)
clusterView.members.map(_.address) should ===(expected)
assertUnreachable(side1: _*)
}

View file

@ -59,17 +59,17 @@ abstract class TransitionSpec
def seenLatestGossip: Set[RoleName] = clusterView.seenBy flatMap roleName
def awaitSeen(addresses: Address*): Unit = awaitAssert {
(seenLatestGossip map address) should be(addresses.toSet)
(seenLatestGossip map address) should ===(addresses.toSet)
}
def awaitMembers(addresses: Address*): Unit = awaitAssert {
clusterView.refreshCurrentState()
memberAddresses should be(addresses.toSet)
memberAddresses should ===(addresses.toSet)
}
def awaitMemberStatus(address: Address, status: MemberStatus): Unit = awaitAssert {
clusterView.refreshCurrentState()
memberStatus(address) should be(status)
memberStatus(address) should ===(status)
}
def leaderActions(): Unit =
@ -134,7 +134,7 @@ abstract class TransitionSpec
awaitMembers(first, second)
awaitMemberStatus(first, Up)
awaitMemberStatus(second, Joining)
awaitAssert(seenLatestGossip should be(Set(first, second)))
awaitAssert(seenLatestGossip should ===(Set(first, second)))
}
enterBarrier("convergence-joining-2")
@ -149,7 +149,7 @@ abstract class TransitionSpec
runOn(first, second) {
// gossip chat will synchronize the views
awaitMemberStatus(second, Up)
awaitAssert(seenLatestGossip should be(Set(first, second)))
awaitAssert(seenLatestGossip should ===(Set(first, second)))
awaitMemberStatus(first, Up)
}
@ -163,7 +163,7 @@ abstract class TransitionSpec
}
runOn(second, third) {
// gossip chat from the join will synchronize the views
awaitAssert(seenLatestGossip should be(Set(second, third)))
awaitAssert(seenLatestGossip should ===(Set(second, third)))
}
enterBarrier("third-joined-second")
@ -173,7 +173,7 @@ abstract class TransitionSpec
awaitMembers(first, second, third)
awaitMemberStatus(third, Joining)
awaitMemberStatus(second, Up)
awaitAssert(seenLatestGossip should be(Set(first, second, third)))
awaitAssert(seenLatestGossip should ===(Set(first, second, third)))
}
first gossipTo third
@ -182,7 +182,7 @@ abstract class TransitionSpec
awaitMemberStatus(first, Up)
awaitMemberStatus(second, Up)
awaitMemberStatus(third, Joining)
awaitAssert(seenLatestGossip should be(Set(first, second, third)))
awaitAssert(seenLatestGossip should ===(Set(first, second, third)))
}
enterBarrier("convergence-joining-3")
@ -201,7 +201,7 @@ abstract class TransitionSpec
leader12 gossipTo other1
runOn(other1) {
awaitMemberStatus(third, Up)
awaitAssert(seenLatestGossip should be(Set(leader12, myself)))
awaitAssert(seenLatestGossip should ===(Set(leader12, myself)))
}
// first non-leader gossipTo the other non-leader
@ -212,7 +212,7 @@ abstract class TransitionSpec
}
runOn(other2) {
awaitMemberStatus(third, Up)
awaitAssert(seenLatestGossip should be(Set(first, second, third)))
awaitAssert(seenLatestGossip should ===(Set(first, second, third)))
}
// first non-leader gossipTo the leader
@ -221,7 +221,7 @@ abstract class TransitionSpec
awaitMemberStatus(first, Up)
awaitMemberStatus(second, Up)
awaitMemberStatus(third, Up)
awaitAssert(seenLatestGossip should be(Set(first, second, third)))
awaitAssert(seenLatestGossip should ===(Set(first, second, third)))
}
enterBarrier("after-3")
@ -232,7 +232,7 @@ abstract class TransitionSpec
markNodeAsUnavailable(second)
reapUnreachable()
awaitAssert(clusterView.unreachableMembers.map(_.address) should contain(address(second)))
awaitAssert(seenLatestGossip should be(Set(third)))
awaitAssert(seenLatestGossip should ===(Set(third)))
}
enterBarrier("after-second-unavailble")
@ -254,7 +254,7 @@ abstract class TransitionSpec
runOn(first, third) {
awaitAssert(clusterView.unreachableMembers.map(_.address) should contain(address(second)))
awaitMemberStatus(second, Down)
awaitAssert(seenLatestGossip should be(Set(first, third)))
awaitAssert(seenLatestGossip should ===(Set(first, third)))
}
enterBarrier("after-6")

Some files were not shown because too many files have changed in this diff Show more