Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ package org.apache.pekko.actor.testkit.typed

import java.util.Optional

import org.slf4j.Marker
import org.slf4j.event.Level

import org.apache.pekko
import pekko.annotation.InternalApi
import pekko.util.OptionConverters._
import pekko.util.OptionVal

import org.slf4j.Marker
import org.slf4j.event.Level

/**
* Representation of a Log Event issued by a [[pekko.actor.typed.Behavior]]
* when testing with [[pekko.actor.testkit.typed.scaladsl.BehaviorTestKit]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ package org.apache.pekko.actor.testkit.typed

import java.util.Optional

import org.slf4j.Marker
import org.slf4j.event.Level

import org.apache.pekko
import pekko.util.ccompat.JavaConverters._
import pekko.util.OptionConverters._
import pekko.util.ccompat.JavaConverters._

import org.slf4j.Marker
import org.slf4j.event.Level

object LoggingEvent {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ package org.apache.pekko.actor.testkit.typed

import scala.concurrent.duration.{ Duration, FiniteDuration }

import com.typesafe.config.Config

import org.apache.pekko
import pekko.actor.typed.ActorSystem
import pekko.actor.typed.Extension
import pekko.actor.typed.ExtensionId
import pekko.util.JavaDurationConverters._
import pekko.util.Timeout

import com.typesafe.config.Config

object TestKitSettings {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
package org.apache.pekko.actor.testkit.typed.internal

import java.util.concurrent.{ CompletionStage, ThreadFactory }
import scala.concurrent._

import scala.annotation.nowarn
import com.typesafe.config.{ Config, ConfigFactory }
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import scala.concurrent._

import org.apache.pekko
import pekko.{ actor => classic }
import pekko.Done
Expand All @@ -39,6 +38,11 @@ import pekko.actor.typed.receptionist.Receptionist
import pekko.annotation.InternalApi
import pekko.util.FutureConverters._

import org.slf4j.Logger
import org.slf4j.LoggerFactory

import com.typesafe.config.{ Config, ConfigFactory }

/**
* INTERNAL API
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ import scala.collection.immutable
import scala.reflect.ClassTag
import scala.util.control.Exception.Catcher
import scala.util.control.NonFatal

import org.apache.pekko
import pekko.actor.ActorPath
import pekko.actor.testkit.typed.{ CapturedLogEvent, Effect }
import pekko.actor.testkit.typed.Effect._
import pekko.actor.typed.internal.AdaptWithRegisteredMessageAdapter
import pekko.actor.typed.{ ActorRef, Behavior, BehaviorInterceptor, PostStop, Signal, TypedActorContext }
import pekko.actor.typed.internal.AdaptWithRegisteredMessageAdapter
import pekko.actor.typed.receptionist.Receptionist
import pekko.actor.typed.scaladsl.Behaviors
import pekko.annotation.InternalApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ package org.apache.pekko.actor.testkit.typed.internal

import java.util.concurrent.ConcurrentLinkedQueue

import scala.concurrent.duration.FiniteDuration
import scala.reflect.ClassTag

import org.apache.pekko
import pekko.actor.{ ActorPath, Cancellable }
import pekko.actor.testkit.typed.Effect
import pekko.actor.testkit.typed.Effect._
import pekko.actor.typed.internal.TimerSchedulerCrossDslSupport
import pekko.actor.typed.{ ActorRef, Behavior, Props }
import pekko.actor.{ ActorPath, Cancellable }
import pekko.actor.typed.internal.TimerSchedulerCrossDslSupport
import pekko.annotation.InternalApi

import scala.concurrent.duration.FiniteDuration
import scala.reflect.ClassTag

/**
* INTERNAL API
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

package org.apache.pekko.actor.testkit.typed.internal

import org.slf4j.LoggerFactory
import org.slf4j.event.Level
import scala.annotation.tailrec

import org.apache.pekko.annotation.InternalApi

import scala.annotation.tailrec
import org.slf4j.LoggerFactory
import org.slf4j.event.Level

/**
* INTERNAL API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import scala.concurrent.duration.Duration
import scala.reflect.ClassTag
import scala.util.matching.Regex

import org.slf4j.event.Level

import org.apache.pekko
import pekko.actor.testkit.typed.LoggingEvent
import pekko.actor.testkit.typed.TestKitSettings
Expand All @@ -30,6 +28,8 @@ import pekko.actor.typed.ActorSystem
import pekko.annotation.InternalApi
import pekko.testkit.TestKit

import org.slf4j.event.Level

/**
* INTERNAL API
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,24 @@

package org.apache.pekko.actor.testkit.typed.internal

import java.util.concurrent.ThreadLocalRandom.{ current => rnd }

import scala.collection.immutable.TreeMap
import scala.concurrent.ExecutionContextExecutor
import scala.concurrent.duration.FiniteDuration

import org.apache.pekko
import pekko.{ actor => classic }
import pekko.actor.{ ActorPath, ActorRefProvider, InvalidMessageException }
import pekko.actor.testkit.typed.CapturedLogEvent
import pekko.actor.typed._
import pekko.actor.typed.internal._
import pekko.actor.{ ActorPath, ActorRefProvider, InvalidMessageException }
import pekko.annotation.InternalApi
import pekko.util.Helpers
import pekko.{ actor => classic }

import org.slf4j.{ Logger, Marker }
import org.slf4j.helpers.{ MessageFormatter, SubstituteLoggerFactory }

import java.util.concurrent.ThreadLocalRandom.{ current => rnd }
import scala.collection.immutable.TreeMap
import scala.concurrent.ExecutionContextExecutor
import scala.concurrent.duration.FiniteDuration

/**
* INTERNAL API
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@

package org.apache.pekko.actor.testkit.typed.internal

import java.util.Collections

import ch.qos.logback.classic.spi.ILoggingEvent
import ch.qos.logback.classic.spi.ThrowableProxy
import ch.qos.logback.core.AppenderBase
import org.slf4j.{ MDC, Marker }

import org.apache.pekko
import pekko.actor.testkit.typed.LoggingEvent
import pekko.annotation.InternalApi

import java.util.Collections
import org.slf4j.{ MDC, Marker }

/**
* INTERNAL API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ package org.apache.pekko.actor.testkit.typed.javadsl

import java.time.Duration

import com.typesafe.config.Config

import org.apache.pekko
import pekko.actor.DeadLetter
import pekko.actor.Dropped
Expand All @@ -32,6 +30,8 @@ import pekko.actor.typed.Scheduler
import pekko.util.JavaDurationConverters._
import pekko.util.Timeout

import com.typesafe.config.Config

object ActorTestKit {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@

package org.apache.pekko.actor.testkit.typed.javadsl

import java.util.concurrent.ThreadLocalRandom

import org.apache.pekko
import pekko.actor.testkit.typed.internal.{ ActorSystemStub, BehaviorTestKitImpl }
import pekko.actor.testkit.typed.{ CapturedLogEvent, Effect }
import pekko.actor.typed.receptionist.Receptionist
import pekko.actor.testkit.typed.internal.{ ActorSystemStub, BehaviorTestKitImpl }
import pekko.actor.typed.{ ActorRef, Behavior, Signal }
import pekko.actor.typed.receptionist.Receptionist
import pekko.annotation.{ ApiMayChange, DoNotInherit }
import com.typesafe.config.Config

import java.util.concurrent.ThreadLocalRandom
import com.typesafe.config.Config

object BehaviorTestKit {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
package org.apache.pekko.actor.testkit.typed.javadsl

import org.apache.pekko
import com.typesafe.config.Config
import pekko.actor.testkit.typed.internal.TestKitUtils
import pekko.actor.testkit.typed.scaladsl.ActorTestKit.ApplicationTestConfig
import pekko.actor.typed.ActorSystem

import com.typesafe.config.Config

final class JUnit5TestKitBuilder() {

var system: Option[ActorSystem[_]] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ import scala.util.control.NonFatal
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
import org.slf4j.LoggerFactory

import org.apache.pekko.actor.testkit.typed.internal.CapturingAppender

import org.slf4j.LoggerFactory

/**
* JUnit `TestRule` to make log lines appear only when the test failed.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@

package org.apache.pekko.actor.testkit.typed.javadsl

import org.junit.jupiter.api.extension.InvocationInterceptor.Invocation
import java.lang.reflect.Method

import scala.util.control.NonFatal

import org.junit.jupiter.api.extension.{ ExtensionContext, InvocationInterceptor, ReflectiveInvocationContext }
import org.slf4j.LoggerFactory
import org.junit.jupiter.api.extension.InvocationInterceptor.Invocation

import org.apache.pekko.actor.testkit.typed.internal.CapturingAppender

import java.lang.reflect.Method
import scala.util.control.NonFatal
import org.slf4j.LoggerFactory

final class LogCapturingExtension extends InvocationInterceptor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ package org.apache.pekko.actor.testkit.typed.javadsl

import java.util.function.Supplier

import org.slf4j.event.Level

import org.apache.pekko
import pekko.actor.testkit.typed.LoggingEvent
import pekko.actor.testkit.typed.internal.LoggingTestKitImpl
import pekko.actor.typed.ActorSystem
import pekko.annotation.DoNotInherit

import org.slf4j.event.Level

/**
* Facilities for verifying logs.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import java.time.Duration

import scala.annotation.varargs

import com.typesafe.config.Config

import org.apache.pekko
import pekko.actor.typed.ActorSystem
import pekko.actor.typed.internal.adapter.SchedulerAdapter
import pekko.util.JavaDurationConverters._

import com.typesafe.config.Config

/**
* Manual time allows you to do async tests while controlling the scheduler of the system.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

package org.apache.pekko.actor.testkit.typed.javadsl

import org.apache.pekko.actor.testkit.typed.annotations.JUnit5TestKit
import org.junit.jupiter.api.extension.{ AfterAllCallback, BeforeTestExecutionCallback, ExtensionContext }
import org.junit.platform.commons.support.AnnotationSupport

import org.apache.pekko.actor.testkit.typed.annotations.JUnit5TestKit

final class TestKitJUnit5Extension() extends AfterAllCallback with BeforeTestExecutionCallback {

var testKit: Option[ActorTestKit] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ package org.apache.pekko.actor.testkit.typed.javadsl

import java.time.Duration

import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
import org.junit.Rule
import org.junit.rules.ExternalResource

Expand All @@ -33,6 +31,9 @@ import pekko.actor.typed.Props
import pekko.actor.typed.Scheduler
import pekko.util.Timeout

import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory

/**
* A Junit external resource for the [[ActorTestKit]], making it possible to have Junit manage the lifecycle of the testkit.
* The testkit will be automatically shut down when the test completes or fails.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import java.util.{ List => JList }
import java.util.function.Supplier

import org.apache.pekko
import pekko.japi.function.Creator
import pekko.actor.testkit.typed.FishingOutcome
import pekko.actor.testkit.typed.TestKitSettings
import pekko.actor.testkit.typed.internal.TestProbeImpl
Expand All @@ -27,6 +26,7 @@ import pekko.actor.typed.ActorSystem
import pekko.actor.typed.RecipientRef
import pekko.actor.typed.internal.InternalRecipientRef
import pekko.annotation.DoNotInherit
import pekko.japi.function.Creator
import pekko.util.unused

object FishingOutcomes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ import scala.concurrent.Await
import scala.concurrent.duration._
import scala.reflect.ClassTag

import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
import org.slf4j.LoggerFactory

import org.apache.pekko
import pekko.actor.DeadLetter
import pekko.actor.DeadLetterSuppression
Expand All @@ -43,6 +39,11 @@ import pekko.actor.typed.scaladsl.adapter._
import pekko.annotation.InternalApi
import pekko.util.Timeout

import org.slf4j.LoggerFactory

import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory

object ActorTestKit {

private val testKitGuardianCounter = new AtomicInteger(0)
Expand Down
Loading