add a test (currently ignored) for a rule with a packaged action.
add a little information to 2 log messages.
add EntityQName -- qualified name for an entity
diff --git a/tests/src/whisk/core/controller/test/RulesApiTests.scala b/tests/src/whisk/core/controller/test/RulesApiTests.scala
index aa60160..bca466a 100644
--- a/tests/src/whisk/core/controller/test/RulesApiTests.scala
+++ b/tests/src/whisk/core/controller/test/RulesApiTests.scala
@@ -51,6 +51,7 @@
import whisk.core.entity.ReducedRule
import whisk.core.entity.test.OldWhiskRule
import whisk.core.entity.test.OldWhiskTrigger
+import whisk.core.entity.WhiskPackage
/**
* Tests Rules API.
@@ -269,6 +270,40 @@
}
}
+ ignore should "create rule with an action in a package" in {
+ implicit val tid = transid()
+
+ val provider = WhiskPackage(namespace, aname)
+ put(entityStore, provider)
+
+ val actionName = aname
+ val action = WhiskAction(provider.path, actionName, Exec.js("??"))
+ // TODO: this should be an EntityQName, not an EntityPath
+ val actionNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, action.name))
+
+ val triggerName = aname
+ val trigger = WhiskTrigger(namespace, triggerName)
+
+ val ruleName = aname
+ val ruleNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, ruleName))
+
+ val rule = WhiskRule(namespace, ruleName, triggerName, actionName)
+ val content = WhiskRulePut(Some(trigger.name), Some(action.name))
+
+ put(entityStore, trigger, false)
+ put(entityStore, action)
+ Put(s"$collectionPath/${rule.name}", content) ~> sealRoute(routes(creds)) ~> check {
+ val t = get(entityStore, trigger.docid.asDocInfo, WhiskTrigger)
+ deleteTrigger(t.docid)
+ deleteRule(rule.docid)
+
+ status should be(OK)
+ t.rules.get(ruleNameQualified) shouldBe ReducedRule(actionNameQualified, Status.ACTIVE)
+ val response = responseAs[WhiskRuleResponse]
+ response should be(rule.withStatus(Status.ACTIVE))
+ }
+ }
+
it should "reject create rule with annotations which are too big" in {
implicit val tid = transid()
val keys: List[Long] = List.range(Math.pow(10, 9) toLong, (Parameters.sizeLimit.toBytes / 2 / 20 + Math.pow(10, 9) + 2) toLong)