Removing Specs2 as a dependency to remove the hassle of keeping track of available versions
This commit is contained in:
parent
f7e3c78a7b
commit
743f9cd8ff
5 changed files with 4 additions and 89 deletions
|
|
@ -206,14 +206,13 @@ public class UntypedActorDocTestBase {
|
||||||
ActorSystem system = ActorSystem.create("MySystem");
|
ActorSystem system = ActorSystem.create("MySystem");
|
||||||
ActorRef actorRef = system.actorOf(new Props(MyUntypedActor.class));
|
ActorRef actorRef = system.actorOf(new Props(MyUntypedActor.class));
|
||||||
//#gracefulStop
|
//#gracefulStop
|
||||||
//FIXME URGENT Await.result should have a @throws clause
|
try {
|
||||||
//try {
|
|
||||||
Future<Boolean> stopped = gracefulStop(actorRef, Duration.create(5, TimeUnit.SECONDS), system);
|
Future<Boolean> stopped = gracefulStop(actorRef, Duration.create(5, TimeUnit.SECONDS), system);
|
||||||
Await.result(stopped, Duration.create(6, TimeUnit.SECONDS));
|
Await.result(stopped, Duration.create(6, TimeUnit.SECONDS));
|
||||||
// the actor has been stopped
|
// the actor has been stopped
|
||||||
//} catch (AskTimeoutException e) {
|
} catch (AskTimeoutException e) {
|
||||||
// the actor wasn't stopped within 5 seconds
|
// the actor wasn't stopped within 5 seconds
|
||||||
//}
|
}
|
||||||
//#gracefulStop
|
//#gracefulStop
|
||||||
system.shutdown();
|
system.shutdown();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
@ -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!
|
|
||||||
}
|
|
||||||
|
|
@ -707,10 +707,3 @@ Some `Specs2 <http://specs2.org>`_ users have contributed examples of how to wor
|
||||||
|
|
||||||
* Specifications are by default executed concurrently, which requires some care
|
* Specifications are by default executed concurrently, which requires some care
|
||||||
when writing the tests or alternatively the ``sequential`` keyword.
|
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
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -516,7 +516,7 @@ object Dependencies {
|
||||||
|
|
||||||
val tutorials = Seq(Test.scalatest, Test.junit)
|
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)
|
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 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 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 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 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 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
|
val tinybundles = "org.ops4j.pax.tinybundles" % "tinybundles" % "1.0.0" % "test" // ApacheV2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue