From 01f9964fd44ddb902c58d034fb1045fa03faff41 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 3 Dec 2018 18:45:49 +0000 Subject: [PATCH] Export play-grpc to the play org This code has been exported out of the akka-grpc repository into https://github.com/playframework/play-grpc. The last release from this repo was: com.lightbend.akka.grpc : akka-grpc-play-testkit : 0.4.2 This is now available from the play-grpc repo as: com.lightbend.play : play-grpc-testkit : 0.5.0-M5 (Still need to sync it from JCenter to Maven Central.) ... and I just realised that I need to change the package from akka.grpc.play to something else... Will do! --- build.sbt | 96 ---------------- .../java/controllers/GreeterServiceImpl.java | 35 ------ .../main/java/controllers/MyController.java | 38 ------ .../src/main/protobuf/helloworld.proto | 19 --- .../src/main/resources/application.conf | 14 --- .../akka/grpc/gen/PlayJavaModuleSpec.scala | 35 ------ .../akka/grpc/gen/PlayJavaRouterSpec.scala | 108 ------------------ .../src/main/protobuf/helloworld.proto | 21 ---- .../src/main/resources/application.conf | 17 --- .../controllers/GreeterServiceImpl.scala | 21 ---- .../main/scala/controllers/MyController.scala | 27 ----- .../akka/grpc/gen/PlayScalaModuleSpec.scala | 35 ------ .../akka/grpc/gen/PlayScalaRouterSpec.scala | 86 -------------- .../scalatestplus/play/ServerGrpcClient.scala | 31 ----- .../play/PlayScalaTestSpec.scala | 50 -------- .../play/api/specs2/ServerGrpcClient.scala | 26 ----- .../grpc/play/api/specs2/PlaySpecs2Spec.scala | 54 --------- .../src/main/protobuf/helloworld.proto | 19 --- .../grpc/play/JavaAkkaGrpcClientHelpers.java | 71 ------------ .../grpc/play/AkkaGrpcClientHelpers.scala | 75 ------------ .../play/test/PlayJavaFunctionalTest.java | 89 --------------- .../helloworld/grpc/GreeterServiceImpl.java | 25 ---- .../grpc/helloworld/GreeterServiceImpl.scala | 19 --- project/Dependencies.scala | 46 -------- 24 files changed, 1057 deletions(-) delete mode 100644 play-interop-test-java/src/main/java/controllers/GreeterServiceImpl.java delete mode 100644 play-interop-test-java/src/main/java/controllers/MyController.java delete mode 100644 play-interop-test-java/src/main/protobuf/helloworld.proto delete mode 100644 play-interop-test-java/src/main/resources/application.conf delete mode 100644 play-interop-test-java/src/test/scala/akka/grpc/gen/PlayJavaModuleSpec.scala delete mode 100644 play-interop-test-java/src/test/scala/akka/grpc/gen/PlayJavaRouterSpec.scala delete mode 100644 play-interop-test-scala/src/main/protobuf/helloworld.proto delete mode 100644 play-interop-test-scala/src/main/resources/application.conf delete mode 100644 play-interop-test-scala/src/main/scala/controllers/GreeterServiceImpl.scala delete mode 100644 play-interop-test-scala/src/main/scala/controllers/MyController.scala delete mode 100644 play-interop-test-scala/src/test/scala/akka/grpc/gen/PlayScalaModuleSpec.scala delete mode 100644 play-interop-test-scala/src/test/scala/akka/grpc/gen/PlayScalaRouterSpec.scala delete mode 100644 play-scalatest/src/main/scala/akka/grpc/scalatestplus/play/ServerGrpcClient.scala delete mode 100644 play-scalatest/src/test/scala/akka/grpc/scalatestplus/play/PlayScalaTestSpec.scala delete mode 100644 play-specs2/src/main/scala/akka/grpc/play/api/specs2/ServerGrpcClient.scala delete mode 100644 play-specs2/src/test/scala/akka/grpc/play/api/specs2/PlaySpecs2Spec.scala delete mode 100644 play-testdata/src/main/protobuf/helloworld.proto delete mode 100644 play-testkit/src/main/java/akka/grpc/play/JavaAkkaGrpcClientHelpers.java delete mode 100644 play-testkit/src/main/scala/akka/grpc/play/AkkaGrpcClientHelpers.scala delete mode 100644 play-testkit/src/test/java/akka/grpc/play/test/PlayJavaFunctionalTest.java delete mode 100644 play-testkit/src/test/java/example/myapp/helloworld/grpc/GreeterServiceImpl.java delete mode 100644 play-testkit/src/test/scala/example/myapp/helloworld/grpc/helloworld/GreeterServiceImpl.scala diff --git a/build.sbt b/build.sbt index c90c4dc8f..e5d9ac308 100644 --- a/build.sbt +++ b/build.sbt @@ -161,96 +161,6 @@ lazy val interopTests = Project( } ))) -lazy val playTestdata = Project( - id="akka-grpc-play-testdata", - base=file("play-testdata") - ) - .settings(Dependencies.playTestdata) - .settings(commonSettings) - .settings( - crossScalaVersions := Seq(scala211, scala212), - ReflectiveCodeGen.generatedLanguages := Seq("Java", "Scala"), - ReflectiveCodeGen.extraGenerators := Seq( - "ScalaMarshallersCodeGenerator", - "akka.grpc.gen.scaladsl.play.PlayScalaServerCodeGenerator", - "akka.grpc.gen.scaladsl.play.PlayScalaClientCodeGenerator", - "akka.grpc.gen.javadsl.play.PlayJavaServerCodeGenerator", - "akka.grpc.gen.javadsl.play.PlayJavaClientCodeGenerator", - ), - ) - .enablePlugins(akka.grpc.NoPublish) - .pluginTestingSettings - -lazy val playTestkit = Project( - id="akka-grpc-play-testkit", - base = file("play-testkit") - ) - .dependsOn(runtime) - .dependsOn(playTestdata % "test") - .settings(Dependencies.playTestkit) - .settings(commonSettings) - .settings( - crossScalaVersions := Seq(scala211, scala212), - ) - .pluginTestingSettings - -val playSpecs2 = Project("akka-grpc-play-specs2", file("play-specs2")) - .dependsOn(playTestkit, playTestkit % "test->test") - .settings( - commonSettings, - crossScalaVersions := Seq(scala211, scala212), - Dependencies.playSpecs2, - ) - .pluginTestingSettings - -val playScalaTest = Project("akka-grpc-play-scalatest", file("play-scalatest")) - .dependsOn(playTestkit, playTestkit % "test->test") - .settings( - commonSettings, - crossScalaVersions := Seq(scala211, scala212), - Dependencies.playScalaTest, - excludeFilter in (Compile, headerSources) := { - val orig = (excludeFilter in (Test, headerSources)).value - // The following files have a different license - orig || "NewGuiceOneServerPerTest.scala" || "NewServerProvider.scala" || "NewBaseOneServerPerTest.scala" - }, - ) - .pluginTestingSettings - -lazy val playInteropTestScala = Project( - id="akka-grpc-play-interop-test-scala", - base = file("play-interop-test-scala") - ) - .dependsOn(playSpecs2 % Test, playScalaTest % Test) - .settings(Dependencies.playInteropTestScala) - .settings(commonSettings) - .settings( - ReflectiveCodeGen.extraGenerators := Seq( - "ScalaMarshallersCodeGenerator", - "akka.grpc.gen.scaladsl.play.PlayScalaServerCodeGenerator", - "akka.grpc.gen.scaladsl.play.PlayScalaClientCodeGenerator" - ), - ) - .enablePlugins(akka.grpc.NoPublish) - .pluginTestingSettings - -lazy val playInteropTestJava = Project( - id="akka-grpc-play-interop-test-java", - base = file("play-interop-test-java") - ) - .dependsOn(playSpecs2 % Test, playScalaTest % Test) - .settings(Dependencies.playInteropTestJava) - .settings(commonSettings) - .settings( - ReflectiveCodeGen.generatedLanguages := Seq("Java"), - ReflectiveCodeGen.extraGenerators := Seq( - "akka.grpc.gen.javadsl.play.PlayJavaServerCodeGenerator", - "akka.grpc.gen.javadsl.play.PlayJavaClientCodeGenerator", - ), - ) - .enablePlugins(akka.grpc.NoPublish) - .pluginTestingSettings - lazy val docs = Project( id = "akka-grpc-docs", base = file("docs"), @@ -311,12 +221,6 @@ lazy val root = Project( sbtPlugin, scalapbProtocPlugin, interopTests, - playInteropTestJava, - playInteropTestScala, - playTestkit, - playSpecs2, - playScalaTest, - playTestdata, pluginTesterScala, pluginTesterJava, docs, diff --git a/play-interop-test-java/src/main/java/controllers/GreeterServiceImpl.java b/play-interop-test-java/src/main/java/controllers/GreeterServiceImpl.java deleted file mode 100644 index 2fd18f3c6..000000000 --- a/play-interop-test-java/src/main/java/controllers/GreeterServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -// #service-impl -package controllers; - -import akka.stream.Materializer; -import com.google.inject.Inject; -import example.myapp.helloworld.grpc.AbstractGreeterServiceRouter; -import example.myapp.helloworld.grpc.HelloReply; -import example.myapp.helloworld.grpc.HelloRequest; - -import javax.inject.Singleton; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionStage; - -/** User implementation, with support for dependency injection etc */ -@Singleton -public class GreeterServiceImpl extends AbstractGreeterServiceRouter { - - @Inject - public GreeterServiceImpl(Materializer mat) { - super(mat); - } - - @Override - public CompletionStage sayHello(HelloRequest in) { - String message = String.format("Hello, %s!", in.getName()); - HelloReply reply = HelloReply.newBuilder().setMessage(message).build(); - return CompletableFuture.completedFuture(reply); - } - -} -// #service-impl \ No newline at end of file diff --git a/play-interop-test-java/src/main/java/controllers/MyController.java b/play-interop-test-java/src/main/java/controllers/MyController.java deleted file mode 100644 index 29ab8eb0b..000000000 --- a/play-interop-test-java/src/main/java/controllers/MyController.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (C) 2009-2018 Lightbend Inc. - */ - -// #using-client -package controllers; - -import example.myapp.helloworld.grpc.GreeterServiceClient; -import example.myapp.helloworld.grpc.HelloRequest; -import play.mvc.Controller; -import play.mvc.Result; - -import javax.inject.Inject; -import javax.inject.Singleton; -import java.util.concurrent.CompletionStage; - -@Singleton -public class MyController extends Controller { - - private final GreeterServiceClient greeterServiceClient; - - @Inject - public MyController(GreeterServiceClient greeterServiceClient) { - this.greeterServiceClient = greeterServiceClient; - } - - public CompletionStage sayHello(String name) { - return greeterServiceClient.sayHello( - HelloRequest.newBuilder() - .setName(name) - .build() - ).thenApply(response -> - ok("response: " + response.getMessage()) - ); - }; - -} -// #using-client diff --git a/play-interop-test-java/src/main/protobuf/helloworld.proto b/play-interop-test-java/src/main/protobuf/helloworld.proto deleted file mode 100644 index ac5185b6a..000000000 --- a/play-interop-test-java/src/main/protobuf/helloworld.proto +++ /dev/null @@ -1,19 +0,0 @@ -// must mirror the scala-interop-test one since that is shown in the docs -syntax = "proto3"; - -option java_multiple_files = true; -option java_package = "example.myapp.helloworld.grpc"; -option java_outer_classname = "HelloWorldProto"; - -package helloworld; - -service GreeterService { - rpc SayHello (HelloRequest) returns (HelloReply) {} -} -message HelloRequest { - string name = 1; -} - -message HelloReply { - string message = 1; -} diff --git a/play-interop-test-java/src/main/resources/application.conf b/play-interop-test-java/src/main/resources/application.conf deleted file mode 100644 index 40850c5e4..000000000 --- a/play-interop-test-java/src/main/resources/application.conf +++ /dev/null @@ -1,14 +0,0 @@ -// #client-module-java -// enable the client module -play.modules.enabled += example.myapp.helloworld.grpc.AkkaGrpcClientModule -// #client-module-java - - -// #service-client-conf -akka.grpc.client { - "helloworld.GreeterService" { - host = "example.com" - port = 9000 - } -} -// #service-client-conf diff --git a/play-interop-test-java/src/test/scala/akka/grpc/gen/PlayJavaModuleSpec.scala b/play-interop-test-java/src/test/scala/akka/grpc/gen/PlayJavaModuleSpec.scala deleted file mode 100644 index 6fcb4a334..000000000 --- a/play-interop-test-java/src/test/scala/akka/grpc/gen/PlayJavaModuleSpec.scala +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (C) 2009-2018 Lightbend Inc. - */ - -package akka.grpc.gen - -import java.io.File - -import example.myapp.helloworld.grpc.{ GreeterServiceClient, GreeterServiceClientProvider } -import org.scalatest.{ Matchers, WordSpec } -import play.api.inject.ProviderConstructionTarget -import play.api.{ Configuration, Environment, Mode } - -class PlayJavaModuleSpec extends WordSpec with Matchers { - - "The generated module" should { - - "provide all clients" in { - // module in longest common package for the two services - val module = new example.myapp.helloworld.grpc.AkkaGrpcClientModule() - - val bindings = module.bindings(Environment(new File("./"), getClass.getClassLoader, Mode.Prod), Configuration.empty) - - // both clients should be in there - bindings should have size (1) - - bindings.map(_.key.clazz).toSet should ===(Set(classOf[GreeterServiceClient])) - - // not super useful assertions but let's keep for good measure - bindings.map(_.target.get.asInstanceOf[ProviderConstructionTarget[_]].provider).toSet should ===(Set(classOf[GreeterServiceClientProvider])) - } - - } - -} diff --git a/play-interop-test-java/src/test/scala/akka/grpc/gen/PlayJavaRouterSpec.scala b/play-interop-test-java/src/test/scala/akka/grpc/gen/PlayJavaRouterSpec.scala deleted file mode 100644 index 21ef41695..000000000 --- a/play-interop-test-java/src/test/scala/akka/grpc/gen/PlayJavaRouterSpec.scala +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -package akka.grpc.gen - -import akka.NotUsed -import akka.actor.ActorSystem -import akka.grpc.scaladsl.GrpcMarshalling -import akka.grpc.{ Codec, Grpc, ProtobufSerializer } -import akka.http.scaladsl.marshalling.{ Marshaller, ToResponseMarshaller } -import akka.http.scaladsl.model.HttpEntity.Chunk -import akka.http.scaladsl.model._ -import akka.http.scaladsl.unmarshalling.{ FromRequestUnmarshaller, Unmarshaller } -import akka.stream.scaladsl.{ Sink, Source } -import akka.stream.{ ActorMaterializer, Materializer } -import akka.util.ByteString -import controllers.GreeterServiceImpl -import example.myapp.helloworld.grpc.{ GreeterService, HelloReply, HelloRequest } -import org.scalatest.concurrent.ScalaFutures -import org.scalatest.{ BeforeAndAfterAll, Matchers, WordSpec } -import play.api.inject.SimpleInjector -import play.api.libs.typedmap.TypedMap -import play.api.mvc.{ Handler, Headers, RequestHeader } -import play.api.mvc.akkahttp.AkkaHttpHandler -import play.api.mvc.request.{ RemoteConnection, RequestFactory, RequestTarget } - -import scala.concurrent.ExecutionContext -import scala.concurrent.duration._ - -class PlayJavaRouterSpec extends WordSpec with Matchers with BeforeAndAfterAll with ScalaFutures { - implicit val sys = ActorSystem() - implicit val mat = ActorMaterializer() - implicit val ec = sys.dispatcher - implicit val patience = PatienceConfig(timeout = 3.seconds, interval = 15.milliseconds) - - // serializers so we can test the requests - implicit val HelloRequestSerializer = example.myapp.helloworld.grpc.GreeterService.Serializers.HelloRequestSerializer - implicit val HelloReplySerializer = example.myapp.helloworld.grpc.GreeterService.Serializers.HelloReplySerializer - - implicit def unmarshaller[T](implicit serializer: ProtobufSerializer[T], mat: Materializer): FromRequestUnmarshaller[T] = - Unmarshaller((ec: ExecutionContext) ⇒ (req: HttpRequest) ⇒ GrpcMarshalling.unmarshal(req)(serializer, mat)) - - implicit def toSourceUnmarshaller[T](implicit serializer: ProtobufSerializer[T], mat: Materializer): FromRequestUnmarshaller[Source[T, NotUsed]] = - Unmarshaller((ec: ExecutionContext) ⇒ (req: HttpRequest) ⇒ GrpcMarshalling.unmarshalStream(req)(serializer, mat)) - - implicit def marshaller[T](implicit serializer: ProtobufSerializer[T], mat: Materializer, codec: Codec): ToResponseMarshaller[T] = - Marshaller.opaque((response: T) ⇒ GrpcMarshalling.marshal(response)(serializer, mat, codec)) - - implicit def fromSourceMarshaller[T](implicit serializer: ProtobufSerializer[T], mat: Materializer, codec: Codec): ToResponseMarshaller[Source[T, NotUsed]] = - Marshaller.opaque((response: Source[T, NotUsed]) ⇒ GrpcMarshalling.marshalStream(response)(serializer, mat, codec)) - - val router = new GreeterServiceImpl(mat) - - "The generated Play (Java) Router" should { - - "don't accept requests for other paths" in { - router.routes.lift(playRequestFor(Uri("http://localhost/foo"))).isEmpty shouldBe true - } - - "accept requests using the service name as prefix" in { - val uri = Uri(s"http://localhost/${GreeterService.name}/SayHello") - router.routes.lift(playRequestFor(uri)).isDefined shouldBe true - - val name = "John" - - val handler = router.routes(playRequestFor(uri)).asInstanceOf[AkkaHttpHandler] - val request = akkaHttpRequestFor(uri, HelloRequest.newBuilder().setName(name).build())(HelloRequestSerializer) - val response = handler(request).futureValue - response.status shouldBe StatusCodes.OK - - val reply = akkaHttpResponse[HelloReply](response).futureValue - reply.getMessage shouldBe s"Hello, $name!" - } - - "allow / as identity prefix" in { - val result = router.withPrefix("/") - result shouldBe theSameInstanceAs(router) - } - - "not allow specifying another prefix" in { - intercept[UnsupportedOperationException] { - router.withPrefix("/some") - } - } - - def akkaHttpRequestFor[T](uri: Uri, msg: T)(implicit serializer: ProtobufSerializer[T]) = { - HttpRequest(uri = uri, entity = HttpEntity.Chunked(Grpc.contentType, Source.single(msg).map(serializer.serialize).via(Grpc.grpcFramingEncoder).map(Chunk(_)))) - } - def akkaHttpResponse[T](response: HttpResponse)(implicit deserializer: ProtobufSerializer[T]) = - response.entity.dataBytes.via(Grpc.grpcFramingDecoder).runWith(Sink.reduce[ByteString](_ ++ _)).map(deserializer.deserialize) - - def playRequestFor(uri: Uri): RequestHeader = - RequestFactory.plain.createRequest( - RemoteConnection(uri.authority.host.address, secure = false, clientCertificateChain = None), - "GET", - RequestTarget(uri.toString, uri.path.toString, queryString = Map.empty), - version = "42", - Headers(), - attrs = TypedMap.empty, - body = ()) - } - - override def afterAll(): Unit = { - super.afterAll() - sys.terminate() - } -} diff --git a/play-interop-test-scala/src/main/protobuf/helloworld.proto b/play-interop-test-scala/src/main/protobuf/helloworld.proto deleted file mode 100644 index c3bb8d7a4..000000000 --- a/play-interop-test-scala/src/main/protobuf/helloworld.proto +++ /dev/null @@ -1,21 +0,0 @@ -// #protoSources -syntax = "proto3"; - -option java_multiple_files = true; -option java_package = "example.myapp.helloworld.grpc"; -option java_outer_classname = "HelloWorldProto"; - -package helloworld; - -service GreeterService { - rpc SayHello (HelloRequest) returns (HelloReply) {} -} - -message HelloRequest { - string name = 1; -} - -message HelloReply { - string message = 1; -} -// #protoSources \ No newline at end of file diff --git a/play-interop-test-scala/src/main/resources/application.conf b/play-interop-test-scala/src/main/resources/application.conf deleted file mode 100644 index f646fbdde..000000000 --- a/play-interop-test-scala/src/main/resources/application.conf +++ /dev/null @@ -1,17 +0,0 @@ - -// #client-module-scala -// enable the client module -play.modules.enabled += example.myapp.helloworld.grpc.helloworld.AkkaGrpcClientModule -// #client-module-scala - - -// #service-client-conf -akka.grpc.client { - "helloworld.GreeterService" { - host = "example.com" - port = 9000 - # By default we connect over TLS - #use-tls = false - } -} -// #service-client-conf diff --git a/play-interop-test-scala/src/main/scala/controllers/GreeterServiceImpl.scala b/play-interop-test-scala/src/main/scala/controllers/GreeterServiceImpl.scala deleted file mode 100644 index d625633ce..000000000 --- a/play-interop-test-scala/src/main/scala/controllers/GreeterServiceImpl.scala +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -// #service-impl -package controllers - -import akka.stream.Materializer -import example.myapp.helloworld.grpc.helloworld.{ AbstractGreeterServiceRouter, HelloReply, HelloRequest } -import javax.inject.{ Inject, Singleton } - -import scala.concurrent.Future - -/** User implementation, with support for dependency injection etc */ -@Singleton -class GreeterServiceImpl @Inject() (implicit mat: Materializer) extends AbstractGreeterServiceRouter(mat) { - - override def sayHello(in: HelloRequest): Future[HelloReply] = Future.successful(HelloReply(s"Hello, ${in.name}!")) - -} -// #service-impl diff --git a/play-interop-test-scala/src/main/scala/controllers/MyController.scala b/play-interop-test-scala/src/main/scala/controllers/MyController.scala deleted file mode 100644 index e011c1dea..000000000 --- a/play-interop-test-scala/src/main/scala/controllers/MyController.scala +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (C) 2009-2018 Lightbend Inc. - */ - -// #using-client -package controllers - -import akka.actor.ActorSystem -import akka.stream.Materializer -import example.myapp.helloworld.grpc.helloworld.{ GreeterServiceClient, HelloRequest } -import javax.inject.{ Inject, Singleton } -import play.api.mvc.{ AbstractController, ControllerComponents } - -import scala.concurrent.ExecutionContext - -@Singleton -class MyController @Inject() (implicit greeterClient: GreeterServiceClient, cc: ControllerComponents, mat: Materializer, exec: ExecutionContext) extends AbstractController(cc) { - - def sayHello(name: String) = Action.async { implicit request => - greeterClient.sayHello(HelloRequest(name)) - .map { reply => - Ok(s"response: ${reply.message}") - } - } - -} -// #using-client diff --git a/play-interop-test-scala/src/test/scala/akka/grpc/gen/PlayScalaModuleSpec.scala b/play-interop-test-scala/src/test/scala/akka/grpc/gen/PlayScalaModuleSpec.scala deleted file mode 100644 index de8621a7a..000000000 --- a/play-interop-test-scala/src/test/scala/akka/grpc/gen/PlayScalaModuleSpec.scala +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (C) 2009-2018 Lightbend Inc. - */ - -package akka.grpc.gen - -import java.io.File - -import example.myapp.helloworld.grpc.helloworld.{ GreeterServiceClient, GreeterServiceClientProvider } -import org.scalatest.{ Matchers, WordSpec } -import play.api.inject.ProviderConstructionTarget -import play.api.{ Configuration, Environment, Mode } - -class PlayScalaModuleSpec extends WordSpec with Matchers { - - "The generated module" should { - - "provide all clients" in { - // module in longest common package for the two services - val module = new example.myapp.helloworld.grpc.helloworld.AkkaGrpcClientModule() - - val bindings = module.bindings(Environment(new File("./"), getClass.getClassLoader, Mode.Prod), Configuration.empty) - - // both clients should be in there - bindings should have size (1) - - bindings.map(_.key.clazz).toSet should ===(Set(classOf[GreeterServiceClient])) - - // not super useful assertions but let's keep for good measure - bindings.map(_.target.get.asInstanceOf[ProviderConstructionTarget[_]].provider).toSet should ===(Set(classOf[GreeterServiceClientProvider])) - } - - } - -} diff --git a/play-interop-test-scala/src/test/scala/akka/grpc/gen/PlayScalaRouterSpec.scala b/play-interop-test-scala/src/test/scala/akka/grpc/gen/PlayScalaRouterSpec.scala deleted file mode 100644 index 3bf8eca19..000000000 --- a/play-interop-test-scala/src/test/scala/akka/grpc/gen/PlayScalaRouterSpec.scala +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -package akka.grpc.gen - -import scala.concurrent.duration._ -import akka.actor.ActorSystem -import akka.http.scaladsl.model._ -import akka.stream.{ ActorMaterializer, Materializer } -import play.api.libs.typedmap.TypedMap -import play.api.mvc.akkahttp.AkkaHttpHandler -import play.api.mvc.Headers -import play.api.mvc.request.{ RemoteConnection, RequestFactory, RequestTarget } -import controllers.GreeterServiceImpl -import example.myapp.helloworld.grpc.helloworld._ -import GreeterServiceMarshallers._ -import akka.grpc.{ Grpc, ProtobufSerializer } -import akka.http.scaladsl.model.HttpEntity.Chunk -import akka.stream.scaladsl.{ Sink, Source } -import akka.util.ByteString -import org.scalatest.concurrent.ScalaFutures -import org.scalatest.{ BeforeAndAfterAll, Matchers, WordSpec } -import play.api.inject.SimpleInjector - -class PlayScalaRouterSpec extends WordSpec with Matchers with BeforeAndAfterAll with ScalaFutures { - implicit val sys = ActorSystem() - implicit val mat = ActorMaterializer() - implicit val ec = sys.dispatcher - implicit val patience = PatienceConfig(timeout = 3.seconds, interval = 15.milliseconds) - - val router = new GreeterServiceImpl - - "The generated Play Router" should { - - "not accept requests for other paths" in { - router.routes.isDefinedAt(playRequestFor(Uri("http://localhost/foo"))) shouldBe false - } - - "by default accept requests using the service name as prefix" in { - val uri = Uri(s"http://localhost/${GreeterService.name}/SayHello") - router.routes.isDefinedAt(playRequestFor(uri)) shouldBe true - - val name = "John" - - val handler = router.routes(playRequestFor(uri)).asInstanceOf[AkkaHttpHandler] - val request = akkaHttpRequestFor(uri, HelloRequest(name)) - val response = handler(request).futureValue - response.status shouldBe StatusCodes.OK - - val reply = akkaHttpResponse[HelloReply](response).futureValue - reply.message shouldBe s"Hello, $name!" - } - - "allow / as identity prefix" in { - val result = router.withPrefix("/") - result shouldBe theSameInstanceAs(router) - } - - "not allow specifying another prefix" in { - intercept[UnsupportedOperationException] { - router.withPrefix("/some") - } - } - - def akkaHttpRequestFor[T](uri: Uri, msg: T)(implicit serializer: ProtobufSerializer[T]) = { - HttpRequest(uri = uri, entity = HttpEntity.Chunked(Grpc.contentType, Source.single(msg).map(serializer.serialize).via(Grpc.grpcFramingEncoder).map(Chunk(_)))) - } - def akkaHttpResponse[T](response: HttpResponse)(implicit deserializer: ProtobufSerializer[T]) = - response.entity.dataBytes.via(Grpc.grpcFramingDecoder).runWith(Sink.reduce[ByteString](_ ++ _)).map(deserializer.deserialize) - - def playRequestFor(uri: Uri) = RequestFactory.plain.createRequest( - RemoteConnection(uri.authority.host.address, secure = false, clientCertificateChain = None), - "GET", - RequestTarget(uri.toString, uri.path.toString, queryString = Map.empty), - version = "42", - Headers(), - attrs = TypedMap.empty, - body = ()) - } - - override def afterAll(): Unit = { - super.afterAll() - sys.terminate() - } -} diff --git a/play-scalatest/src/main/scala/akka/grpc/scalatestplus/play/ServerGrpcClient.scala b/play-scalatest/src/main/scala/akka/grpc/scalatestplus/play/ServerGrpcClient.scala deleted file mode 100644 index cef2aa02d..000000000 --- a/play-scalatest/src/main/scala/akka/grpc/scalatestplus/play/ServerGrpcClient.scala +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -package akka.grpc.scalatestplus.play - -import akka.grpc.internal.AkkaGrpcClientFactory -import akka.grpc.play.AkkaGrpcClientHelpers -import akka.grpc.scaladsl.AkkaGrpcClient -import play.api.Application -import play.api.test.{ DefaultTestServerFactory, RunningServer } -import scala.reflect.ClassTag -import org.scalatest.TestData -import org.scalatestplus.play.BaseOneServerPerTest - -/** - * Helpers to test gRPC clients with Play using ScalaTest. - * - * Mixes a method into [[AkkaGrpcClientHelpers]] that knows how to configure - */ -trait ServerGrpcClient extends AkkaGrpcClientHelpers { this: BaseOneServerPerTest => - - /** Configure the factory by combining the current app and server information */ - implicit def configuredAkkaGrpcClientFactory[T <: AkkaGrpcClient: ClassTag](implicit running: RunningServer): AkkaGrpcClientFactory.Configured[T] = { - AkkaGrpcClientHelpers.factoryForAppEndpoints(running.app, running.endpoints) - } - - override protected def newServerForTest(app: Application, testData: TestData): RunningServer = - DefaultTestServerFactory.start(app) - -} diff --git a/play-scalatest/src/test/scala/akka/grpc/scalatestplus/play/PlayScalaTestSpec.scala b/play-scalatest/src/test/scala/akka/grpc/scalatestplus/play/PlayScalaTestSpec.scala deleted file mode 100644 index cf6eaf7b0..000000000 --- a/play-scalatest/src/test/scala/akka/grpc/scalatestplus/play/PlayScalaTestSpec.scala +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -package akka.grpc.scalatestplus.play - -import org.scalatest.concurrent.{ IntegrationPatience, ScalaFutures } -import org.scalatestplus.play.PlaySpec -import org.scalatestplus.play.guice.GuiceOneServerPerTest -import play.api.Application -import play.api.inject.bind -import play.api.inject.guice.GuiceApplicationBuilder -import play.api.libs.ws.WSClient -import play.api.routing.Router -import example.myapp.helloworld.grpc.helloworld._ - -/** - * Test for the Play gRPC ScalaTest APIs - */ -class PlayScalaTestSpec extends PlaySpec with GuiceOneServerPerTest with ServerGrpcClient - with ScalaFutures with IntegrationPatience { - - override def fakeApplication(): Application = { - GuiceApplicationBuilder() - .overrides(bind[Router].to[GreeterServiceImpl]) - .build() - } - - implicit def ws: WSClient = app.injector.instanceOf(classOf[WSClient]) - - "A Play server bound to a gRPC router" must { - "give a 404 when routing a non-gRPC request" in { - val result = wsUrl("/").get.futureValue - result.status must be(404) // Maybe should be a 426, see #396 - } - "give an Ok header (and hopefully a not implemented trailer) when routing a non-existent gRPC method" in { - val result = wsUrl(s"/${GreeterService.name}/FooBar").get.futureValue - result.status must be(200) // Maybe should be a 426, see #396 - // TODO: Test that trailer has a not implemented status - } - "give a 500 when routing an empty request to a gRPC method" in { - val result = wsUrl(s"/${GreeterService.name}/SayHello").get.futureValue - result.status must be(500) // Maybe should be a 426, see #396 - } - "work with a gRPC client" in withGrpcClient[GreeterServiceClient] { client: GreeterServiceClient => - val reply = client.sayHello(HelloRequest("Alice")).futureValue - reply.message must be("Hello, Alice!") - } - } -} diff --git a/play-specs2/src/main/scala/akka/grpc/play/api/specs2/ServerGrpcClient.scala b/play-specs2/src/main/scala/akka/grpc/play/api/specs2/ServerGrpcClient.scala deleted file mode 100644 index 11c1ed9e8..000000000 --- a/play-specs2/src/main/scala/akka/grpc/play/api/specs2/ServerGrpcClient.scala +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -package akka.grpc.play.api.specs2 - -import scala.reflect.ClassTag -import akka.grpc.internal.AkkaGrpcClientFactory -import akka.grpc.play.AkkaGrpcClientHelpers -import akka.grpc.scaladsl.AkkaGrpcClient -import play.api.test.RunningServer - -/** - * Helpers to test gRPC clients with Play using Specs2. - * - * Mixes a method into [[AkkaGrpcClientHelpers]] that knows how to configure - * gRPC clients for the running server. - */ -trait ServerGrpcClient extends AkkaGrpcClientHelpers { - - /** Configure the factory by combining the app and the current implicit server information */ - implicit def configuredAkkaGrpcClientFactory[T <: AkkaGrpcClient: ClassTag](implicit running: RunningServer): AkkaGrpcClientFactory.Configured[T] = { - AkkaGrpcClientHelpers.factoryForAppEndpoints(running.app, running.endpoints) - } - -} diff --git a/play-specs2/src/test/scala/akka/grpc/play/api/specs2/PlaySpecs2Spec.scala b/play-specs2/src/test/scala/akka/grpc/play/api/specs2/PlaySpecs2Spec.scala deleted file mode 100644 index d8550179d..000000000 --- a/play-specs2/src/test/scala/akka/grpc/play/api/specs2/PlaySpecs2Spec.scala +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -package akka.grpc.play.api.specs2 - -import org.junit.runner.RunWith -import org.specs2.runner.JUnitRunner -import play.api.inject.bind -import play.api.inject.guice.GuiceApplicationBuilder -import play.api.libs.ws.{ WSClient, WSRequest } -import play.api.routing.Router -import play.api.test._ - -import example.myapp.helloworld.grpc.helloworld._ - -/** - * Test for the Play gRPC Specs2 APIs - */ -@RunWith(classOf[JUnitRunner]) -class PlaySpecs2Spec extends ForServer with ServerGrpcClient with PlaySpecification with ApplicationFactories { - - protected def applicationFactory: ApplicationFactory = - withGuiceApp(GuiceApplicationBuilder().overrides(bind[Router].to[GreeterServiceImpl])) - - // RICH: Still need to work out how to make WSClient work properly with endpoints - def wsUrl(path: String)(implicit running: RunningServer): WSRequest = { - val ws = running.app.injector.instanceOf[WSClient] - val url = running.endpoints.httpEndpoint.get.pathUrl(path) - ws.url(url) - } - - "A Play server bound to a gRPC router" should { - "give a 404 when routing a non-gRPC request" >> { implicit rs: RunningServer => - val result = await(wsUrl("/").get) - result.status must ===(404) // Maybe should be a 426, see #396 - } - "give an Ok header (and hopefully a not implemented trailer) when routing a non-existent gRPC method" >> { implicit rs: RunningServer => - val result = await(wsUrl(s"/${GreeterService.name}/FooBar").get) - result.status must ===(200) // Maybe should be a 426, see #396 - // TODO: Test that trailer has a not implemented status - } - "give a 500 when routing an empty request to a gRPC method" >> { implicit rs: RunningServer => - val result = await(wsUrl(s"/${GreeterService.name}/SayHello").get) - result.status must ===(500) // Maybe should be a 426, see #396 - } - "work with a gRPC client" >> { implicit rs: RunningServer => - withGrpcClient[GreeterServiceClient] { client: GreeterServiceClient => - val reply = await(client.sayHello(HelloRequest("Alice"))) - reply.message must ===("Hello, Alice!") - } - } - } -} diff --git a/play-testdata/src/main/protobuf/helloworld.proto b/play-testdata/src/main/protobuf/helloworld.proto deleted file mode 100644 index ac5185b6a..000000000 --- a/play-testdata/src/main/protobuf/helloworld.proto +++ /dev/null @@ -1,19 +0,0 @@ -// must mirror the scala-interop-test one since that is shown in the docs -syntax = "proto3"; - -option java_multiple_files = true; -option java_package = "example.myapp.helloworld.grpc"; -option java_outer_classname = "HelloWorldProto"; - -package helloworld; - -service GreeterService { - rpc SayHello (HelloRequest) returns (HelloReply) {} -} -message HelloRequest { - string name = 1; -} - -message HelloReply { - string message = 1; -} diff --git a/play-testkit/src/main/java/akka/grpc/play/JavaAkkaGrpcClientHelpers.java b/play-testkit/src/main/java/akka/grpc/play/JavaAkkaGrpcClientHelpers.java deleted file mode 100644 index fb7ec17fa..000000000 --- a/play-testkit/src/main/java/akka/grpc/play/JavaAkkaGrpcClientHelpers.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -package akka.grpc.play; - -import static scala.compat.java8.JFunction.*; - -import akka.actor.ActorSystem; -import akka.grpc.GrpcClientSettings; - -import play.api.test.RunningServer; -import play.core.server.ServerEndpoint; -import play.core.server.ServerEndpoints; - -import javax.net.ssl.SSLContext; - -/** Helpers to test Java Akka gRPC clients with Play. */ -public final class JavaAkkaGrpcClientHelpers { - private JavaAkkaGrpcClientHelpers() {} - - /** Creates a GrpcClientSettings from the given NewTestServer. */ - public static GrpcClientSettings grpcClientSettings(final RunningServer runningServer) { - final ServerEndpoint http2Endpoint = getHttp2Endpoint(runningServer.endpoints()); - return grpcClientSettings(http2Endpoint, runningServer.app().actorSystem()); - } - - /** - * Unsafely gets the HTTP/2 endpoint from the given ServerEndpoints. - * - * If no HTTP/2 endpoint exists this throws an IllegalArgumentException. - */ - public static ServerEndpoint getHttp2Endpoint(final ServerEndpoints serverEndpoints) { - final scala.collection.Traversable possibleEndpoints = - serverEndpoints.endpoints().filter(func(e->e.expectedHttpVersions().contains("2"))); - if (possibleEndpoints.size() != 1) { - throw new IllegalArgumentException(String.format( - "gRPC client can't automatically find HTTP/2 connection: " + - "%s valid endpoints available: %s", - possibleEndpoints.size(), - serverEndpoints - )); - } - return possibleEndpoints.head(); - } - - /** Creates a GrpcClientSettings from the given HTTP/2 endpoint and ActorSystem. */ - public static GrpcClientSettings grpcClientSettings( - final ServerEndpoint http2Endpoint, - final ActorSystem actorSystem - ) { - - final ServerEndpoint.ClientSsl clientSsl = http2Endpoint.ssl().getOrElse(func(() -> { - throw new IllegalArgumentException( - "GrpcClientSettings requires a server endpoint with ssl, but non provided"); - })); - - return grpcClientSettings(http2Endpoint, clientSsl.sslContext(), actorSystem); - } - - public static GrpcClientSettings grpcClientSettings( - final ServerEndpoint http2Endpoint, - final SSLContext sslContext, - final ActorSystem actorSystem - ) { - return GrpcClientSettings - .connectToServiceAt(http2Endpoint.host(), http2Endpoint.port(), actorSystem) - .withSSLContext(sslContext); - } - -} diff --git a/play-testkit/src/main/scala/akka/grpc/play/AkkaGrpcClientHelpers.scala b/play-testkit/src/main/scala/akka/grpc/play/AkkaGrpcClientHelpers.scala deleted file mode 100644 index 2340154c9..000000000 --- a/play-testkit/src/main/scala/akka/grpc/play/AkkaGrpcClientHelpers.scala +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -package akka.grpc.play - -import java.util.concurrent.TimeUnit - -import akka.actor.ActorSystem -import akka.grpc.internal.AkkaGrpcClientFactory -import akka.grpc.scaladsl.AkkaGrpcClient -import akka.stream.Materializer -import play.api.Application -import play.core.server.{ ServerEndpoint, ServerEndpoints } - -import scala.concurrent.duration.Duration -import scala.concurrent.{ Await, ExecutionContext } -import scala.reflect.ClassTag - -/** - * Helpers to test gRPC clients with Play. The methods in this class require - * an implicit `AkkaGrpcClientFactory.Configured[T]` to be in scope. This can - * usually be done by mixing in a method that knows how to configure the factory - * for the current environment, e.g. by configuring the correct port values. - */ -trait AkkaGrpcClientHelpers { - - /** - * Create a gRPC client to connect to the currently running test server. - * @tparam T The type of client to create. - * @return - */ - def withGrpcClient[T <: AkkaGrpcClient]: WithGrpcClient[T] = new WithGrpcClient[T] - - /** - * Runs a block of code with a gRPC client, closing the client afterwards. - * @tparam T The type of gRPC client. - */ - final class WithGrpcClient[T <: AkkaGrpcClient] { - def apply[U](f: T => U)(implicit factory: AkkaGrpcClientFactory.Configured[T]): U = { - val client = grpcClient[T] - try f(client) finally Await.result(client.close(), grpcClientCloseTimeout) - } - } - - /** - * Get a gRPC client to connect to the currently running test server. Remember - * to close it afterwards, or use [[withGrpcClient]] to have it closed automatically. - */ - def grpcClient[T <: AkkaGrpcClient](implicit factory: AkkaGrpcClientFactory.Configured[T]): T = - factory.create() - - /** The close timeout used by gRPC clients. */ - protected def grpcClientCloseTimeout: Duration = Duration(30, TimeUnit.SECONDS) - -} - -object AkkaGrpcClientHelpers { - /** - * Configure a factory from an application and some server endpoints. Expects to have exactly one HTTP/2 endpoint. - */ - def factoryForAppEndpoints[T <: AkkaGrpcClient: ClassTag](app: Application, serverEndpoints: ServerEndpoints): AkkaGrpcClientFactory.Configured[T] = { - factoryForAppEndpoints(app, JavaAkkaGrpcClientHelpers.getHttp2Endpoint(serverEndpoints)) - } - - /** - * Configure a factory from an application and a server endpoints. - */ - def factoryForAppEndpoints[T <: AkkaGrpcClient: ClassTag](app: Application, serverEndpoint: ServerEndpoint): AkkaGrpcClientFactory.Configured[T] = { - implicit val sys: ActorSystem = app.actorSystem - implicit val materializer: Materializer = app.materializer - implicit val executionContext: ExecutionContext = sys.dispatcher - AkkaGrpcClientFactory.configure[T](JavaAkkaGrpcClientHelpers.grpcClientSettings(serverEndpoint, sys)) - } -} diff --git a/play-testkit/src/test/java/akka/grpc/play/test/PlayJavaFunctionalTest.java b/play-testkit/src/test/java/akka/grpc/play/test/PlayJavaFunctionalTest.java deleted file mode 100644 index 8b8a98265..000000000 --- a/play-testkit/src/test/java/akka/grpc/play/test/PlayJavaFunctionalTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -package akka.grpc.play.test; - -import akka.grpc.GrpcClientSettings; -import akka.grpc.play.JavaAkkaGrpcClientHelpers; - -import example.myapp.helloworld.grpc.*; - -import org.junit.*; - -import play.*; -import play.api.routing.*; -import play.api.test.*; -import play.inject.guice.*; -import play.libs.ws.*; - -import java.util.concurrent.TimeUnit; - -import static org.junit.Assert.*; -import static play.inject.Bindings.*; - -public final class PlayJavaFunctionalTest { - private final TestServerFactory testServerFactory = new DefaultTestServerFactory(); - - private Application app; - private RunningServer runningServer; - - private Application provideApplication() { - return new GuiceApplicationBuilder() - .overrides(bind(Router.class).to(GreeterServiceImpl.class)) - .build(); - } - - @Before - public void startServer() throws Exception { - if (runningServer != null) - runningServer.stopServer().close(); - app = provideApplication(); - final play.api.Application app = this.app.asScala(); - runningServer = testServerFactory.start(app); - } - - @After - public void stopServer() throws Exception { - if (runningServer != null) { - runningServer.stopServer().close(); - runningServer = null; - app = null; - } - } - - private WSResponse wsGet(final String path) throws Exception { - final WSClient wsClient = app.injector().instanceOf(WSClient.class); - final String url = runningServer.endpoints().httpEndpoint().get().pathUrl(path); - return wsClient.url(url).get().toCompletableFuture().get(); - } - - @Test public void returns404OnNonGrpcRequest() throws Exception { - assertEquals(404, wsGet("/").getStatus()); // Maybe should be a 426, see #396 - } - - @Test public void returns200OnNonExistentGrpcMethod() throws Exception { - final WSResponse rsp = wsGet("/" + GreeterService.name + "/FooBar"); - assertEquals(200, rsp.getStatus()); // Maybe should be a 426, see #396 - } - - @Test public void returns200OnEmptyRequestToAGrpcMethod() throws Exception { - final WSResponse rsp = wsGet("/" + GreeterService.name + "/SayHello"); - assertEquals(200, rsp.getStatus()); // Maybe should be a 426, see #396 - } - - @Test public void worksWithAGrpcClient() throws Exception { - final HelloRequest req = HelloRequest.newBuilder().setName("Alice").build(); - final GrpcClientSettings grpcClientSettings = - JavaAkkaGrpcClientHelpers.grpcClientSettings(runningServer); - final GreeterServiceClient greeterServiceClient = GreeterServiceClient.create( - grpcClientSettings, app.asScala().materializer(), app.asScala().actorSystem().dispatcher()); - try { - final HelloReply helloReply = greeterServiceClient.sayHello(req).toCompletableFuture().get(); - assertEquals("Hello, Alice!", helloReply.getMessage()); - } finally { - greeterServiceClient.close().toCompletableFuture().get(30, TimeUnit.SECONDS); - } - } - -} diff --git a/play-testkit/src/test/java/example/myapp/helloworld/grpc/GreeterServiceImpl.java b/play-testkit/src/test/java/example/myapp/helloworld/grpc/GreeterServiceImpl.java deleted file mode 100644 index 854f47dd0..000000000 --- a/play-testkit/src/test/java/example/myapp/helloworld/grpc/GreeterServiceImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -package example.myapp.helloworld.grpc; - -import akka.stream.Materializer; - -import javax.inject.Inject; -import javax.inject.Singleton; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionStage; - -/** User implementation, with support for dependency injection etc */ -@Singleton -public class GreeterServiceImpl extends AbstractGreeterServiceRouter { - @Inject public GreeterServiceImpl(final Materializer mat) { super(mat); } - - @Override - public CompletionStage sayHello(final HelloRequest in) { - final String message = String.format("Hello, %s!", in.getName()); - final HelloReply reply = HelloReply.newBuilder().setMessage(message).build(); - return CompletableFuture.completedFuture(reply); - } -} diff --git a/play-testkit/src/test/scala/example/myapp/helloworld/grpc/helloworld/GreeterServiceImpl.scala b/play-testkit/src/test/scala/example/myapp/helloworld/grpc/helloworld/GreeterServiceImpl.scala deleted file mode 100644 index c9aa8a774..000000000 --- a/play-testkit/src/test/scala/example/myapp/helloworld/grpc/helloworld/GreeterServiceImpl.scala +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2018 Lightbend Inc. - */ - -package example.myapp.helloworld.grpc.helloworld - -import akka.stream.Materializer -import javax.inject.{ Inject, Singleton } - -import scala.concurrent.Future - -/** User implementation, with support for dependency injection etc */ -@Singleton -class GreeterServiceImpl @Inject() (implicit mat: Materializer) extends AbstractGreeterServiceRouter(mat) { - - override def sayHello(in: HelloRequest): Future[HelloReply] = Future.successful(HelloReply(s"Hello, ${in.name}!")) - -} -// #service-impl diff --git a/project/Dependencies.scala b/project/Dependencies.scala index d0b9ebf91..11b2b4c9b 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -21,7 +21,6 @@ object Dependencies { val sslConfig = "0.3.6" val scalaTest = "3.0.5" - val scalaTestPlusPlay = "4.0.0-RC1" val maven = "3.5.4" } @@ -55,13 +54,7 @@ object Dependencies { val plexusBuildApi = "org.sonatype.plexus" % "plexus-build-api" % "0.0.7" % "optional"// Apache v2 val play = "com.typesafe.play" %% "play" % Versions.play exclude("javax.activation", "javax.activation-api") // Apache V2 (exclusion is "either GPL or CDDL") - val playJava = "com.typesafe.play" %% "play-java" % Versions.play // Apache V2 - val playGuice = "com.typesafe.play" %% "play-guice" % Versions.play // Apache V2 val playAkkaHttpServer = "com.typesafe.play" %% "play-akka-http-server" % Versions.play // Apache V2 - - val playTest = "com.typesafe.play" %% "play-test" % Versions.play // Apache V2 - val playSpecs2 = "com.typesafe.play" %% "play-specs2" % Versions.play // Apache V2 - val scalaTestPlusPlay = "org.scalatestplus.play" %% "scalatestplus-play" % Versions.scalaTestPlusPlay // Apache V2 } object Test { @@ -70,10 +63,6 @@ object Dependencies { val junit = "junit" % "junit" % "4.12" % "test" // Common Public License 1.0 val akkaDiscoveryConfig = "com.lightbend.akka.discovery" %% "akka-discovery-config" % Versions.akkaDiscovery % "test" val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % Versions.akka % "test" - val playAhcWs = "com.typesafe.play" %% "play-ahc-ws" % Versions.play % Test // Apache V2 - val playTest = Compile.playTest % Test - val playSpecs2 = Compile.playSpecs2 % Test - val scalaTestPlusPlay = Compile.scalaTestPlusPlay % Test } object Plugins { @@ -129,22 +118,6 @@ object Dependencies { addSbtPlugin(Plugins.sbtProtoc), ) - val playTestdata = l ++= Seq( - // usually automatically added by `suggestedDependencies`, which doesn't work with ReflectiveCodeGen - Compile.play, - Compile.grpcStub, - Compile.playAkkaHttpServer, - ) - - val playTestkit = l ++= Seq( - Compile.play, - Compile.playTest, - Test.playAhcWs, - ) - - val playSpecs2 = l += Compile.playSpecs2 - val playScalaTest = l += Compile.scalaTestPlusPlay - val interopTests = l ++= Seq( Compile.grpcInteropTesting, Compile.grpcInteropTesting % "protobuf", // gets the proto files for interop tests @@ -157,23 +130,4 @@ object Dependencies { // usually automatically added by `suggestedDependencies`, which doesn't work with ReflectiveCodeGen Compile.grpcStub, ) ++ testing - - val playInteropTestScala = l ++= Seq( - // TODO #193 - Compile.grpcStub, - Compile.play, - Compile.playGuice, - Compile.playAkkaHttpServer, - Test.playSpecs2, - Test.scalaTestPlusPlay, - ) ++ testing - - val playInteropTestJava = l ++= Seq( - // TODO #193 - Compile.grpcStub, - Compile.play, - Compile.playGuice, - Compile.playAkkaHttpServer, - Compile.playJava, - ) ++ testing }