markusthoemmes closed pull request #3283: Add implicit ClassTag for entity type
URL: https://github.com/apache/incubator-openwhisk/pull/3283
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 e8cac180ac..d07381ea27 100644
--- 
a/common/scala/src/main/scala/whisk/core/database/ArtifactStoreProvider.scala
+++ 
b/common/scala/src/main/scala/whisk/core/database/ArtifactStoreProvider.scala
@@ -25,13 +25,15 @@ import whisk.core.WhiskConfig
 import whisk.spi.Spi
 import whisk.core.entity.DocumentReader
 
+import scala.reflect.ClassTag
+
 /**
  * An Spi for providing ArtifactStore implementations
  */
 trait ArtifactStoreProvider extends Spi {
-  def makeStore[D <: DocumentSerializer](config: WhiskConfig,
-                                         name: WhiskConfig => String,
-                                         useBatching: Boolean = false)(
+  def makeStore[D <: DocumentSerializer: ClassTag](config: WhiskConfig,
+                                                   name: WhiskConfig => String,
+                                                   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 08b915e4f9..0a59c39bc5 100644
--- a/common/scala/src/main/scala/whisk/core/database/CouchDbStoreProvider.scala
+++ b/common/scala/src/main/scala/whisk/core/database/CouchDbStoreProvider.scala
@@ -24,9 +24,13 @@ import whisk.common.Logging
 import whisk.core.WhiskConfig
 import whisk.core.entity.DocumentReader
 
+import scala.reflect.ClassTag
+
 object CouchDbStoreProvider extends ArtifactStoreProvider {
 
-  def makeStore[D <: DocumentSerializer](config: WhiskConfig, name: 
WhiskConfig => String, useBatching: Boolean)(
+  def makeStore[D <: DocumentSerializer: ClassTag](config: WhiskConfig,
+                                                   name: WhiskConfig => String,
+                                                   useBatching: Boolean)(
     implicit jsonFormat: RootJsonFormat[D],
     docReader: DocumentReader,
     actorSystem: ActorSystem,
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 7eaf1a10da..d69f9d7e21 100644
--- a/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala
@@ -49,6 +49,8 @@ import whisk.core.database.StaleParameter
 import whisk.spi.SpiLoader
 import pureconfig._
 
+import scala.reflect.classTag
+
 package object types {
   type AuthStore = ArtifactStore[WhiskAuth]
   type EntityStore = ArtifactStore[WhiskEntity]
@@ -123,6 +125,7 @@ object WhiskEntityStore {
     SpiLoader
       .get[ArtifactStoreProvider]
       .makeStore[WhiskEntity](config, _.dbWhisk)(
+        classTag[WhiskEntity],
         WhiskEntityJsonFormat,
         WhiskDocumentReader,
         system,
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 7d69ccf579..cf9303d1f1 100644
--- a/tests/src/test/scala/whisk/core/controller/test/ActivationsApiTests.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/ActivationsApiTests.scala
@@ -35,6 +35,8 @@ import whisk.core.entity.size._
 import whisk.http.{ErrorResponse, Messages}
 import whisk.spi.SpiLoader
 
+import scala.reflect.classTag
+
 /**
  * Tests Activations API.
  *
@@ -525,6 +527,7 @@ class ActivationsApiTests extends ControllerTestCommon with 
WhiskActivationsApi
     val activationStore = SpiLoader
       .get[ArtifactStoreProvider]
       .makeStore[WhiskEntity](whiskConfig, _.dbActivations)(
+        classTag[WhiskEntity],
         WhiskEntityJsonFormat,
         WhiskDocumentReader,
         system,


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to