Package csw.testkit

Class AlarmTestKit

  • All Implemented Interfaces:
    EmbeddedRedis, RedisStore

    public final class AlarmTestKit
    extends java.lang.Object
    implements RedisStore
    AlarmTestKit supports starting Alarm server using embedded redis internally (sentinel + master) and registering it with location service

    Example:

    
       private val testKit = AlarmTestKit()
    
       // starting alarm server (start sentinel and master on default ports specified in configuration file)
       // it will also register AlarmService with location service
       testKit.startAlarmService()
    
       // stopping alarm server
       testKit.shutdownAlarmService()
    
     

    • Constructor Detail

      • AlarmTestKit

        public AlarmTestKit()
    • Method Detail

      • apply

        public static AlarmTestKit apply​(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem,
                                         TestKitSettings testKitSettings)
        Create a AlarmTestKit

        When the test has completed you should shutdown the alarm service with shutdownAlarmService().

        Parameters:
        actorSystem - (undocumented)
        testKitSettings - (undocumented)
        Returns:
        handle to AlarmTestKit which can be used to start and stop alarm service
      • create

        public static AlarmTestKit create​(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem)
        Java API to create a EventTestKit

        Parameters:
        actorSystem - (undocumented)
        Returns:
        handle to EventTestKit which can be used to start and stop event service
      • create

        public static AlarmTestKit create​(TestKitSettings testKitSettings)
        Java API to create a AlarmTestKit

        Parameters:
        testKitSettings - custom testKitSettings
        Returns:
        handle to AlarmTestKit which can be used to start and stop alarm service
      • untypedSystem

        public akka.actor.ActorSystem untypedSystem()
        Specified by:
        untypedSystem in interface RedisStore
      • ec

        public scala.concurrent.ExecutionContext ec()
        Specified by:
        ec in interface RedisStore
      • system

        public akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> system()
        Specified by:
        system in interface RedisStore
      • timeout

        public akka.util.Timeout timeout()
        Specified by:
        timeout in interface RedisStore
      • masterId

        protected java.lang.String masterId()
        Specified by:
        masterId in interface RedisStore
      • startAlarmService

        public csw.location.api.scaladsl.RegistrationResult startAlarmService​(int sentinelPort,
                                                                              int serverPort)
        Scala API to Start Alarm service

        It will start redis sentinel and redis server on provided ports and then register's Alarm service with location service

        Parameters:
        sentinelPort - (undocumented)
        serverPort - (undocumented)
        Returns:
        (undocumented)
      • startAlarmService

        public void startAlarmService​(java.util.Optional<java.lang.Object> sentinelPort,
                                      java.util.Optional<java.lang.Object> serverPort)
        Java API to Start Alarm service

        It will start redis sentinel and redis server on provided ports and then register's Alarm service with location service

        Parameters:
        sentinelPort - (undocumented)
        serverPort - (undocumented)
      • shutdownAlarmService

        public void shutdownAlarmService()
        Shutdown Alarm service

        When the test has completed, make sure you shutdown Alarm service. This will terminate actor system and stop redis sentinel and redis server.