Package csw.testkit
Class EventTestKit
- java.lang.Object
-
- csw.testkit.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 serviceExample:
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 Summary
Constructors Constructor Description EventTestKit()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EventTestKit
apply(akka.actor.typed.ActorSystem<?> actorSystem, TestKitSettings testKitSettings)
Create a EventTestKitprotected Connection.TcpConnection
connection()
static EventTestKit
create(akka.actor.typed.ActorSystem<?> actorSystem)
Java API to create a EventTestKitstatic EventTestKit
create(TestKitSettings testKitSettings)
Java API to create a EventTestKitscala.concurrent.ExecutionContext
ec()
protected java.lang.String
masterId()
void
shutdownEventService()
Shutdown Event servicecsw.location.api.scaladsl.RegistrationResult
startEventService(int sentinelPort, int serverPort)
Scala API to Start Event servicevoid
startEventService(java.util.Optional<java.lang.Object> sentinelPort, java.util.Optional<java.lang.Object> serverPort)
Java API to Start Event serviceakka.actor.typed.ActorSystem<?>
system()
akka.util.Timeout
timeout()
akka.actor.ActorSystem
untypedSystem()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface csw.testkit.redis.EmbeddedRedis
addJvmShutdownHook, startSentinel, stopSentinel
-
Methods inherited from interface csw.testkit.redis.RedisStore
shutdown, start, start, stopRedis
-
-
-
-
Method Detail
-
apply
public static EventTestKit apply(akka.actor.typed.ActorSystem<?> actorSystem, TestKitSettings testKitSettings)
Create a EventTestKitWhen 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 interfaceRedisStore
-
ec
public scala.concurrent.ExecutionContext ec()
- Specified by:
ec
in interfaceRedisStore
-
system
public akka.actor.typed.ActorSystem<?> system()
- Specified by:
system
in interfaceRedisStore
-
timeout
public akka.util.Timeout timeout()
- Specified by:
timeout
in interfaceRedisStore
-
masterId
protected java.lang.String masterId()
- Specified by:
masterId
in interfaceRedisStore
-
connection
protected Connection.TcpConnection connection()
- Specified by:
connection
in interfaceRedisStore
-
startEventService
public csw.location.api.scaladsl.RegistrationResult startEventService(int sentinelPort, int serverPort)
Scala API to Start Event serviceIt 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 serviceIt 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 serviceWhen the test has completed, make sure you shutdown event service. This will terminate actor system and stop redis sentinel and redis server.
-
-