Skip to content

Commit

Permalink
fix typo for sourceActorSystem and mistake package name (#641)
Browse files Browse the repository at this point in the history
* fix typo for sourceActorSystem

* fix mistake package
  • Loading branch information
laglangyue committed Apr 29, 2024
1 parent 4e04617 commit d9ca03f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class TypedMqttFlowSpec
abstract class MqttFlowSpecBase(clientId: String, topic: String, system: ActorSystem) extends TestKit(system)
with AnyWordSpecLike with Matchers with BeforeAndAfterAll with ScalaFutures with LogCapturing {

override def sourceActorSytem = Some(system.name)
override def sourceActorSystem = Some(system.name)

private implicit val defaultPatience: PatienceConfig = PatienceConfig(timeout = 5.seconds, interval = 100.millis)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ import org.slf4j.LoggerFactory
* the captured logging events are flushed to the appenders defined for the
* org.apache.pekko.actor.testkit.typed.internal.CapturingAppenderDelegate logger.
*
* The flushing on test failure is handled by [[pekko.actor.testkit.typed.scaladsl.LogCapturing]]
* for ScalaTest and [[pekko.actor.testkit.typed.javadsl.LogCapturing]] for JUnit.
* The flushing on test failure is handled by [[org.apache.pekko.actor.testkit.typed.scaladsl.LogCapturing]]
* for ScalaTest and [[org.apache.pekko.actor.testkit.typed.javadsl.LogCapturing]] for JUnit.
*
* Use configuration like the following the logback-test.xml:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import org.slf4j.MDC
trait LogCapturing extends BeforeAndAfterAll { self: TestSuite =>

// Can be overridden to filter on sourceActorSystem
def sourceActorSytem: Option[String] = None
def sourceActorSystem: Option[String] = None

// eager access of CapturingAppender to fail fast if misconfigured
private val capturingAppender = CapturingAppender.get("")
Expand All @@ -64,18 +64,18 @@ trait LogCapturing extends BeforeAndAfterAll { self: TestSuite =>
}

abstract override def withFixture(test: NoArgTest): Outcome = {
sourceActorSytem.foreach(MDC.put("sourceActorSystem", _))
sourceActorSystem.foreach(MDC.put("sourceActorSystem", _))
myLogger.info(s"Logging started for test [${self.getClass.getName}: ${test.name}]")
sourceActorSytem.foreach(_ => MDC.remove("sourceActorSystem"))
sourceActorSystem.foreach(_ => MDC.remove("sourceActorSystem"))
val res = test()
sourceActorSytem.foreach(MDC.put("sourceActorSystem", _))
sourceActorSystem.foreach(MDC.put("sourceActorSystem", _))
myLogger.info(s"Logging finished for test [${self.getClass.getName}: ${test.name}] that [$res]")
sourceActorSytem.foreach(_ => MDC.remove("sourceActorSystem"))
sourceActorSystem.foreach(_ => MDC.remove("sourceActorSystem"))

if (!(res.isSucceeded || res.isPending)) {
println(
s"--> [${Console.BLUE}${self.getClass.getName}: ${test.name}${Console.RESET}] Start of log messages of test that [$res]")
capturingAppender.flush(sourceActorSytem)
capturingAppender.flush(sourceActorSystem)
println(
s"<-- [${Console.BLUE}${self.getClass.getName}: ${test.name}${Console.RESET}] End of log messages of test that [$res]")
}
Expand Down

0 comments on commit d9ca03f

Please sign in to comment.