Package csw.testkit
Class EventTestKit
java.lang.Object
csw.testkit.EventTestKit
- All Implemented Interfaces:
EmbeddedRedis
,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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic EventTestKit
apply
(akka.actor.typed.ActorSystem<?> actorSystem, TestKitSettings testKitSettings) Create a EventTestKitprotected Connection.TcpConnection
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 String
masterId()
void
Shutdown Event servicecsw.location.api.scaladsl.RegistrationResult
startEventService
(int sentinelPort, int serverPort) Scala API to Start Event servicevoid
startEventService
(Optional<Object> sentinelPort, Optional<Object> serverPort) Java API to Start Event serviceakka.actor.typed.ActorSystem<?>
system()
akka.util.Timeout
timeout()
akka.actor.ActorSystem
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
-
Constructor Details
-
EventTestKit
public EventTestKit()
-
-
Method Details
-
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
Java API to create a EventTestKit- Parameters:
actorSystem
-- Returns:
- handle to EventTestKit which can be used to start and stop event service
-
create
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
- Specified by:
masterId
in interfaceRedisStore
-
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
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.
-