You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2019/06/05 16:15:38 UTC

[incubator-openwhisk] branch master updated: Consolidated action annotations to a new singleton (#4499)

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

rabbah 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 e88257e  Consolidated action annotations to a new singleton (#4499)
e88257e is described below

commit e88257ea72dd4341726f50af72e8924fc1ddb966
Author: Sai kiran Krishna murthy <au...@gmail.com>
AuthorDate: Wed Jun 5 18:15:27 2019 +0200

    Consolidated action annotations to a new singleton (#4499)
---
 .../apache/openwhisk/core/entity/Annotations.scala | 27 ++++++++++++++++++++++
 .../apache/openwhisk/core/entity/WhiskAction.scala |  8 +------
 .../apache/openwhisk/core/controller/Actions.scala |  6 ++---
 .../openwhisk/core/controller/WebActions.scala     | 10 ++++----
 .../core/containerpool/ContainerProxy.scala        |  2 +-
 .../scala/invokerShoot/ShootInvokerTests.scala     |  6 ++---
 .../core/cli/test/WskRestBasicUsageTests.scala     |  8 +++----
 .../containerpool/test/ContainerProxyTests.scala   |  3 +--
 .../core/controller/test/ActionsApiTests.scala     | 12 +++++-----
 .../controller/test/ControllerTestCommon.scala     |  2 +-
 .../core/controller/test/WebActionsApiTests.scala  |  2 +-
 .../test/scala/system/basic/WskActionTests.scala   |  8 +++----
 .../test/scala/system/basic/WskConsoleTests.scala  |  5 ++--
 .../scala/system/basic/WskRestBasicTests.scala     |  8 +++----
 14 files changed, 63 insertions(+), 44 deletions(-)

diff --git a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Annotations.scala b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Annotations.scala
new file mode 100644
index 0000000..96ae58f
--- /dev/null
+++ b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Annotations.scala
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.openwhisk.core.entity
+
+object Annotations {
+  val FinalParamsAnnotationName = "final"
+  val WebActionAnnotationName = "web-export"
+  val WebCustomOptionsAnnotationName = "web-custom-options"
+  val RawHttpAnnotationName = "raw-http"
+  val RequireWhiskAuthAnnotation = "require-whisk-auth"
+  val ProvideApiKeyAnnotationName = "provide-api-key"
+}
diff --git a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/WhiskAction.scala b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/WhiskAction.scala
index 84bc59c..a053813 100644
--- a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/WhiskAction.scala
+++ b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/WhiskAction.scala
@@ -83,7 +83,7 @@ abstract class WhiskActionLike(override val name: EntityName) extends WhiskEntit
 
   /** @return true iff action has appropriate annotation. */
   def hasFinalParamsAnnotation = {
-    annotations.getAs[Boolean](WhiskAction.finalParamsAnnotationName) getOrElse false
+    annotations.getAs[Boolean](Annotations.FinalParamsAnnotationName) getOrElse false
   }
 
   /** @return a Set of immutable parameternames */
@@ -329,13 +329,7 @@ case class ExecutableWhiskActionMetaData(namespace: EntityPath,
 object WhiskAction extends DocumentFactory[WhiskAction] with WhiskEntityQueries[WhiskAction] with DefaultJsonProtocol {
 
   val execFieldName = "exec"
-  val finalParamsAnnotationName = "final"
-  val webActionAnnotationName = "web-export"
-  val webCustomOptionsAnnotationName = "web-custom-options"
-  val rawHttpAnnotationName = "raw-http"
-  val requireWhiskAuthAnnotation = "require-whisk-auth"
   val requireWhiskAuthHeader = "x-require-whisk-auth"
-  val provideApiKeyAnnotationName = "provide-api-key"
 
   override val collectionName = "actions"
 
diff --git a/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala b/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
index da41e3d..2e7fa64 100644
--- a/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
+++ b/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
@@ -61,7 +61,7 @@ object WhiskActionsApi {
   /**
    * Amends annotations on an action create/update with system defined values.
    * This method currently adds the following annotations:
-   * 1. [[WhiskAction.provideApiKeyAnnotationName]] with the value false iff the annotation is not already defined in the action annotations
+   * 1. [[Annotations.ProvideApiKeyAnnotationName]] with the value false iff the annotation is not already defined in the action annotations
    * 2. An [[execAnnotation]] consistent with the action kind; this annotation is always added and overrides a pre-existing value
    */
   protected[core] def amendAnnotations(annotations: Parameters, exec: Exec, create: Boolean = true): Parameters = {
@@ -70,10 +70,10 @@ object WhiskActionsApi {
       // since they can break existing actions created before the
       // annotation was created
       annotations
-        .get(WhiskAction.provideApiKeyAnnotationName)
+        .get(Annotations.ProvideApiKeyAnnotationName)
         .map(_ => annotations)
         .getOrElse {
-          annotations ++ Parameters(WhiskAction.provideApiKeyAnnotationName, JsBoolean(false))
+          annotations ++ Parameters(Annotations.ProvideApiKeyAnnotationName, JsBoolean(false))
         }
     } else annotations
     newAnnotations ++ execAnnotation(exec)
diff --git a/core/controller/src/main/scala/org/apache/openwhisk/core/controller/WebActions.scala b/core/controller/src/main/scala/org/apache/openwhisk/core/controller/WebActions.scala
index d698cb4..c785f09 100644
--- a/core/controller/src/main/scala/org/apache/openwhisk/core/controller/WebActions.scala
+++ b/core/controller/src/main/scala/org/apache/openwhisk/core/controller/WebActions.scala
@@ -491,7 +491,7 @@ trait WhiskWebActionsApi
                         "web action with require-whisk-auth was invoked without a matching x-require-whisk-auth header value")
                       terminate(Unauthorized)
                     } else if (!action.annotations
-                                 .getAs[Boolean](WhiskAction.webCustomOptionsAnnotationName)
+                                 .getAs[Boolean](Annotations.WebCustomOptionsAnnotationName)
                                  .getOrElse(false)) {
                       respondWithHeaders(defaultCorsResponse(context.headers)) {
                         if (context.method == OPTIONS) {
@@ -556,7 +556,7 @@ trait WhiskWebActionsApi
       processRequest(actionOwnerIdentity, action, extension, onBehalfOf, context.withBody(body), isRawHttpAction)
     }
 
-    provide(action.annotations.getAs[Boolean](WhiskAction.rawHttpAnnotationName).getOrElse(false)) { isRawHttpAction =>
+    provide(action.annotations.getAs[Boolean](Annotations.RawHttpAnnotationName).getOrElse(false)) { isRawHttpAction =>
       httpEntity match {
         case Empty =>
           process(None, isRawHttpAction)
@@ -706,8 +706,8 @@ trait WhiskWebActionsApi
     implicit transid: TransactionId): Future[WhiskActionMetaData] = {
     actionLookup flatMap { action =>
       val requiresAuthenticatedUser =
-        action.annotations.getAs[Boolean](WhiskAction.requireWhiskAuthAnnotation).getOrElse(false)
-      val isExported = action.annotations.getAs[Boolean](WhiskAction.webActionAnnotationName).getOrElse(false)
+        action.annotations.getAs[Boolean](Annotations.RequireWhiskAuthAnnotation).getOrElse(false)
+      val isExported = action.annotations.getAs[Boolean](Annotations.WebActionAnnotationName).getOrElse(false)
 
       if ((isExported && requiresAuthenticatedUser && authenticated) ||
           (isExported && !requiresAuthenticatedUser)) {
@@ -764,7 +764,7 @@ trait WhiskWebActionsApi
    */
   private def requiredWhiskAuthSuccessful(annotations: Parameters, reqHeaders: Seq[HttpHeader]): Option[Boolean] = {
     annotations
-      .get(WhiskAction.requireWhiskAuthAnnotation)
+      .get(Annotations.RequireWhiskAuthAnnotation)
       .flatMap {
         case JsString(authStr) => Some(authStr)
         case JsNumber(authNum) => Some(authNum.toString)
diff --git a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala
index 94d54df..669b308 100644
--- a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala
+++ b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala
@@ -563,7 +563,7 @@ class ContainerProxy(
         // if the action requests the api key to be injected into the action context, add it here;
         // treat a missing annotation as requesting the api key for backward compatibility
         val authEnvironment = {
-          if (job.action.annotations.isTruthy(WhiskAction.provideApiKeyAnnotationName, valueForNonExistent = true)) {
+          if (job.action.annotations.isTruthy(Annotations.ProvideApiKeyAnnotationName, valueForNonExistent = true)) {
             job.msg.user.authkey.toEnvironment
           } else JsObject.empty
         }
diff --git a/tests/src/test/scala/invokerShoot/ShootInvokerTests.scala b/tests/src/test/scala/invokerShoot/ShootInvokerTests.scala
index f64956e..56e576c 100644
--- a/tests/src/test/scala/invokerShoot/ShootInvokerTests.scala
+++ b/tests/src/test/scala/invokerShoot/ShootInvokerTests.scala
@@ -24,7 +24,7 @@ import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
 import common._
 import common.rest.WskRestOperations
-import org.apache.openwhisk.core.entity.WhiskAction
+import org.apache.openwhisk.core.entity.{Annotations}
 import org.apache.commons.io.FileUtils
 import spray.json._
 import spray.json.DefaultJsonProtocol._
@@ -189,7 +189,7 @@ class ShootInvokerTests extends TestHelpers with WskTestHelpers with JsHelpers w
         JsObject("key" -> JsString("copiedAnnot2"), "value" -> JsBoolean(false)),
         JsObject("key" -> JsString("copiedAnnot1"), "value" -> JsString("copiedAnnotValue1")),
         JsObject("key" -> JsString("origAnnot2"), "value" -> JsBoolean(true)),
-        JsObject("key" -> WhiskAction.provideApiKeyAnnotationName.toJson, "value" -> JsBoolean(false)))
+        JsObject("key" -> Annotations.ProvideApiKeyAnnotationName.toJson, "value" -> JsBoolean(false)))
 
       assetHelper.withCleaner(wsk.action, origName) {
         val file = Some(TestUtils.getTestActionFilename("echo.js"))
@@ -267,7 +267,7 @@ class ShootInvokerTests extends TestHelpers with WskTestHelpers with JsHelpers w
       action.create(
         name,
         Some(TestUtils.getTestActionFilename("wcbin.js")),
-        annotations = Map(WhiskAction.provideApiKeyAnnotationName -> JsBoolean(true)))
+        annotations = Map(Annotations.ProvideApiKeyAnnotationName -> JsBoolean(true)))
     }
     assetHelper.withCleaner(wsk.action, child) { (action, _) =>
       action.create(child, Some(TestUtils.getTestActionFilename("wc.js")))
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskRestBasicUsageTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskRestBasicUsageTests.scala
index 8b08ffc..def7167 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskRestBasicUsageTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskRestBasicUsageTests.scala
@@ -304,7 +304,7 @@ class WskRestBasicUsageTests extends TestHelpers with WskTestHelpers with WskAct
       action.create(
         name,
         Some(TestUtils.getTestActionFilename("helloOpenwhiskPackage.js")),
-        annotations = Map(WhiskAction.provideApiKeyAnnotationName -> JsTrue))
+        annotations = Map(Annotations.ProvideApiKeyAnnotationName -> JsTrue))
     }
 
     val run = wsk.action.invoke(name, Map("ignore_certs" -> true.toJson, "name" -> name.toJson))
@@ -348,7 +348,7 @@ class WskRestBasicUsageTests extends TestHelpers with WskTestHelpers with WskAct
         action.create(
           name,
           Some(TestUtils.getTestActionFilename("helloContext.js")),
-          annotations = Map(WhiskAction.provideApiKeyAnnotationName -> JsTrue))
+          annotations = Map(Annotations.ProvideApiKeyAnnotationName -> JsTrue))
       }
 
       val start = Instant.now(Clock.systemUTC()).toEpochMilli
@@ -453,7 +453,7 @@ class WskRestBasicUsageTests extends TestHelpers with WskTestHelpers with WskAct
         Parameters("raw-http", JsBoolean(rawEnabled)) ++
         Parameters("final", JsBoolean(webEnabled || rawEnabled))
       val testAnnotations = if (requireAPIKeyAnnotation) {
-        baseAnnotations ++ Parameters(WhiskAction.provideApiKeyAnnotationName, JsFalse)
+        baseAnnotations ++ Parameters(Annotations.ProvideApiKeyAnnotationName, JsFalse)
       } else baseAnnotations
 
       // we ignore the exec field here, since we already compared it above
@@ -482,7 +482,7 @@ class WskRestBasicUsageTests extends TestHelpers with WskTestHelpers with WskAct
 
       val testAnnotations = if (requireAPIKeyAnnotation) {
         baseAnnotations ++
-          Parameters(WhiskAction.provideApiKeyAnnotationName, JsBoolean(false))
+          Parameters(Annotations.ProvideApiKeyAnnotationName, JsBoolean(false))
       } else {
         baseAnnotations
       }
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala
index cf93736..75377a2 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala
@@ -41,7 +41,6 @@ import org.apache.openwhisk.core.entity._
 import org.apache.openwhisk.core.entity.size._
 import org.apache.openwhisk.http.Messages
 import org.apache.openwhisk.core.database.UserContext
-import org.apache.openwhisk.core.entity.WhiskAction.provideApiKeyAnnotationName
 
 import scala.concurrent.Await
 import scala.concurrent.duration._
@@ -1092,7 +1091,7 @@ class ContainerProxyTests
 
     preWarm(machine)
 
-    val keyFalsyAnnotation = Parameters(provideApiKeyAnnotationName, JsBoolean(false))
+    val keyFalsyAnnotation = Parameters(Annotations.ProvideApiKeyAnnotationName, JsBoolean(false))
     val actionWithFalsyKeyAnnotation =
       ExecutableWhiskAction(EntityPath("actionSpace"), EntityName("actionName"), exec, annotations = keyFalsyAnnotation)
 
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala
index 69f617f..d462e69 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala
@@ -1381,7 +1381,7 @@ class ActionsApiTests extends ControllerTestCommon with WhiskActionsApi {
 
   it should "not invoke an action when final parameters are redefined" in {
     implicit val tid = transid()
-    val annotations = Parameters(WhiskAction.finalParamsAnnotationName, JsTrue)
+    val annotations = Parameters(Annotations.FinalParamsAnnotationName, JsTrue)
     val parameters = Parameters("a", "A") ++ Parameters("empty", JsNull)
     val action = WhiskAction(namespace, aname(), jsDefault("??"), parameters = parameters, annotations = annotations)
     put(entityStore, action)
@@ -1707,19 +1707,19 @@ class ActionsApiTests extends ControllerTestCommon with WhiskActionsApi {
 @RunWith(classOf[JUnitRunner])
 class WhiskActionsApiTests extends FlatSpec with Matchers with ExecHelpers {
   import WhiskActionsApi.amendAnnotations
-  import WhiskAction.provideApiKeyAnnotationName
+  import Annotations.ProvideApiKeyAnnotationName
   import WhiskAction.execFieldName
 
   val baseParams = Parameters("a", JsString("A")) ++ Parameters("b", JsString("B"))
-  val keyTruthyAnnotation = Parameters(provideApiKeyAnnotationName, JsBoolean(true))
-  val keyFalsyAnnotation = Parameters(provideApiKeyAnnotationName, JsString("")) // falsy other than JsBoolean(false)
+  val keyTruthyAnnotation = Parameters(ProvideApiKeyAnnotationName, JsBoolean(true))
+  val keyFalsyAnnotation = Parameters(ProvideApiKeyAnnotationName, JsString("")) // falsy other than JsBoolean(false)
   val execAnnotation = Parameters(execFieldName, JsString("foo"))
   val exec: Exec = jsDefault("??")
 
   it should "add key annotation if it is not present already" in {
     Seq(Parameters(), baseParams).foreach { p =>
       amendAnnotations(p, exec) shouldBe {
-        p ++ Parameters(provideApiKeyAnnotationName, JsBoolean(false)) ++
+        p ++ Parameters(ProvideApiKeyAnnotationName, JsBoolean(false)) ++
           Parameters(WhiskAction.execFieldName, exec.kind)
       }
     }
@@ -1735,7 +1735,7 @@ class WhiskActionsApiTests extends FlatSpec with Matchers with ExecHelpers {
 
   it should "override system annotation as necessary" in {
     amendAnnotations(baseParams ++ execAnnotation, exec) shouldBe {
-      baseParams ++ Parameters(provideApiKeyAnnotationName, JsBoolean(false)) ++ Parameters(
+      baseParams ++ Parameters(ProvideApiKeyAnnotationName, JsBoolean(false)) ++ Parameters(
         WhiskAction.execFieldName,
         exec.kind)
     }
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ControllerTestCommon.scala b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ControllerTestCommon.scala
index 51e06fd..9df7d8c 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ControllerTestCommon.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ControllerTestCommon.scala
@@ -87,7 +87,7 @@ protected trait ControllerTestCommon
 
   def systemAnnotations(kind: String, create: Boolean = true): Parameters = {
     val base = if (create && FeatureFlags.requireApiKeyAnnotation) {
-      Parameters(WhiskAction.provideApiKeyAnnotationName, JsFalse)
+      Parameters(Annotations.ProvideApiKeyAnnotationName, JsFalse)
     } else {
       Parameters()
     }
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/WebActionsApiTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/WebActionsApiTests.scala
index 591ebd4..bd4708a 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/WebActionsApiTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/WebActionsApiTests.scala
@@ -210,7 +210,7 @@ trait WebActionsApiBaseTests extends ControllerTestCommon with BeforeAndAfterEac
                            requireAuthentication: Boolean = false,
                            requireAuthenticationAsBoolean: Boolean = true) = {
 
-    val annotations = Parameters(WhiskAction.finalParamsAnnotationName, JsTrue)
+    val annotations = Parameters(Annotations.FinalParamsAnnotationName, JsTrue)
     WhiskAction(
       namespace,
       name,
diff --git a/tests/src/test/scala/system/basic/WskActionTests.scala b/tests/src/test/scala/system/basic/WskActionTests.scala
index 50d2410..74e1cc0 100644
--- a/tests/src/test/scala/system/basic/WskActionTests.scala
+++ b/tests/src/test/scala/system/basic/WskActionTests.scala
@@ -24,7 +24,7 @@ import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
 import common._
 import common.rest.WskRestOperations
-import org.apache.openwhisk.core.entity.WhiskAction
+import org.apache.openwhisk.core.entity.Annotations
 import org.apache.commons.io.FileUtils
 import org.apache.openwhisk.core.FeatureFlags
 import spray.json._
@@ -190,9 +190,9 @@ class WskActionTests extends TestHelpers with WskTestHelpers with JsHelpers with
         JsObject("key" -> JsString("copiedAnnot2"), "value" -> JsFalse),
         JsObject("key" -> JsString("copiedAnnot1"), "value" -> JsString("copiedAnnotValue1")),
         JsObject("key" -> JsString("origAnnot2"), "value" -> JsTrue),
-        JsObject("key" -> WhiskAction.provideApiKeyAnnotationName.toJson, "value" -> JsFalse))
+        JsObject("key" -> Annotations.ProvideApiKeyAnnotationName.toJson, "value" -> JsFalse))
       val resAnnots: Seq[JsObject] = if (FeatureFlags.requireApiKeyAnnotation) {
-        baseAnnots ++ Seq(JsObject("key" -> WhiskAction.provideApiKeyAnnotationName.toJson, "value" -> JsFalse))
+        baseAnnots ++ Seq(JsObject("key" -> Annotations.ProvideApiKeyAnnotationName.toJson, "value" -> JsFalse))
       } else baseAnnots
 
       assetHelper.withCleaner(wsk.action, origName) {
@@ -270,7 +270,7 @@ class WskActionTests extends TestHelpers with WskTestHelpers with JsHelpers with
 
     assetHelper.withCleaner(wsk.action, name) { (action, _) =>
       val annotations =
-        if (FeatureFlags.requireApiKeyAnnotation) Map(WhiskAction.provideApiKeyAnnotationName -> JsTrue)
+        if (FeatureFlags.requireApiKeyAnnotation) Map(Annotations.ProvideApiKeyAnnotationName -> JsTrue)
         else Map.empty[String, JsValue]
       action.create(name, Some(TestUtils.getTestActionFilename("wcbin.js")), annotations = annotations)
 
diff --git a/tests/src/test/scala/system/basic/WskConsoleTests.scala b/tests/src/test/scala/system/basic/WskConsoleTests.scala
index 349404c..c3fd142 100644
--- a/tests/src/test/scala/system/basic/WskConsoleTests.scala
+++ b/tests/src/test/scala/system/basic/WskConsoleTests.scala
@@ -34,8 +34,7 @@ import common.WskProps
 import common.WskTestHelpers
 import spray.json.DefaultJsonProtocol._
 import spray.json._
-
-import org.apache.openwhisk.core.entity.WhiskAction
+import org.apache.openwhisk.core.entity.Annotations
 
 /**
  * Tests of the text console
@@ -93,7 +92,7 @@ abstract class WskConsoleTests extends TestHelpers with WskTestHelpers {
       action.create(
         name,
         Some(TestUtils.getTestActionFilename("countdown.js")),
-        annotations = Map(WhiskAction.provideApiKeyAnnotationName -> JsBoolean(true)))
+        annotations = Map(Annotations.ProvideApiKeyAnnotationName -> JsBoolean(true)))
     }
 
     val count = 3
diff --git a/tests/src/test/scala/system/basic/WskRestBasicTests.scala b/tests/src/test/scala/system/basic/WskRestBasicTests.scala
index b6c2c38..7780f84 100644
--- a/tests/src/test/scala/system/basic/WskRestBasicTests.scala
+++ b/tests/src/test/scala/system/basic/WskRestBasicTests.scala
@@ -33,7 +33,7 @@ import common.rest.RestResult
 import spray.json._
 import spray.json.DefaultJsonProtocol._
 import org.apache.openwhisk.core.containerpool.Container
-import org.apache.openwhisk.core.entity.WhiskAction
+import org.apache.openwhisk.core.entity.Annotations
 import org.apache.openwhisk.http.Messages
 
 @RunWith(classOf[JUnitRunner])
@@ -173,7 +173,7 @@ class WskRestBasicTests extends TestHelpers with WskTestHelpers with WskActorSys
                                               "name" -> JsString("paramName2"),
                                               "description" -> JsString("Parameter description 2")))),
                                         JsObject(
-                                          "key" -> WhiskAction.provideApiKeyAnnotationName.toJson,
+                                          "key" -> Annotations.ProvideApiKeyAnnotationName.toJson,
                                           "value" -> JsBoolean(false)))
                                     } else {
                                       JsArray(
@@ -406,7 +406,7 @@ class WskRestBasicTests extends TestHelpers with WskTestHelpers with WskActorSys
         .toJson shouldBe (if (requireAPIKeyAnnotation) {
                             JsArray(
                               JsObject(
-                                "key" -> WhiskAction.provideApiKeyAnnotationName.toJson,
+                                "key" -> Annotations.ProvideApiKeyAnnotationName.toJson,
                                 "value" -> JsBoolean(false)))
                           } else {
                             JsArray()
@@ -539,7 +539,7 @@ class WskRestBasicTests extends TestHelpers with WskTestHelpers with WskActorSys
                                          "name" -> JsString("paramName2"),
                                          "description" -> JsString("Parameter description 2")))),
                                    JsObject(
-                                     "key" -> WhiskAction.provideApiKeyAnnotationName.toJson,
+                                     "key" -> Annotations.ProvideApiKeyAnnotationName.toJson,
                                      "value" -> JsBoolean(false)))
                                } else {
                                  JsArray(