diff --git a/.github/scala-steward.conf b/.github/scala-steward.conf
index f4a5c024..a7779b9b 100644
--- a/.github/scala-steward.conf
+++ b/.github/scala-steward.conf
@@ -10,3 +10,5 @@ updates.pin = [
# Prevent updates to 3.2.x and beyond
{ groupId = "org.scalatest", artifactId = "scalatest", version = "3.1."}
]
+
+updatePullRequests = false
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index 9b8306b5..ec275ba7 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -38,8 +38,8 @@ jobs:
- "check-docs"
uses: playframework/.github/.github/workflows/cmd.yml@v3
with:
- java: 11, 8
- scala: 2.12.x, 2.13.x
+ java: 17, 11
+ scala: 2.13.x
cmd: sbt ++$MATRIX_SCALA test
finish:
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 911e825c..db1edc72 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -9,5 +9,5 @@ on:
jobs:
publish-artifacts:
name: Publish / Artifacts
- uses: playframework/.github/.github/workflows/publish.yml@v2
+ uses: playframework/.github/.github/workflows/publish.yml@v3
secrets: inherit
diff --git a/.gitignore b/.gitignore
index dfba3254..8b3f873c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ target
node_modules/
/docs/build/
/docs/package*.json
+logs/
diff --git a/build.sbt b/build.sbt
index 84b47fbc..535cf828 100644
--- a/build.sbt
+++ b/build.sbt
@@ -116,6 +116,7 @@ val playGenerators = Project(id = "play-grpc-generators", file("play-generators"
buildInfoPackage := "play.grpc.gen",
// Only used in build tools (like sbt), so only 2.12 is needed:
crossScalaVersions := Seq(scala212),
+ scalaVersion := scala212,
)
val playTestkit = Project("play-grpc-testkit", file("play-testkit"))
diff --git a/play-scalatest/src/main/scala/play/grpc/scalatest/ServerGrpcClient.scala b/play-scalatest/src/main/scala/play/grpc/scalatest/ServerGrpcClient.scala
index 8577be71..4ae18dc2 100644
--- a/play-scalatest/src/main/scala/play/grpc/scalatest/ServerGrpcClient.scala
+++ b/play-scalatest/src/main/scala/play/grpc/scalatest/ServerGrpcClient.scala
@@ -27,8 +27,4 @@ trait ServerGrpcClient extends AkkaGrpcClientHelpers { this: BaseOneServerPerTes
): AkkaGrpcClientFactory.Configured[T] = {
AkkaGrpcClientHelpers.factoryForAppEndpoints(running.app, running.endpoints)
}
-
- protected override def newServerForTest(app: Application, testData: TestData): RunningServer =
- DefaultTestServerFactory.start(app)
-
}
diff --git a/play-scalatest/src/test/resources/application.conf b/play-scalatest/src/test/resources/application.conf
new file mode 100644
index 00000000..f91aa7f5
--- /dev/null
+++ b/play-scalatest/src/test/resources/application.conf
@@ -0,0 +1 @@
+play.ws.ssl.loose.acceptAnyCertificate = true
diff --git a/play-scalatest/src/test/resources/logback.xml b/play-scalatest/src/test/resources/logback.xml
new file mode 100644
index 00000000..ab6c2b12
--- /dev/null
+++ b/play-scalatest/src/test/resources/logback.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${application.home:-.}/logs/application.log
+
+ UTF-8
+ %d{yyyy-MM-dd HH:mm:ss} %highlight(%-5level) %cyan(%logger{36}) %magenta(%X{pekkoSource}) %msg%n
+
+
+
+
+
+
+
+ UTF-8
+ %d{yyyy-MM-dd HH:mm:ss} %highlight(%-5level) %cyan(%logger{36}) %magenta(%X{pekkoSource}) %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/play-scalatest/src/test/scala/play/grpc/scalatest/PlayActionsScalaTestSpec.scala b/play-scalatest/src/test/scala/play/grpc/scalatest/PlayActionsScalaTestSpec.scala
index 6086a310..b9e4164e 100644
--- a/play-scalatest/src/test/scala/play/grpc/scalatest/PlayActionsScalaTestSpec.scala
+++ b/play-scalatest/src/test/scala/play/grpc/scalatest/PlayActionsScalaTestSpec.scala
@@ -15,6 +15,7 @@ import play.api.inject.guice.GuiceApplicationBuilder
import play.api.libs.ws.WSClient
import play.api.routing.Router
import play.api.Application
+import play.grpc.testkit.SslTestServerFactory
/**
* Test for the Play gRPC ScalaTest APIs
@@ -26,6 +27,8 @@ class PlayActionsScalaTestSpec
with ScalaFutures
with IntegrationPatience {
+ override def testServerFactory = new SslTestServerFactory
+
override def fakeApplication(): Application = {
GuiceApplicationBuilder()
.overrides(bind[Router].to[GreeterServiceWithActionsImpl])
@@ -36,7 +39,7 @@ class PlayActionsScalaTestSpec
"A Play server bound to a gRPC router using actions" must {
"give a 404 when routing a non-gRPC request" in {
- val result = wsUrl("/").get.futureValue
+ val result = wsUrl("/", true).get.futureValue
result.status must be(404) // Maybe should be a 426, see #396
}
// this test results in a 500
@@ -54,7 +57,7 @@ class PlayActionsScalaTestSpec
// result.header("grpc-status") mustEqual Some(Status.Code.UNIMPLEMENTED.value().toString)
// }
"give a grpc 'invalid argument' error when routing an empty request to a gRPC method" in {
- val result = wsUrl(s"/${GreeterService.name}/SayHello")
+ val result = wsUrl(s"/${GreeterService.name}/SayHello", true)
.addHttpHeaders("Content-Type" -> GrpcProtocolNative.contentType.toString)
.get
.futureValue
diff --git a/play-scalatest/src/test/scala/play/grpc/scalatest/PlayScalaTestSpec.scala b/play-scalatest/src/test/scala/play/grpc/scalatest/PlayScalaTestSpec.scala
index e89a9c2c..77cfd343 100644
--- a/play-scalatest/src/test/scala/play/grpc/scalatest/PlayScalaTestSpec.scala
+++ b/play-scalatest/src/test/scala/play/grpc/scalatest/PlayScalaTestSpec.scala
@@ -15,6 +15,7 @@ import play.api.inject.guice.GuiceApplicationBuilder
import play.api.libs.ws.WSClient
import play.api.routing.Router
import play.api.Application
+import play.grpc.testkit.SslTestServerFactory
/**
* Test for the Play gRPC ScalaTest APIs
@@ -26,6 +27,8 @@ class PlayScalaTestSpec
with ScalaFutures
with IntegrationPatience {
+ override def testServerFactory = new SslTestServerFactory
+
override def fakeApplication(): Application = {
GuiceApplicationBuilder()
.overrides(bind[Router].to[GreeterServiceImpl])
@@ -36,15 +39,15 @@ class PlayScalaTestSpec
"A Play server bound to a gRPC router" must {
"give a 404 when routing a non-gRPC request" in {
- val result = wsUrl("/").get.futureValue
+ val result = wsUrl("/", true).get.futureValue
result.status must be(404) // Maybe should be a 426, see #396
}
"give a 415 error when not using a gRPC content-type" in {
- val result = wsUrl(s"/${GreeterService.name}/FooBar").get.futureValue
+ val result = wsUrl(s"/${GreeterService.name}/FooBar", true).get.futureValue
result.status must be(415)
}
"give a grpc 'unimplemented' error when routing a non-existent gRPC method" in {
- val result = wsUrl(s"/${GreeterService.name}/FooBar")
+ val result = wsUrl(s"/${GreeterService.name}/FooBar", true)
.addHttpHeaders("Content-Type" -> GrpcProtocolNative.contentType.toString)
.get
.futureValue
@@ -52,7 +55,7 @@ class PlayScalaTestSpec
result.header("grpc-status") mustEqual Some(Status.Code.UNIMPLEMENTED.value().toString)
}
"give a grpc 'invalid argument' error when routing an empty request to a gRPC method" in {
- val result = wsUrl(s"/${GreeterService.name}/SayHello")
+ val result = wsUrl(s"/${GreeterService.name}/SayHello", true)
.addHttpHeaders("Content-Type" -> GrpcProtocolNative.contentType.toString)
.get
.futureValue
diff --git a/play-specs2/src/test/resources/application.conf b/play-specs2/src/test/resources/application.conf
new file mode 100644
index 00000000..f91aa7f5
--- /dev/null
+++ b/play-specs2/src/test/resources/application.conf
@@ -0,0 +1 @@
+play.ws.ssl.loose.acceptAnyCertificate = true
diff --git a/play-specs2/src/test/resources/logback.xml b/play-specs2/src/test/resources/logback.xml
new file mode 100644
index 00000000..ab6c2b12
--- /dev/null
+++ b/play-specs2/src/test/resources/logback.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${application.home:-.}/logs/application.log
+
+ UTF-8
+ %d{yyyy-MM-dd HH:mm:ss} %highlight(%-5level) %cyan(%logger{36}) %magenta(%X{pekkoSource}) %msg%n
+
+
+
+
+
+
+
+ UTF-8
+ %d{yyyy-MM-dd HH:mm:ss} %highlight(%-5level) %cyan(%logger{36}) %magenta(%X{pekkoSource}) %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/play-specs2/src/test/scala/play/grpc/specs2/PlaySpecs2Spec.scala b/play-specs2/src/test/scala/play/grpc/specs2/PlaySpecs2Spec.scala
index 64814359..bbe2d7f9 100644
--- a/play-specs2/src/test/scala/play/grpc/specs2/PlaySpecs2Spec.scala
+++ b/play-specs2/src/test/scala/play/grpc/specs2/PlaySpecs2Spec.scala
@@ -14,6 +14,7 @@ import play.api.libs.ws.WSClient
import play.api.libs.ws.WSRequest
import play.api.routing.Router
import play.api.test._
+import play.grpc.testkit.SslTestServerFactory
/**
* Test for the Play gRPC Specs2 APIs
@@ -21,13 +22,15 @@ import play.api.test._
@RunWith(classOf[JUnitRunner])
class PlaySpecs2Spec extends ForServer with ServerGrpcClient with PlaySpecification with ApplicationFactories {
+ override def testServerFactory = new SslTestServerFactory
+
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)
+ val url = running.endpoints.httpsEndpoint.get.pathUrl(path)
ws.url(url)
}
diff --git a/play-testkit/src/main/java/play/grpc/testkit/JavaAkkaGrpcClientHelpers.java b/play-testkit/src/main/java/play/grpc/testkit/JavaAkkaGrpcClientHelpers.java
index b8ae7f50..9f89c7e7 100644
--- a/play-testkit/src/main/java/play/grpc/testkit/JavaAkkaGrpcClientHelpers.java
+++ b/play-testkit/src/main/java/play/grpc/testkit/JavaAkkaGrpcClientHelpers.java
@@ -31,7 +31,7 @@ public static ServerEndpoint getHttp2Endpoint(final ServerEndpoints serverEndpoi
.endpoints()
.filter(e -> e.protocols().contains("HTTP/2.0" /* Play's HttpProtocol.HTTP_2_0 */))
.toIterable();
- if (possibleEndpoints.size() == 0) {
+ if (possibleEndpoints.isEmpty()) {
throw new IllegalArgumentException(
String.format(
"gRPC client can't automatically find HTTP/2 connection: "
@@ -60,7 +60,7 @@ public static GrpcClientSettings grpcClientSettings(
.getOrElse(
() -> {
throw new IllegalArgumentException(
- "GrpcClientSettings requires a server endpoint with ssl, but non provided");
+ "GrpcClientSettings requires a server endpoint with ssl, but none provided");
});
return grpcClientSettings(http2Endpoint, sslContext, actorSystem);
diff --git a/play-testkit/src/test/java/play/grpc/testkit/PlayJavaFunctionalTest.java b/play-testkit/src/test/java/play/grpc/testkit/PlayJavaFunctionalTest.java
index f1186b1a..0fdf6c05 100644
--- a/play-testkit/src/test/java/play/grpc/testkit/PlayJavaFunctionalTest.java
+++ b/play-testkit/src/test/java/play/grpc/testkit/PlayJavaFunctionalTest.java
@@ -19,7 +19,7 @@
import play.libs.ws.*;
public final class PlayJavaFunctionalTest {
- private final TestServerFactory testServerFactory = new DefaultTestServerFactory();
+ private final TestServerFactory testServerFactory = new SslTestServerFactory();
private Application app;
private RunningServer runningServer;
@@ -49,7 +49,7 @@ public void stopServer() throws Exception {
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);
+ final String url = runningServer.endpoints().httpsEndpoint().get().pathUrl(path);
return wsClient
.url(url)
.addHeader("Content-Type", GrpcProtocolNative.contentType().toString())
diff --git a/play-testkit/src/test/resources/application.conf b/play-testkit/src/test/resources/application.conf
index 8e91daa8..1451bd3a 100644
--- a/play-testkit/src/test/resources/application.conf
+++ b/play-testkit/src/test/resources/application.conf
@@ -1 +1,3 @@
-play.server.provider = play.core.server.AkkaHttpServerProvider
\ No newline at end of file
+play.server.provider = play.core.server.AkkaHttpServerProvider
+
+play.ws.ssl.loose.acceptAnyCertificate = true
diff --git a/play-testkit/src/test/resources/logback.xml b/play-testkit/src/test/resources/logback.xml
new file mode 100644
index 00000000..ab6c2b12
--- /dev/null
+++ b/play-testkit/src/test/resources/logback.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${application.home:-.}/logs/application.log
+
+ UTF-8
+ %d{yyyy-MM-dd HH:mm:ss} %highlight(%-5level) %cyan(%logger{36}) %magenta(%X{pekkoSource}) %msg%n
+
+
+
+
+
+
+
+ UTF-8
+ %d{yyyy-MM-dd HH:mm:ss} %highlight(%-5level) %cyan(%logger{36}) %magenta(%X{pekkoSource}) %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/play-testkit/src/test/scala/play/grpc/testkit/SslTestServerFactory.scala b/play-testkit/src/test/scala/play/grpc/testkit/SslTestServerFactory.scala
new file mode 100644
index 00000000..7b1d5b63
--- /dev/null
+++ b/play-testkit/src/test/scala/play/grpc/testkit/SslTestServerFactory.scala
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) from 2022 The Play Framework Contributors , 2011-2021 Lightbend Inc.
+ */
+package play.grpc.testkit
+
+import akka.annotation.ApiMayChange
+import play.api.test.DefaultTestServerFactory
+import play.api.Application
+import play.core.server.ServerConfig
+
+/**
+ * A test server factory that configures the server to use SSL.
+ */
+@ApiMayChange class SslTestServerFactory extends DefaultTestServerFactory {
+ override def serverConfig(app: Application): ServerConfig = {
+ super
+ .serverConfig(app)
+ .copy(
+ port = None,
+ sslPort = Some(0),
+ )
+ }
+}
diff --git a/project/CommonPlugin.scala b/project/CommonPlugin.scala
index 8585aacb..3398280b 100644
--- a/project/CommonPlugin.scala
+++ b/project/CommonPlugin.scala
@@ -18,7 +18,10 @@ object CommonPlugin extends AutoPlugin {
Nil
},
doc / javacOptions --= Seq("-Xlint:unchecked", "-Xlint:deprecation"),
- crossScalaVersions := Seq(scala212, scala213),
+ Test / javaOptions ++= Seq("--add-exports=java.base/sun.security.x509=ALL-UNNAMED"),
+ Test / fork := true,
+ crossScalaVersions := Seq(scala213),
+ scalaVersion := scala213,
)
val scalaVersionNumber = Def.setting(VersionNumber(scalaVersion.value))
diff --git a/project/Dependencies.scala b/project/Dependencies.scala
index 16efb8f2..b850aa07 100644
--- a/project/Dependencies.scala
+++ b/project/Dependencies.scala
@@ -17,13 +17,13 @@ object Dependencies {
// bumps Akka HTTP version beyond play's 10.1.x
val akkaHttp = "10.2.10"
- val akkaGrpc = AkkaGrpcBuildInfo.version
- val grpc = AkkaGrpcBuildInfo.grpcVersion
+ val akkaGrpc: String = AkkaGrpcBuildInfo.version
+ val grpc: String = AkkaGrpcBuildInfo.grpcVersion
- val play = "2.8.21"
+ val play = "2.9.1"
- val scalaTest = "3.1.4"
- val scalaTestPlusPlay = "5.1.0"
+ val scalaTest = "3.2.17"
+ val scalaTestPlusPlay = "6.0.1"
val macwire = "2.5.9"
}
@@ -74,7 +74,6 @@ object Dependencies {
val scalaTestPlusPlay = Compile.scalaTestPlusPlay % Test
val junitInterface = "com.github.sbt" % "junit-interface" % "0.13.3" % "test"
- val logback = "ch.qos.logback" % "logback-classic" % "1.2.12" % "test"
+ val logback = "ch.qos.logback" % "logback-classic" % "1.4.14" % "test"
}
-
}
diff --git a/project/build.properties b/project/build.properties
index 563a014d..abbbce5d 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version=1.7.2
+sbt.version=1.9.8
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 1301875a..133fa620 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,8 +1,8 @@
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.lightbend.akka" % "sbt-paradox-akka" % "0.44")
-addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.1")
+addSbtPlugin("com.typesafe.play" % "sbt-twirl" % "1.6.4")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")
-addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.1")
+addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("com.lightbend.sbt" % "sbt-java-formatter" % "0.8.0")
addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "2.1.5") // Sync with docs/antora.yml
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
diff --git a/project/project-info.conf b/project/project-info.conf
index 06c58d62..47ee00a5 100644
--- a/project/project-info.conf
+++ b/project/project-info.conf
@@ -1,7 +1,7 @@
project-info {
# version is overridden from the `projectInfoVersion` key (which defaults to sbt's project version)
version: "current"
- jdk-versions: ["OpenJDK 8"]
+ jdk-versions: ["Eclipse Temurin OpenJDK 11"]
title: "play-grpc"
issues: {
url: "https://github.com/playframework/play-grpc/issues"