Package csw.testkit
Class ConfigTestKit
java.lang.Object
csw.testkit.ConfigTestKit
ConfigTestKit supports starting HTTP Config Server backed by SVN
and registering it with location service
Example:
private val testKit = ConfigTestKit()
// starting Config Server (starts config server on default ports specified in configuration file)
// it will also register ConfigService with location service
testKit.startConfigServer()
// stopping Config Server
testKit.shutdownConfigServer()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncsw.aas.http.SecurityDirectivesakka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command>static ConfigTestKitapply(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem, scala.Option<com.typesafe.config.Config> serverConfig, TestKitSettings testKitSettings) Create a ConfigTestKitcsw.config.server.ServerWiringstatic ConfigTestKitcreate(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem) Java API for creating ConfigTestKitstatic ConfigTestKitcreate(com.typesafe.config.Config serverConfig) Java API for creating ConfigTestKitstatic ConfigTestKitcreate(com.typesafe.config.Config serverConfig, TestKitSettings testKitSettings) Java API for creating ConfigTestKitstatic ConfigTestKitcreate(TestKitSettings testKitSettings) Java API for creating ConfigTestKitvoiduseful for deleting entire svn repo when test has finishedscala.concurrent.ExecutionContextExecutorec()voidWARNING: use this method only when you are sure that config server is up and running For example: When you start config server using ScalaTestFrameworkTestKit(ConfigServer), you might want to init svn repo explicitlycsw.aas.http.PolicyValidatorvoidShutdown HTTP Config servervoidStart HTTP Config server on provided port in constructor or configuration and create clean copy of SVN repovoidterminate HTTP ConfigServerakka.util.Timeouttimeout()msocket.security.api.TokenValidator
-
Constructor Details
-
ConfigTestKit
public ConfigTestKit()
-
-
Method Details
-
apply
public static ConfigTestKit apply(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem, scala.Option<com.typesafe.config.Config> serverConfig, TestKitSettings testKitSettings) Create a ConfigTestKitWhen the test has completed you should shutdown the config server with
shutdownConfigServer().- Parameters:
actorSystem- (undocumented)serverConfig- (undocumented)testKitSettings- (undocumented)- Returns:
- (undocumented)
-
create
public static ConfigTestKit create(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem) Java API for creating ConfigTestKit- Parameters:
actorSystem-- Returns:
- handle to ConfigTestKit which can be used to start and stop config server
-
create
Java API for creating ConfigTestKit- Parameters:
serverConfig- custom configuration with which to start config server- Returns:
- handle to ConfigTestKit which can be used to start and stop config server
-
create
Java API for creating ConfigTestKit- Parameters:
testKitSettings- custom testKitSettings- Returns:
- handle to ConfigTestKit which can be used to start and stop config server
-
create
public static ConfigTestKit create(com.typesafe.config.Config serverConfig, TestKitSettings testKitSettings) Java API for creating ConfigTestKit- Parameters:
serverConfig- custom configuration with which to start config servertestKitSettings- custom testKitSettings- Returns:
- handle to ConfigTestKit which can be used to start and stop config server
-
tokenValidator
public msocket.security.api.TokenValidator tokenValidator() -
policyValidator
public csw.aas.http.PolicyValidator policyValidator() -
_securityDirectives
public csw.aas.http.SecurityDirectives _securityDirectives() -
actorSystem
public akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem() -
configWiring
public csw.config.server.ServerWiring configWiring() -
ec
public scala.concurrent.ExecutionContextExecutor ec() -
timeout
public akka.util.Timeout timeout() -
startConfigServer
public void startConfigServer()Start HTTP Config server on provided port in constructor or configuration and create clean copy of SVN repoIf your test's requires accessing/creating configurations from configuration service, then using this method you can start configuration service. Configuration service can be accessed via
ConfigClientServiceorConfigServicewhich can be created viaConfigClientFactory -
initSvnRepo
public void initSvnRepo()WARNING: use this method only when you are sure that config server is up and running For example: When you start config server using ScalaTestFrameworkTestKit(ConfigServer), you might want to init svn repo explicitly -
deleteServerFiles
public void deleteServerFiles()useful for deleting entire svn repo when test has finished -
terminateServer
public void terminateServer()terminate HTTP ConfigServer -
shutdownConfigServer
public void shutdownConfigServer()Shutdown HTTP Config serverWhen the test has completed, make sure you shutdown config server.
-