Package csw.testkit

Class ConfigTestKit

java.lang.Object
csw.testkit.ConfigTestKit

public final class ConfigTestKit extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    csw.aas.http.SecurityDirectives
     
    akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command>
     
    apply(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem, scala.Option<com.typesafe.config.Config> serverConfig, TestKitSettings testKitSettings)
    Create a ConfigTestKit
    csw.config.server.ServerWiring
     
    create(akka.actor.typed.ActorSystem<akka.actor.typed.SpawnProtocol.Command> actorSystem)
    Java API for creating ConfigTestKit
    create(com.typesafe.config.Config serverConfig)
    Java API for creating ConfigTestKit
    create(com.typesafe.config.Config serverConfig, TestKitSettings testKitSettings)
    Java API for creating ConfigTestKit
    create(TestKitSettings testKitSettings)
    Java API for creating ConfigTestKit
    void
    useful for deleting entire svn repo when test has finished
    scala.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 explicitly
    csw.aas.http.PolicyValidator
     
    void
    Shutdown HTTP Config server
    void
    Start HTTP Config server on provided port in constructor or configuration and create clean copy of SVN repo
    void
    terminate HTTP ConfigServer
    akka.util.Timeout
     
    msocket.security.api.TokenValidator
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 ConfigTestKit

      When 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 server
      testKitSettings - 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 repo

      If 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 or ConfigService which can be created via ConfigClientFactory

    • 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 server

      When the test has completed, make sure you shutdown config server.