openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markusthoem...@apache.org
Subject [incubator-openwhisk] branch master updated: Use pureconfig for CouchDbRestStore. (#3369)
Date Thu, 08 Mar 2018 08:03:59 GMT
This is an automated email from the ASF dual-hosted git repository.

markusthoemmes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 2ede318  Use pureconfig for CouchDbRestStore. (#3369)
2ede318 is described below

commit 2ede318797b31896d0272ebc9d4a645771144cd7
Author: Chetan Mehrotra <chetanm@apache.org>
AuthorDate: Thu Mar 8 13:33:56 2018 +0530

    Use pureconfig for CouchDbRestStore. (#3369)
---
 ansible/roles/controller/tasks/deploy.yml          | 18 ++++----
 ansible/roles/invoker/tasks/deploy.yml             | 15 ++++---
 common/scala/src/main/resources/application.conf   | 17 ++++++++
 .../src/main/scala/whisk/core/WhiskConfig.scala    | 21 +--------
 .../core/database/ArtifactStoreProvider.scala      |  5 +--
 .../whisk/core/database/CouchDbStoreProvider.scala | 47 ++++++++++++--------
 .../main/scala/whisk/core/entity/WhiskStore.scala  | 50 +++-------------------
 .../scala/whisk/core/controller/Authenticate.scala |  9 ----
 .../scala/whisk/core/controller/Controller.scala   |  6 +--
 .../scala/whisk/core/controller/RestAPIs.scala     |  9 +---
 .../scala/whisk/core/entitlement/Collection.scala  |  3 --
 .../core/loadBalancer/ContainerPoolBalancer.scala  |  2 +-
 .../ShardingContainerPoolBalancer.scala            |  4 +-
 .../main/scala/whisk/core/invoker/Invoker.scala    |  5 +--
 .../scala/whisk/core/invoker/InvokerReactive.scala |  6 +--
 tests/src/test/resources/application.conf.j2       | 14 ++++++
 tests/src/test/scala/common/WhiskProperties.java   |  4 --
 tests/src/test/scala/ha/ShootComponentsTests.scala | 17 +++++---
 .../core/cli/test/SequenceMigrationTests.scala     |  4 +-
 .../core/controller/test/ActivationsApiTests.scala | 28 +++++++++---
 .../controller/test/ControllerTestCommon.scala     |  6 +--
 .../database/test/CouchDbRestClientTests.scala     | 33 ++++++--------
 .../database/test/DatabaseScriptTestUtils.scala    | 25 +++++------
 .../whisk/core/entity/test/DatastoreTests.scala    |  6 +--
 .../scala/whisk/core/entity/test/ViewTests.scala   |  6 +--
 .../invoker/test/NamespaceBlacklistTests.scala     | 23 +++++-----
 26 files changed, 178 insertions(+), 205 deletions(-)

diff --git a/ansible/roles/controller/tasks/deploy.yml b/ansible/roles/controller/tasks/deploy.yml
index 636937c..9dc2de7 100644
--- a/ansible/roles/controller/tasks/deploy.yml
+++ b/ansible/roles/controller/tasks/deploy.yml
@@ -117,15 +117,15 @@
       "CONFIG_whisk_kafka_common_sslTruststorePassword": "{{ kafka.ssl.keystore.password
}}"
       "CONFIG_whisk_kafka_common_sslKeystoreLocation": "/conf/{{ kafka.ssl.keystore.name
}}"
       "CONFIG_whisk_kafka_common_sslKeystorePassword": "{{ kafka.ssl.keystore.password }}"
-      "DB_PROTOCOL": "{{ db_protocol }}"
-      "DB_PROVIDER": "{{ db_provider }}"
-      "DB_HOST": "{{ db_host }}"
-      "DB_PORT": "{{ db_port }}"
-      "DB_USERNAME": "{{ db_username }}"
-      "DB_PASSWORD": "{{ db_password }}"
-      "DB_WHISK_AUTHS": "{{ db.whisk.auth }}"
-      "DB_WHISK_ACTIONS": "{{ db.whisk.actions }}"
-      "DB_WHISK_ACTIVATIONS": "{{ db.whisk.activations }}"
+      "CONFIG_whisk_couchdb_protocol": "{{ db_protocol }}"
+      "CONFIG_whisk_couchdb_host": "{{ db_host }}"
+      "CONFIG_whisk_couchdb_port": "{{ db_port }}"
+      "CONFIG_whisk_couchdb_username": "{{ db_username }}"
+      "CONFIG_whisk_couchdb_password": "{{ db_password }}"
+      "CONFIG_whisk_couchdb_provider": "{{ db_provider }}"
+      "CONFIG_whisk_couchdb_databases_WhiskAuth": "{{ db.whisk.auth }}"
+      "CONFIG_whisk_couchdb_databases_WhiskEntity": "{{ db.whisk.actions }}"
+      "CONFIG_whisk_couchdb_databases_WhiskActivation": "{{ db.whisk.activations }}"
       "CONFIG_whisk_db_actionsDdoc": "{{ db_whisk_actions_ddoc | default() }}"
       "CONFIG_whisk_db_activationsDdoc": "{{ db_whisk_activations_ddoc | default() }}"
       "CONFIG_whisk_db_activationsFilterDdoc": "{{ db_whisk_activations_filter_ddoc | default()
}}"
diff --git a/ansible/roles/invoker/tasks/deploy.yml b/ansible/roles/invoker/tasks/deploy.yml
index c113f54..51867f4 100644
--- a/ansible/roles/invoker/tasks/deploy.yml
+++ b/ansible/roles/invoker/tasks/deploy.yml
@@ -161,12 +161,15 @@
         -e CONFIG_whisk_kafka_common_sslKeystoreLocation='/conf/{{ kafka.ssl.keystore.name
}}'
         -e CONFIG_whisk_kafka_common_sslKeystorePassword='{{ kafka.ssl.keystore.password
}}'
         -e ZOOKEEPER_HOSTS='{{ zookeeper_connect_string }}'
-        -e DB_PROTOCOL='{{ db_protocol }}'
-        -e DB_PROVIDER='{{ db_provider }}'
-        -e DB_HOST='{{ db_host }}'
-        -e DB_PORT='{{ db_port }}'
-        -e DB_USERNAME='{{ db_username }}'
-        -e DB_PASSWORD='{{ db_password }}'
+        -e CONFIG_whisk_couchdb_protocol='{{ db_protocol }}'
+        -e CONFIG_whisk_couchdb_host='{{ db_host }}'
+        -e CONFIG_whisk_couchdb_port='{{ db_port }}'
+        -e CONFIG_whisk_couchdb_username='{{ db_username }}'
+        -e CONFIG_whisk_couchdb_password='{{ db_password }}'
+        -e CONFIG_whisk_couchdb_provider='{{ db_provider }}'
+        -e CONFIG_whisk_couchdb_databases_WhiskAuth='{{ db.whisk.auth }}'
+        -e CONFIG_whisk_couchdb_databases_WhiskEntity='{{ db.whisk.actions }}'
+        -e CONFIG_whisk_couchdb_databases_WhiskActivation='{{ db.whisk.activations }}'
         -e DB_WHISK_ACTIONS='{{ db.whisk.actions }}'
         -e DB_WHISK_ACTIVATIONS='{{ db.whisk.activations }}'
         -e DB_WHISK_AUTHS='{{ db.whisk.auth }}'
diff --git a/common/scala/src/main/resources/application.conf b/common/scala/src/main/resources/application.conf
index b1d1163..9470bd3 100644
--- a/common/scala/src/main/resources/application.conf
+++ b/common/scala/src/main/resources/application.conf
@@ -105,6 +105,23 @@ whisk {
         activations-ddoc = "whisks.v2.1.0"
         activations-filter-ddoc = "whisks-filters.v2.1.0"
     }
+
+    # CouchDB related configuration
+    # For example:
+    # couchdb {
+    #     protocol = http          # One of "https" or "http"
+    #     host     = servername    # DB Host
+    #     port     = 5984          # DB Port
+    #     username =
+    #     password =
+    #     provider =               # Either "Cloudant" or "CouchDB"
+    #     databases {              # Database names used for various entity classes
+    #        WhiskAuth       =
+    #        WhiskEntity     =
+    #        WhiskActivation =
+    #     }
+    #}
+
     # transaction ID related configuration
     transactions {
         stride = 1
diff --git a/common/scala/src/main/scala/whisk/core/WhiskConfig.scala b/common/scala/src/main/scala/whisk/core/WhiskConfig.scala
index a5e1fe1..4c4b4e8 100644
--- a/common/scala/src/main/scala/whisk/core/WhiskConfig.scala
+++ b/common/scala/src/main/scala/whisk/core/WhiskConfig.scala
@@ -77,16 +77,7 @@ class WhiskConfig(requiredProperties: Map[String, String],
   val invokerHosts = this(WhiskConfig.invokerHostsList)
   val zookeeperHosts = this(WhiskConfig.zookeeperHostList)
 
-  val dbProvider = this(WhiskConfig.dbProvider)
-  val dbUsername = this(WhiskConfig.dbUsername)
-  val dbPassword = this(WhiskConfig.dbPassword)
-  val dbProtocol = this(WhiskConfig.dbProtocol)
-  val dbHost = this(WhiskConfig.dbHost)
-  val dbPort = this(WhiskConfig.dbPort)
   val dbPrefix = this(WhiskConfig.dbPrefix)
-  val dbAuths = this(WhiskConfig.dbAuths)
-  val dbWhisk = this(WhiskConfig.dbWhisk)
-  val dbActivations = this(WhiskConfig.dbActivations)
   val mainDockerEndpoint = this(WhiskConfig.mainDockerEndpoint)
 
   val runtimesManifest = this(WhiskConfig.runtimesManifest)
@@ -166,18 +157,7 @@ object WhiskConfig {
   val dockerPort = "docker.port"
 
   val dockerEndpoint = "main.docker.endpoint"
-
-  val dbProvider = "db.provider"
-  val dbProtocol = "db.protocol"
-  val dbHost = "db.host"
-  val dbPort = "db.port"
-  val dbUsername = "db.username"
-  val dbPassword = "db.password"
   val dbPrefix = "db.prefix"
-  val dbAuths = "db.whisk.auths"
-  val dbWhisk = "db.whisk.actions"
-  val dbActivations = "db.whisk.activations"
-
   // these are not private because they are needed
   // in the invoker (they are part of the environment
   // passed to the user container)
@@ -235,6 +215,7 @@ object WhiskConfig {
 object ConfigKeys {
   val loadbalancer = "whisk.loadbalancer"
 
+  val couchdb = "whisk.couchdb"
   val kafka = "whisk.kafka"
   val kafkaCommon = s"$kafka.common"
   val kafkaProducer = s"$kafka.producer"
diff --git a/common/scala/src/main/scala/whisk/core/database/ArtifactStoreProvider.scala b/common/scala/src/main/scala/whisk/core/database/ArtifactStoreProvider.scala
index d07381e..fdcc306 100644
--- a/common/scala/src/main/scala/whisk/core/database/ArtifactStoreProvider.scala
+++ b/common/scala/src/main/scala/whisk/core/database/ArtifactStoreProvider.scala
@@ -21,7 +21,6 @@ import akka.actor.ActorSystem
 import akka.stream.ActorMaterializer
 import spray.json.RootJsonFormat
 import whisk.common.Logging
-import whisk.core.WhiskConfig
 import whisk.spi.Spi
 import whisk.core.entity.DocumentReader
 
@@ -31,9 +30,7 @@ import scala.reflect.ClassTag
  * An Spi for providing ArtifactStore implementations
  */
 trait ArtifactStoreProvider extends Spi {
-  def makeStore[D <: DocumentSerializer: ClassTag](config: WhiskConfig,
-                                                   name: WhiskConfig => String,
-                                                   useBatching: Boolean = false)(
+  def makeStore[D <: DocumentSerializer: ClassTag](useBatching: Boolean = false)(
     implicit jsonFormat: RootJsonFormat[D],
     docReader: DocumentReader,
     actorSystem: ActorSystem,
diff --git a/common/scala/src/main/scala/whisk/core/database/CouchDbStoreProvider.scala b/common/scala/src/main/scala/whisk/core/database/CouchDbStoreProvider.scala
index 0a59c39..c10436b 100644
--- a/common/scala/src/main/scala/whisk/core/database/CouchDbStoreProvider.scala
+++ b/common/scala/src/main/scala/whisk/core/database/CouchDbStoreProvider.scala
@@ -21,37 +21,50 @@ import akka.actor.ActorSystem
 import akka.stream.ActorMaterializer
 import spray.json.RootJsonFormat
 import whisk.common.Logging
-import whisk.core.WhiskConfig
+import whisk.core.ConfigKeys
 import whisk.core.entity.DocumentReader
+import pureconfig._
 
 import scala.reflect.ClassTag
 
+case class CouchDbConfig(provider: String,
+                         protocol: String,
+                         host: String,
+                         port: Int,
+                         username: String,
+                         password: String,
+                         databases: Map[String, String]) {
+  assume(Set(protocol, host, username, password).forall(_.nonEmpty), "At least one expected
property is missing")
+
+  def databaseFor[D](implicit tag: ClassTag[D]): String = {
+    val entityType = tag.runtimeClass.getSimpleName
+    databases.get(entityType) match {
+      case Some(name) => name
+      case None       => throw new IllegalArgumentException(s"Database name mapping not
found for $entityType")
+    }
+  }
+}
+
 object CouchDbStoreProvider extends ArtifactStoreProvider {
 
-  def makeStore[D <: DocumentSerializer: ClassTag](config: WhiskConfig,
-                                                   name: WhiskConfig => String,
-                                                   useBatching: Boolean)(
+  def makeStore[D <: DocumentSerializer: ClassTag](useBatching: Boolean)(
     implicit jsonFormat: RootJsonFormat[D],
     docReader: DocumentReader,
     actorSystem: ActorSystem,
     logging: Logging,
     materializer: ActorMaterializer): ArtifactStore[D] = {
-    require(config != null && config.isValid, "config is undefined or not valid")
+    val dbConfig = loadConfigOrThrow[CouchDbConfig](ConfigKeys.couchdb)
     require(
-      config.dbProvider == "Cloudant" || config.dbProvider == "CouchDB",
-      "Unsupported db.provider: " + config.dbProvider)
-    assume(
-      Set(config.dbProtocol, config.dbHost, config.dbPort, config.dbUsername, config.dbPassword,
name(config))
-        .forall(_.nonEmpty),
-      "At least one expected property is missing")
+      dbConfig.provider == "Cloudant" || dbConfig.provider == "CouchDB",
+      s"Unsupported db.provider: ${dbConfig.provider}")
 
     new CouchDbRestStore[D](
-      config.dbProtocol,
-      config.dbHost,
-      config.dbPort.toInt,
-      config.dbUsername,
-      config.dbPassword,
-      name(config),
+      dbConfig.protocol,
+      dbConfig.host,
+      dbConfig.port,
+      dbConfig.username,
+      dbConfig.password,
+      dbConfig.databaseFor[D],
       useBatching)
   }
 }
diff --git a/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala b/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala
index 016363a..c5c2c32 100644
--- a/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala
@@ -31,16 +31,6 @@ import spray.json.RootJsonFormat
 import whisk.common.Logging
 import whisk.common.TransactionId
 import whisk.core.ConfigKeys
-import whisk.core.WhiskConfig
-import whisk.core.WhiskConfig.dbActivations
-import whisk.core.WhiskConfig.dbAuths
-import whisk.core.WhiskConfig.dbHost
-import whisk.core.WhiskConfig.dbPassword
-import whisk.core.WhiskConfig.dbPort
-import whisk.core.WhiskConfig.dbProtocol
-import whisk.core.WhiskConfig.dbProvider
-import whisk.core.WhiskConfig.dbUsername
-import whisk.core.WhiskConfig.dbWhisk
 import whisk.core.database.ArtifactStore
 import whisk.core.database.ArtifactStoreProvider
 import whisk.core.database.DocumentRevisionProvider
@@ -96,35 +86,16 @@ protected[core] trait WhiskDocument extends DocumentSerializer with DocumentRevi
 object WhiskAuthStore {
   implicit val docReader = WhiskDocumentReader
 
-  def requiredProperties =
-    Map(
-      dbProvider -> null,
-      dbProtocol -> null,
-      dbUsername -> null,
-      dbPassword -> null,
-      dbHost -> null,
-      dbPort -> null,
-      dbAuths -> null)
-
-  def datastore(config: WhiskConfig)(implicit system: ActorSystem, logging: Logging, materializer:
ActorMaterializer) =
-    SpiLoader.get[ArtifactStoreProvider].makeStore[WhiskAuth](config, _.dbAuths)
+  def datastore()(implicit system: ActorSystem, logging: Logging, materializer: ActorMaterializer)
=
+    SpiLoader.get[ArtifactStoreProvider].makeStore[WhiskAuth]()
 }
 
 object WhiskEntityStore {
-  def requiredProperties =
-    Map(
-      dbProvider -> null,
-      dbProtocol -> null,
-      dbUsername -> null,
-      dbPassword -> null,
-      dbHost -> null,
-      dbPort -> null,
-      dbWhisk -> null)
 
-  def datastore(config: WhiskConfig)(implicit system: ActorSystem, logging: Logging, materializer:
ActorMaterializer) =
+  def datastore()(implicit system: ActorSystem, logging: Logging, materializer: ActorMaterializer)
=
     SpiLoader
       .get[ArtifactStoreProvider]
-      .makeStore[WhiskEntity](config, _.dbWhisk)(
+      .makeStore[WhiskEntity]()(
         classTag[WhiskEntity],
         WhiskEntityJsonFormat,
         WhiskDocumentReader,
@@ -135,18 +106,9 @@ object WhiskEntityStore {
 
 object WhiskActivationStore {
   implicit val docReader = WhiskDocumentReader
-  def requiredProperties =
-    Map(
-      dbProvider -> null,
-      dbProtocol -> null,
-      dbUsername -> null,
-      dbPassword -> null,
-      dbHost -> null,
-      dbPort -> null,
-      dbActivations -> null)
 
-  def datastore(config: WhiskConfig)(implicit system: ActorSystem, logging: Logging, materializer:
ActorMaterializer) =
-    SpiLoader.get[ArtifactStoreProvider].makeStore[WhiskActivation](config, _.dbActivations,
true)
+  def datastore()(implicit system: ActorSystem, logging: Logging, materializer: ActorMaterializer)
=
+    SpiLoader.get[ArtifactStoreProvider].makeStore[WhiskActivation](useBatching = true)
 }
 
 /**
diff --git a/core/controller/src/main/scala/whisk/core/controller/Authenticate.scala b/core/controller/src/main/scala/whisk/core/controller/Authenticate.scala
index 70ea3ef..cb60100 100644
--- a/core/controller/src/main/scala/whisk/core/controller/Authenticate.scala
+++ b/core/controller/src/main/scala/whisk/core/controller/Authenticate.scala
@@ -27,21 +27,12 @@ import scala.util.Try
 import whisk.common.Logging
 import whisk.common.TransactionId
 import whisk.core.database.NoDocumentException
-import whisk.core.entity.UUID
 import whisk.core.entity.types.AuthStore
-import whisk.core.entity.WhiskAuthStore
 import whisk.core.entity.AuthKey
 import whisk.core.entity.Identity
 import whisk.core.entity.Secret
 import whisk.core.entity.UUID
 
-object Authenticate {
-
-  /** Required properties for this component */
-  def requiredProperties = WhiskAuthStore.requiredProperties
-}
-
-/** A trait to validate basic auth credentials */
 trait Authenticate {
   protected implicit val executionContext: ExecutionContext
   protected implicit val logging: Logging
diff --git a/core/controller/src/main/scala/whisk/core/controller/Controller.scala b/core/controller/src/main/scala/whisk/core/controller/Controller.scala
index 00901bf..bb2086a 100644
--- a/core/controller/src/main/scala/whisk/core/controller/Controller.scala
+++ b/core/controller/src/main/scala/whisk/core/controller/Controller.scala
@@ -104,9 +104,9 @@ class Controller(val instance: InstanceId,
   }
 
   // initialize datastores
-  private implicit val authStore = WhiskAuthStore.datastore(whiskConfig)
-  private implicit val entityStore = WhiskEntityStore.datastore(whiskConfig)
-  private implicit val activationStore = WhiskActivationStore.datastore(whiskConfig)
+  private implicit val authStore = WhiskAuthStore.datastore()
+  private implicit val entityStore = WhiskEntityStore.datastore()
+  private implicit val activationStore = WhiskActivationStore.datastore()
   private implicit val cacheChangeNotification = Some(new CacheChangeNotification {
     val remoteCacheInvalidaton = new RemoteCacheInvalidation(whiskConfig, "controller", instance)
     override def apply(k: CacheKey) = {
diff --git a/core/controller/src/main/scala/whisk/core/controller/RestAPIs.scala b/core/controller/src/main/scala/whisk/core/controller/RestAPIs.scala
index afb9d13..bc1e0b5 100644
--- a/core/controller/src/main/scala/whisk/core/controller/RestAPIs.scala
+++ b/core/controller/src/main/scala/whisk/core/controller/RestAPIs.scala
@@ -87,13 +87,8 @@ protected[controller] object RestApiCommons {
   def requiredProperties =
     Map(WhiskConfig.servicePort -> 8080.toString) ++
       WhiskConfig.whiskVersion ++
-      WhiskAuthStore.requiredProperties ++
-      WhiskEntityStore.requiredProperties ++
-      WhiskActivationStore.requiredProperties ++
       EntitlementProvider.requiredProperties ++
-      WhiskActionsApi.requiredProperties ++
-      Authenticate.requiredProperties ++
-      Collection.requiredProperties
+      WhiskActionsApi.requiredProperties
 
   import akka.http.scaladsl.model.HttpCharsets
   import akka.http.scaladsl.model.MediaTypes.`application/json`
@@ -171,7 +166,7 @@ class RestAPIVersion(config: WhiskConfig, apiPath: String, apiVersion:
String)(
     with AuthenticatedRoute
     with RespondWithHeaders {
   implicit val executionContext = actorSystem.dispatcher
-  implicit val authStore = WhiskAuthStore.datastore(config)
+  implicit val authStore = WhiskAuthStore.datastore()
 
   def prefix = pathPrefix(apiPath / apiVersion)
 
diff --git a/core/controller/src/main/scala/whisk/core/entitlement/Collection.scala b/core/controller/src/main/scala/whisk/core/entitlement/Collection.scala
index 6bf6403..b5063f2 100644
--- a/core/controller/src/main/scala/whisk/core/entitlement/Collection.scala
+++ b/core/controller/src/main/scala/whisk/core/entitlement/Collection.scala
@@ -33,7 +33,6 @@ import whisk.common.TransactionId
 import whisk.core.entity.Identity
 import whisk.core.entity.WhiskAction
 import whisk.core.entity.WhiskActivation
-import whisk.core.entity.WhiskEntityStore
 import whisk.core.entity.WhiskPackage
 import whisk.core.entity.WhiskRule
 import whisk.core.entity.WhiskTrigger
@@ -108,8 +107,6 @@ protected[core] case class Collection protected (val path: String,
 /** An enumeration of known collections. */
 protected[core] object Collection {
 
-  protected[core] def requiredProperties = WhiskEntityStore.requiredProperties
-
   /** Number of records allowed per query. */
   protected[core] val DEFAULT_LIST_LIMIT = 30
   protected[core] val MAX_LIST_LIMIT = 200
diff --git a/core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
b/core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
index de2e56e..570281d 100644
--- a/core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
+++ b/core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
@@ -192,7 +192,7 @@ class ContainerPoolBalancer(config: WhiskConfig, controllerInstance: InstanceId)
   }
 
   private val invokerPool = {
-    InvokerPool.prepare(controllerInstance, WhiskEntityStore.datastore(config))
+    InvokerPool.prepare(controllerInstance, WhiskEntityStore.datastore())
 
     actorSystem.actorOf(
       InvokerPool.props(
diff --git a/core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
b/core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
index 9b7aaec..19b959a 100644
--- a/core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
+++ b/core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
@@ -61,7 +61,7 @@ class ShardingContainerPoolBalancer(config: WhiskConfig, controllerInstance:
Ins
   cluster.joinSeedNodes(seedNodesProvider.getSeedNodes())
 
   /** Used to manage an action for testing invoker health */
-  private val entityStore = WhiskEntityStore.datastore(config)
+  private val entityStore = WhiskEntityStore.datastore()
 
   /** State related to invocations and throttling */
   private val activations = TrieMap[ActivationId, ActivationEntry]()
@@ -276,7 +276,7 @@ class ShardingContainerPoolBalancer(config: WhiskConfig, controllerInstance:
Ins
   }
 
   private val invokerPool = {
-    InvokerPool.prepare(controllerInstance, WhiskEntityStore.datastore(config))
+    InvokerPool.prepare(controllerInstance, WhiskEntityStore.datastore())
 
     actorSystem.actorOf(
       InvokerPool.props(
diff --git a/core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala b/core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala
index d6d2735..b6bcccd 100644
--- a/core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala
+++ b/core/invoker/src/main/scala/whisk/core/invoker/Invoker.scala
@@ -37,6 +37,8 @@ import whisk.core.WhiskConfig._
 import whisk.core.connector.MessagingProvider
 import whisk.core.connector.PingMessage
 import whisk.core.entity._
+import whisk.core.entity.ExecManifest
+import whisk.core.entity.InstanceId
 import whisk.http.BasicHttpService
 import whisk.spi.SpiLoader
 import whisk.utils.ExecutionContextFactory
@@ -52,9 +54,6 @@ object Invoker {
   def requiredProperties =
     Map(servicePort -> 8080.toString(), dockerRegistry -> null, dockerImagePrefix ->
null) ++
       ExecManifest.requiredProperties ++
-      WhiskEntityStore.requiredProperties ++
-      WhiskActivationStore.requiredProperties ++
-      WhiskAuthStore.requiredProperties ++
       kafkaHosts ++
       zookeeperHosts ++
       wskApiHost ++ Map(
diff --git a/core/invoker/src/main/scala/whisk/core/invoker/InvokerReactive.scala b/core/invoker/src/main/scala/whisk/core/invoker/InvokerReactive.scala
index 77c63fa..afe0c89 100644
--- a/core/invoker/src/main/scala/whisk/core/invoker/InvokerReactive.scala
+++ b/core/invoker/src/main/scala/whisk/core/invoker/InvokerReactive.scala
@@ -75,9 +75,9 @@ class InvokerReactive(config: WhiskConfig, instance: InstanceId, producer:
Messa
   sys.addShutdownHook(containerFactory.cleanup())
 
   /** Initialize needed databases */
-  private val entityStore = WhiskEntityStore.datastore(config)
-  private val activationStore = WhiskActivationStore.datastore(config)
-  private val authStore = WhiskAuthStore.datastore(config)
+  private val entityStore = WhiskEntityStore.datastore()
+  private val activationStore = WhiskActivationStore.datastore()
+  private val authStore = WhiskAuthStore.datastore()
 
   private val namespaceBlacklist = new NamespaceBlacklist(authStore)
 
diff --git a/tests/src/test/resources/application.conf.j2 b/tests/src/test/resources/application.conf.j2
index 94f1664..7bf9421 100644
--- a/tests/src/test/resources/application.conf.j2
+++ b/tests/src/test/resources/application.conf.j2
@@ -31,4 +31,18 @@ whisk {
           max-poll-interval-ms: 10000
         }
     }
+
+    couchdb {
+        protocol = {{ db_protocol }}
+        host     = {{ db_host }}
+        port     = {{ db_port }}
+        username = {{ db_username }}
+        password = {{ db_password }}
+        provider = {{ db_provider }}
+        databases {
+          WhiskAuth       = {{ db.whisk.auth }}
+          WhiskEntity     = {{ db.whisk.actions }}
+          WhiskActivation = {{ db.whisk.activations }}
+        }
+    }
 }
diff --git a/tests/src/test/scala/common/WhiskProperties.java b/tests/src/test/scala/common/WhiskProperties.java
index 0daa28d..d8897bc 100644
--- a/tests/src/test/scala/common/WhiskProperties.java
+++ b/tests/src/test/scala/common/WhiskProperties.java
@@ -229,10 +229,6 @@ public class WhiskProperties {
         return whiskProperties.getProperty("db.hostsList");
     }
 
-    public static int getDBPort() {
-        return Integer.parseInt(whiskProperties.getProperty("db.port"));
-    }
-
     public static int getControllerBasePort() {
         return Integer.parseInt(whiskProperties.getProperty("controller.host.basePort"));
     }
diff --git a/tests/src/test/scala/ha/ShootComponentsTests.scala b/tests/src/test/scala/ha/ShootComponentsTests.scala
index fa7d3a8..a3ea2b5 100644
--- a/tests/src/test/scala/ha/ShootComponentsTests.scala
+++ b/tests/src/test/scala/ha/ShootComponentsTests.scala
@@ -34,9 +34,12 @@ import akka.http.scaladsl.unmarshalling.Unmarshal
 import akka.stream.ActorMaterializer
 import common._
 import common.rest.WskRest
+import pureconfig._
 import spray.json._
 import spray.json.DefaultJsonProtocol._
 import whisk.core.WhiskConfig
+import whisk.core.ConfigKeys
+import whisk.core.database.CouchDbConfig
 import whisk.core.database.test.ExtendedCouchDbRestClient
 import whisk.utils.retry
 
@@ -67,13 +70,13 @@ class ShootComponentsTests
   val controller0DockerHost = WhiskProperties.getBaseControllerHost()
   val couchDB0DockerHost = WhiskProperties.getBaseDBHost()
 
-  val dbProtocol = WhiskProperties.getProperty(WhiskConfig.dbProtocol)
+  val dbConfig = loadConfigOrThrow[CouchDbConfig](ConfigKeys.couchdb)
+  val dbProtocol = dbConfig.protocol
   val dbHostsList = WhiskProperties.getDBHosts
-  val dbPort = WhiskProperties.getProperty(WhiskConfig.dbPort)
-  val dbUsername = WhiskProperties.getProperty(WhiskConfig.dbUsername)
-  val dbPassword = WhiskProperties.getProperty(WhiskConfig.dbPassword)
-  val dbPrefix = WhiskProperties.getProperty(WhiskConfig.dbPrefix)
-  val dbWhiskAuth = WhiskProperties.getProperty(WhiskConfig.dbAuths)
+  val dbPort = dbConfig.port
+  val dbUsername = dbConfig.username
+  val dbPassword = dbConfig.password
+  val dbWhiskAuth = dbConfig.databases.get("WhiskAuth").get
 
   def ping(host: String, port: Int, path: String = "/") = {
     val response = Try {
@@ -99,7 +102,7 @@ class ShootComponentsTests
     require(instance >= 0 && instance < 2, "DB instance not known.")
 
     val host = WhiskProperties.getProperty("db.hosts").split(",")(instance)
-    val port = WhiskProperties.getDBPort + instance
+    val port = dbPort + instance
 
     val res = ping(host, port)
     res == Some(
diff --git a/tests/src/test/scala/whisk/core/cli/test/SequenceMigrationTests.scala b/tests/src/test/scala/whisk/core/cli/test/SequenceMigrationTests.scala
index acc0361..8c8bb79 100644
--- a/tests/src/test/scala/whisk/core/cli/test/SequenceMigrationTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/SequenceMigrationTests.scala
@@ -34,7 +34,6 @@ import common.WskProps
 import common.WskTestHelpers
 import spray.json._
 import spray.json.DefaultJsonProtocol.StringJsonFormat
-import whisk.core.WhiskConfig
 import whisk.core.database.test.DbUtils
 import whisk.core.entity._
 import whisk.core.entity.test.ExecHelpers
@@ -48,9 +47,8 @@ class SequenceMigrationTests extends TestHelpers with BeforeAndAfter with
DbUtil
   implicit val matzerializer = ActorMaterializer()
   implicit val wskprops = WskProps()
   val wsk = new WskRest
-  val whiskConfig = new WhiskConfig(WhiskEntityStore.requiredProperties)
   // handle on the entity datastore
-  val entityStore = WhiskEntityStore.datastore(whiskConfig)
+  val entityStore = WhiskEntityStore.datastore()
   val namespace = wsk.namespace.whois()
   val allowedActionDuration = 120 seconds
 
diff --git a/tests/src/test/scala/whisk/core/controller/test/ActivationsApiTests.scala b/tests/src/test/scala/whisk/core/controller/test/ActivationsApiTests.scala
index d01398f..f45b771 100644
--- a/tests/src/test/scala/whisk/core/controller/test/ActivationsApiTests.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/ActivationsApiTests.scala
@@ -556,18 +556,34 @@ class ActivationsApiTests extends ControllerTestCommon with WhiskActivationsApi
     implicit val materializer = ActorMaterializer()
     val activationStore = SpiLoader
       .get[ArtifactStoreProvider]
-      .makeStore[WhiskEntity](whiskConfig, _.dbActivations)(
-        classTag[WhiskEntity],
-        WhiskEntityJsonFormat,
+      .makeStore[WhiskActivation]()(
+        classTag[WhiskActivation],
+        WhiskActivation.serdes,
         WhiskDocumentReader,
         system,
         logging,
         materializer)
     implicit val tid = transid()
-    val entity = BadEntity(namespace, EntityName(ActivationId.generate().toString))
-    put(activationStore, entity)
 
-    Get(s"$collectionPath/${entity.name}") ~> Route.seal(routes(creds)) ~> check {
+    //A bad activation type which breaks the deserialization by removing the subject entry
+    class BadActivation(override val namespace: EntityPath,
+                        override val name: EntityName,
+                        override val subject: Subject,
+                        override val activationId: ActivationId,
+                        override val start: Instant,
+                        override val end: Instant)
+        extends WhiskActivation(namespace, name, subject, activationId, start, end) {
+      override def toJson = {
+        val json = super.toJson
+        JsObject(json.fields - "subject")
+      }
+    }
+
+    val activation =
+      new BadActivation(namespace, aname(), creds.subject, ActivationId.generate(), Instant.now,
Instant.now)
+    put(activationStore, activation)
+
+    Get(s"$collectionPath/${activation.activationId}") ~> Route.seal(routes(creds)) ~>
check {
       status should be(InternalServerError)
       responseAs[ErrorResponse].error shouldBe Messages.corruptedEntity
     }
diff --git a/tests/src/test/scala/whisk/core/controller/test/ControllerTestCommon.scala b/tests/src/test/scala/whisk/core/controller/test/ControllerTestCommon.scala
index e4d7904..662c6d7 100644
--- a/tests/src/test/scala/whisk/core/controller/test/ControllerTestCommon.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/ControllerTestCommon.scala
@@ -89,9 +89,9 @@ protected trait ControllerTestCommon
     }
   }
 
-  val entityStore = WhiskEntityStore.datastore(whiskConfig)
-  val activationStore = WhiskActivationStore.datastore(whiskConfig)
-  val authStore = WhiskAuthStore.datastore(whiskConfig)
+  val entityStore = WhiskEntityStore.datastore()
+  val activationStore = WhiskActivationStore.datastore()
+  val authStore = WhiskAuthStore.datastore()
   val logStore = SpiLoader.get[LogStoreProvider].logStore(actorSystem)
 
   def deleteAction(doc: DocId)(implicit transid: TransactionId) = {
diff --git a/tests/src/test/scala/whisk/core/database/test/CouchDbRestClientTests.scala b/tests/src/test/scala/whisk/core/database/test/CouchDbRestClientTests.scala
index 4803f25..50b80fc 100644
--- a/tests/src/test/scala/whisk/core/database/test/CouchDbRestClientTests.scala
+++ b/tests/src/test/scala/whisk/core/database/test/CouchDbRestClientTests.scala
@@ -23,7 +23,6 @@ import scala.concurrent.Promise
 import scala.concurrent.duration.DurationDouble
 import scala.concurrent.duration.DurationInt
 import scala.util._
-
 import org.junit.runner.RunWith
 import org.scalatest.BeforeAndAfterAll
 import org.scalatest.FlatSpec
@@ -31,17 +30,17 @@ import org.scalatest.Matchers
 import org.scalatest.concurrent.PatienceConfiguration.Timeout
 import org.scalatest.concurrent.ScalaFutures
 import org.scalatest.junit.JUnitRunner
-
 import akka.actor.Props
 import akka.http.scaladsl.model._
 import akka.stream.scaladsl._
 import akka.util.ByteString
 import common.StreamLogging
 import common.WskActorSystem
+import pureconfig._
 import spray.json._
 import spray.json.DefaultJsonProtocol._
-import whisk.core.WhiskConfig
-import whisk.core.WhiskConfig._
+import whisk.core.ConfigKeys
+import whisk.core.database.CouchDbConfig
 import whisk.test.http.RESTProxy
 
 @RunWith(classOf[JUnitRunner])
@@ -58,19 +57,13 @@ class CouchDbRestClientTests
 
   private def someId(prefix: String): String = s"${prefix}${Random.nextInt().abs}"
 
-  val config = new WhiskConfig(
-    Map(dbProvider -> null, dbProtocol -> null, dbUsername -> null, dbPassword ->
null, dbHost -> null, dbPort -> null))
+  val config = loadConfigOrThrow[CouchDbConfig](ConfigKeys.couchdb)
 
   // We assume this DB does not exist.
   val dbName = someId("whisk_test_db_")
 
-  val client = new ExtendedCouchDbRestClient(
-    config.dbProtocol,
-    config.dbHost,
-    config.dbPort.toInt,
-    config.dbUsername,
-    config.dbPassword,
-    dbName)
+  val client =
+    new ExtendedCouchDbRestClient(config.protocol, config.host, config.port, config.username,
config.password, dbName)
 
   override def beforeAll() = {
     super.beforeAll()
@@ -97,7 +90,7 @@ class CouchDbRestClientTests
   behavior of "CouchDbRestClient"
 
   it should "successfully access the DB instance info" in {
-    assume(config.dbProvider == "Cloudant" || config.dbProvider == "CouchDB")
+    assume(config.provider == "Cloudant" || config.provider == "CouchDB")
     val f = client.instanceInfo()
     whenReady(f) { e =>
       checkInstanceInfoResponse(e)
@@ -164,16 +157,16 @@ class CouchDbRestClientTests
   }
 
   ignore /* it */ should "successfully access the DB despite transient connection failures"
in {
-    assume(config.dbProvider == "Cloudant" || config.dbProvider == "CouchDB")
+    assume(config.provider == "Cloudant" || config.provider == "CouchDB")
 
-    val dbAuthority = Uri.Authority(host = Uri.Host(config.dbHost), port = config.dbPort.toInt)
+    val dbAuthority = Uri.Authority(host = Uri.Host(config.host), port = config.port)
 
     val proxyPort = 15975
     val proxyActor =
-      actorSystem.actorOf(Props(new RESTProxy("0.0.0.0", proxyPort)(dbAuthority, config.dbProtocol
== "https")))
+      actorSystem.actorOf(Props(new RESTProxy("0.0.0.0", proxyPort)(dbAuthority, config.protocol
== "https")))
 
     val proxiedClient =
-      new ExtendedCouchDbRestClient("http", "localhost", proxyPort, config.dbUsername, config.dbPassword,
dbName)
+      new ExtendedCouchDbRestClient("http", "localhost", proxyPort, config.username, config.password,
dbName)
 
     // sprays the client with requests, makes sure they are all answered
     // despite temporary connection failure.
@@ -214,7 +207,7 @@ class CouchDbRestClientTests
   }
 
   it should "upload then download an attachment" in {
-    assume(config.dbProvider == "Cloudant" || config.dbProvider == "CouchDB")
+    assume(config.provider == "Cloudant" || config.provider == "CouchDB")
 
     val docId = "some_doc"
     val doc = JsObject("greeting" -> JsString("hello"))
@@ -261,7 +254,7 @@ class CouchDbRestClientTests
   }
 
   it should "check group Parameter on view-execution" in {
-    assume(config.dbProvider == "Cloudant" || config.dbProvider == "CouchDB")
+    assume(config.provider == "Cloudant" || config.provider == "CouchDB")
 
     val ids = List("some_doc_1", "some_doc_2", "some_doc_3", "some_doc_4", "some_doc_5")
     val docs = Map(
diff --git a/tests/src/test/scala/whisk/core/database/test/DatabaseScriptTestUtils.scala b/tests/src/test/scala/whisk/core/database/test/DatabaseScriptTestUtils.scala
index 9b227df..8957736 100644
--- a/tests/src/test/scala/whisk/core/database/test/DatabaseScriptTestUtils.scala
+++ b/tests/src/test/scala/whisk/core/database/test/DatabaseScriptTestUtils.scala
@@ -19,29 +19,30 @@ package whisk.core.database.test
 
 import scala.concurrent.duration.DurationInt
 import scala.io.Source
-
 import org.scalatest.Matchers
 import org.scalatest.concurrent.IntegrationPatience
 import org.scalatest.concurrent.ScalaFutures
-
 import akka.actor.ActorSystem
 import common.WaitFor
 import common.WhiskProperties
+import pureconfig._
 import spray.json._
 import spray.json.DefaultJsonProtocol._
 import whisk.common.Logging
+import whisk.core.ConfigKeys
 import whisk.core.WhiskConfig
 import whisk.core.database.CouchDbRestClient
+import whisk.core.database.CouchDbConfig
 
 trait DatabaseScriptTestUtils extends ScalaFutures with Matchers with WaitFor with IntegrationPatience
{
 
   val python = WhiskProperties.python
-
-  val dbProtocol = WhiskProperties.getProperty(WhiskConfig.dbProtocol)
-  val dbHost = WhiskProperties.getProperty(WhiskConfig.dbHost)
-  val dbPort = WhiskProperties.getProperty(WhiskConfig.dbPort)
-  val dbUsername = WhiskProperties.getProperty(WhiskConfig.dbUsername)
-  val dbPassword = WhiskProperties.getProperty(WhiskConfig.dbPassword)
+  val config = loadConfigOrThrow[CouchDbConfig](ConfigKeys.couchdb)
+  val dbProtocol = config.protocol
+  val dbHost = config.host
+  val dbPort = config.port
+  val dbUsername = config.username
+  val dbPassword = config.password
   val dbPrefix = WhiskProperties.getProperty(WhiskConfig.dbPrefix)
   val dbUrl = s"${dbProtocol}://${dbUsername}:${dbPassword}@${dbHost}:${dbPort}"
 
@@ -53,7 +54,7 @@ trait DatabaseScriptTestUtils extends ScalaFutures with Matchers with WaitFor
wi
     removeDatabase(name, true)
 
     println(s"Creating database: $name")
-    val db = new ExtendedCouchDbRestClient(dbProtocol, dbHost, dbPort.toInt, dbUsername,
dbPassword, name)
+    val db = new ExtendedCouchDbRestClient(dbProtocol, dbHost, dbPort, dbUsername, dbPassword,
name)
     retry(db.createDb().futureValue shouldBe 'right)
 
     retry {
@@ -71,7 +72,7 @@ trait DatabaseScriptTestUtils extends ScalaFutures with Matchers with WaitFor
wi
 
   /** Wait for database to appear */
   def waitForDatabase(dbName: String)(implicit as: ActorSystem, logging: Logging) = {
-    val client = new ExtendedCouchDbRestClient(dbProtocol, dbHost, dbPort.toInt, dbUsername,
dbPassword, dbName)
+    val client = new ExtendedCouchDbRestClient(dbProtocol, dbHost, dbPort, dbUsername, dbPassword,
dbName)
     waitfor(() => {
       client.getAllDocs(includeDocs = Some(true)).futureValue.isRight
     })
@@ -81,7 +82,7 @@ trait DatabaseScriptTestUtils extends ScalaFutures with Matchers with WaitFor
wi
   /** Removes the database with the given name */
   def removeDatabase(name: String, ignoreFailure: Boolean = false)(implicit as: ActorSystem,
logging: Logging) = {
     println(s"Removing database: $name")
-    val db = new ExtendedCouchDbRestClient(dbProtocol, dbHost, dbPort.toInt, dbUsername,
dbPassword, name)
+    val db = new ExtendedCouchDbRestClient(dbProtocol, dbHost, dbPort, dbUsername, dbPassword,
name)
     retry {
       val delete = db.deleteDb().futureValue
       if (!ignoreFailure) delete shouldBe 'right
@@ -95,7 +96,7 @@ trait DatabaseScriptTestUtils extends ScalaFutures with Matchers with WaitFor
wi
 
   /** Get all docs within one database */
   def getAllDocs(dbName: String)(implicit as: ActorSystem, logging: Logging) = {
-    val client = new ExtendedCouchDbRestClient(dbProtocol, dbHost, dbPort.toInt, dbUsername,
dbPassword, dbName)
+    val client = new ExtendedCouchDbRestClient(dbProtocol, dbHost, dbPort, dbUsername, dbPassword,
dbName)
     val documents = client.getAllDocs(includeDocs = Some(true)).futureValue
     documents shouldBe 'right
     documents.right.get
diff --git a/tests/src/test/scala/whisk/core/entity/test/DatastoreTests.scala b/tests/src/test/scala/whisk/core/entity/test/DatastoreTests.scala
index 601efec..4741ef3 100644
--- a/tests/src/test/scala/whisk/core/entity/test/DatastoreTests.scala
+++ b/tests/src/test/scala/whisk/core/entity/test/DatastoreTests.scala
@@ -30,7 +30,6 @@ import common.StreamLogging
 import common.WskActorSystem
 import org.scalatest.mockito.MockitoSugar
 import org.mockito.Mockito._
-import whisk.core.WhiskConfig
 import whisk.core.database.DocumentConflictException
 import whisk.core.database.CacheChangeNotification
 import whisk.core.database.NoDocumentException
@@ -50,9 +49,8 @@ class DatastoreTests
 
   implicit val materializer = ActorMaterializer()
   val namespace = EntityPath("test namespace")
-  val config = new WhiskConfig(WhiskAuthStore.requiredProperties ++ WhiskEntityStore.requiredProperties)
-  val datastore = WhiskEntityStore.datastore(config)
-  val authstore = WhiskAuthStore.datastore(config)
+  val datastore = WhiskEntityStore.datastore()
+  val authstore = WhiskAuthStore.datastore()
 
   implicit val cacheUpdateNotifier: Option[CacheChangeNotification] = None
 
diff --git a/tests/src/test/scala/whisk/core/entity/test/ViewTests.scala b/tests/src/test/scala/whisk/core/entity/test/ViewTests.scala
index ef85ee4..8af3dd7 100644
--- a/tests/src/test/scala/whisk/core/entity/test/ViewTests.scala
+++ b/tests/src/test/scala/whisk/core/entity/test/ViewTests.scala
@@ -28,7 +28,6 @@ import org.scalatest.junit.JUnitRunner
 import akka.stream.ActorMaterializer
 import common.StreamLogging
 import common.WskActorSystem
-import whisk.core.WhiskConfig
 import whisk.core.controller.test.WhiskAuthHelpers
 import whisk.core.database.ArtifactStore
 import whisk.core.database.StaleParameter
@@ -65,9 +64,8 @@ class ViewTests
 
   implicit val materializer = ActorMaterializer()
 
-  val config = new WhiskConfig(WhiskEntityStore.requiredProperties ++ WhiskActivationStore.requiredProperties)
-  val entityStore = WhiskEntityStore.datastore(config)
-  val activationStore = WhiskActivationStore.datastore(config)
+  val entityStore = WhiskEntityStore.datastore()
+  val activationStore = WhiskActivationStore.datastore()
 
   override def afterEach = {
     cleanup()
diff --git a/tests/src/test/scala/whisk/core/invoker/test/NamespaceBlacklistTests.scala b/tests/src/test/scala/whisk/core/invoker/test/NamespaceBlacklistTests.scala
index 89670f1..6ab2457 100644
--- a/tests/src/test/scala/whisk/core/invoker/test/NamespaceBlacklistTests.scala
+++ b/tests/src/test/scala/whisk/core/invoker/test/NamespaceBlacklistTests.scala
@@ -18,15 +18,17 @@
 package whisk.core.invoker.test
 
 import akka.stream.ActorMaterializer
-import common.{StreamLogging, WhiskProperties, WskActorSystem}
+import common.{StreamLogging, WskActorSystem}
 import org.junit.runner.RunWith
 import org.scalatest.concurrent.{IntegrationPatience, ScalaFutures}
 import org.scalatest.junit.JUnitRunner
 import org.scalatest.{FlatSpec, Matchers}
+import pureconfig.loadConfigOrThrow
 import spray.json.DefaultJsonProtocol._
 import spray.json._
 import whisk.common.TransactionId
-import whisk.core.WhiskConfig
+import whisk.core.database.CouchDbConfig
+import whisk.core.ConfigKeys
 import whisk.core.database.test.{DbUtils, ExtendedCouchDbRestClient}
 import whisk.core.entity._
 import whisk.core.invoker.NamespaceBlacklist
@@ -45,19 +47,18 @@ class NamespaceBlacklistTests
 
   behavior of "NamespaceBlacklist"
 
-  val config = new WhiskConfig(WhiskAuthStore.requiredProperties)
-
   implicit val materializer = ActorMaterializer()
   implicit val tid = TransactionId.testing
 
-  val authStore = WhiskAuthStore.datastore(config)
+  val dbConfig = loadConfigOrThrow[CouchDbConfig](ConfigKeys.couchdb)
+  val authStore = WhiskAuthStore.datastore()
   val subjectsDb = new ExtendedCouchDbRestClient(
-    WhiskProperties.getProperty(WhiskConfig.dbProtocol),
-    WhiskProperties.getProperty(WhiskConfig.dbHost),
-    WhiskProperties.getProperty(WhiskConfig.dbPort).toInt,
-    WhiskProperties.getProperty(WhiskConfig.dbUsername),
-    WhiskProperties.getProperty(WhiskConfig.dbPassword),
-    WhiskProperties.getProperty(WhiskConfig.dbAuths))
+    dbConfig.protocol,
+    dbConfig.host,
+    dbConfig.port,
+    dbConfig.username,
+    dbConfig.password,
+    dbConfig.databaseFor[WhiskAuth])
 
   /* Identities needed for the first test */
   val identities = Seq(

-- 
To stop receiving notification emails like this one, please contact
markusthoemmes@apache.org.

Mime
View raw message