This is an automated email from the ASF dual-hosted git repository.

dubeejw 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 54527b5  GET trigger now returns matched rules in JSON payload (#3275)
54527b5 is described below

commit 54527b5d76cbbc130a7ecb42132b5075ab60890e
Author: Mark Deuser <mdeu...@us.ibm.com>
AuthorDate: Wed Feb 14 16:31:21 2018 -0500

    GET trigger now returns matched rules in JSON payload (#3275)
    
    * GET trigger now returns matched rules in JSON payload
    
    * Update GET trigger swagger to include "rules" object
---
 core/controller/src/main/resources/apiv1swagger.json                | 5 ++++-
 core/controller/src/main/scala/whisk/core/controller/Triggers.scala | 2 +-
 tests/src/test/scala/system/basic/WskBasicTests.scala               | 6 ++++++
 .../test/scala/whisk/core/controller/test/TriggersApiTests.scala    | 6 +++---
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/core/controller/src/main/resources/apiv1swagger.json 
b/core/controller/src/main/resources/apiv1swagger.json
index 86e9460..efb553a 100644
--- a/core/controller/src/main/resources/apiv1swagger.json
+++ b/core/controller/src/main/resources/apiv1swagger.json
@@ -410,7 +410,6 @@
                         }
                     },
                     "202": {
-                        "description": "Activation request accepted",
                         "$ref": "#/responses/AcceptedActivation"
                     },
                     "401": {
@@ -1718,6 +1717,10 @@
                 },
                 "limits": {
                     "$ref": "#/definitions/TriggerLimits"
+                },
+                "rules": {
+                    "type": "object",
+                    "description": "rules associated with the trigger"
                 }
             }
         },
diff --git 
a/core/controller/src/main/scala/whisk/core/controller/Triggers.scala 
b/core/controller/src/main/scala/whisk/core/controller/Triggers.scala
index 207e4f5..873dcfd 100644
--- a/core/controller/src/main/scala/whisk/core/controller/Triggers.scala
+++ b/core/controller/src/main/scala/whisk/core/controller/Triggers.scala
@@ -283,7 +283,7 @@ trait WhiskTriggersApi extends WhiskCollectionAPI {
    * @param status the status to include in the response
    */
   private def completeAsTriggerResponse(trigger: WhiskTrigger): RequestContext 
=> Future[RouteResult] = {
-    complete(OK, trigger.withoutRules)
+    complete(OK, trigger)
   }
 
   /**
diff --git a/tests/src/test/scala/system/basic/WskBasicTests.scala 
b/tests/src/test/scala/system/basic/WskBasicTests.scala
index 8e68d29..4c8e197 100644
--- a/tests/src/test/scala/system/basic/WskBasicTests.scala
+++ b/tests/src/test/scala/system/basic/WskBasicTests.scala
@@ -513,6 +513,12 @@ class WskBasicTests extends TestHelpers with 
WskTestHelpers {
     trigger.getFieldJsValue("publish") shouldBe JsBoolean(false)
     trigger.getField("version") shouldBe "0.0.2"
 
+    val expectedRules = JsObject(
+      ns + "/" + ruleName -> JsObject(
+        "action" -> JsObject("name" -> JsString(actionName), "path" -> 
JsString(ns)),
+        "status" -> JsString("active")))
+    trigger.getFieldJsValue("rules") shouldBe expectedRules
+
     val dynamicParams = Map("t" -> "T".toJson)
     val run = wsk.trigger.fire(triggerName, dynamicParams)
     withActivation(wsk.activation, run) { activation =>
diff --git 
a/tests/src/test/scala/whisk/core/controller/test/TriggersApiTests.scala 
b/tests/src/test/scala/whisk/core/controller/test/TriggersApiTests.scala
index 1734a17..59e9e7e 100644
--- a/tests/src/test/scala/whisk/core/controller/test/TriggersApiTests.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/TriggersApiTests.scala
@@ -132,14 +132,14 @@ class TriggersApiTests extends ControllerTestCommon with 
WhiskTriggersApi {
     Get(s"$collectionPath/${trigger.name}") ~> Route.seal(routes(creds)) ~> 
check {
       status should be(OK)
       val response = responseAs[WhiskTrigger]
-      response should be(trigger.withoutRules)
+      response should be(trigger)
     }
 
     // it should "get trigger by name in explicit namespace owned by subject" 
in
     Get(s"/$namespace/${collection.path}/${trigger.name}") ~> 
Route.seal(routes(creds)) ~> check {
       status should be(OK)
       val response = responseAs[WhiskTrigger]
-      response should be(trigger.withoutRules)
+      response should be(trigger)
     }
 
     // it should "reject get trigger by name in explicit namespace not owned 
by subject" in
@@ -170,7 +170,7 @@ class TriggersApiTests extends ControllerTestCommon with 
WhiskTriggersApi {
     Delete(s"$collectionPath/${trigger.name}") ~> Route.seal(routes(creds)) ~> 
check {
       status should be(OK)
       val response = responseAs[WhiskTrigger]
-      response should be(trigger.withoutRules)
+      response should be(trigger)
     }
   }
 

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

Reply via email to