Package csw.testkit

Class FrameworkTestKit


  • public final class FrameworkTestKit
    extends java.lang.Object
    FrameworkTestKit supports starting one or more services from csw.testkit.scaladsl.CSWService It also provides helpers to spawn components in standalone or container mode

    Example:

    
       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 Detail

      • FrameworkTestKit

        public FrameworkTestKit()
    • 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 components
        testKitSettings - 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 services

        This 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()
      • 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 services

        This 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 services

        This 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.