Package csw.testkit

Class EventTestKit

  • All Implemented Interfaces:
    EmbeddedRedis, RedisStore

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

    Example:

    
       private val testKit = EventTestKit()
    
       // starting event server (start sentinel on port 6379 and master on port 6378)
       // it will also register EventService with location service
       testKit.startEventService(sentinelPort = 6379, serverPort = 6378)
    
       // stopping event server
       testKit.shutdownEventService()
    
     
    • Constructor Detail

      • EventTestKit

        public EventTestKit()
    • Method Detail

      • apply

        public static EventTestKit apply​(akka.actor.typed.ActorSystem<?> actorSystem,
                                         TestKitSettings testKitSettings)
        Create a EventTestKit

        When the test has completed you should shutdown the event service with shutdownEventService().

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

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

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

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

        Parameters:
        testKitSettings - custom testKitSettings
        Returns:
        handle to EventTestKit which can be used to start and stop event 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<?> 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
      • startEventService

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

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

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

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

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

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

        public void shutdownEventService()
        Shutdown Event service

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