Skip to content

Commit

Permalink
Move to play 3 / pekko
Browse files Browse the repository at this point in the history
  • Loading branch information
larousso committed Oct 4, 2024
1 parent 122be04 commit e32715d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 15 deletions.
56 changes: 47 additions & 9 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,56 @@ services:
command: mongod --port 27018
ports:
- 27018:27018
kafka:
image: spotify/kafka
ports:
- 2181:2181
- 9092:9092
environment:
ADVERTISED_HOST: 127.0.0.1
ADVERTISED_PORT: 9092
s3server:
image: scality/s3server
ports:
- 8000:8000
environment:
- "SCALITY_ACCESS_KEY_ID=newAccessKey"
- "SCALITY_SECRET_ACCESS_KEY=newSecretKey"
- "SCALITY_SECRET_ACCESS_KEY=newSecretKey"
zookeeper_test:
image: confluentinc/cp-zookeeper:5.2.3
ports:
- 32182:32182
environment:
ZOOKEEPER_CLIENT_PORT: 32182
ZOOKEEPER_TICK_TIME: 2000
extra_hosts:
- "moby:127.0.0.1"
- "localhost: 127.0.0.1"
kafka_test:
image: confluentinc/cp-kafka:5.2.3
ports:
- 9092:9092
depends_on:
- zookeeper_test
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper_test:32182
KAFKA_LISTENERS: "INTERNAL://:9093,EXTERNAL://:9092"
KAFKA_ADVERTISED_LISTENERS: "INTERNAL://kafka_test:9093,EXTERNAL://localhost:9092"
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT"
KAFKA_INTER_BROKER_LISTENER_NAME: "INTERNAL"
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_DELETE_TOPIC_ENABLE: "true"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_NUM_PARTITIONS: 5
extra_hosts:
- "moby:127.0.0.1"
- "localhost: 127.0.0.1"
akhq_test:
image: tchiotludo/akhq
ports:
- 9005:8080
environment:
AKHQ_CONFIGURATION: |
akhq:
connections:
docker-kafka-server:
properties:
bootstrap.servers: "kafka_test:9092"
depends_on:
- kafka_test
extra_hosts:
- "moby:127.0.0.1"
- "localhost: 127.0.0.1"
2 changes: 1 addition & 1 deletion nio-server/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-serialization-jackson" % pekko,
"org.apache.pekko" %% "pekko-http" % "1.1.0",
"org.apache.pekko" %% "pekko-http-xml" % "1.1.0",
"org.apache.pekko" %% "pekko-connectors-kafka" % pekkoKafka,
"org.reactivemongo" %% "reactivemongo" % s"$reactiveMongoVersion-pekko.RC13",
"org.reactivemongo" %% "play2-reactivemongo" % s"$reactiveMongoVersion-play30.RC13",
"org.reactivemongo" %% "reactivemongo-pekkostream" % s"$reactiveMongoVersion-RC13",
"org.apache.pekko" %% "pekko-connectors-kafka" % pekkoKafka,

"org.apache.commons" % "commons-lang3" % "3.11",
"de.svenkubiak" % "jBCrypt" % "0.4.1", // ISC/BSD
Expand Down
6 changes: 3 additions & 3 deletions nio-server/test/controllers/EventControllerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package controllers
import java.util.concurrent.atomic.AtomicBoolean

import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.stream.{ActorMaterializer, Materializer}
import org.apache.pekko.stream.{Materializer, ActorMaterializer}
import play.api.libs.json.Json
import play.api.libs.ws.WSResponse
import play.api.test.Helpers._
Expand All @@ -27,9 +27,9 @@ class EventControllerSpec extends TestUtils {
"EventController" should {

"listen events, create a new tenant then check that the received event is valid" ignore {
val system = nioComponents.actorSystem
val system: ActorSystem = nioComponents.actorSystem

implicit val materializer = Materializer(system)
implicit val materializer: Materializer = Materializer.createMaterializer(system)

val response: WSResponse =
callJson("/tenants", POST, tenant1AsJson, headers = jsonHeaders)
Expand Down
2 changes: 1 addition & 1 deletion nio-server/test/utils/TestUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ trait TestUtils
.alsoTo(Sink.foreach(v => println(s"read events ${Json.stringify(v)}")))
.runWith(Sink.last)

Await.result[JsValue](lastEvent, Duration(10, TimeUnit.SECONDS))
Await.result[JsValue](lastEvent, Duration(30, TimeUnit.SECONDS))
}

def readLastNKafkaEvents(n: Int): Seq[JsValue] = {
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ object Dependencies {
val macwireVersion = "2.3.7"
val metricsVersion = "4.0.2"
val pekkoS3Version = "1.0.2"
val scalatestPlay = "5.1.0"
val scalatestPlay = "7.0.1"
val javaJwt = "3.11.0"
}

0 comments on commit e32715d

Please sign in to comment.