From 743f9cd8ff1edd7087762f886acd04933970580c Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Sat, 21 Jul 2012 18:09:20 +0200 Subject: [PATCH] Removing Specs2 as a dependency to remove the hassle of keeping track of available versions --- .../docs/actor/UntypedActorDocTestBase.java | 7 ++-- .../docs/testkit/Specs2DemoAcceptance.scala | 39 ------------------- .../code/docs/testkit/Specs2DemoSpec.scala | 37 ------------------ akka-docs/scala/testing.rst | 7 ---- project/AkkaBuild.scala | 3 +- 5 files changed, 4 insertions(+), 89 deletions(-) delete mode 100644 akka-docs/scala/code/docs/testkit/Specs2DemoAcceptance.scala delete mode 100644 akka-docs/scala/code/docs/testkit/Specs2DemoSpec.scala diff --git a/akka-docs/java/code/docs/actor/UntypedActorDocTestBase.java b/akka-docs/java/code/docs/actor/UntypedActorDocTestBase.java index 875d317dba..7ae1cf7e21 100644 --- a/akka-docs/java/code/docs/actor/UntypedActorDocTestBase.java +++ b/akka-docs/java/code/docs/actor/UntypedActorDocTestBase.java @@ -206,14 +206,13 @@ public class UntypedActorDocTestBase { ActorSystem system = ActorSystem.create("MySystem"); ActorRef actorRef = system.actorOf(new Props(MyUntypedActor.class)); //#gracefulStop - //FIXME URGENT Await.result should have a @throws clause - //try { + try { Future stopped = gracefulStop(actorRef, Duration.create(5, TimeUnit.SECONDS), system); Await.result(stopped, Duration.create(6, TimeUnit.SECONDS)); // the actor has been stopped - //} catch (AskTimeoutException e) { + } catch (AskTimeoutException e) { // the actor wasn't stopped within 5 seconds - //} + } //#gracefulStop system.shutdown(); } diff --git a/akka-docs/scala/code/docs/testkit/Specs2DemoAcceptance.scala b/akka-docs/scala/code/docs/testkit/Specs2DemoAcceptance.scala deleted file mode 100644 index 6a65c410bc..0000000000 --- a/akka-docs/scala/code/docs/testkit/Specs2DemoAcceptance.scala +++ /dev/null @@ -1,39 +0,0 @@ -package docs.testkit - -import language.postfixOps -import language.implicitConversions - -import org.specs2.Specification -import org.specs2.specification.{ Step, Scope } - -import akka.actor.{ Props, ActorSystem, Actor } -import akka.testkit.{ TestKit, ImplicitSender } -import scala.concurrent.util.{ FiniteDuration, Duration } - -class Specs2DemoAcceptance extends Specification { - def is = - - "This is a specification of basic TestKit interop" ^ - p ^ - "A TestKit should" ^ - "work properly with Specs2 acceptance tests" ! e1 ^ - "correctly convert durations" ! e2 ^ - Step(system.shutdown()) ^ end // do not forget to shutdown! - - val system = ActorSystem() - - // an alternative to mixing in NoTimeConversions - implicit def d2d(d: org.specs2.time.Duration): FiniteDuration = Duration(d.inMilliseconds, "millis") - - def e1 = new TestKit(system) with Scope with ImplicitSender { - within(1 second) { - system.actorOf(Props(new Actor { - def receive = { case x ⇒ sender ! x } - })) ! "hallo" - - expectMsgType[String] must be equalTo "hallo" - } - } - - def e2 = ((1 second): Duration).toMillis must be equalTo 1000 -} diff --git a/akka-docs/scala/code/docs/testkit/Specs2DemoSpec.scala b/akka-docs/scala/code/docs/testkit/Specs2DemoSpec.scala deleted file mode 100644 index 4d22c45c13..0000000000 --- a/akka-docs/scala/code/docs/testkit/Specs2DemoSpec.scala +++ /dev/null @@ -1,37 +0,0 @@ -package docs.testkit - -import language.postfixOps - -import org.specs2.mutable.Specification -import org.specs2.specification.Scope -import org.specs2.time.NoTimeConversions - -import akka.actor.{ Props, ActorSystem, Actor } -import akka.testkit.{ TestKit, ImplicitSender } -import scala.concurrent.util.duration._ - -class Specs2DemoUnitSpec extends Specification with NoTimeConversions { - - val system = ActorSystem() - - /* - * this is needed if different test cases would clash when run concurrently, - * e.g. when creating specifically named top-level actors; leave out otherwise - */ - sequential - - "A TestKit" should { - "work properly with Specs2 unit tests" in - new TestKit(system) with Scope with ImplicitSender { - within(1 second) { - system.actorOf(Props(new Actor { - def receive = { case x ⇒ sender ! x } - })) ! "hallo" - - expectMsgType[String] must be equalTo "hallo" - } - } - } - - step(system.shutdown) // do not forget to shutdown! -} diff --git a/akka-docs/scala/testing.rst b/akka-docs/scala/testing.rst index 8a05280580..0ca0373f5f 100644 --- a/akka-docs/scala/testing.rst +++ b/akka-docs/scala/testing.rst @@ -707,10 +707,3 @@ Some `Specs2 `_ users have contributed examples of how to wor * Specifications are by default executed concurrently, which requires some care when writing the tests or alternatively the ``sequential`` keyword. - -You can use the following two examples as guidelines: - -.. includecode:: code/docs/testkit/Specs2DemoSpec.scala - -.. includecode:: code/docs/testkit/Specs2DemoAcceptance.scala - diff --git a/project/AkkaBuild.scala b/project/AkkaBuild.scala index aa02d4dec4..9dada5fbad 100644 --- a/project/AkkaBuild.scala +++ b/project/AkkaBuild.scala @@ -516,7 +516,7 @@ object Dependencies { val tutorials = Seq(Test.scalatest, Test.junit) - val docs = Seq(Test.scalatest, Test.junit, Test.specs2, Test.junitIntf) + val docs = Seq(Test.scalatest, Test.junit, Test.junitIntf) val zeroMQ = Seq(protobuf, Dependency.zeroMQ, Test.scalatest, Test.junit) } @@ -547,7 +547,6 @@ object Dependency { val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test" // MIT val scalatest = "org.scalatest" % v("scalatest") % "1.9-2.10.0-M5-B2" % "test" // ApacheV2 val scalacheck = "org.scalacheck" % v("scalacheck") % "1.10.0" % "test" // New BSD - val specs2 = "org.specs2" % "specs2_2.10" % "1.11" % "test" // Modified BSD / ApacheV2 val ariesProxy = "org.apache.aries.proxy" % "org.apache.aries.proxy.impl" % "0.3" % "test" // ApacheV2 val pojosr = "com.googlecode.pojosr" % "de.kalpatec.pojosr.framework" % "0.1.4" % "test" // ApacheV2 val tinybundles = "org.ops4j.pax.tinybundles" % "tinybundles" % "1.0.0" % "test" // ApacheV2