Enable trigger caching now that cache properly transacts reads and writes. (#1455)

diff --git a/tests/src/whisk/core/controller/test/RulesApiTests.scala b/tests/src/whisk/core/controller/test/RulesApiTests.scala
index a1902f3..51d441a 100644
--- a/tests/src/whisk/core/controller/test/RulesApiTests.scala
+++ b/tests/src/whisk/core/controller/test/RulesApiTests.scala
@@ -73,7 +73,7 @@
 
     val creds = WhiskAuth(Subject(), AuthKey()).toIdentity
     val namespace = EntityPath(creds.subject())
-    def aname = MakeName.next("rules_tests")
+    def aname() = MakeName.next("rules_tests")
     val collectionPath = s"/${EntityPath.DEFAULT}/${collection.path}"
     val activeStatus = s"""{"status":"${Status.ACTIVE}"}""".parseJson.asJsObject
     val inactiveStatus = s"""{"status":"${Status.INACTIVE}"}""".parseJson.asJsObject
@@ -84,7 +84,7 @@
     it should "list rules by default namespace" in {
         implicit val tid = transid()
         val rules = (1 to 2).map { i =>
-            WhiskRule(namespace, aname, EntityName("bogus trigger"), EntityName("bogus action"))
+            WhiskRule(namespace, aname(), EntityName("bogus trigger"), EntityName("bogus action"))
         }.toList
         rules foreach { put(entityStore, _) }
         waitOnView(entityStore, WhiskRule, namespace, 2)
@@ -100,7 +100,7 @@
     ignore should "list rules by default namespace with full docs" in {
         implicit val tid = transid()
         val rules = (1 to 2).map { i =>
-            WhiskRule(namespace, aname, EntityName("bogus trigger"), EntityName("bogus action"))
+            WhiskRule(namespace, aname(), EntityName("bogus trigger"), EntityName("bogus action"))
         }.toList
         rules foreach { put(entityStore, _) }
         waitOnView(entityStore, WhiskRule, namespace, 2)
@@ -115,7 +115,7 @@
     //// GET /rule/name
     it should "get rule" in {
         implicit val tid = transid()
-        val rule = WhiskRule(namespace, aname, EntityName("bogus trigger"), EntityName("bogus action"))
+        val rule = WhiskRule(namespace, aname(), EntityName("bogus trigger"), EntityName("bogus action"))
         put(entityStore, rule)
         Get(s"$collectionPath/${rule.name}") ~> sealRoute(routes(creds)) ~> check {
             status should be(OK)
@@ -167,7 +167,7 @@
 
     it should "report Conflict if the name was of a different type" in {
         implicit val tid = transid()
-        val trigger = WhiskTrigger(namespace, aname)
+        val trigger = WhiskTrigger(namespace, aname())
         put(entityStore, trigger)
         Get(s"/$namespace/${collection.path}/${trigger.name}") ~> sealRoute(routes(creds)) ~> check {
             status should be(Conflict)
@@ -178,7 +178,7 @@
     it should "reject delete rule in state active" in {
         implicit val tid = transid()
         val ruleName = EntityName("reject_delete_rule_active")
-        val triggerName = EntityName("a trigger")
+        val triggerName = aname()
         val trigger = WhiskTrigger(namespace, triggerName, rules = Some(Map(EntityPath(WhiskEntity.qualifiedName(namespace, ruleName)) -> ReducedRule(namespace, Status.ACTIVE))))
         val rule = WhiskRule(namespace, ruleName, triggerName, EntityName("an action"))
         put(entityStore, trigger)
@@ -193,10 +193,10 @@
 
     it should "delete rule in state inactive" in {
         implicit val tid = transid()
-        val ruleName = aname
+        val ruleName = aname()
         val ruleNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, ruleName))
-        val triggerName = aname
-        val actionName = aname
+        val triggerName = aname()
+        val actionName = aname()
         val actionNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, actionName))
         val triggerLink = ReducedRule(actionNameQualified, Status.INACTIVE)
         val trigger = WhiskTrigger(namespace, triggerName, rules = Some(Map(ruleNameQualified -> triggerLink)))
@@ -227,9 +227,9 @@
 
     it should "delete rule in state inactive even if the trigger has no reference to the rule" in {
         implicit val tid = transid()
-        val ruleName = aname
+        val ruleName = aname()
         val ruleNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, ruleName))
-        val triggerName = aname
+        val triggerName = aname()
         val trigger = WhiskTrigger(namespace, triggerName)
         val rule = WhiskRule(namespace, ruleName, triggerName, EntityName("an action"))
         put(entityStore, trigger, false)
@@ -247,10 +247,10 @@
     it should "create rule" in {
         implicit val tid = transid()
 
-        val ruleName = aname
+        val ruleName = aname()
         val ruleNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, ruleName))
-        val triggerName = aname
-        val actionName = aname
+        val triggerName = aname()
+        val actionName = aname()
         val actionNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, actionName))
         val trigger = WhiskTrigger(namespace, triggerName)
         val rule = WhiskRule(namespace, ruleName, triggerName, actionName)
@@ -273,18 +273,18 @@
     ignore should "create rule with an action in a package" in {
         implicit val tid = transid()
 
-        val provider = WhiskPackage(namespace, aname)
+        val provider = WhiskPackage(namespace, aname())
         put(entityStore, provider)
 
-        val actionName = aname
+        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 triggerName = aname()
         val trigger = WhiskTrigger(namespace, triggerName)
 
-        val ruleName = aname
+        val ruleName = aname()
         val ruleNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, ruleName))
 
         val rule = WhiskRule(namespace, ruleName, triggerName, actionName)
@@ -310,12 +310,12 @@
         val parameters = keys map { key =>
             Parameters(key.toString, "a" * 10)
         } reduce (_ ++ _)
-        val trigger = WhiskTrigger(namespace, aname)
-        val action = WhiskAction(namespace, aname, Exec.js("??"))
+        val trigger = WhiskTrigger(namespace, aname())
+        val action = WhiskAction(namespace, aname(), Exec.js("??"))
         val content = s"""{"trigger":"${trigger.name}","action":"${action.name}","annotations":$parameters}""".parseJson.asJsObject
         put(entityStore, trigger, false)
         put(entityStore, action)
-        Put(s"$collectionPath/${aname}", content) ~> sealRoute(routes(creds)) ~> check {
+        Put(s"$collectionPath/${aname()}", content) ~> sealRoute(routes(creds)) ~> check {
             val t = get(entityStore, trigger.docid, WhiskTrigger)
             deleteTrigger(t.docid)
 
@@ -330,9 +330,9 @@
         val parameters = keys map { key =>
             Parameters(key.toString, "a" * 10)
         } reduce (_ ++ _)
-        val trigger = WhiskTrigger(namespace, aname)
-        val action = WhiskAction(namespace, aname, Exec.js("??"))
-        val rule = WhiskRule(namespace, aname, trigger.name, action.name)
+        val trigger = WhiskTrigger(namespace, aname())
+        val action = WhiskAction(namespace, aname(), Exec.js("??"))
+        val rule = WhiskRule(namespace, aname(), trigger.name, action.name)
         val content = s"""{"trigger":"${trigger.name}","action":"${action.name}","annotations":$parameters}""".parseJson.asJsObject
         put(entityStore, trigger, false)
         put(entityStore, action)
@@ -348,7 +348,7 @@
 
     it should "reject rule if action does not exist" in {
         implicit val tid = transid()
-        val trigger = WhiskTrigger(namespace, aname)
+        val trigger = WhiskTrigger(namespace, aname())
         val content = WhiskRulePut(Some(trigger.name), Some(EntityName("bogus action")))
         put(entityStore, trigger)
         Put(s"$collectionPath/xxx", content) ~> sealRoute(routes(creds)) ~> check {
@@ -359,7 +359,7 @@
 
     it should "reject rule if trigger does not exist" in {
         implicit val tid = transid()
-        val action = WhiskAction(namespace, aname, Exec.js("??"))
+        val action = WhiskAction(namespace, aname(), Exec.js("??"))
         val content = WhiskRulePut(Some(EntityName("bogus trigger")), Some(action.name))
         put(entityStore, action)
         Put(s"$collectionPath/xxx", content) ~> sealRoute(routes(creds)) ~> check {
@@ -379,9 +379,9 @@
 
     it should "update rule updating trigger and action at once" in {
         implicit val tid = transid()
-        val trigger = WhiskTrigger(namespace, aname)
-        val action = WhiskAction(namespace, aname, Exec.js("??"))
-        val rule = WhiskRule(namespace, aname, EntityName("bogus trigger"), EntityName("bogus action"))
+        val trigger = WhiskTrigger(namespace, aname())
+        val action = WhiskAction(namespace, aname(), Exec.js("??"))
+        val rule = WhiskRule(namespace, aname(), EntityName("bogus trigger"), EntityName("bogus action"))
         put(entityStore, trigger, false)
         put(entityStore, action)
         put(entityStore, rule, false)
@@ -401,9 +401,9 @@
 
     it should "update rule with a new action while passing the same trigger" in {
         implicit val tid = transid()
-        val trigger = WhiskTrigger(namespace, aname)
-        val action = WhiskAction(namespace, aname, Exec.js("??"))
-        val rule = WhiskRule(namespace, aname, trigger.name, EntityName("bogus action"))
+        val trigger = WhiskTrigger(namespace, aname())
+        val action = WhiskAction(namespace, aname(), Exec.js("??"))
+        val rule = WhiskRule(namespace, aname(), trigger.name, EntityName("bogus action"))
         put(entityStore, trigger, false)
         put(entityStore, action)
         put(entityStore, rule, false)
@@ -422,9 +422,9 @@
 
     it should "update rule with just a new action" in {
         implicit val tid = transid()
-        val trigger = WhiskTrigger(namespace, aname)
-        val action = WhiskAction(namespace, aname, Exec.js("??"))
-        val rule = WhiskRule(namespace, aname, trigger.name, EntityName("bogus action"))
+        val trigger = WhiskTrigger(namespace, aname())
+        val action = WhiskAction(namespace, aname(), Exec.js("??"))
+        val rule = WhiskRule(namespace, aname(), trigger.name, EntityName("bogus action"))
         put(entityStore, trigger, false)
         put(entityStore, action)
         put(entityStore, rule, false)
@@ -443,9 +443,9 @@
 
     it should "update rule with just a new trigger" in {
         implicit val tid = transid()
-        val trigger = WhiskTrigger(namespace, aname)
-        val action = WhiskAction(namespace, aname, Exec.js("??"))
-        val rule = WhiskRule(namespace, aname, trigger.name, action.name)
+        val trigger = WhiskTrigger(namespace, aname())
+        val action = WhiskAction(namespace, aname(), Exec.js("??"))
+        val rule = WhiskRule(namespace, aname(), trigger.name, action.name)
         put(entityStore, trigger, false)
         put(entityStore, action)
         put(entityStore, rule, false)
@@ -464,9 +464,9 @@
 
     it should "update rule when no new content is provided" in {
         implicit val tid = transid()
-        val trigger = WhiskTrigger(namespace, aname)
-        val action = WhiskAction(namespace, aname, Exec.js("??"))
-        val rule = WhiskRule(namespace, aname, trigger.name, action.name)
+        val trigger = WhiskTrigger(namespace, aname())
+        val action = WhiskAction(namespace, aname(), Exec.js("??"))
+        val rule = WhiskRule(namespace, aname(), trigger.name, action.name)
         put(entityStore, trigger, false)
         put(entityStore, action)
         put(entityStore, rule, false)
@@ -483,8 +483,8 @@
 
     it should "reject update rule if trigger does not exist" in {
         implicit val tid = transid()
-        val action = WhiskAction(namespace, aname, Exec.js("??"))
-        val rule = WhiskRule(namespace, aname, EntityName("bogus trigger"), action.name)
+        val action = WhiskAction(namespace, aname(), Exec.js("??"))
+        val rule = WhiskRule(namespace, aname(), EntityName("bogus trigger"), action.name)
         put(entityStore, action)
         put(entityStore, rule)
         val content = WhiskRulePut(action = Some(action.name))
@@ -496,8 +496,8 @@
 
     it should "reject update rule if action does not exist" in {
         implicit val tid = transid()
-        val trigger = WhiskTrigger(namespace, aname)
-        val rule = WhiskRule(namespace, aname, trigger.name, EntityName("bogus action"))
+        val trigger = WhiskTrigger(namespace, aname())
+        val rule = WhiskRule(namespace, aname(), trigger.name, EntityName("bogus action"))
         put(entityStore, trigger)
         put(entityStore, rule)
         val content = WhiskRulePut(trigger = Some(trigger.name))
@@ -509,7 +509,7 @@
 
     it should "reject update rule if neither trigger or action exist" in {
         implicit val tid = transid()
-        val rule = WhiskRule(namespace, aname, EntityName("bogus trigger"), EntityName("bogus action"))
+        val rule = WhiskRule(namespace, aname(), EntityName("bogus trigger"), EntityName("bogus action"))
         put(entityStore, rule)
         val content = WhiskRulePut(None, None, None, None, None)
         Put(s"$collectionPath/${rule.name}?overwrite=true", content) ~> sealRoute(routes(creds)) ~> check {
@@ -521,7 +521,7 @@
     it should "reject update rule in state active" in {
         implicit val tid = transid()
         val triggerName = EntityName("a trigger")
-        val ruleName = aname
+        val ruleName = aname()
         val trigger = WhiskTrigger(namespace, triggerName, rules = Some(Map(EntityPath(WhiskEntity.qualifiedName(namespace, ruleName)) -> ReducedRule(namespace, Status.ACTIVE))))
         val rule = WhiskRule(namespace, ruleName, triggerName, EntityName("an action"))
         put(entityStore, trigger)
@@ -535,7 +535,7 @@
     //// POST /rules/name
     it should "do nothing to disable already disabled rule" in {
         implicit val tid = transid()
-        val rule = WhiskRule(namespace, aname, EntityName("a trigger"), EntityName("an action"))
+        val rule = WhiskRule(namespace, aname(), EntityName("a trigger"), EntityName("an action"))
         put(entityStore, rule)
         Post(s"$collectionPath/${rule.name}", inactiveStatus) ~> sealRoute(routes(creds)) ~> check {
             status should be(OK)
@@ -544,8 +544,8 @@
 
     it should "do nothing to enable already enabled rule" in {
         implicit val tid = transid()
-        val ruleName = aname
-        val triggerName = EntityName("a trigger")
+        val ruleName = aname()
+        val triggerName = aname()
         val trigger = WhiskTrigger(namespace, triggerName, rules = Some(Map(EntityPath(WhiskEntity.qualifiedName(namespace, ruleName)) -> ReducedRule(namespace, Status.ACTIVE))))
         val rule = WhiskRule(namespace, ruleName, triggerName, EntityName("an action"))
         put(entityStore, trigger)
@@ -572,9 +572,9 @@
 
     it should "activate rule" in {
         implicit val tid = transid()
-        val ruleName = aname
+        val ruleName = aname()
         val ruleNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, ruleName))
-        val triggerName = aname
+        val triggerName = aname()
         val rule = WhiskRule(namespace, ruleName, triggerName, EntityName("an action"))
         val trigger = WhiskTrigger(namespace, triggerName, rules = Some(Map(ruleNameQualified -> ReducedRule(namespace, Status.INACTIVE))))
         put(entityStore, trigger, false)
@@ -591,9 +591,9 @@
 
     it should "activate rule without rule in trigger" in {
         implicit val tid = transid()
-        val ruleName = aname
+        val ruleName = aname()
         val ruleNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, ruleName))
-        val triggerName = aname
+        val triggerName = aname()
         val rule = WhiskRule(namespace, ruleName, triggerName, EntityName("an action"))
         val trigger = WhiskTrigger(namespace, triggerName)
         put(entityStore, trigger, false)
@@ -609,9 +609,9 @@
 
     it should "reject rule activation, if the trigger is absent" in {
         implicit val tid = transid()
-        val ruleName = aname
+        val ruleName = aname()
         val ruleNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, ruleName))
-        val triggerName = aname
+        val triggerName = aname()
         val rule = WhiskRule(namespace, ruleName, triggerName, EntityName("an action"))
         put(entityStore, rule)
         Post(s"$collectionPath/${rule.name}", activeStatus) ~> sealRoute(routes(creds)) ~> check {
@@ -621,9 +621,9 @@
 
     it should "deactivate rule" in {
         implicit val tid = transid()
-        val ruleName = aname
+        val ruleName = aname()
         val ruleNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, ruleName))
-        val triggerName = aname
+        val triggerName = aname()
         val rule = WhiskRule(namespace, ruleName, triggerName, EntityName("an action"))
         val trigger = WhiskTrigger(namespace, triggerName, rules = Some(Map(ruleNameQualified -> ReducedRule(namespace, Status.ACTIVE))))
         put(entityStore, trigger, false)
@@ -640,7 +640,7 @@
     // invalid resource
     it should "reject invalid resource" in {
         implicit val tid = transid()
-        val rule = WhiskRule(namespace, aname, EntityName("a trigger"), EntityName("an action"))
+        val rule = WhiskRule(namespace, aname(), EntityName("a trigger"), EntityName("an action"))
         put(entityStore, rule)
         Get(s"$collectionPath/${rule.name}/bar") ~> sealRoute(routes(creds)) ~> check {
             status should be(NotFound)
@@ -650,7 +650,7 @@
     // migration path
     it should "handle a rule with the old schema gracefully" in {
         implicit val tid = transid()
-        val rule = OldWhiskRule(namespace, aname, EntityName("a trigger"), EntityName("an action"), Status.ACTIVE)
+        val rule = OldWhiskRule(namespace, aname(), EntityName("a trigger"), EntityName("an action"), Status.ACTIVE)
         put(entityStore, rule)
         Get(s"$collectionPath/${rule.name}") ~> sealRoute(routes(creds)) ~> check {
             status should be(OK)
@@ -662,10 +662,10 @@
     it should "create rule even if the attached trigger has the old schema" in {
         implicit val tid = transid()
 
-        val ruleName = aname
+        val ruleName = aname()
         val ruleNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, ruleName))
-        val triggerName = aname
-        val actionName = aname
+        val triggerName = aname()
+        val actionName = aname()
         val actionNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, actionName))
         val trigger = OldWhiskTrigger(namespace, triggerName)
         val rule = WhiskRule(namespace, ruleName, triggerName, actionName)
@@ -687,9 +687,9 @@
 
     it should "activate rule even if it is still in the old schema" in {
         implicit val tid = transid()
-        val ruleName = aname
+        val ruleName = aname()
         val ruleNameQualified = EntityPath(WhiskEntity.qualifiedName(namespace, ruleName))
-        val triggerName = aname
+        val triggerName = aname()
         val rule = OldWhiskRule(namespace, ruleName, triggerName, EntityName("an action"), Status.ACTIVE)
         val trigger = WhiskTrigger(namespace, triggerName, rules = Some(Map(ruleNameQualified -> ReducedRule(namespace, Status.INACTIVE))))
         put(entityStore, trigger, false)
diff --git a/tests/src/whisk/core/database/test/CacheConcurrencyTests.scala b/tests/src/whisk/core/database/test/CacheConcurrencyTests.scala
index 5fa26ce..96f3f95 100644
--- a/tests/src/whisk/core/database/test/CacheConcurrencyTests.scala
+++ b/tests/src/whisk/core/database/test/CacheConcurrencyTests.scala
@@ -43,8 +43,8 @@
     implicit private val transId = TransactionId.testing
     implicit private val wp = WskProps()
 
-    val nExternalIters = 10
-    val nInternalIters = 20
+    val nExternalIters = 1
+    val nInternalIters = 10
 
     for (i <- 1 to nExternalIters)
         "the cache" should s"support concurrent CRUD without bogus residual cache entries, iter ${i}" in {