[GitHub] sven-lange-last commented on a change in pull request #2870: Remove broken containers if docker run fails

2017-10-19 Thread GitBox
sven-lange-last commented on a change in pull request #2870: Remove broken 
containers if docker run fails
URL: 
https://github.com/apache/incubator-openwhisk/pull/2870#discussion_r145624194
 
 

 ##
 File path: 
core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerClient.scala
 ##
 @@ -63,8 +73,26 @@ class DockerClient(dockerHost: Option[String] = 
None)(executionContext: Executio
 Seq(dockerBin) ++ host
   }
 
-  def run(image: String, args: Seq[String] = Seq.empty[String])(implicit 
transid: TransactionId): Future[ContainerId] =
-runCmd((Seq("run", "-d") ++ args ++ Seq(image)): _*).map(ContainerId.apply)
+  def run(image: String, args: Seq[String] = Seq.empty[String])(
+implicit transid: TransactionId): Future[ContainerId] = {
+runCmd((Seq("run", "-d") ++ args ++ Seq(image)): _*)
+  .map {
+ContainerId(_)
+  }
+  .recoverWith {
+// https://docs.docker.com/v1.12/engine/reference/run/#/exit-status
+// Exit code 125 means an error reported by the Docker daemon.
+// Examples:
+// - Unrecognized option specified
+// - Not enough disk space
+case pre @ (_: ProcessRunningException) if pre.exitCode == 125 =>
 
 Review comment:
   You are so right.


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


[GitHub] sven-lange-last commented on a change in pull request #2870: Remove broken containers if docker run fails

2017-10-19 Thread GitBox
sven-lange-last commented on a change in pull request #2870: Remove broken 
containers if docker run fails
URL: 
https://github.com/apache/incubator-openwhisk/pull/2870#discussion_r145624104
 
 

 ##
 File path: 
core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerClient.scala
 ##
 @@ -35,6 +35,16 @@ import scala.collection.concurrent.TrieMap
 import whisk.core.containerpool.ContainerId
 import whisk.core.containerpool.ContainerAddress
 
+object DockerContainerId {
+  def convertToContainerId(id: String): Try[ContainerId] = {
 
 Review comment:
   Okay, will change the name.


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


[GitHub] sven-lange-last commented on a change in pull request #2870: Remove broken containers if docker run fails

2017-10-19 Thread GitBox
sven-lange-last commented on a change in pull request #2870: Remove broken 
containers if docker run fails
URL: 
https://github.com/apache/incubator-openwhisk/pull/2870#discussion_r145625893
 
 

 ##
 File path: 
core/invoker/src/main/scala/whisk/core/containerpool/docker/DockerContainer.scala
 ##
 @@ -98,7 +98,12 @@ object DockerContainer {
 for {
   _ <- pulled
   id <- docker.run(image, args).recoverWith {
-case _ => Future.failed(WhiskContainerStartupError(s"Failed to run 
container with image '${image}'."))
+case BrokenDockerContainer(brokenId, message) =>
+  docker.rm(brokenId)
+  Future.failed(
 
 Review comment:
   I don't think we want to wait. If the removal fails, there is nothing we 
could do to recover and at this point, the Docker container creation has failed 
anyway so that we return a failed Future. Added a comment to the code.
   
   A few lines below, we also remove the Docker container if `inspectIPAddress` 
fails and do not wait for the removal to complete.


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


[GitHub] sven-lange-last commented on issue #2870: Remove broken containers if docker run fails

2017-10-19 Thread GitBox
sven-lange-last commented on issue #2870: Remove broken containers if docker 
run fails
URL: 
https://github.com/apache/incubator-openwhisk/pull/2870#issuecomment-337833314
 
 
   PG 4 / 906 running.


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


[GitHub] cbickel closed pull request #2861: Add batching time to BatcherTests.

2017-10-19 Thread GitBox
cbickel closed pull request #2861: Add batching time to BatcherTests.
URL: https://github.com/apache/incubator-openwhisk/pull/2861
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/tests/src/test/scala/whisk/core/database/test/BatcherTests.scala 
b/tests/src/test/scala/whisk/core/database/test/BatcherTests.scala
index 51f54baa89..a2eac6f478 100644
--- a/tests/src/test/scala/whisk/core/database/test/BatcherTests.scala
+++ b/tests/src/test/scala/whisk/core/database/test/BatcherTests.scala
@@ -30,18 +30,24 @@ import whisk.utils.retry
 
 import scala.collection.mutable
 import scala.concurrent.duration._
-import scala.concurrent.{Await, ExecutionContext, Future, Promise}
+import scala.concurrent.{Await, Future, Promise}
 
 @RunWith(classOf[JUnitRunner])
 class BatcherTests extends FlatSpec with Matchers with WskActorSystem {
   implicit val materializer: ActorMaterializer = ActorMaterializer()
-  implicit val ec: ExecutionContext = actorSystem.dispatcher
 
   def await[V](f: Future[V]) = Await.result(f, 10.seconds)
 
   def between(start: Instant, end: Instant) =
 Duration.fromNanos(java.time.Duration.between(start, end).toNanos)
 
+  val promiseDelay = 100.milliseconds
+  def resolveDelayed(p: Promise[Unit], delay: FiniteDuration = promiseDelay) =
+akka.pattern.after(delay, actorSystem.scheduler) {
+  p.success(())
+  Future.successful(())
+}
+
   behavior of "Batcher"
 
   it should "batch based on batch size" in {
@@ -60,19 +66,23 @@ class BatcherTests extends FlatSpec with Matchers with 
WskActorSystem {
 val results = values.map(batcher.put)
 
 // First "batch"
-retry(batchOperation.calls should have size 1, 100)
-ps(0).success(())
+retry(batchOperation.calls should have size 1, (promiseDelay.toMillis * 
2).toInt)
 batchOperation.calls(0) should have size 1
 
+// Allow batch to build up
+resolveDelayed(ps(0))
+
 // Second batch
-retry(batchOperation.calls should have size 2, 100)
-ps(1).success(())
+retry(batchOperation.calls should have size 2, (promiseDelay.toMillis * 
2).toInt)
 batchOperation.calls(1) should have size 2
 
+// Allow batch to build up
+resolveDelayed(ps(1))
+
 // Third batch
-retry(batchOperation.calls should have size 3, 100)
-ps(2).success(())
+retry(batchOperation.calls should have size 3, (promiseDelay.toMillis * 
2).toInt)
 batchOperation.calls(2) should have size 2
+ps(2).success(())
 
 await(Future.sequence(results)) shouldBe values.map(transform)
   }


 


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


[GitHub] jthomas commented on issue #1825: Support triggers and rules under package?

2017-10-19 Thread GitBox
jthomas commented on issue #1825: Support triggers and rules under package?
URL: 
https://github.com/apache/incubator-openwhisk/issues/1825#issuecomment-337881669
 
 
   Is this still planned? 


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


[GitHub] rabbah commented on issue #1825: Support triggers and rules under package?

2017-10-19 Thread GitBox
rabbah commented on issue #1825: Support triggers and rules under package?
URL: 
https://github.com/apache/incubator-openwhisk/issues/1825#issuecomment-337882339
 
 
   Yes we should do this. Hasn?t been a priority though with a lot of work on 
performance and scale out. 


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


[GitHub] jthomas commented on issue #86: automatically delete a feed that reaches max trigger count

2017-10-19 Thread GitBox
jthomas commented on issue #86: automatically delete a feed that reaches max 
trigger count
URL: 
https://github.com/apache/incubator-openwhisk-package-alarms/issues/86#issuecomment-337883165
 
 
   It would be nice to support a parameter for choosing whether to "delete when 
finished". I can see examples where you would want both types of behaviour. It 
would be better to "opt-in" for this as I can see users getting confused if it 
defaults to on. 
   
   :+1: on extending the feed API as well. There have been numerous issues 
asking for this.
   https://github.com/apache/incubator-openwhisk/issues/1925
   https://github.com/apache/incubator-openwhisk/issues/1398


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


[GitHub] jthomas commented on issue #89: Provide once trigger

2017-10-19 Thread GitBox
jthomas commented on issue #89: Provide once trigger
URL: 
https://github.com/apache/incubator-openwhisk-package-alarms/issues/89#issuecomment-337883977
 
 
   ? on this feature and an optional parameter to "delete after firing". 
   
   I can see lots of use-cases when an action wants to schedule a trigger to 
fire a set period after it is running using this approach. 


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


[GitHub] rabbah closed issue #88: Activation size mismatch

2017-10-19 Thread GitBox
rabbah closed issue #88: Activation size mismatch
URL: https://github.com/apache/incubator-openwhisk-package-alarms/issues/88
 
 
   


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


[GitHub] rabbah commented on issue #2: Added support for configurable java action method name

2017-10-19 Thread GitBox
rabbah commented on issue #2: Added support for configurable java action method 
name
URL: 
https://github.com/apache/incubator-openwhisk-runtime-java/pull/2#issuecomment-337894378
 
 
   Carlos I would merge this from the command line. 


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


[GitHub] rabbah commented on issue #2875: Added support for configurable java action method name.

2017-10-19 Thread GitBox
rabbah commented on issue #2875: Added support for configurable java action 
method name.
URL: 
https://github.com/apache/incubator-openwhisk/pull/2875#issuecomment-337894670
 
 
   Carlos when the runtime pr is merged shall I bump the pinned version for the 
base image in this pr?


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


[GitHub] mrutkows commented on issue #1825: Support triggers and rules under package?

2017-10-19 Thread GitBox
mrutkows commented on issue #1825: Support triggers and rules under package?
URL: 
https://github.com/apache/incubator-openwhisk/issues/1825#issuecomment-337905152
 
 
   @rabbah @jthomas agree. We have been experiencing name collisions with 
wskdeploy tests as devs copy names from one test file to another and the 
results can be quite frustrating as we automate.


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


[GitHub] mrutkows commented on issue #1825: Support triggers and rules under package?

2017-10-19 Thread GitBox
mrutkows commented on issue #1825: Support triggers and rules under package?
URL: 
https://github.com/apache/incubator-openwhisk/issues/1825#issuecomment-337905152
 
 
   @rabbah @jthomas agree. We have been experiencing name collisions with 
wskdeploy tests as devs copy triggers and rules (and do not change their) names 
from one test file to another and the results can be quite frustrating as we 
automate.


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


[GitHub] jthomas commented on issue #1825: Support triggers and rules under package?

2017-10-19 Thread GitBox
jthomas commented on issue #1825: Support triggers and rules under package?
URL: 
https://github.com/apache/incubator-openwhisk/issues/1825#issuecomment-337906531
 
 
   Good point @mrutkows. I have the same issue in The Serverless Framework. 
   https://github.com/serverless/serverless-openwhisk/issues/29


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


[GitHub] houshengbo opened a new pull request #2876: DO NOT MERGE: Test the secure mode

2017-10-19 Thread GitBox
houshengbo opened a new pull request #2876: DO NOT MERGE: Test the secure mode
URL: https://github.com/apache/incubator-openwhisk/pull/2876
 
 
   


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


[GitHub] csantanapr closed pull request #110: Sync openwhisk

2017-10-19 Thread GitBox
csantanapr closed pull request #110: Sync openwhisk
URL: https://github.com/apache/incubator-openwhisk-cli/pull/110
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
index 8348838f..ca7adaee 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -65,7 +65,7 @@
},
 {
 "ImportPath": 
"github.com/apache/incubator-openwhisk-client-go/whisk",
-"Rev": "4a63a306d52f5dd54454e0ba38e0c7eb9cb2852b"
+"Rev": "ad5aa3402b033edd8b30aec7f33434a253aa35ed"
 }
]
 }
diff --git a/commands/action.go b/commands/action.go
index b80bfb0e..75aa7c54 100644
--- a/commands/action.go
+++ b/commands/action.go
@@ -24,6 +24,7 @@ import (
 "path/filepath"
 "io"
 "strings"
+"os"
 
 "github.com/apache/incubator-openwhisk-client-go/whisk"
 "github.com/apache/incubator-openwhisk-cli/wski18n"
@@ -33,13 +34,29 @@ import (
 "github.com/mattn/go-colorable"
 )
 
-const MEMORY_LIMIT  = 256
-const TIMEOUT_LIMIT = 6
-const LOGSIZE_LIMIT = 10
-const ACTIVATION_ID = "activationId"
-const WEB_EXPORT_ANNOT  = "web-export"
-const RAW_HTTP_ANNOT= "raw-http"
-const FINAL_ANNOT   = "final"
+const (
+MEMORY_LIMIT  = 256
+TIMEOUT_LIMIT = 6
+LOGSIZE_LIMIT = 10
+ACTIVATION_ID = "activationId"
+WEB_EXPORT_ANNOT  = "web-export"
+RAW_HTTP_ANNOT= "raw-http"
+FINAL_ANNOT   = "final"
+NODE_JS_EXT   = ".js"
+PYTHON_EXT= ".py"
+JAVA_EXT  = ".jar"
+SWIFT_EXT = ".swift"
+ZIP_EXT   = ".zip"
+PHP_EXT   = ".php"
+NODE_JS   = "nodejs"
+PYTHON= "python"
+JAVA  = "java"
+SWIFT = "swift"
+PHP   = "php"
+DEFAULT   = "default"
+BLACKBOX  = "blackbox"
+SEQUENCE  = "sequence"
+)
 
 var actionCmd = &cobra.Command{
 Use:   "action",
@@ -243,6 +260,8 @@ var actionGetCmd = &cobra.Command{
 printActionGetWithURL(qualifiedName.GetEntity(), actionURL)
 } else if Flags.common.summary {
 printSummary(action)
+} else if cmd.LocalFlags().Changed(SAVE_AS_FLAG) || 
cmd.LocalFlags().Changed(SAVE_FLAG) {
+return saveCode(*action, Flags.action.saveAs)
 } else {
 if len(field) > 0 {
 printActionGetWithField(qualifiedName.GetEntityName(), field, 
action)
@@ -399,7 +418,7 @@ func parseAction(cmd *cobra.Command, args []string, update 
bool) (*whisk.Action,
 } else if Flags.action.sequence {
 if len(args) == 2 {
 action.Exec = new(whisk.Exec)
-action.Exec.Kind = "sequence"
+action.Exec.Kind = SEQUENCE
 action.Exec.Components = csvToQualifiedActions(args[1])
 } else {
 return nil, noArtifactError()
@@ -445,8 +464,7 @@ func getExec(args []string, params ActionFlags) 
(*whisk.Exec, error) {
 return nil, err
 }
 
-if ext == ".zip" || ext == ".jar" {
-// Base64 encode the file
+if ext == ZIP_EXT || ext == JAVA_EXT {
 code = base64.StdEncoding.EncodeToString([]byte(code))
 }
 
@@ -460,24 +478,24 @@ func getExec(args []string, params ActionFlags) 
(*whisk.Exec, error) {
 if len(kind) > 0 {
 exec.Kind = kind
 } else if len(docker) > 0 || isNative {
-exec.Kind = "blackbox"
+exec.Kind = BLACKBOX
 if isNative {
 exec.Image = "openwhisk/dockerskeleton"
 } else {
 exec.Image = docker
 }
-} else if ext == ".swift" {
-exec.Kind = "swift:default"
-} else if ext == ".js" {
-exec.Kind = "nodejs:default"
-} else if ext == ".py" {
-exec.Kind = "python:default"
-} else if ext == ".jar" {
-exec.Kind = "java:default"
-} else if ext == ".php" {
-exec.Kind = "php:default"
+} else if ext == SWIFT_EXT {
+exec.Kind = fmt.Sprintf("%s:%s", SWIFT, DEFAULT)
+} else if ext == NODE_JS_EXT {
+exec.Kind = fmt.Sprintf("%s:%s", NODE_JS, DEFAULT)
+} else if ext == PYTHON_EXT {
+exec.Kind = fmt.Sprintf("%s:%s", PYTHON, DEFAULT)
+} else if ext == JAVA_EXT {
+exec.Kind = fmt.Sprintf("%s:%s", JAVA, DEFAULT)
+} else if ext == PHP_EXT {
+exec.Kind = fmt.Sprintf("%s:%s", PHP, DEFAULT)
 } else {
-if ext == ".zip" {
+if ext == ZIP_EXT {
 return nil, zipKindError()
 } else {
 return nil, extensionError(ext)
@@ -496,6 +514,86 @@ func getExec(args []string, params ActionFlags) 
(*whisk.Exec, error) {
 return exec, nil
 }
 
+func

[GitHub] houshengbo closed pull request #2876: DO NOT MERGE: Test the secure mode

2017-10-19 Thread GitBox
houshengbo closed pull request #2876: DO NOT MERGE: Test the secure mode
URL: https://github.com/apache/incubator-openwhisk/pull/2876
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/tests/src/test/scala/whisk/core/cli/test/WskConfigTests.scala 
b/tests/src/test/scala/whisk/core/cli/test/WskConfigTests.scala
index 795a26a9c3..4301ded7a4 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskConfigTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskConfigTests.scala
@@ -132,6 +132,21 @@ class WskConfigTests extends TestHelpers with 
WskTestHelpers {
 }
   }
 
+  it should "show api build details secure mode" in {
+val tmpProps = File.createTempFile("wskprops", ".tmp")
+try {
+  val env = Map("WSK_CONFIG_FILE" -> tmpProps.getAbsolutePath())
+  wsk.cli(Seq("property", "set", "-i") ++ wskprops.overrides, env = env)
+  val rr = wsk.cli(Seq("property", "get", "--apibuild", "--apibuildno"), 
env = env)
+  rr.stderr should not include ("https:///api/v1: http: no Host in request 
URL")
+  rr.stdout should not include regex("Cannot determine API build")
+  rr.stdout should include regex ("""(?i)whisk API build\s+201.*""")
+  rr.stdout should include regex ("""(?i)whisk API build number\s+.*""")
+} finally {
+  tmpProps.delete()
+}
+  }
+
   it should "set apihost, auth, and namespace" in {
 val tmpwskprops = File.createTempFile("wskprops", ".tmp")
 try {


 


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


[GitHub] mdeuser opened a new pull request #2877: Better error controller message for authorization failure

2017-10-19 Thread GitBox
mdeuser opened a new pull request #2877: Better error controller message for 
authorization failure
URL: https://github.com/apache/incubator-openwhisk/pull/2877
 
 
   Fixes #1684


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


[GitHub] mdeuser commented on issue #2877: Better error controller message for authorization failure

2017-10-19 Thread GitBox
mdeuser commented on issue #2877: Better error controller message for 
authorization failure
URL: 
https://github.com/apache/incubator-openwhisk/pull/2877#issuecomment-337931265
 
 
   pg2/2187


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


[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145723997
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+Map(

[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145721451
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+Map(

[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145723872
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+Map(

[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145723107
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+Map(

[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145724353
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+Map(

[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145723997
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+Map(

[GitHub] dubeejw commented on issue #2877: Better error controller message for authorization failure

2017-10-19 Thread GitBox
dubeejw commented on issue #2877: Better error controller message for 
authorization failure
URL: 
https://github.com/apache/incubator-openwhisk/pull/2877#issuecomment-337938777
 
 
   @mdeuser, you need to run `gradle scalafmtAll` from OpenWhisk root directory 
then commit the changes in order to get Travis to pass.


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


[GitHub] dubeejw commented on issue #2877: Better error controller message for authorization failure

2017-10-19 Thread GitBox
dubeejw commented on issue #2877: Better error controller message for 
authorization failure
URL: 
https://github.com/apache/incubator-openwhisk/pull/2877#issuecomment-337938777
 
 
   @mdeuser, you need to run `./gradlew scalafmtAll` from OpenWhisk root 
directory then commit the changes in order to get Travis to pass.


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


[GitHub] dubeejw commented on issue #2877: Better error controller message for authorization failure

2017-10-19 Thread GitBox
dubeejw commented on issue #2877: Better error controller message for 
authorization failure
URL: 
https://github.com/apache/incubator-openwhisk/pull/2877#issuecomment-337938777
 
 
   @mdeuser, you need to run `./gradlew scalafmtAll` from OpenWhisk root 
directory then commit the changes in order to get Travis to pass.


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


[GitHub] csantanapr closed pull request #100: increase test case wait time on trigger creation and deletion

2017-10-19 Thread GitBox
csantanapr closed pull request #100: increase test case wait time on trigger 
creation and deletion
URL: https://github.com/apache/incubator-openwhisk-package-alarms/pull/100
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/tests/src/test/scala/system/health/AlarmsHealthFeedTests.scala 
b/tests/src/test/scala/system/health/AlarmsHealthFeedTests.scala
index 7072289..80004ea 100644
--- a/tests/src/test/scala/system/health/AlarmsHealthFeedTests.scala
+++ b/tests/src/test/scala/system/health/AlarmsHealthFeedTests.scala
@@ -66,7 +66,7 @@ class AlarmsHealthFeedTests
 feedCreationResult.stdout should include("ok")
 
 println("waiting for triggers")
-val activations = wsk.activation.pollFor(N = 5, 
Some(triggerName)).length
+val activations = wsk.activation.pollFor(N = 5, Some(triggerName), 
retries = 30).length
 println(s"Found activation size (should be at least 5): 
$activations")
 activations should be >= 5
 
@@ -74,7 +74,7 @@ class AlarmsHealthFeedTests
 wsk.trigger.delete(triggerName)
 
 // get activation list after delete of the trigger
-val activationsAfterDelete = wsk.activation.pollFor(N = 20, 
Some(triggerName), retries = 20).length
+val activationsAfterDelete = wsk.activation.pollFor(N = 100, 
Some(triggerName), retries = 30).length
 val now = Instant.now(Clock.systemUTC())
 println(s"Found activation size after delete ($now): 
$activationsAfterDelete")
 
@@ -135,13 +135,12 @@ class AlarmsHealthFeedTests
 
 // create whisk stuff
 println(s"Creating trigger: $triggerName")
-val feedCreationResult = assetHelper.withCleaner(wsk.trigger, 
triggerName, confirmDelete = true) {
+val feedCreationResult = assetHelper.withCleaner(wsk.trigger, 
triggerName) {
 (trigger, name) =>
 trigger.create(name, feed = Some(s"$packageName/alarm"), 
parameters = Map(
 "trigger_payload" -> "alarmTest".toJson,
 "cron" -> "* * * * * *".toJson,
-"maxTriggers" -> -1.toJson),
-expectedExitCode = 0)
+"maxTriggers" -> (-1).toJson))
 }
 feedCreationResult.stderr should not include("error")
 }


 


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


[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145734281
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+M

[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145734540
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+M

[GitHub] rabbah commented on issue #1362: Support private repository from docker / bluemix

2017-10-19 Thread GitBox
rabbah commented on issue #1362: Support private repository from docker / 
bluemix
URL: 
https://github.com/apache/incubator-openwhisk/issues/1362#issuecomment-337943114
 
 
   One way to support this is by pulling images from the private registry to a 
whisk managed registry at action create time. This would avoid some the 
challenges around key management for docker login. In general I think this is a 
good approach for docker actions as it will make it easier for vetting images. 


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


[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145735023
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+M

[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145736423
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+M

[GitHub] rabbah commented on issue #1362: Support private repository from docker / bluemix

2017-10-19 Thread GitBox
rabbah commented on issue #1362: Support private repository from docker / 
bluemix
URL: 
https://github.com/apache/incubator-openwhisk/issues/1362#issuecomment-337943114
 
 
   One way to support this is by pulling images from the private registry to a 
whisk managed registry at action create time. This would avoid some the 
challenges around key management for docker login. In general I think this is a 
good approach for docker actions as it will make it easier for vetting images; 
but not without its demerits. 


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


[GitHub] beemarie opened a new issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
beemarie opened a new issue #610: Provide support for an env_variable for 
package name
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610
 
 
   Currently in the deploy package, if we want to provide a different package 
name, we are parsing the file & renaming the package name node.  Would it be 
possible to provide support for an optional environment variable as the package 
name?


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


[GitHub] dubeejw commented on issue #2848: Support reading param.json from stdin #2837

2017-10-19 Thread GitBox
dubeejw commented on issue #2848: Support reading param.json from stdin #2837
URL: 
https://github.com/apache/incubator-openwhisk/pull/2848#issuecomment-337949635
 
 
   @akrabat, check here for the valid `-P` tests.
   
   
https://github.com/apache/incubator-openwhisk/blob/master/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala#L193
   
   
https://github.com/apache/incubator-openwhisk/blob/master/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala#L920
   
   
https://github.com/apache/incubator-openwhisk/blob/master/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala#L920


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


[GitHub] dubeejw commented on issue #2848: Support reading param.json from stdin #2837

2017-10-19 Thread GitBox
dubeejw commented on issue #2848: Support reading param.json from stdin #2837
URL: 
https://github.com/apache/incubator-openwhisk/pull/2848#issuecomment-337949635
 
 
   @akrabat, check here for positive `-P` tests.
   
   
https://github.com/apache/incubator-openwhisk/blob/master/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala#L193
   
   
https://github.com/apache/incubator-openwhisk/blob/master/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala#L920
   
   
https://github.com/apache/incubator-openwhisk/blob/master/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala#L920


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


[GitHub] drcariel commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
drcariel commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-337950112
 
 
   in scenario 2, the CLI would need to complete the file extension based on 
the kind flag in order to find the correct local file, right? 
   
   Im a bit confused by the 3rd scenario, would the extension need to match the 
kind? what happens if they do not match?


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


[GitHub] dubeejw commented on issue #2848: Support reading param.json from stdin #2837

2017-10-19 Thread GitBox
dubeejw commented on issue #2848: Support reading param.json from stdin #2837
URL: 
https://github.com/apache/incubator-openwhisk/pull/2848#issuecomment-337949635
 
 
   @alexkli, check here for positive `-P` tests.
   
   
https://github.com/apache/incubator-openwhisk/blob/master/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala#L193
   
   
https://github.com/apache/incubator-openwhisk/blob/master/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala#L920
   
   
https://github.com/apache/incubator-openwhisk/blob/master/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala#L920


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


[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145745292
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+M

[GitHub] dubeejw commented on issue #2848: Support reading param.json from stdin #2837

2017-10-19 Thread GitBox
dubeejw commented on issue #2848: Support reading param.json from stdin #2837
URL: 
https://github.com/apache/incubator-openwhisk/pull/2848#issuecomment-337954262
 
 
   @alexkli, I'm not familiar with the devtools project. Perhaps @rabbah has 
some suggestions.


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


[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145745207
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+M

[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145745172
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+M

[GitHub] rabbah commented on issue #2848: Support reading param.json from stdin #2837

2017-10-19 Thread GitBox
rabbah commented on issue #2848: Support reading param.json from stdin #2837
URL: 
https://github.com/apache/incubator-openwhisk/pull/2848#issuecomment-337955069
 
 
   Try wskdev setup props
   If you have not run ansible before the hosts file may not exist and the 
error suggests this (i guess we have a missing depedendencd). 


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


[GitHub] rabbah commented on issue #2848: Support reading param.json from stdin #2837

2017-10-19 Thread GitBox
rabbah commented on issue #2848: Support reading param.json from stdin #2837
URL: 
https://github.com/apache/incubator-openwhisk/pull/2848#issuecomment-337955069
 
 
   Try: wskdev setup props
   If you have not run ansible before the hosts file may not exist and the 
error suggests this (i guess we have a missing dependency). 


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


[GitHub] dubeejw commented on issue #2772: Fix issue with trailing spaces and handle comments in the property file.

2017-10-19 Thread GitBox
dubeejw commented on issue #2772: Fix issue with trailing spaces and handle 
comments in the property file.
URL: 
https://github.com/apache/incubator-openwhisk/pull/2772#issuecomment-337956951
 
 
   PG4 908 ? 


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


[GitHub] dubeejw commented on a change in pull request #2848: Support reading param.json from stdin #2837

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2848: Support reading param.json 
from stdin #2837
URL: 
https://github.com/apache/incubator-openwhisk/pull/2848#discussion_r145748713
 
 

 ##
 File path: tools/cli/go-whisk-cli/commands/action.go
 ##
 @@ -1060,11 +1060,11 @@ func init() {
 actionUpdateCmd.Flags().StringSliceVarP(&flags.common.annotation, 
"annotation", "a", []string{}, wski18n.T("annotation values in `KEY VALUE` 
format"))
 actionUpdateCmd.Flags().StringVarP(&flags.common.annotFile, 
"annotation-file", "A", "", wski18n.T("`FILE` containing annotation values in 
JSON format"))
 actionUpdateCmd.Flags().StringSliceVarP(&flags.common.param, "param", "p", 
[]string{}, wski18n.T("parameter values in `KEY VALUE` format"))
-actionUpdateCmd.Flags().StringVarP(&flags.common.paramFile, "param-file", 
"P", "", wski18n.T("`FILE` containing parameter values in JSON format"))
+actionUpdateCmd.Flags().StringVarP(&flags.common.paramFile, "param-file", 
"P", "", wski18n.T("`FILE` containing parameter values in JSON format, use '-' 
to read from stdin"))
 actionUpdateCmd.Flags().StringVar(&flags.action.web, WEB_FLAG, "", 
wski18n.T("treat ACTION as a web action, a raw HTTP web action, or as a 
standard action; yes | true = web action, raw = raw HTTP web action, no | false 
= standard action"))
 
 actionInvokeCmd.Flags().StringSliceVarP(&flags.common.param, "param", "p", 
[]string{}, wski18n.T("parameter values in `KEY VALUE` format"))
-actionInvokeCmd.Flags().StringVarP(&flags.common.paramFile, "param-file", 
"P", "", wski18n.T("`FILE` containing parameter values in JSON format"))
+actionInvokeCmd.Flags().StringVarP(&flags.common.paramFile, "param-file", 
"P", "", wski18n.T("`FILE` containing parameter values in JSON format, use '-' 
to read from stdin"))
 
 Review comment:
   You will need to update the user-facing message in the exported message file.
   
   
https://github.com/apache/incubator-openwhisk/blob/master/tools/cli/go-whisk-cli/wski18n/resources/en_US.all.json#L711
   
   
https://github.com/apache/incubator-openwhisk/blob/master/tools/cli/go-whisk-cli/wski18n/resources/en_US.all.json#L712


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


[GitHub] dubeejw commented on a change in pull request #2864: Add the support of certificate checking for secure mode

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2864: Add the support of 
certificate checking for secure mode
URL: 
https://github.com/apache/incubator-openwhisk/pull/2864#discussion_r145749137
 
 

 ##
 File path: tools/cli/go-whisk/whisk/client.go
 ##
 @@ -67,14 +67,14 @@ type Client struct {
 }
 
 type Config struct {
 
 Review comment:
   Can you align all the properties in `Config`?


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


[GitHub] csantanapr commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
csantanapr commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-337960565
 
 
   @mrutkows @houshengbo @daisy-ycguo 
   The sample is the following, we want to be able to have a manifest of this 
form
   ```
   package:
 name: $MY_AWESOME_PACKAGE
 version: 1.0
 license: Apache-2.0
 namespace: _
 actions:
   helloworld:
 function: actions/helloworld.js
   ```
   And  use the environment variable `MY_AWESOME_PACKAGE`  for the package name.
   
   @beemarie what's the current behavior? you get an error in wskdeploy?


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


[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145752489
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1430 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
 
 Review comment:
   Newline here needed?


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, pl

[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145753549
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1430 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0", "docs" -> 
true.toString) } ++ {
+  limit map { l =>
+Map("limit" -

[GitHub] dubeejw commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
dubeejw commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-337964990
 
 
   Scenario 2 and 3 are essentially the same. If a kind is not specified, we 
try to figure out the kind by checking the file extension. If a kind is not 
specified we need to error. When a kind is specified we will always use that 
and forego checking the file extension. We currently do this today, and it 
would be applied to the scenarios above.


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


[GitHub] dubeejw commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
dubeejw commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-337964990
 
 
   Scenario 2 and 3 are essentially the same. If a kind is not specified, we 
try to figure out the kind by checking the file extension. If a kind is not 
specified we need to error if the extension is not present or unknown. When a 
kind is specified we will always use that and forego checking the file 
extension. We currently do this today, and it would be applied to the scenarios 
above.


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


[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145734540
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1437 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0".toString, 
"docs" -> true.toString) } ++ {
+  limit map { l =>
+M

[GitHub] houshengbo commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
houshengbo commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-337995219
 
 
   @beemarie @csantanapr 
   We are deprecating the format in the previous comment. Here is the new 
format looks like:
   ```
   packages:
 PACKAGE_NAME:
   version: 1.0
   license: Apache-2.0
   namespace: _
   actions:
 helloworld:
   function: actions/helloworld.js
   ```
   Do we need the package name able to read from env variable supported for the 
new format?
   Besides, is it only for package name? We also have trigger name, dependency 
name, rule name, etc.
   
   I have to say that if we support env variables to be picked up by the 
manifest, it can be even more complicated to maintain the yaml files, because 
there can be multiple env variables to manage. 
   
   


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


[GitHub] houshengbo commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
houshengbo commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-337995219
 
 
   @beemarie @csantanapr 
   We are deprecating the format in the previous comment. Here is the new 
format looks like:
   ```
   packages:
 PACKAGE_NAME:
   version: 1.0
   license: Apache-2.0
   namespace: _
   actions:
 helloworld:
   function: actions/helloworld.js
   ```
   Do we need the package name able to read from env variable supported for the 
new format?
   Besides, is it only for package name? We also have trigger name, dependency 
name, rule name, etc.
   
   I have to say that if we support env variables to be picked up by the 
manifest, it can be even more complicated to maintain the yaml files, because 
there can be multiple env variables to manage. I am thinking of whether yaml 
files can import variables, so that we can put common variable names at one 
place, and import it into the files in need.
   
   


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


[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145784760
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1430 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0", "docs" -> 
true.toString) } ++ {
+  limit map { l =>
+Map("limit

[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145784718
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1430 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+
 
 Review comment:
   removed.


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 cont

[GitHub] mrutkows commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
mrutkows commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-337996805
 
 
   IMO, the CLI should be careful in not inferring too much from too little in 
CRUD operations... and if assumptions or inferences are made, the user needs to 
be informed/warned of this additional behaviors.  
   
   Entity naming and Namespacing is becoming more and more important with 
Compositions so making these assumptions could cause unintended consequences 
for user/customers composing solutions with hundreds of actions.
   
   https://swaggerhub.com/blog/api-design/api-design-best-practices/


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


[GitHub] mrutkows commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
mrutkows commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-337996805
 
 
   IMO, the CLI should be careful in not inferring too much from too little in 
CRUD operations... and if assumptions or inferences are made, the user needs to 
be informed/warned of this additional behaviors.  
   
   Entity naming and Namespacing is becoming more and more important with 
Compositions so making these assumptions could cause unintended consequences 
for user/customers composing solutions with hundreds of actions.
   
   "Hard to misuse":
   https://swaggerhub.com/blog/api-design/api-design-best-practices/


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


[GitHub] beemarie commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
beemarie commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-337998070
 
 
   @houshengbo @csantanapr 
   It is more important to be able to provide PACKAGE_NAME as an env-variable 
over trigger name, rule name, etc., as packages can not be renamed once created.


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


[GitHub] mrutkows commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
mrutkows commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-337998797
 
 
   it could be implemented as a new feature easily with exiting code; however, 
we are moving away from ?package? to ?packages? and then it becomes more 
difficult...
   
   Currently, "packages" follows our consistent convention/pattern to use names 
as "keys" (or IDs) in the YAML document. The YAML parser may not handle having 
and odd string (it might though would have to try it with the go-yaml parser).  
If the parser cannot handle it, then we would have to assure we had the ?name? 
(or similar) field as a valid field for ?packages? and make sure we replaced 
the name on the API call.


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


[GitHub] mrutkows commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
mrutkows commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-337998797
 
 
   @beemarie  it could be implemented as a new feature easily with exiting 
code; however, we are moving away from ?package? to ?packages? and then it 
becomes more difficult...
   
   Currently, "packages" follows our consistent convention/pattern to use names 
as "keys" (or IDs) in the YAML document. The YAML parser may not handle having 
and odd string (it might though would have to try it with the go-yaml parser).  
If the parser cannot handle it, then we would have to assure we had the ?name? 
(or similar) field as a valid field for ?packages? and make sure we replaced 
the name on the API call.


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


[GitHub] mrutkows commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
mrutkows commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-337998797
 
 
   @beemarie  it could be implemented as a new feature easily with exiting 
code; however, we are moving away from ?package? to ?packages? and then it 
becomes more difficult...
   
   Currently, "packages" follows our consistent convention/pattern to use names 
as "keys" (or IDs) in the YAML document. The YAML parser may not handle having 
an odd ${} string (it might though would have to try it with the go-yaml 
parser).  If the parser cannot handle it, then we would have to assure we had 
the ?name? (or similar) field as a valid field for ?packages? and make sure we 
replaced the name on the API call.


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


[GitHub] alexkli commented on issue #2848: Support reading param.json from stdin #2837

2017-10-19 Thread GitBox
alexkli commented on issue #2848: Support reading param.json from stdin #2837
URL: 
https://github.com/apache/incubator-openwhisk/pull/2848#issuecomment-337999506
 
 
   `wskdev setup props` fails similar to `tools/build/redo props`, as they seem 
to run the same and expect a running local ansible based OpenWhisk.
   
   However, after some fiddling around, I was able to successfully run at least 
the WskBasicUsageTests
   
   ./gradlew tests:test -Dtest.single=WskBasicUsageTests
   
   against my local OpenWhisk from the [docker-compose 
setup](https://github.com/apache/incubator-openwhisk-devtools/tree/master/docker-compose)
 using this minimal `whisk.properties` file in the root of the checkout:
   
   ```properties
   openwhisk.home=$OPENWHISK_CHECKOUT_DIR
   
   testing.auth=$USER_HOME/tmp/openwhisk/src/ansible/files/auth.guest
   
whisk.ssl.cert=$USER_HOME/tmp/openwhisk/apigateway/ssl/openwhisk-server-cert.pem
   
   edge.host=$LOCAL_IP:443
   whisk.api.host.proto=https
   whisk.api.host.name=$LOCAL_IP
   whisk.api.host.port=443
   
   vcap.services.file=
   use.cli.download=false
   ```
   
   Replace the variables in there:
   * `$OPENWHISK_CHECKOUT_DIR`: absolute path to the openwhisk git checkout
   * `$USER_HOME`: absolute path to your user home (e.g. `/Users/alex`), tilde 
`~` does not work
   * `$LOCAL_IP`: local IP (`localhost` might work too)


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


[GitHub] mrutkows commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
mrutkows commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-337999702
 
 
   @houshengbo also be aware that we allow "partial" replacement as well...
   e.g.
   ```
   packages:
 IBM-{$PACKAGE_NAME}:
   version: 1.0
   license: Apache-2.0
   namespace: _
   actions:
 helloworld:
   function: actions/helloworld.js
   ```


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


[GitHub] mrutkows commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
mrutkows commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-33768
 
 
   @houshengbo as part of this feature I would like to add name validation 
using the regex. for valid OW names (it is documented and also in the OW 
Packing Spec.).


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


[GitHub] houshengbo commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
houshengbo commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-338000349
 
 
   Daisy implemented the support for cloudant. I think we can directly port the 
code to use.


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


[GitHub] mrutkows commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
mrutkows commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-337998797
 
 
   @beemarie  it could be implemented as a new feature easily with exiting 
code; however, we are moving away from ?package? to ?packages? and then it 
becomes more difficult...
   
   Currently, "packages" follows our consistent convention/pattern to use names 
as "keys" (or IDs) in the YAML document. The YAML parser may not handle having 
an odd ${} string (it might though would have to try it with the go-yaml 
parser).  If the parser cannot handle it, then we would have to assure we had 
the ?name? (or similar) field as a valid field for ?packages? and make sure we 
replaced the name on the API call.
   
   That is general YAML parsers allow:
   ```
   project:
 packages:
   $PACKAGE_NAME:
 actions:
   hello: hello.js
   ```
   
   but we would need to verify the go-yaml parser does not balk...


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


[GitHub] mrutkows commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
mrutkows commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-337998797
 
 
   @beemarie  it could be implemented as a new feature easily with exiting 
code; however, we are moving away from ?package? to ?packages? and then it 
becomes more difficult...
   
   Currently, "packages" follows our consistent convention/pattern to use names 
as "keys" (or IDs) in the YAML document. The YAML parser may not handle having 
an odd ${} string (it might though would have to try it with the go-yaml 
parser).  If the parser cannot handle it, then we would have to assure we had 
the ?name? (or similar) field as a valid field for ?packages? and make sure we 
replaced the name on the API call.
   
   That is general YAML parsers allow:
   ```
   project:
 packages:
   $PACKAGE_NAME:
 actions:
   hello: hello.js
   ```
   but we would need to verify the go-yaml parser does not balk... otherwise we 
would use the ?name? option?


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


[GitHub] mrutkows commented on issue #610: Provide support for an env_variable for package name

2017-10-19 Thread GitBox
mrutkows commented on issue #610: Provide support for an env_variable for 
package name
URL: 
https://github.com/apache/incubator-openwhisk-wskdeploy/issues/610#issuecomment-338001346
 
 
   @houshengbo yes, Daisy's work (and work previous) should allow replacement 
easily enough (that is why I told Carlos it _should_ be easy.  However, we 
would need to assure go-yaml parser does not have issues.


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


[GitHub] drcariel commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
drcariel commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338005115
 
 
   I agree with @mrutkows , I think it's important to inform the user that 
these assumptions are being made in real time.


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


[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145796086
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1434 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0", "docs" -> 
true.toString) } ++ {
+  limit map { l =>
+Map("limit" -> 

[GitHub] dubeejw commented on issue #2772: Fix issue with trailing spaces and handle comments in the property file.

2017-10-19 Thread GitBox
dubeejw commented on issue #2772: Fix issue with trailing spaces and handle 
comments in the property file.
URL: 
https://github.com/apache/incubator-openwhisk/pull/2772#issuecomment-337956951
 
 
   PG2 2109 ? 


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


[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145797908
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1434 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0", "docs" -> 
true.toString) } ++ {
+  limit map { l =>
+Map("limit" -> 

[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145796086
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1434 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0", "docs" -> 
true.toString) } ++ {
+  limit map { l =>
+Map("limit" -> 

[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145797867
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1434 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0", "docs" -> 
true.toString) } ++ {
+  limit map { l =>
+Map("limit" -> 

[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145798662
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1434 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0", "docs" -> 
true.toString) } ++ {
+  limit map { l =>
+Map("limit" -> 

[GitHub] dubeejw commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
dubeejw commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145798900
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1434 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0", "docs" -> 
true.toString) } ++ {
+  limit map { l =>
+Map("limit" -> 

[GitHub] rabbah commented on a change in pull request #2848: Support reading param.json from stdin #2837

2017-10-19 Thread GitBox
rabbah commented on a change in pull request #2848: Support reading param.json 
from stdin #2837
URL: 
https://github.com/apache/incubator-openwhisk/pull/2848#discussion_r145799109
 
 

 ##
 File path: docs/actions.md
 ##
 @@ -202,6 +202,39 @@ Parameters can be passed to the action when it is invoked.
   "payload": "Hello, Bernie from Vermont"
   }
   ```
+4.  It is possible to pipe JSON parameters to the `wsk` command by using the 
special filename `-` with `--params-file` or `-P`:
+  
+  ```
+  cat parameters.json | envsubst | wsk action invoke -r hello -P -
+  ```
+  
+  This example uses `envsubst` to replace environment variables in the JSON 
before passing them to the action invocation.
 
 Review comment:
   OK - I was going for simpler example but after your explanation it's good to 
have a real use case.


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


[GitHub] rabbah commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
rabbah commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338011390
 
 
   Less magic FTW and clarity. What's the point of saving the user from `.js` 
or `.py` it's not that many more characters and potentially confusing. Maybe I 
missed the rationale here.


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


[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145801486
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1434 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0", "docs" -> 
true.toString) } ++ {
+  limit map { l =>
+Map("limit" 

[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145801536
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1434 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0", "docs" -> 
true.toString) } ++ {
+  limit map { l =>
+Map("limit" 

[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145801509
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1434 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0", "docs" -> 
true.toString) } ++ {
+  limit map { l =>
+Map("limit" 

[GitHub] houshengbo commented on a change in pull request #2589: Add the fundamental framework of REST invocation for test cases

2017-10-19 Thread GitBox
houshengbo commented on a change in pull request #2589: Add the fundamental 
framework of REST invocation for test cases
URL: 
https://github.com/apache/incubator-openwhisk/pull/2589#discussion_r145802353
 
 

 ##
 File path: tests/src/test/scala/common/rest/WskRest.scala
 ##
 @@ -0,0 +1,1434 @@
+/*
+ * 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 common.rest
+
+import java.io.File
+import java.time.Clock
+import java.time.Instant
+import java.util.Base64
+
+import org.apache.commons.io.FileUtils
+import org.scalatest.Matchers
+import org.scalatest.FlatSpec
+import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.time.Span.convertDurationToSpan
+
+import scala.Left
+import scala.Right
+import scala.collection.JavaConversions.mapAsJavaMap
+import scala.collection.mutable.Buffer
+import scala.collection.immutable.Seq
+import scala.concurrent.duration.Duration
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.Future
+import scala.language.postfixOps
+import scala.util.Failure
+import scala.util.Success
+import scala.util.Try
+import scala.util.{Failure, Success}
+
+import akka.http.scaladsl.model.StatusCode
+import akka.http.scaladsl.model.StatusCodes.Accepted
+import akka.http.scaladsl.model.StatusCodes.NotFound
+import akka.http.scaladsl.model.StatusCodes.BadRequest
+import akka.http.scaladsl.model.StatusCodes.OK
+import akka.http.scaladsl.model.HttpRequest
+import akka.http.scaladsl.model.HttpMethod
+import akka.http.scaladsl.model.HttpResponse
+import akka.http.scaladsl.model.headers.Authorization
+import akka.http.scaladsl.model.HttpEntity
+import akka.http.scaladsl.model.ContentTypes
+import akka.http.scaladsl.Http
+
+import akka.http.scaladsl.model.headers.BasicHttpCredentials
+import akka.http.scaladsl.model.Uri
+import akka.http.scaladsl.model.Uri.Path
+
+import akka.http.scaladsl.model.HttpMethods.DELETE
+import akka.http.scaladsl.model.HttpMethods.GET
+import akka.http.scaladsl.model.HttpMethods.POST
+import akka.http.scaladsl.model.HttpMethods.PUT
+
+import akka.stream.ActorMaterializer
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+import spray.json.JsObject
+import spray.json.JsValue
+import spray.json.pimpString
+
+import common._
+import common.BaseDeleteFromCollection
+import common.BaseListOrGetFromCollection
+import common.HasActivation
+import common.RunWskCmd
+import common.TestUtils
+import common.TestUtils.SUCCESS_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.ANY_ERROR_EXIT
+import common.TestUtils.DONTCARE_EXIT
+import common.TestUtils.RunResult
+import common.WaitFor
+import common.WhiskProperties
+import common.WskActorSystem
+import common.WskProps
+
+import whisk.core.entity.ByteSize
+import whisk.utils.retry
+
+class WskRest() extends RunWskRestCmd with BaseWsk {
+  override implicit val action = new WskRestAction
+  override implicit val trigger = new WskRestTrigger
+  override implicit val rule = new WskRestRule
+  override implicit val activation = new WskRestActivation
+  override implicit val pkg = new WskRestPackage
+  override implicit val namespace = new WskRestNamespace
+  override implicit val api = new WskRestApi
+}
+
+trait ListOrGetFromCollectionRest extends BaseListOrGetFromCollection {
+  self: RunWskRestCmd =>
+
+  /**
+   * List entities in collection.
+   *
+   * @param namespace (optional) if specified must be  fully qualified 
namespace
+   * @param expectedExitCode (optional) the expected exit code for the command
+   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
+   */
+  override def list(namespace: Option[String] = None,
+limit: Option[Int] = None,
+nameSort: Option[Boolean] = None,
+expectedExitCode: Int = OK.intValue)(implicit wp: 
WskProps): RestResult = {
+val (ns, name) = getNamespaceActionName(resolve(namespace))
+val pathToList = s"$basePath/namespaces/$ns/$noun"
+val entPath =
+  if (name != "") Path(s"$pathToList/$name/")
+  else Path(s"$pathToList")
+val paramMap = Map[String, String]() ++ { Map("skip" -> "0", "docs" -> 
true.toString) } ++ {
+  limit map { l =>
+Map("limit" 

[GitHub] dubeejw commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
dubeejw commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338015208
 
 
   No API changes here. This is a usability issue to allow the user to type 
less information. The CLI will continue to work as it does today when 
creating/updating actions.


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


[GitHub] dubeejw commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
dubeejw commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338015208
 
 
   No API changes here. This is a usability issue to allow the user to type 
less information when creating/update an action. The CLI will continue to work 
as it does today when creating/updating actions.


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


[GitHub] dubeejw commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
dubeejw commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338015208
 
 
   No API changes here. This is a usability issue to allow the user to type 
less information when creating/update an action. Ie, not having to provide an 
action name. The CLI will continue to work as it does today when 
creating/updating actions.


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


[GitHub] dubeejw commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
dubeejw commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338015208
 
 
   No API changes here. This is a usability issue to allow the user to type 
less information when creating/update an action. Ie, not having to provide an 
action name. The CLI will continue to work as it does today when 
creating/updating actions even with the changes mentioned above.


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


[GitHub] dubeejw commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
dubeejw commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338025783
 
 
   To be more clear, here are some more examples.
   
   Say the user wants to create an action that has the same name as his or her 
filename. Instead of the user having to type duplicate information, we only 
need the filename to be provided. Ex:
   ```
   wsk action create myActionName.js
   ok: created action myActionName
   ```
   
   The CLI would still work as it does today allowing a filename and an action 
name if the user wants the action name to differ from the filename:
   ```
   wsk action create myAction myActionName.js
   ok: created action myActionName
   ```


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


[GitHub] rabbah commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
rabbah commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338025830
 
 
   I get that it's client only - I'm just not sure I like the automatic 
inference here. Note that the CLI change is actually going to change behavior 
(1 is an error today, and will work after these changes).


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


[GitHub] dubeejw commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
dubeejw commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338025783
 
 
   To be more clear, here are some more examples.
   
   Say the user wants to create an action that has the same name as his or her 
filename. Instead of the user having to type duplicate information, we only 
need the filename to be provided. Ex:
   ```
   wsk action create myActionName.js
   ok: created action myActionName
   ```
   
   The CLI would still work as it does today allowing a filename and an action 
name if the user wants the action name to differ from the filename:
   ```
   wsk action create myAction myActionName.js
   ok: created action myAction
   ```


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


[GitHub] dubeejw commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
dubeejw commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338025783
 
 
   To be more clear, here are some more examples.
   
   Say the user wants to create an action that has the same name as his or her 
filename. Instead of the user having to type duplicate information, we only 
need the filename to be provided. Ex:
   ```
   $ wsk action create myActionName.js
   ok: created action myActionName
   ```
   
   The CLI would still work as it does today allowing a filename and an action 
name if the user wants the action name to differ from the filename:
   ```
   $ wsk action create myAction myActionName.js
   ok: created action myAction
   ```


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


[GitHub] drcariel commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
drcariel commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338032843
 
 
   I can see the value in the 1st use case. Maybe the scope should be limited 
to this?
   
   2  is where I see more user complications 
   ( For example: different files with the same name but different extensions  
etc..)
   
   3 still doesn't make sense to me, but I am not sure how it work at in it's 
current state TBH. 


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


[GitHub] drcariel commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
drcariel commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338032843
 
 
   I can see the value in the 1st use case. Maybe the scope should be limited 
to this?
   
   2  is where I see more user complications 
   ( For example: different files with the same name but different extensions  
etc..)
   
   3 still doesn't make sense to me, but I am not sure how it works in it's 
current state TBH. 


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


[GitHub] meyumeapps commented on issue #89: Provide once trigger

2017-10-19 Thread GitBox
meyumeapps commented on issue #89: Provide once trigger
URL: 
https://github.com/apache/incubator-openwhisk-package-alarms/issues/89#issuecomment-338034178
 
 
   ? this would be a very useful feature for me as currently I'm having to run 
clean up jobs looking for stale triggers and rules.
   
   For my perspective it would be good to have an uber trigger that 
encapsulates the trigger and rule e.g. a `Job`.
   
   It's the job which I can designate as `runOnce` and have the system clean up 
after it's finished.


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


[GitHub] rabbah commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
rabbah commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338034773
 
 
   > I can see the value in the 1st use case. Maybe the scope should be limited 
to this?
   
   yeah maybe... but also feel that if you're doing anything serious you're 
going to use a deployment framework like `wskdeploy` or you're writing your own 
scripts. I could be convinced to accept 1.
   
   ```bash
   wsk action create foo.zip --kind nodejs:6
   ```
   
   do you want that to work? I think that's maybe a use of 3.
   
   


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


[GitHub] rabbah commented on issue #2869: CLI should use filename as action name when one is not provided

2017-10-19 Thread GitBox
rabbah commented on issue #2869: CLI should use filename as action name when 
one is not provided
URL: 
https://github.com/apache/incubator-openwhisk/issues/2869#issuecomment-338034773
 
 
   > I can see the value in the 1st use case. Maybe the scope should be limited 
to this?
   
   yeah maybe... but also feel that if you're doing anything serious you're 
going to use a deployment framework like wskdeploy or you're writing your own 
scripts. I could be convinced to accept 1.
   
   ```bash
   wsk action create foo.zip --kind nodejs:6
   ```
   
   do you want that to work? I think that's maybe a use of 3.
   
   


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


  1   2   >