Package csw.testkit

Class EventTestKit

java.lang.Object
csw.testkit.EventTestKit
All Implemented Interfaces:
EmbeddedRedis, RedisStore

public final class EventTestKit extends 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 Details

    • EventTestKit

      public EventTestKit()
  • Method Details

    • 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 String masterId()
      Specified by:
      masterId in interface RedisStore
    • connection

      protected Connection.TcpConnection connection()
      Specified by:
      connection 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(Optional<Object> sentinelPort, Optional<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.