[GitHub] chetanmeh commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore
chetanmeh commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore URL: https://github.com/apache/incubator-openwhisk/pull/3366#discussion_r172755939 ## File path: common/scala/src/main/scala/whisk/core/entity/WhiskAction.scala ## @@ -376,6 +376,24 @@ object WhiskAction extends DocumentFactory[WhiskAction] with WhiskEntityQueries[ } } + override def del[Wsuper >: WhiskAction](db: ArtifactStore[Wsuper], doc: DocInfo)( +implicit transid: TransactionId, +notifier: Option[CacheChangeNotification]): Future[Boolean] = { +Try { + require(db != null, "db undefined") + require(doc != null, "doc undefined") +}.map { _ => + val fa = super.del(db, doc) + implicit val ec = db.executionContext + fa.flatMap { _ => +super.deleteAttachments(db, doc) Review comment: @rabbah Any pointers on how to determine if an attachment is present ... or you meant expose a method in `DocumentFactory` like `hasAttachement` and use that and have that overridden in `WhiskAction` 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
[GitHub] chetanmeh commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore
chetanmeh commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore URL: https://github.com/apache/incubator-openwhisk/pull/3366#discussion_r171210065 ## File path: common/scala/src/main/scala/whisk/core/database/ArtifactStore.scala ## @@ -129,6 +129,11 @@ trait ArtifactStore[DocumentAbstraction] { protected[core] def readAttachment[T](doc: DocInfo, name: String, sink: Sink[ByteString, Future[T]])( implicit transid: TransactionId): Future[(ContentType, T)] + /** + * Deletes an attachments linked to given document + */ + protected[core] def deleteAttachments[T](doc: DocInfo)(implicit transid: TransactionId): Future[Boolean] Review comment: It deletes all linked attachments. See #3356 for more details on the API part 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
[GitHub] chetanmeh commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore
chetanmeh commented on a change in pull request #3366: Adds method deleteAttachments to ArtifactStore URL: https://github.com/apache/incubator-openwhisk/pull/3366#discussion_r171174734 ## File path: tests/build.gradle ## @@ -66,7 +66,8 @@ dependencies { compile 'org.scalamock:scalamock-scalatest-support_2.11:3.4.2' compile 'com.typesafe.akka:akka-testkit_2.11:2.4.16' compile 'com.typesafe.akka:akka-http-testkit_2.11:10.0.10' -compile 'com.github.java-json-tools:json-schema-validator:2.2.8'; +compile 'com.github.java-json-tools:json-schema-validator:2.2.8' +compile "org.mockito:mockito-core:2.15.0" Review comment: Checked scalamock but did not found any way to [spy][1] on existing object which I require in the test. Scalamock can mock any interface or class but looks like does not provide a way to proxy an existing object and check interactions that happen with that object [1]: http://static.javadoc.io/org.mockito/mockito-core/2.15.0/org/mockito/Mockito.html#13 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