Package csw.testkit
Class ConfigTestKit
- java.lang.Object
-
- csw.testkit.ConfigTestKit
-
public final class ConfigTestKit extends java.lang.ObjectConfigTestKit supports starting HTTP Config Server backed by SVN and registering it with location serviceExample:
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 Constructor Description ConfigTestKit()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description csw.aas.http.SecurityDirectives_securityDirectives()akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command>actorSystem()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.ServerWiringconfigWiring()static 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 ConfigTestKitvoiddeleteServerFiles()useful for deleting entire svn repo when test has finishedscala.concurrent.ExecutionContextExecutorec()voidinitSvnRepo()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.PolicyValidatorpolicyValidator()voidshutdownConfigServer()Shutdown HTTP Config servervoidstartConfigServer()Start HTTP Config server on provided port in constructor or configuration and create clean copy of SVN repovoidterminateServer()terminate HTTP ConfigServerakka.util.Timeouttimeout()msocket.security.api.TokenValidatortokenValidator()
-
-
-
Method Detail
-
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
public static ConfigTestKit create(com.typesafe.config.Config serverConfig)
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
public static ConfigTestKit create(TestKitSettings testKitSettings)
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.
-
-