Skip to content

Commit

Permalink
workaround for scala/scala3#8588
Browse files Browse the repository at this point in the history
  • Loading branch information
giabao committed Apr 6, 2020
1 parent 0581f47 commit c7467c7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class FSMActorSpec extends AkkaSpec(Map("akka.actor.debug.fsm" -> true)) with Im
"log events and transitions if asked to do so" in {
import akka.util.ccompat.JavaConverters._
val config = ConfigFactory
.parseMap(Map("akka.loglevel" -> "DEBUG", "akka.actor.debug.fsm" -> true).asJava)
.parseMap(Map("akka.loglevel" -> "DEBUG", "akka.actor.debug.fsm" -> (true: java.lang.Boolean)).asJava)
.withFallback(system.settings.config)
val fsmEventSystem = ActorSystem("fsmEvent", config)
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ class LoggingReceiveSpec extends AnyWordSpec with BeforeAndAfterAll {
val config = ConfigFactory.parseString("""
akka.loglevel=DEBUG # test verifies debug
""").withFallback(AkkaSpec.testConf)
val appLogging =
ActorSystem("logging", ConfigFactory.parseMap(Map("akka.actor.debug.receive" -> true).asJava).withFallback(config))
val appAuto = ActorSystem(
"autoreceive",
ConfigFactory.parseMap(Map("akka.actor.debug.autoreceive" -> true).asJava).withFallback(config))
val appLifecycle = ActorSystem(
"lifecycle",
ConfigFactory.parseMap(Map("akka.actor.debug.lifecycle" -> true).asJava).withFallback(config))

private def debugActorSystem(name: String, debugKey: String) = {
// https://github.com/lampepfl/dotty/issues/8588
val m = Map(s"akka.actor.debug.$debugKey" -> (true: java.lang.Boolean))
ActorSystem(name, ConfigFactory.parseMap(m.asJava).withFallback(config))
}
val appLogging = debugActorSystem("logging", "receive")
val appAuto = debugActorSystem("autoreceive", "autoreceive")
val appLifecycle = debugActorSystem("lifecycle", "lifecycle")

val filter = TestEvent.Mute(EventFilter.custom {
case _: Logging.Debug => true
Expand Down
2 changes: 1 addition & 1 deletion akka-testkit/src/test/scala/akka/testkit/AkkaSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ object AkkaSpec {

def mapToConfig(map: Map[String, Any]): Config = {
import akka.util.ccompat.JavaConverters._
ConfigFactory.parseMap(map.asJava)
ConfigFactory.parseMap(map.asInstanceOf[Map[String, AnyRef]].asJava)
}

def testNameFromCallStack(classToStartFrom: Class[_]): String = {
Expand Down
4 changes: 2 additions & 2 deletions akka-testkit/src/test/scala/akka/testkit/AkkaSpecSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class AkkaSpecSpec extends AnyWordSpec with Matchers {
// verbose config just for demonstration purposes, please leave in in case of debugging
import akka.util.ccompat.JavaConverters._
val conf = Map(
"akka.actor.debug.lifecycle" -> true,
"akka.actor.debug.event-stream" -> true,
"akka.actor.debug.lifecycle" -> (true: java.lang.Boolean),
"akka.actor.debug.event-stream" -> (true: java.lang.Boolean),
"akka.loglevel" -> "DEBUG",
"akka.stdout-loglevel" -> "DEBUG")
val system = ActorSystem("AkkaSpec1", ConfigFactory.parseMap(conf.asJava).withFallback(AkkaSpec.testConf))
Expand Down

0 comments on commit c7467c7

Please sign in to comment.