Include Parameters and Annotations when Copying an Action (#1662)

- When copying an action ensure that parameters and annotations are also copied
diff --git a/tests/src/common/WskTestHelpers.scala b/tests/src/common/WskTestHelpers.scala
index 49c4f30..ce209a6 100644
--- a/tests/src/common/WskTestHelpers.scala
+++ b/tests/src/common/WskTestHelpers.scala
@@ -237,4 +237,8 @@
                 throw error
         }
     }
+
+    def removeCLIHeader(response: String): String = response.substring(response.indexOf("\n"))
+
+    def getJSONFromCLIResponse(response: String): JsObject = removeCLIHeader(response).parseJson.asJsObject
 }
diff --git a/tests/src/system/basic/WskActionTests.scala b/tests/src/system/basic/WskActionTests.scala
index f79b51d..deac9f7 100644
--- a/tests/src/system/basic/WskActionTests.scala
+++ b/tests/src/system/basic/WskActionTests.scala
@@ -134,6 +134,31 @@
             }
     }
 
+    it should "copy an action and ensure exec, parameters, and annotations copied" in withAssetCleaner(wskprops) {
+        (wp, assetHelper) =>
+            val origActionName = "orignAction"
+            val copiedActionName = "copiedAction"
+            val params = Map("a" -> "A".toJson)
+            val annots = Map("b" -> "B".toJson)
+
+            assetHelper.withCleaner(wsk.action, origActionName) {
+                val file = Some(TestUtils.getTestActionFilename("wc.js"))
+                (action, _) => action.create(origActionName, file, parameters = params, annotations = annots)
+            }
+
+            assetHelper.withCleaner(wsk.action, copiedActionName) {
+                (action, _) => action.create(copiedActionName, Some(origActionName), Some("copy"))
+            }
+
+            val copiedAction = getJSONFromCLIResponse(wsk.action.get(copiedActionName).stdout)
+            val origAction = getJSONFromCLIResponse(wsk.action.get(copiedActionName).stdout)
+
+            copiedAction.fields("annotations") shouldBe origAction.fields("annotations")
+            copiedAction.fields("parameters") shouldBe origAction.fields("parameters")
+            copiedAction.fields("exec") shouldBe origAction.fields("exec")
+            copiedAction.fields("version") shouldBe JsString("0.0.1")
+    }
+
     it should "recreate and invoke a new action with different code" in withAssetCleaner(wskprops) {
         (wp, assetHelper) =>
             val name = "recreatedAction"