Skip to content

Commit

Permalink
Merge pull request #62 from moia-oss/typed
Browse files Browse the repository at this point in the history
#56: Use Akka Typed
  • Loading branch information
saeltz authored Feb 28, 2022
2 parents 8ddd6be + cee2501 commit c7c636a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 22 deletions.
26 changes: 13 additions & 13 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,19 @@ lazy val library =
val scalaLogging = "3.9.4"
val scalaTest = "3.2.11"
}
val akkaActor = "com.typesafe.akka" %% "akka-actor" % Version.akka
val akkaHttp = "com.typesafe.akka" %% "akka-http" % Version.akkaHttp
val akkaHttpTestkit = "com.typesafe.akka" %% "akka-http-testkit" % Version.akkaHttp
val akkaStream = "com.typesafe.akka" %% "akka-stream" % Version.akka
val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % Version.akka
val log4jApi = "org.apache.logging.log4j" % "log4j-api" % Version.log4j
val log4jCore = "org.apache.logging.log4j" % "log4j-core" % Version.log4j
val logJulOverLog4j = "org.apache.logging.log4j" % "log4j-jul" % Version.log4j
val logSlfOverLog4j = "org.apache.logging.log4j" % "log4j-slf4j-impl" % Version.log4j
val pureConfig = "com.github.pureconfig" %% "pureconfig" % Version.pureConfig
val scalaCheck = "org.scalacheck" %% "scalacheck" % Version.scalaCheck
val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % Version.scalaLogging
val scalaTest = "org.scalatest" %% "scalatest" % Version.scalaTest
val akkaActor = "com.typesafe.akka" %% "akka-actor-typed" % Version.akka
val akkaHttp = "com.typesafe.akka" %% "akka-http" % Version.akkaHttp
val akkaHttpTestkit = "com.typesafe.akka" %% "akka-http-testkit" % Version.akkaHttp
val akkaStream = "com.typesafe.akka" %% "akka-stream-typed" % Version.akka
val akkaTestkit = "com.typesafe.akka" %% "akka-actor-testkit-typed" % Version.akka
val log4jApi = "org.apache.logging.log4j" % "log4j-api" % Version.log4j
val log4jCore = "org.apache.logging.log4j" % "log4j-core" % Version.log4j
val logJulOverLog4j = "org.apache.logging.log4j" % "log4j-jul" % Version.log4j
val logSlfOverLog4j = "org.apache.logging.log4j" % "log4j-slf4j-impl" % Version.log4j
val pureConfig = "com.github.pureconfig" %% "pureconfig" % Version.pureConfig
val scalaCheck = "org.scalacheck" %% "scalacheck" % Version.scalaCheck
val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % Version.scalaLogging
val scalaTest = "org.scalatest" %% "scalatest" % Version.scalaTest
}

// *****************************************************************************
Expand Down
7 changes: 4 additions & 3 deletions samples/src/main/scala/io/moia/itkit/samples/Main.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.moia.itkit.samples

import akka.actor.ActorSystem
import akka.actor.typed.ActorSystem
import akka.actor.typed.scaladsl.Behaviors
import akka.http.scaladsl.Http
import akka.http.scaladsl.settings.ServerSettings
import io.moia.itkit.Logger
Expand All @@ -9,8 +10,8 @@ import scala.util.{Failure, Success}

object Main extends Logger {
def main(args: Array[String]): Unit = {
implicit val system: ActorSystem = ActorSystem()
import system.dispatcher
implicit val system: ActorSystem[Nothing] = ActorSystem(Behaviors.empty, "itkit")
import system.executionContext

type OptionMap = Map[Symbol, String]

Expand Down
9 changes: 7 additions & 2 deletions src/main/scala/io/moia/itkit/OneClientPerSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

package io.moia.itkit

import akka.actor.ActorSystem
import akka.actor.typed.ActorSystem
import akka.actor.typed.scaladsl.Behaviors
import akka.http.scaladsl.model.Uri
import akka.http.scaladsl.{Http, HttpExt}
import akka.stream.Materializer
Expand All @@ -18,7 +19,11 @@ trait OneClientPerSuite extends AsyncTestSuiteMixin with ClientProvider { this:
}
""")

implicit private val system: ActorSystem = ActorSystem(s"itkit-client-${suiteId.hashCode().toString}", ConfigFactory.load(clientConfig))
implicit private val system: ActorSystem[Nothing] = ActorSystem(
guardianBehavior = Behaviors.empty,
name = s"itkit-client-${suiteId.hashCode().toString}",
config = ConfigFactory.load(clientConfig)
)

implicit protected val actorMaterializer: Materializer = implicitly[Materializer]

Expand Down
9 changes: 7 additions & 2 deletions src/main/scala/io/moia/itkit/OneServerPerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
package io.moia
package itkit

import akka.actor.ActorSystem
import akka.actor.typed.ActorSystem
import akka.actor.typed.scaladsl.Behaviors
import akka.http.scaladsl.model.Uri
import akka.http.scaladsl.{Http, HttpExt}
import akka.stream.Materializer
Expand All @@ -24,7 +25,11 @@ trait OneServerPerTest extends AsyncTestSuiteMixin { this: AsyncTestSuite =>
}
""")

implicit private val system: ActorSystem = ActorSystem(s"itkit-client-${suiteId.hashCode().toString}", ConfigFactory.load(clientConfig))
implicit private val system: ActorSystem[Nothing] = ActorSystem(
guardianBehavior = Behaviors.empty,
name = s"itkit-client-${suiteId.hashCode().toString}",
config = ConfigFactory.load(clientConfig)
)
implicit protected val materializer: Materializer = implicitly[Materializer]

private lazy val suiteHttp: HttpExt = Http()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

package io.moia.itkit.fixture

import akka.actor.ActorSystem
import akka.actor.typed.ActorSystem
import akka.actor.typed.scaladsl.Behaviors
import akka.http.scaladsl.model.Uri
import akka.http.scaladsl.{Http, HttpExt}
import akka.stream.Materializer
Expand All @@ -22,7 +23,11 @@ trait OneServerPerTestWithClient extends AsyncTestSuiteMixin with ProcessProvide
}
""")

implicit private val system: ActorSystem = ActorSystem(s"itkit-client-${suiteId.hashCode().toString}", ConfigFactory.load(clientConfig))
implicit private val system: ActorSystem[Nothing] = ActorSystem(
guardianBehavior = Behaviors.empty,
name = s"itkit-client-${suiteId.hashCode().toString}",
config = ConfigFactory.load(clientConfig)
)

implicit protected val actorMaterializer: Materializer = implicitly[Materializer]

Expand Down

0 comments on commit c7c636a

Please sign in to comment.