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
-
Method Summary
Modifier and TypeMethodDescriptioncsw.aas.http.SecurityDirectives
akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command>
static ConfigTestKit
apply
(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem, scala.Option<com.typesafe.config.Config> serverConfig, TestKitSettings testKitSettings) Create a ConfigTestKitcsw.config.server.ServerWiring
static ConfigTestKit
create
(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem) Java API for creating ConfigTestKitstatic ConfigTestKit
create
(com.typesafe.config.Config serverConfig) Java API for creating ConfigTestKitstatic ConfigTestKit
create
(com.typesafe.config.Config serverConfig, TestKitSettings testKitSettings) Java API for creating ConfigTestKitstatic ConfigTestKit
create
(TestKitSettings testKitSettings) Java API for creating ConfigTestKitvoid
useful for deleting entire svn repo when test has finishedscala.concurrent.ExecutionContextExecutor
ec()
void
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 explicitlycsw.aas.http.PolicyValidator
void
Shutdown HTTP Config servervoid
Start HTTP Config server on provided port in constructor or configuration and create clean copy of SVN repovoid
terminate HTTP ConfigServerakka.util.Timeout
timeout()
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
ConfigClientService
orConfigService
which 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.
-