Package csw.testkit
Class FrameworkTestKit
- java.lang.Object
-
- csw.testkit.FrameworkTestKit
-
public final class FrameworkTestKit extends java.lang.ObjectFrameworkTestKit supports starting one or more services fromcsw.testkit.scaladsl.CSWServiceIt also provides helpers to spawn components in standalone or container modeExample:
private val testKit = FrameworkTestKit() // this will start Event and Alarm Server (Note: Location Server will always be started as it is required by all other services) testKit.start(EventServer, AlarmServer) // spawn component in standalone mode testKit.spawnStandalone(ConfigFactory.load("standalone.conf")) // stopping services testKit.shutdown()
-
-
Constructor Summary
Constructors Constructor Description FrameworkTestKit()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command>actorSystem()AlarmTestKitalarmTestKit()static FrameworkTestKitapply(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem, TestKitSettings testKitSettings)Scala API for creating FrameworkTestKitConfigTestKitconfigTestKit()static FrameworkTestKitcreate()Java API for creating FrameworkTestKitstatic FrameworkTestKitcreate(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem)Java API for creating FrameworkTestKitstatic FrameworkTestKitcreate(TestKitSettings testKitSettings)Java API for creating FrameworkTestKitscala.concurrent.ExecutionContextec()EventTestKiteventTestKit()csw.framework.internal.wiring.FrameworkWiringframeworkWiring()LocationTestKitlocationTestKit()voidshutdown()Shutdown all testkits which are started.akka.actor.typed.ActorRef<ContainerMessage>spawnContainer(com.typesafe.config.Config config)Use this to start multiple components in container modeakka.actor.typed.ActorRef<ComponentMessage>spawnStandalone(com.typesafe.config.Config config)Use this to start component in standalone modevoidstart(csw.testkit.scaladsl.CSWService... services)Before running tests, use this or [FrameworkTestKit#startAll] method to start required servicesvoidstart(scala.collection.immutable.Seq<csw.testkit.scaladsl.CSWService> services)Before running tests, use this or [FrameworkTestKit#startAll] method to start required servicesvoidstartAll()Before running tests, use this or [FrameworkTestKit#start] method to start required servicesakka.util.Timeouttimeout()
-
-
-
Method Detail
-
apply
public static FrameworkTestKit apply(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem, TestKitSettings testKitSettings)
Scala API for creating FrameworkTestKit- Parameters:
actorSystem- actorSystem used for spawning componentstestKitSettings- custom testKitSettings- Returns:
- handle to FrameworkTestKit which can be used to start and stop all services started
-
create
public static FrameworkTestKit create()
Java API for creating FrameworkTestKit- Returns:
- handle to FrameworkTestKit which can be used to start and stop all services started
-
create
public static FrameworkTestKit create(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem)
Java API for creating FrameworkTestKit- Parameters:
actorSystem- actorSystem used for spawning components- Returns:
- handle to FrameworkTestKit which can be used to start and stop all services started
-
create
public static FrameworkTestKit create(TestKitSettings testKitSettings)
Java API for creating FrameworkTestKit- Parameters:
testKitSettings- custom testKitSettings- Returns:
- handle to FrameworkTestKit which can be used to start and stop all services started
-
start
public void start(csw.testkit.scaladsl.CSWService... services)
Before running tests, use this or [FrameworkTestKit#startAll] method to start required servicesThis will always start location server as it is required by all other services along with provided services
- Parameters:
services- (undocumented)
-
actorSystem
public akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem()
-
locationTestKit
public LocationTestKit locationTestKit()
-
configTestKit
public ConfigTestKit configTestKit()
-
eventTestKit
public EventTestKit eventTestKit()
-
alarmTestKit
public AlarmTestKit alarmTestKit()
-
frameworkWiring
public csw.framework.internal.wiring.FrameworkWiring frameworkWiring()
-
ec
public scala.concurrent.ExecutionContext ec()
-
timeout
public akka.util.Timeout timeout()
-
startAll
public void startAll()
Before running tests, use this or [FrameworkTestKit#start] method to start required servicesThis will start following services: [LocationServer, ConfigServer, EventServer, AlarmServer]
-
start
public void start(scala.collection.immutable.Seq<csw.testkit.scaladsl.CSWService> services)
Before running tests, use this or [FrameworkTestKit#startAll] method to start required servicesThis will always start location server as it is required by all other services along with provided services
- Parameters:
services- (undocumented)
-
spawnStandalone
public akka.actor.typed.ActorRef<ComponentMessage> spawnStandalone(com.typesafe.config.Config config)
Use this to start component in standalone mode- Parameters:
config- configuration of standalone component- Returns:
- actorRef of spawned standalone component (supervisor)
-
spawnContainer
public akka.actor.typed.ActorRef<ContainerMessage> spawnContainer(com.typesafe.config.Config config)
Use this to start multiple components in container mode- Parameters:
config- configuration of container- Returns:
- actorRef of spawned container
-
shutdown
public void shutdown()
Shutdown all testkits which are started.
-
-