dubeejw closed pull request #3275: GET trigger now returns matched rules in JSON payload URL: https://github.com/apache/incubator-openwhisk/pull/3275
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/core/controller/src/main/resources/apiv1swagger.json b/core/controller/src/main/resources/apiv1swagger.json index 86e946081a..efb553a629 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 207e4f5de9..873dcfdab3 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 8e68d29e59..4c8e1972db 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 1734a17818..59e9e7ea25 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) } } ---------------------------------------------------------------- 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