From f1d4c9af0bc068475af2e5872f1c87b9d4d1c406 Mon Sep 17 00:00:00 2001 From: Heiko Seeberger Date: Mon, 21 Jun 2010 13:08:10 +0200 Subject: [PATCH] closes #281: Made all subprojects test after breaking changes introduced by removing the type parameter from ActorRef.!!. --- .../test/scala/CamelServiceFeatureTest.scala | 10 ++++----- .../src/test/scala/ProducerFeatureTest.scala | 4 ++-- .../src/test/scala/PublishRequestorTest.scala | 6 ++--- .../src/test/scala/RemoteConsumerTest.scala | 2 +- .../component/ActorComponentFeatureTest.scala | 4 ++-- .../scala/component/ActorProducerTest.scala | 2 +- akka-http/src/test/scala/SecuritySpec.scala | 6 ++--- .../scala/CassandraPersistentActorSpec.scala | 8 +++---- .../scala/RedisInconsistentSizeBugTest.scala | 4 ++-- .../test/scala/RedisPersistentActorSpec.scala | 6 ++--- .../src/test/scala/RedisPersistentQSpec.scala | 22 +++++++++---------- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/akka-camel/src/test/scala/CamelServiceFeatureTest.scala b/akka-camel/src/test/scala/CamelServiceFeatureTest.scala index fd57d83457..771ed83af3 100644 --- a/akka-camel/src/test/scala/CamelServiceFeatureTest.scala +++ b/akka-camel/src/test/scala/CamelServiceFeatureTest.scala @@ -26,7 +26,7 @@ class CamelServiceFeatureTest extends FeatureSpec with BeforeAndAfterAll with Gi // count expectations in the next step (needed for testing only). service.consumerPublisher.start // set expectations on publish count - val latch = service.consumerPublisher.!![CountDownLatch](SetExpectedMessageCount(1)).get + val latch = (service.consumerPublisher !! SetExpectedMessageCount(1)).as[CountDownLatch].get // start the CamelService service.load // await publication of first test consumer @@ -43,7 +43,7 @@ class CamelServiceFeatureTest extends FeatureSpec with BeforeAndAfterAll with Gi scenario("access registered consumer actors via Camel direct-endpoints") { given("two consumer actors registered before and after CamelService startup") - val latch = service.consumerPublisher.!![CountDownLatch](SetExpectedMessageCount(1)).get + val latch = (service.consumerPublisher !! SetExpectedMessageCount(1)).as[CountDownLatch].get actorOf(new TestConsumer("direct:publish-test-2")).start assert(latch.await(5000, TimeUnit.MILLISECONDS)) @@ -64,12 +64,12 @@ class CamelServiceFeatureTest extends FeatureSpec with BeforeAndAfterAll with Gi given("a consumer actor that has been stopped") assert(CamelContextManager.context.hasEndpoint(endpointUri) eq null) - var latch = service.consumerPublisher.!![CountDownLatch](SetExpectedMessageCount(1)).get + var latch = (service.consumerPublisher !! SetExpectedMessageCount(1)).as[CountDownLatch].get val consumer = actorOf(new TestConsumer(endpointUri)).start assert(latch.await(5000, TimeUnit.MILLISECONDS)) assert(CamelContextManager.context.hasEndpoint(endpointUri) ne null) - latch = service.consumerPublisher.!![CountDownLatch](SetExpectedMessageCount(1)).get + latch = (service.consumerPublisher !! SetExpectedMessageCount(1)).as[CountDownLatch].get consumer.stop assert(latch.await(5000, TimeUnit.MILLISECONDS)) // endpoint is still there but the route has been stopped @@ -103,7 +103,7 @@ class CamelServiceFeatureTest extends FeatureSpec with BeforeAndAfterAll with Gi scenario("access active object methods via Camel direct-endpoints") { given("an active object registered after CamelService startup") - val latch = service.consumerPublisher.!![CountDownLatch](SetExpectedMessageCount(3)).get + val latch = (service.consumerPublisher !! SetExpectedMessageCount(3)).as[CountDownLatch].get ActiveObject.newInstance(classOf[PojoBase]) assert(latch.await(5000, TimeUnit.MILLISECONDS)) diff --git a/akka-camel/src/test/scala/ProducerFeatureTest.scala b/akka-camel/src/test/scala/ProducerFeatureTest.scala index eda866e064..96d1b9eeef 100644 --- a/akka-camel/src/test/scala/ProducerFeatureTest.scala +++ b/akka-camel/src/test/scala/ProducerFeatureTest.scala @@ -68,7 +68,7 @@ class ProducerFeatureTest extends FeatureSpec with BeforeAndAfterAll with Before when("a fail message is sent to the producer") val message = Message("fail", Map(Message.MessageExchangeId -> "123")) - val result = producer.!![Failure](message) + val result = (producer !! message).as[Failure] then("the expected failure message should be returned including a correlation identifier") val expectedFailureText = result.get.cause.getMessage @@ -84,7 +84,7 @@ class ProducerFeatureTest extends FeatureSpec with BeforeAndAfterAll with Before when("a fail message is sent to the producer") val message = Message("fail", Map(Message.MessageExchangeId -> "123")) - val result = producer.!![Failure](message) + val result = (producer !! message).as[Failure] then("the expected failure message should be returned including a correlation identifier") val expectedFailureText = result.get.cause.getMessage diff --git a/akka-camel/src/test/scala/PublishRequestorTest.scala b/akka-camel/src/test/scala/PublishRequestorTest.scala index f3c9a899b2..7729e6eec6 100644 --- a/akka-camel/src/test/scala/PublishRequestorTest.scala +++ b/akka-camel/src/test/scala/PublishRequestorTest.scala @@ -34,7 +34,7 @@ class PublishRequestorTest extends JUnitSuite { @Test def shouldReceiveConsumerMethodRegisteredEvent = { val obj = ActiveObject.newInstance(classOf[PojoSingle]) val init = AspectInit(classOf[PojoSingle], null, None, 1000) - val latch = publisher.!![CountDownLatch](SetExpectedTestMessageCount(1)).get + val latch = (publisher !! SetExpectedTestMessageCount(1)).as[CountDownLatch].get requestor ! AspectInitRegistered(obj, init) assert(latch.await(5000, TimeUnit.MILLISECONDS)) val event = (publisher !! GetRetainedMessage).get.asInstanceOf[ConsumerMethodRegistered] @@ -45,7 +45,7 @@ class PublishRequestorTest extends JUnitSuite { } @Test def shouldReceiveConsumerRegisteredEvent = { - val latch = publisher.!![CountDownLatch](SetExpectedTestMessageCount(1)).get + val latch = (publisher !! SetExpectedTestMessageCount(1)).as[CountDownLatch].get requestor ! ActorRegistered(consumer) assert(latch.await(5000, TimeUnit.MILLISECONDS)) assert((publisher !! GetRetainedMessage) === @@ -53,7 +53,7 @@ class PublishRequestorTest extends JUnitSuite { } @Test def shouldReceiveConsumerUnregisteredEvent = { - val latch = publisher.!![CountDownLatch](SetExpectedTestMessageCount(1)).get + val latch = (publisher !! SetExpectedTestMessageCount(1)).as[CountDownLatch].get requestor ! ActorUnregistered(consumer) assert(latch.await(5000, TimeUnit.MILLISECONDS)) assert((publisher !! GetRetainedMessage) === diff --git a/akka-camel/src/test/scala/RemoteConsumerTest.scala b/akka-camel/src/test/scala/RemoteConsumerTest.scala index e1a7842e0d..4e2aa59b24 100644 --- a/akka-camel/src/test/scala/RemoteConsumerTest.scala +++ b/akka-camel/src/test/scala/RemoteConsumerTest.scala @@ -45,7 +45,7 @@ class RemoteConsumerTest extends FeatureSpec with BeforeAndAfterAll with GivenWh val consumer = actorOf[RemoteConsumer].start when("remote consumer publication is triggered") - val latch = service.consumerPublisher.!![CountDownLatch](SetExpectedMessageCount(1)).get + val latch = (service.consumerPublisher !! SetExpectedMessageCount(1)).as[CountDownLatch].get consumer !! "init" assert(latch.await(5000, TimeUnit.MILLISECONDS)) diff --git a/akka-camel/src/test/scala/component/ActorComponentFeatureTest.scala b/akka-camel/src/test/scala/component/ActorComponentFeatureTest.scala index f73a2fcd3e..b7fd607f28 100644 --- a/akka-camel/src/test/scala/component/ActorComponentFeatureTest.scala +++ b/akka-camel/src/test/scala/component/ActorComponentFeatureTest.scala @@ -26,7 +26,7 @@ class ActorComponentFeatureTest extends FeatureSpec with BeforeAndAfterAll with scenario("one-way communication using actor id") { val actor = actorOf[Tester1].start - val latch = actor.!![CountDownLatch](SetExpectedMessageCount(1)).get + val latch = (actor !! SetExpectedMessageCount(1)).as[CountDownLatch].get template.sendBody("actor:%s" format actor.id, "Martin") assert(latch.await(5000, TimeUnit.MILLISECONDS)) val reply = (actor !! GetRetainedMessage).get.asInstanceOf[Message] @@ -35,7 +35,7 @@ class ActorComponentFeatureTest extends FeatureSpec with BeforeAndAfterAll with scenario("one-way communication using actor uuid") { val actor = actorOf[Tester1].start - val latch = actor.!![CountDownLatch](SetExpectedMessageCount(1)).get + val latch = (actor !! SetExpectedMessageCount(1)).as[CountDownLatch].get template.sendBody("actor:uuid:%s" format actor.uuid, "Martin") assert(latch.await(5000, TimeUnit.MILLISECONDS)) val reply = (actor !! GetRetainedMessage).get.asInstanceOf[Message] diff --git a/akka-camel/src/test/scala/component/ActorProducerTest.scala b/akka-camel/src/test/scala/component/ActorProducerTest.scala index 419784681b..6840bf1c79 100644 --- a/akka-camel/src/test/scala/component/ActorProducerTest.scala +++ b/akka-camel/src/test/scala/component/ActorProducerTest.scala @@ -19,7 +19,7 @@ class ActorProducerTest extends JUnitSuite with BeforeAndAfterAll { @Test def shouldSendMessageToActor = { val actor = actorOf[Tester1].start - val latch = actor.!![CountDownLatch](SetExpectedMessageCount(1)).get + val latch = (actor !! SetExpectedMessageCount(1)).as[CountDownLatch].get val endpoint = mockEndpoint("actor:uuid:%s" format actor.uuid) val exchange = endpoint.createExchange(ExchangePattern.InOnly) exchange.getIn.setBody("Martin") diff --git a/akka-http/src/test/scala/SecuritySpec.scala b/akka-http/src/test/scala/SecuritySpec.scala index 2ee7596a25..6a3cf4f803 100644 --- a/akka-http/src/test/scala/SecuritySpec.scala +++ b/akka-http/src/test/scala/SecuritySpec.scala @@ -39,7 +39,7 @@ class BasicAuthenticatorSpec extends junit.framework.TestCase @Test def testChallenge = { val req = mock[ContainerRequest] - val result: Response = (authenticator !! (Authenticate(req, List("foo")), 10000)).get + val result = (authenticator !! (Authenticate(req, List("foo")), 10000)).as[Response].get // the actor replies with a challenge for the browser result.getStatus must equal(Response.Status.UNAUTHORIZED.getStatusCode) @@ -54,7 +54,7 @@ class BasicAuthenticatorSpec extends junit.framework.TestCase // fake a request authorization -> this will authorize the user when(req.isUserInRole("chef")).thenReturn(true) - val result: AnyRef = (authenticator !! (Authenticate(req, List("chef")), 10000)).get + val result = (authenticator !! (Authenticate(req, List("chef")), 10000)).as[AnyRef].get result must be(OK) // the authenticator must have set a security context @@ -68,7 +68,7 @@ class BasicAuthenticatorSpec extends junit.framework.TestCase when(req.getHeaderValue("Authorization")).thenReturn("Basic " + new String(Base64.encode("foo:bar"))) when(req.isUserInRole("chef")).thenReturn(false) // this will deny access - val result: Response = (authenticator !! (Authenticate(req, List("chef")), 10000)).get + val result = (authenticator !! (Authenticate(req, List("chef")), 10000)).as[Response].get result.getStatus must equal(Response.Status.FORBIDDEN.getStatusCode) diff --git a/akka-persistence/akka-persistence-cassandra/src/test/scala/CassandraPersistentActorSpec.scala b/akka-persistence/akka-persistence-cassandra/src/test/scala/CassandraPersistentActorSpec.scala index 97419f3231..74673f2041 100644 --- a/akka-persistence/akka-persistence-cassandra/src/test/scala/CassandraPersistentActorSpec.scala +++ b/akka-persistence/akka-persistence-cassandra/src/test/scala/CassandraPersistentActorSpec.scala @@ -80,7 +80,7 @@ class CassandraPersistentActorSpec extends JUnitSuite { stateful.start stateful !! SetMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "init") // set init state stateful !! Success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired - val result: Array[Byte] = (stateful !! GetMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess")).get + val result = (stateful !! GetMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess")).as[Array[Byte]].get assertEquals("new state", new String(result, 0, result.length, "UTF-8")) } @@ -95,7 +95,7 @@ class CassandraPersistentActorSpec extends JUnitSuite { stateful !! Failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method fail("should have thrown an exception") } catch {case e: RuntimeException => {}} - val result: Array[Byte] = (stateful !! GetMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure")).get + val result = (stateful !! GetMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure")).as[Array[Byte]].get assertEquals("init", new String(result, 0, result.length, "UTF-8")) // check that state is == init state } @@ -128,7 +128,7 @@ class CassandraPersistentActorSpec extends JUnitSuite { stateful.start stateful !! SetRefState("init") // set init state stateful !! Success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired - val result: Array[Byte] = (stateful !! GetRefState).get + val result = (stateful !! GetRefState).as[Array[Byte]].get assertEquals("new state", new String(result, 0, result.length, "UTF-8")) } @@ -143,7 +143,7 @@ class CassandraPersistentActorSpec extends JUnitSuite { stateful !! Failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method fail("should have thrown an exception") } catch {case e: RuntimeException => {}} - val result: Array[Byte] = (stateful !! GetRefState).get + val result = (stateful !! GetRefState).as[Array[Byte]].get assertEquals("init", new String(result, 0, result.length, "UTF-8")) // check that state is == init state } diff --git a/akka-persistence/akka-persistence-redis/src/test/scala/RedisInconsistentSizeBugTest.scala b/akka-persistence/akka-persistence-redis/src/test/scala/RedisInconsistentSizeBugTest.scala index dde431628a..74d1e95cc9 100644 --- a/akka-persistence/akka-persistence-redis/src/test/scala/RedisInconsistentSizeBugTest.scala +++ b/akka-persistence/akka-persistence-redis/src/test/scala/RedisInconsistentSizeBugTest.scala @@ -66,9 +66,9 @@ object Runner { def run { val proc = actorOf[RedisSampleStorage] proc.start - val i: Option[String] = proc !! SETFOO("debasish") + val i = (proc !! SETFOO("debasish")).as[String] println("i = " + i) - val ev: Option[Int] = proc !! GETFOO("debasish") + val ev = (proc !! GETFOO("debasish")).as[Int] println(ev) } } diff --git a/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentActorSpec.scala b/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentActorSpec.scala index 18dd4ce94d..236519abd8 100644 --- a/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentActorSpec.scala +++ b/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentActorSpec.scala @@ -113,7 +113,7 @@ class RedisPersistentActorSpec extends JUnitSuite { bactor !! Debit("a-123", 8000, failer) assertEquals(BigInt(1000), (bactor !! Balance("a-123")).get) - val c: Int = (bactor !! LogSize).get + val c = (bactor !! LogSize).as[Int].get assertTrue(7 == c) } @@ -134,7 +134,7 @@ class RedisPersistentActorSpec extends JUnitSuite { assertEquals(BigInt(5000), (bactor !! Balance("a-123")).get) // should not count the failed one - val c: Int = (bactor !! LogSize).get + val c = (bactor !! LogSize).as[Int].get assertTrue(3 == c) } @@ -156,7 +156,7 @@ class RedisPersistentActorSpec extends JUnitSuite { assertEquals(BigInt(5000), (bactor !! (Balance("a-123"), 5000)).get) // should not count the failed one - val c: Int = (bactor !! LogSize).get + val c = (bactor !! LogSize).as[Int].get assertTrue(3 == c) } } diff --git a/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentQSpec.scala b/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentQSpec.scala index 6cdd192593..5522b00d45 100644 --- a/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentQSpec.scala +++ b/akka-persistence/akka-persistence-redis/src/test/scala/RedisPersistentQSpec.scala @@ -58,7 +58,7 @@ class RedisPersistentQSpec extends JUnitSuite { qa !! NQ("a-123") qa !! NQ("a-124") qa !! NQ("a-125") - val t: Int = (qa !! SZ).get + val t = (qa !! SZ).as[Int].get assertTrue(3 == t) } @@ -69,12 +69,12 @@ class RedisPersistentQSpec extends JUnitSuite { qa !! NQ("a-123") qa !! NQ("a-124") qa !! NQ("a-125") - val s: Int = (qa !! SZ).get + val s = (qa !! SZ).as[Int].get assertTrue(3 == s) assertEquals("a-123", (qa !! DQ).get) assertEquals("a-124", (qa !! DQ).get) assertEquals("a-125", (qa !! DQ).get) - val t: Int = (qa !! SZ).get + val t = (qa !! SZ).as[Int].get assertTrue(0 == t) } @@ -88,13 +88,13 @@ class RedisPersistentQSpec extends JUnitSuite { qa !! NQ("a-123") qa !! NQ("a-124") qa !! NQ("a-125") - val t: Int = (qa !! SZ).get + val t = (qa !! SZ).as[Int].get assertTrue(3 == t) assertEquals("a-123", (qa !! DQ).get) - val s: Int = (qa !! SZ).get + val s = (qa !! SZ).as[Int].get assertTrue(2 == s) qa !! MNDQ(List("a-126", "a-127"), 2, failer) - val u: Int = (qa !! SZ).get + val u = (qa !! SZ).as[Int].get assertTrue(2 == u) } @@ -110,25 +110,25 @@ class RedisPersistentQSpec extends JUnitSuite { qa !! NQ("a-124") qa !! NQ("a-125") - val t: Int = (qa !! SZ).get + val t = (qa !! SZ).as[Int].get assertTrue(3 == t) // dequeue 1 assertEquals("a-123", (qa !! DQ).get) // size == 2 - val s: Int = (qa !! SZ).get + val s = (qa !! SZ).as[Int].get assertTrue(2 == s) // enqueue 2, dequeue 2 => size == 2 qa !! MNDQ(List("a-126", "a-127"), 2, failer) - val u: Int = (qa !! SZ).get + val u = (qa !! SZ).as[Int].get assertTrue(2 == u) // enqueue 2 => size == 4 qa !! NQ("a-128") qa !! NQ("a-129") - val v: Int = (qa !! SZ).get + val v = (qa !! SZ).as[Int].get assertTrue(4 == v) // enqueue 1 => size 5 @@ -138,7 +138,7 @@ class RedisPersistentQSpec extends JUnitSuite { qa !! MNDQ(List("a-130"), 6, failer) } catch { case e: Exception => {} } - val w: Int = (qa !! SZ).get + val w = (qa !! SZ).as[Int].get assertTrue(4 == w) } }