abaruni commented on a change in pull request #217: Add ability to get trigger 
configuration and status
URL: 
https://github.com/apache/incubator-openwhisk-package-kafka/pull/217#discussion_r144572363
 
 

 ##########
 File path: tests/src/test/scala/system/packages/MessageHubFeedTests.scala
 ##########
 @@ -274,6 +274,67 @@ class MessageHubFeedTests
       assert(matchingActivations.length == 0)
   }
 
+  it should "return correct status and configuration" in 
withAssetCleaner(wskprops) {
+    val currentTime = s"${System.currentTimeMillis}"
+
+    (wp, assetHelper) =>
+      val triggerName = s"/_/dummyMessageHubTrigger-$currentTime"
+      println(s"Creating trigger ${triggerName}")
+
+      val username = kafkaUtils.getAsJson("user")
+      val password = kafkaUtils.getAsJson("password")
+      val admin_url = kafkaUtils.getAsJson("kafka_admin_url")
+      val brokers = kafkaUtils.getAsJson("brokers")
+
+      createTrigger(assetHelper, triggerName, parameters = Map(
+        "user" -> username,
+        "password" -> password,
+        "api_key" -> kafkaUtils.getAsJson("api_key"),
+        "kafka_admin_url" -> admin_url,
+        "kafka_brokers_sasl" -> brokers,
+        "topic" -> topic.toJson,
+        "isBinaryKey" -> false.toJson,
+        "isBinaryValue" -> false.toJson
+      ))
+
+      val run = wsk.action.invoke(actionName, parameters = Map(
+        "triggerName" -> triggerName.toJson,
+        "lifecycleEvent" -> "READ".toJson,
+        "authKey" -> wp.authKey.toJson
+      ))
+
+      withActivation(wsk.activation, run) {
+        activation =>
+          activation.response.success shouldBe true
+
+          inside (activation.response.result) {
+            case Some(result) =>
+              val config = 
result.getFields("config").head.asInstanceOf[JsObject].fields
+              val status = 
result.getFields("status").head.asInstanceOf[JsObject].fields
+
+              config should contain("brokers" -> brokers)
 
 Review comment:
   passed in as `/_/dummyTrigger-...` returned as `/guest/dummyTrigger-...`
 
----------------------------------------------------------------
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