You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2017/09/22 15:03:35 UTC

[incubator-openwhisk-cli] branch master updated (caf748d -> d6ec004)

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

csantanapr pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git.


    from caf748d  Remove heisenbug from test by checking either order for stdout/stderr lines. (#2761) (#105)
     new 0792cc8  Don't assume apihost is https for sdk and action urls (#2748)
     new 8282760  Updating the way we print names in the Cli Fixes #1155 (#2462)
     new 300a2bb  Display content-type in __ow_headers for web actions (#2741)
     new db5d092  Echo Access-Control-Request-Headers as Access-Control-Allow-Headers instead of hardcoding value for header. (#2771)
     new 95e67fc  Don't assume apihost is https for sdk and action urls (#2748)
     new f85b26a  update apigw end-to-end to be more resilient (#2724)
     new d6ec004  Updating the way we print names in the Cli Fixes #1155 (#2462)

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Godeps/Godeps.json                                 |  2 +-
 commands/action.go                                 | 10 +++-
 commands/activation.go                             |  4 +-
 commands/api.go                                    | 29 +++++------
 commands/commands.go                               |  4 +-
 commands/package.go                                |  2 +-
 commands/property.go                               |  8 ++--
 commands/sdk.go                                    | 14 +++---
 commands/util.go                                   | 26 +---------
 .../apigw/healthtests/ApiGwEndToEndTests.scala     |  6 +++
 .../src/test/scala/system/basic/WskSdkTests.scala  | 21 +++++++-
 .../whisk/core/cli/test/WskBasicUsageTests.scala   | 42 +++++++++++++---
 .../whisk/core/cli/test/WskWebActionsTests.scala   | 56 ++++++++++++++++++++--
 wski18n/i18n_resources.go                          | 22 ++++-----
 wski18n/resources/en_US.all.json                   | 40 ++++++++--------
 15 files changed, 184 insertions(+), 102 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].

[incubator-openwhisk-cli] 02/07: Updating the way we print names in the Cli Fixes #1155 (#2462)

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git

commit 82827602d17a14cbcb3a016d8071d914d934b1da
Author: Jesus Alva <ja...@us.ibm.com>
AuthorDate: Thu Sep 21 11:01:33 2017 -0500

    Updating the way we print names in the Cli Fixes #1155 (#2462)
    
    * Changes so that we are more consistent with quoting names that are not bolded when we print statements
    
    * Fixing up tests related to making quoting consistent in our CLI
---
 Godeps/Godeps.json               |  2 +-
 commands/action.go               |  2 +-
 commands/activation.go           |  4 ++--
 commands/api.go                  | 29 +++++++++++++++--------------
 commands/package.go              |  2 +-
 commands/sdk.go                  | 14 +++++++-------
 commands/util.go                 |  2 +-
 wski18n/i18n_resources.go        | 22 +++++++++++-----------
 wski18n/resources/en_US.all.json | 40 ++++++++++++++++++++--------------------
 9 files changed, 59 insertions(+), 58 deletions(-)

diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
index 998bfb4..8510ec6 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -65,7 +65,7 @@
 		},
         {
             "ImportPath": "github.com/apache/incubator-openwhisk-client-go/whisk",
-            "Rev": "d9d11f0b21f8c32b3d78cd632d41a69a818be200"
+            "Rev": "c6e512b136e8c27bb144c0f8b625e833fbae878a"
         }
 	]
 }
diff --git a/commands/action.go b/commands/action.go
index 82312f6..be56dda 100644
--- a/commands/action.go
+++ b/commands/action.go
@@ -895,7 +895,7 @@ func isWebAction(client *whisk.Client, qname QualifiedName) (error) {
         err = whisk.MakeWskErrorFromWskError(errors.New(errMsg), err, whisk.EXIT_CODE_ERR_NETWORK, whisk.DISPLAY_MSG,
             whisk.NO_DISPLAY_USAGE)
     } else {
-        err = errors.New(wski18n.T("Action '{{.name}}' is not a web action. Issue 'wsk action update {{.name}} --web true' to convert the action to a web action.",
+        err = errors.New(wski18n.T("Action '{{.name}}' is not a web action. Issue 'wsk action update \"{{.name}}\" --web true' to convert the action to a web action.",
             map[string]interface{}{"name": fullActionName}))
 
         if action.WebAction() {
diff --git a/commands/activation.go b/commands/activation.go
index 6d5d1d8..1a2bd33 100644
--- a/commands/activation.go
+++ b/commands/activation.go
@@ -145,7 +145,7 @@ var activationGetCmd = &cobra.Command{
 
         if Flags.common.summary {
             fmt.Printf(
-                wski18n.T("activation result for /{{.namespace}}/{{.name}} ({{.status}} at {{.time}})\n",
+                wski18n.T("activation result for '/{{.namespace}}/{{.name}}' ({{.status}} at {{.time}})\n",
                     map[string]interface{}{
                         "namespace": activation.Namespace,
                         "name": activation.Name,
@@ -377,7 +377,7 @@ var activationPollCmd = &cobra.Command{
                     continue
                 } else {
                     fmt.Printf(
-                        wski18n.T("\nActivation: {{.name}} ({{.id}})\n",
+                        wski18n.T("\nActivation: '{{.name}}' ({{.id}})\n",
                             map[string]interface{}{"name": activation.Name, "id": activation.ActivationID}))
                     printJSON(activation.Logs)
                     reported[activation.ActivationID] = true
diff --git a/commands/api.go b/commands/api.go
index fda962e..9c83941 100644
--- a/commands/api.go
+++ b/commands/api.go
@@ -53,7 +53,7 @@ var fmtString = "%-30s %7s %20s  %s\n"
 func IsValidApiVerb(verb string) (error, bool) {
     // Is the API verb valid?
     if _, ok := whisk.ApiVerbs[strings.ToUpper(verb)]; !ok {
-        whisk.Debug(whisk.DbgError, "Invalid API verb: %s\n", verb)
+        whisk.Debug(whisk.DbgError, "Invalid API verb: '%s'\n", verb)
         errMsg := wski18n.T("'{{.verb}}' is not a valid API verb.  Valid values are: {{.verbs}}",
                 map[string]interface{}{
                     "verb": verb,
@@ -67,7 +67,7 @@ func IsValidApiVerb(verb string) (error, bool) {
 
 func hasPathPrefix(path string) (error, bool) {
     if (! strings.HasPrefix(path, "/")) {
-        whisk.Debug(whisk.DbgError, "path does not begin with '/': %s\n", path)
+        whisk.Debug(whisk.DbgError, "path does not begin with '/': '%s'\n", path)
         errMsg := wski18n.T("'{{.path}}' must begin with '/'.",
                 map[string]interface{}{
                     "path": path,
@@ -98,15 +98,15 @@ func isValidRelpath(relpath string) (error, bool) {
  */
 func getManagedUrl(api *whisk.RetApi, relpath string, operation string) (url string) {
     baseUrl := strings.TrimSuffix(api.BaseUrl, "/")
-    whisk.Debug(whisk.DbgInfo, "getManagedUrl: baseUrl = %s, relpath = %s, operation = %s\n", baseUrl, relpath, operation)
+    whisk.Debug(whisk.DbgInfo, "getManagedUrl: baseUrl = '%s', relpath = '%s', operation = '%s'\n", baseUrl, relpath, operation)
     for path, _ := range api.Swagger.Paths {
-        whisk.Debug(whisk.DbgInfo, "getManagedUrl: comparing api relpath: %s\n", path)
+        whisk.Debug(whisk.DbgInfo, "getManagedUrl: comparing api relpath: '%s'\n", path)
         if (path == relpath) {
             whisk.Debug(whisk.DbgInfo, "getManagedUrl: relpath matches '%s'\n", relpath)
             for op, _  := range api.Swagger.Paths[path] {
                 whisk.Debug(whisk.DbgInfo, "getManagedUrl: comparing operation: '%s'\n", op)
                 if (strings.ToLower(op) == strings.ToLower(operation)) {
-                    whisk.Debug(whisk.DbgInfo, "getManagedUrl: operation matches: %s\n", operation)
+                    whisk.Debug(whisk.DbgInfo, "getManagedUrl: operation matches: '%s'\n", operation)
                     url = baseUrl+path
                 }
             }
@@ -207,9 +207,9 @@ var apiCreateCmd = &cobra.Command{
             baseUrl := retApi.BaseUrl
             for path, _ := range retApi.Swagger.Paths {
                 managedUrl := strings.TrimSuffix(baseUrl, "/")+path
-                whisk.Debug(whisk.DbgInfo, "Managed path: %s\n",managedUrl)
+                whisk.Debug(whisk.DbgInfo, "Managed path: '%s'\n",managedUrl)
                 for op, opv  := range retApi.Swagger.Paths[path] {
-                    whisk.Debug(whisk.DbgInfo, "Path operation: %s\n", op)
+                    whisk.Debug(whisk.DbgInfo, "Path operation: '%s'\n", op)
                     var fqActionName string
                     if (opv.XOpenWhisk == nil) {
                         fqActionName = ""
@@ -218,7 +218,8 @@ var apiCreateCmd = &cobra.Command{
                     } else {
                         fqActionName = "/"+opv.XOpenWhisk.Namespace+"/"+opv.XOpenWhisk.ActionName
                     }
-                    whisk.Debug(whisk.DbgInfo, "baseUrl %s  Path %s  Path obj %+v\n", baseUrl, path, opv)
+
+                    whisk.Debug(whisk.DbgInfo, "baseUrl '%s'  Path '%s'  Path obj %+v\n", baseUrl, path, opv)
                     if len(fqActionName) > 0 {
                         fmt.Fprintf(color.Output,
                             wski18n.T("{{.ok}} created API {{.path}} {{.verb}} for action {{.name}}\n{{.fullpath}}\n",
@@ -574,7 +575,7 @@ func genFilteredList(resultApi *whisk.RetApi, apiPath string, apiVerb string) []
     basePath := resultApi.Swagger.BasePath
     if (resultApi.Swagger != nil && resultApi.Swagger.Paths != nil) {
         for path, _ := range resultApi.Swagger.Paths {
-            whisk.Debug(whisk.DbgInfo, "genFilteredList: comparing api relpath: %s\n", path)
+            whisk.Debug(whisk.DbgInfo, "genFilteredApi: comparing api relpath: '%s'\n", path)
             if ( len(apiPath) == 0 || path == apiPath) {
                 whisk.Debug(whisk.DbgInfo, "genFilteredList: relpath matches\n")
                 for op, opv  := range resultApi.Swagger.Paths[path] {
@@ -612,7 +613,7 @@ func genFilteredRow(resultApi *whisk.RetApi, apiPath string, apiVerb string, max
     basePath := resultApi.Swagger.BasePath
     if (resultApi.Swagger != nil && resultApi.Swagger.Paths != nil) {
         for path, _ := range resultApi.Swagger.Paths {
-            whisk.Debug(whisk.DbgInfo, "genFilteredRow: comparing api relpath: %s\n", path)
+            whisk.Debug(whisk.DbgInfo, "genFilteredRow: comparing api relpath: '%s'\n", path)
             if ( len(apiPath) == 0 || path == apiPath) {
                 whisk.Debug(whisk.DbgInfo, "genFilteredRow: relpath matches\n")
                 for op, opv  := range resultApi.Swagger.Paths[path] {
@@ -675,7 +676,7 @@ func getLargestActionNameSize(retApiArray *whisk.RetApiArray, apiPath string, ap
         var resultApi = retApiArray.Apis[i].ApiValue
         if (resultApi.Swagger != nil && resultApi.Swagger.Paths != nil) {
             for path, _ := range resultApi.Swagger.Paths {
-                whisk.Debug(whisk.DbgInfo, "getLargestActionNameSize: comparing api relpath: %s\n", path)
+                whisk.Debug(whisk.DbgInfo, "getLargestActionNameSize: comparing api relpath: '%s'\n", path)
                 if ( len(apiPath) == 0 || path == apiPath) {
                     whisk.Debug(whisk.DbgInfo, "getLargestActionNameSize: relpath matches\n")
                     for op, opv  := range resultApi.Swagger.Paths[path] {
@@ -709,7 +710,7 @@ func getLargestApiNameSize(retApiArray *whisk.RetApiArray, apiPath string, apiVe
         apiName := resultApi.Swagger.Info.Title
         if (resultApi.Swagger != nil && resultApi.Swagger.Paths != nil) {
             for path, _ := range resultApi.Swagger.Paths {
-                whisk.Debug(whisk.DbgInfo, "getLargestActionNameSize: comparing api relpath: %s\n", path)
+                whisk.Debug(whisk.DbgInfo, "getLargestActionNameSize: comparing api relpath: '%s'\n", path)
                 if ( len(apiPath) == 0 || path == apiPath) {
                     whisk.Debug(whisk.DbgInfo, "getLargestActionNameSize: relpath matches\n")
                     for op, opv  := range resultApi.Swagger.Paths[path] {
@@ -869,7 +870,7 @@ func parseSwaggerApi() (*whisk.Api, error) {
     swaggerObj := new(whisk.ApiSwagger)
     err = json.Unmarshal([]byte(swagger), swaggerObj)
     if ( err != nil ) {
-        whisk.Debug(whisk.DbgError, "JSON parse of `%s' error: %s\n", Flags.api.configfile, err)
+        whisk.Debug(whisk.DbgError, "JSON parse of '%s' error: %s\n", Flags.api.configfile, err)
         errMsg := wski18n.T("Error parsing swagger file '{{.name}}': {{.err}}",
             map[string]interface{}{"name": Flags.api.configfile, "err": err})
         whiskErr := whisk.MakeWskErrorFromWskError(errors.New(errMsg), err, whisk.EXIT_CODE_ERR_GENERAL,
@@ -925,7 +926,7 @@ func getUserContextId() (string, error) {
         if len(props["AUTH"]) > 0 {
             guid = strings.Split(props["AUTH"], ":")[0]
         } else {
-            whisk.Debug(whisk.DbgError, "AUTH property not set in properties file: %s\n", Properties.PropsFile)
+            whisk.Debug(whisk.DbgError, "AUTH property not set in properties file: '%s'\n", Properties.PropsFile)
             errStr := wski18n.T("Authorization key is not configured (--auth is required)")
             err = whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
         }
diff --git a/commands/package.go b/commands/package.go
index 45a6d1f..abec693 100644
--- a/commands/package.go
+++ b/commands/package.go
@@ -465,7 +465,7 @@ var packageRefreshCmd = &cobra.Command{
 
     switch resp.StatusCode {
     case http.StatusOK:
-      fmt.Printf(wski18n.T("{{.name}} refreshed successfully\n",
+      fmt.Printf(wski18n.T("'{{.name}}' refreshed successfully\n",
         map[string]interface{}{"name": client.Config.Namespace}))
 
       fmt.Println(wski18n.T("created bindings:"))
diff --git a/commands/sdk.go b/commands/sdk.go
index 357c699..145839a 100644
--- a/commands/sdk.go
+++ b/commands/sdk.go
@@ -115,7 +115,7 @@ func dockerInstall() error {
     targetFile := sdkMap[SDK_DOCKER_COMPONENT_NAME].FileName
     if _, err = os.Stat(targetFile); err == nil {
         whisk.Debug(whisk.DbgError, "os.Stat reports file '%s' exists\n", targetFile)
-        errStr := wski18n.T("The file {{.name}} already exists.  Delete it and retry.",
+        errStr := wski18n.T("The file '{{.name}}' already exists.  Delete it and retry.",
             map[string]interface{}{"name": targetFile})
         werr := whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
         return werr
@@ -145,7 +145,7 @@ func iOSInstall() error {
     }
 
     fmt.Printf(
-        wski18n.T("Downloaded OpenWhisk iOS starter app. Unzip {{.name}} and open the project in Xcode.\n",
+        wski18n.T("Downloaded OpenWhisk iOS starter app. Unzip '{{.name}}' and open the project in Xcode.\n",
             map[string]interface{}{"name": sdkMap[SDK_IOS_COMPONENT_NAME].FileName}))
     return nil
 }
@@ -154,7 +154,7 @@ func sdkInstall(componentName string) error {
     targetFile := sdkMap[componentName].FileName
     if _, err := os.Stat(targetFile); err == nil {
         whisk.Debug(whisk.DbgError, "os.Stat reports file '%s' exists\n", targetFile)
-        errStr := wski18n.T("The file {{.name}} already exists.  Delete it and retry.",
+        errStr := wski18n.T("The file '{{.name}}' already exists.  Delete it and retry.",
                 map[string]interface{}{"name": targetFile})
         werr := whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
         return werr
@@ -181,7 +181,7 @@ func sdkInstall(componentName string) error {
     sdkfile, err := os.Create(targetFile)
     if err != nil {
         whisk.Debug(whisk.DbgError, "os.Create(%s) failure: %s\n", targetFile, err)
-        errStr := wski18n.T("Error creating SDK file {{.name}}: {{.err}}",
+        errStr := wski18n.T("Error creating SDK file '{{.name}}': {{.err}}",
                 map[string]interface{}{"name": targetFile, "err": err})
         werr := whisk.MakeWskErrorFromWskError(errors.New(errStr), err, whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
         return werr
@@ -209,7 +209,7 @@ func sdkInstall(componentName string) error {
         targetdir := sdkMap[componentName].UnpackDir
         if _, err = os.Stat(targetdir); err == nil {
             whisk.Debug(whisk.DbgError, "os.Stat reports that directory '%s' exists\n", targetdir)
-            errStr := wski18n.T("The directory {{.name}} already exists.  Delete it and retry.",
+            errStr := wski18n.T("The directory '{{.name}}' already exists.  Delete it and retry.",
                     map[string]interface{}{"name": targetdir})
             werr := whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
             return werr
@@ -223,7 +223,7 @@ func sdkInstall(componentName string) error {
             err := unpackGzip(targetFile, "temp.tar")
             if err != nil {
                 whisk.Debug(whisk.DbgError, "unpackGzip(%s,temp.tar) failure: %s\n", targetFile, err)
-                errStr := wski18n.T("Error unGzipping file {{.name}}: {{.err}}",
+                errStr := wski18n.T("Error unGzipping file '{{.name}}': {{.err}}",
                     map[string]interface{}{"name": targetFile, "err": err})
                 werr := whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
                 return werr
@@ -234,7 +234,7 @@ func sdkInstall(componentName string) error {
             err = unpackTar("temp.tar")
             if err != nil {
                 whisk.Debug(whisk.DbgError, "unpackTar(temp.tar) failure: %s\n", err)
-                errStr := wski18n.T("Error untarring file {{.name}}: {{.err}}",
+                errStr := wski18n.T("Error untarring file '{{.name}}': {{.err}}",
                         map[string]interface{}{"name": "temp.tar", "err": err})
                 werr := whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
                 return werr
diff --git a/commands/util.go b/commands/util.go
index 7226487..95b8291 100644
--- a/commands/util.go
+++ b/commands/util.go
@@ -589,7 +589,7 @@ func unpackGzip(inpath string, outpath string) error {
     // Make sure the target file does not exist
     if _, err := os.Stat(outpath); err == nil {
         whisk.Debug(whisk.DbgError, "os.Stat reports file '%s' exists\n", outpath)
-        errStr := wski18n.T("The file {{.name}} already exists.  Delete it and retry.",
+        errStr := wski18n.T("The file '{{.name}}' already exists.  Delete it and retry.",
             map[string]interface{}{"name": outpath})
         werr := whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
         return werr
diff --git a/wski18n/i18n_resources.go b/wski18n/i18n_resources.go
index 72f9ec4..b331ec6 100644
--- a/wski18n/i18n_resources.go
+++ b/wski18n/i18n_resources.go
@@ -109,12 +109,12 @@ func wski18nResourcesDe_deAllJson() (*asset, error) {
         return nil, err
     }
 
-    info := bindataFileInfo{name: "wski18n/resources/de_DE.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1500156058, 0)}
+    info := bindataFileInfo{name: "wski18n/resources/de_DE.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1506089398, 0)}
     a := &asset{bytes: bytes, info: info}
     return a, nil
 }
 
-var _wski18nResourcesEn_usAllJson = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x7d\x4f\x73\xdb\x38\xd2\xf7\x7d\x3e\x45\x57\x2e\x76\xde\x92\x9d\xdd\xd3\x5b\x4f\x52\x73\xd0\x24\x9e\x8d\x37\x89\xed\x8a\x9d\xd9\x9d\xda\x6c\x8d\x20\x12\x92\xb0\xa6\x00\x0e\x00\x5a\x51\xb2\xfe\xee\x4f\x01\x20\x29\x52\xc2\x5f\x52\x4e\x9e\x53\x1c\xb1\xfb\xd7\x0d\xa0\x01\x34\x1a\x0d\xe0\x5f\x3f\x01\x7c\xfb\x09\x00\xe0\x19\xc9\x9f\xbd\x84\x67\xd3\xb2\x2c\x48\x86\x24\x61\x14\xf0\x17\x22\x71\x0e\x15\xc5\x5f [...]
+var _wski18nResourcesEn_usAllJson = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x7d\x4f\x73\xdb\x38\xd2\xf7\x7d\x3e\x45\x57\x2e\x76\xde\x92\x9d\xdd\xd3\x5b\x4f\x52\x73\xd0\x24\x9e\x8d\x37\x89\xed\x8a\x9d\xd9\x9d\xda\x6c\x8d\x20\x12\x92\xb0\xa6\x00\x0e\x00\x5a\x51\xb2\xfe\xee\x4f\x01\x20\x29\x52\xc2\x5f\x52\x4e\x9e\x53\x1c\xb1\xfb\xd7\x0d\xa0\x01\x34\x1a\x0d\xe0\x5f\x3f\x01\x7c\xfb\x09\x00\xe0\x19\xc9\x9f\xbd\x84\x67\xd3\xb2\x2c\x48\x86\x24\x61\x14\xf0\x17\x22\x71\x0e\x15\xc5\x5f [...]
 
 func wski18nResourcesEn_usAllJsonBytes() ([]byte, error) {
     return bindataRead(
@@ -129,7 +129,7 @@ func wski18nResourcesEn_usAllJson() (*asset, error) {
         return nil, err
     }
 
-    info := bindataFileInfo{name: "wski18n/resources/en_US.all.json", size: 50955, mode: os.FileMode(420), modTime: time.Unix(1505616931, 0)}
+    info := bindataFileInfo{name: "wski18n/resources/en_US.all.json", size: 50999, mode: os.FileMode(420), modTime: time.Unix(1506089759, 0)}
     a := &asset{bytes: bytes, info: info}
     return a, nil
 }
@@ -149,7 +149,7 @@ func wski18nResourcesEs_esAllJson() (*asset, error) {
         return nil, err
     }
 
-    info := bindataFileInfo{name: "wski18n/resources/es_ES.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1500156058, 0)}
+    info := bindataFileInfo{name: "wski18n/resources/es_ES.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1506089398, 0)}
     a := &asset{bytes: bytes, info: info}
     return a, nil
 }
@@ -169,7 +169,7 @@ func wski18nResourcesFr_frAllJson() (*asset, error) {
         return nil, err
     }
 
-    info := bindataFileInfo{name: "wski18n/resources/fr_FR.all.json", size: 101, mode: os.FileMode(420), modTime: time.Unix(1500156058, 0)}
+    info := bindataFileInfo{name: "wski18n/resources/fr_FR.all.json", size: 101, mode: os.FileMode(420), modTime: time.Unix(1506089398, 0)}
     a := &asset{bytes: bytes, info: info}
     return a, nil
 }
@@ -189,7 +189,7 @@ func wski18nResourcesIt_itAllJson() (*asset, error) {
         return nil, err
     }
 
-    info := bindataFileInfo{name: "wski18n/resources/it_IT.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1500156058, 0)}
+    info := bindataFileInfo{name: "wski18n/resources/it_IT.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1506089398, 0)}
     a := &asset{bytes: bytes, info: info}
     return a, nil
 }
@@ -209,7 +209,7 @@ func wski18nResourcesJa_jaAllJson() (*asset, error) {
         return nil, err
     }
 
-    info := bindataFileInfo{name: "wski18n/resources/ja_JA.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1500156058, 0)}
+    info := bindataFileInfo{name: "wski18n/resources/ja_JA.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1506089398, 0)}
     a := &asset{bytes: bytes, info: info}
     return a, nil
 }
@@ -229,7 +229,7 @@ func wski18nResourcesKo_krAllJson() (*asset, error) {
         return nil, err
     }
 
-    info := bindataFileInfo{name: "wski18n/resources/ko_KR.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1500156058, 0)}
+    info := bindataFileInfo{name: "wski18n/resources/ko_KR.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1506089398, 0)}
     a := &asset{bytes: bytes, info: info}
     return a, nil
 }
@@ -249,7 +249,7 @@ func wski18nResourcesPt_brAllJson() (*asset, error) {
         return nil, err
     }
 
-    info := bindataFileInfo{name: "wski18n/resources/pt_BR.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1500156058, 0)}
+    info := bindataFileInfo{name: "wski18n/resources/pt_BR.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1506089398, 0)}
     a := &asset{bytes: bytes, info: info}
     return a, nil
 }
@@ -269,7 +269,7 @@ func wski18nResourcesZh_hansAllJson() (*asset, error) {
         return nil, err
     }
 
-    info := bindataFileInfo{name: "wski18n/resources/zh_Hans.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1500156058, 0)}
+    info := bindataFileInfo{name: "wski18n/resources/zh_Hans.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1506089398, 0)}
     a := &asset{bytes: bytes, info: info}
     return a, nil
 }
@@ -289,7 +289,7 @@ func wski18nResourcesZh_hantAllJson() (*asset, error) {
         return nil, err
     }
 
-    info := bindataFileInfo{name: "wski18n/resources/zh_Hant.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1500156058, 0)}
+    info := bindataFileInfo{name: "wski18n/resources/zh_Hant.all.json", size: 0, mode: os.FileMode(420), modTime: time.Unix(1506089398, 0)}
     a := &asset{bytes: bytes, info: info}
     return a, nil
 }
diff --git a/wski18n/resources/en_US.all.json b/wski18n/resources/en_US.all.json
index 5f5bdf8..3236830 100644
--- a/wski18n/resources/en_US.all.json
+++ b/wski18n/resources/en_US.all.json
@@ -184,8 +184,8 @@
     "translation": "Package refresh for namespace '{{.name}}' failed: {{.err}}"
   },
   {
-    "id": "{{.name}} refreshed successfully\n",
-    "translation": "{{.name}} refreshed successfully\n"
+    "id": "'{{.name}}' refreshed successfully\n",
+    "translation": "'{{.name}}' refreshed successfully\n"
   },
   {
     "id": "created bindings:",
@@ -566,8 +566,8 @@
     "translation": "The SDK component argument '{{.component}}' is invalid. Valid components are docker, ios and bashauto"
   },
   {
-    "id": "The file {{.name}} already exists.  Delete it and retry.",
-    "translation": "The file {{.name}} already exists.  Delete it and retry."
+    "id": "The file '{{.name}}' already exists.  Delete it and retry.",
+    "translation": "The file '{{.name}}' already exists.  Delete it and retry."
   },
   {
     "id": "The {{.component}} SDK installation failed: {{.err}}",
@@ -578,8 +578,8 @@
     "translation": "The docker skeleton is now installed at the current directory."
   },
   {
-    "id": "Downloaded OpenWhisk iOS starter app. Unzip {{.name}} and open the project in Xcode.\n",
-    "translation": "Downloaded OpenWhisk iOS starter app. Unzip {{.name}} and open the project in Xcode.\n"
+    "id": "Downloaded OpenWhisk iOS starter app. Unzip '{{.name}}' and open the project in Xcode.\n",
+    "translation": "Downloaded OpenWhisk iOS starter app. Unzip '{{.name}}' and open the project in Xcode.\n"
   },
   {
     "id": "Unable to retrieve '{{.urlpath}}' SDK: {{.err}}",
@@ -590,24 +590,24 @@
     "translation": "Server failed to send the '{{.component}}' SDK: {{.err}}"
   },
   {
-    "id": "Error creating SDK file {{.name}}: {{.err}}",
-    "translation": "Error creating SDK file {{.name}}: {{.err}}"
+    "id": "Error creating SDK file '{{.name}}': {{.err}}",
+    "translation": "Error creating SDK file '{{.name}}': {{.err}}"
   },
   {
     "id": "Error copying server response into file: {{.err}}",
     "translation": "Error copying server response into file: {{.err}}"
   },
   {
-    "id": "The directory {{.name}} already exists.  Delete it and retry.",
-    "translation": "The directory {{.name}} already exists.  Delete it and retry."
+    "id": "The directory '{{.name}}' already exists.  Delete it and retry.",
+    "translation": "The directory '{{.name}}' already exists.  Delete it and retry."
   },
   {
-    "id": "Error unGzipping file {{.name}}: {{.err}}",
-    "translation": "Error unGzipping file {{.name}}: {{.err}}"
+    "id": "Error unGzipping file '{{.name}}': {{.err}}",
+    "translation": "Error unGzipping file '{{.name}}': {{.err}}"
   },
   {
-    "id": "Error untarring file {{.name}}: {{.err}}",
-    "translation": "Error untarring file {{.name}}: {{.err}}"
+    "id": "Error untarring file '{{.name}}': {{.err}}",
+    "translation": "Error untarring file '{{.name}}': {{.err}}"
   },
   {
     "id": "work with triggers",
@@ -984,8 +984,8 @@
     "translation": "Unable to get activation '{{.id}}': {{.err}}"
   },
   {
-    "id": "activation result for /{{.namespace}}/{{.name}} ({{.status}} at {{.time}})\n",
-    "translation": "activation result for /{{.namespace}}/{{.name}} ({{.status}} at {{.time}})\n"
+    "id": "activation result for '/{{.namespace}}/{{.name}}' ({{.status}} at {{.time}})\n",
+    "translation": "activation result for '/{{.namespace}}/{{.name}}' ({{.status}} at {{.time}})\n"
   },
   {
     "id": "{{.ok}} got activation {{.id}}\n",
@@ -1028,8 +1028,8 @@
     "translation": "Polling for activation logs\n"
   },
   {
-    "id": "\nActivation: {{.name}} ({{.id}})\n",
-    "translation": "\nActivation: {{.name}} ({{.id}})\n"
+    "id": "\nActivation: '{{.name}}' ({{.id}})\n",
+    "translation": "\nActivation: '{{.name}}' ({{.id}})\n"
   },
   {
     "id": "Activation list does not contain any activations.",
@@ -1424,8 +1424,8 @@
     "translation": "Invalid argument '{{.arg}}' for --web flag. Valid input consist of 'yes', 'true', 'raw', 'false', or 'no'."
   },
   {
-    "id": "Action '{{.name}}' is not a web action. Issue 'wsk action update {{.name}} --web true' to convert the action to a web action.",
-    "translation": "Action '{{.name}}' is not a web action. Issue 'wsk action update {{.name}} --web true' to convert the action to a web action."
+    "id": "Action '{{.name}}' is not a web action. Issue 'wsk action update \"{{.name}}\" --web true' to convert the action to a web action.",
+    "translation": "Action '{{.name}}' is not a web action. Issue 'wsk action update \"{{.name}}\" --web true' to convert the action to a web action."
   },
   {
     "id": "Invalid configuration. The x-openwhisk stanza is missing.",

-- 
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.

[incubator-openwhisk-cli] 01/07: Don't assume apihost is https for sdk and action urls (#2748)

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git

commit 0792cc89b106682326ea55d15b6334be190512e1
Author: Ben Browning <be...@gmail.com>
AuthorDate: Wed Sep 20 15:21:51 2017 -0400

    Don't assume apihost is https for sdk and action urls (#2748)
    
    * Don't assume apihost is https for sdk and action urls
    
    Reuse the getURLBase utility method when computing the URL for sdk
    downloads and action URLs.
    
    This fixes #2720 and fixes #2719.
    
    * Cleanup some trailing whitespace I missed
    
    * Missed this import in last-second rebase
    
    * Update debug messages to match `GetURLBase` method name
---
 commands/action.go   |  8 +++++++-
 commands/commands.go |  4 ++--
 commands/property.go |  8 ++++----
 commands/util.go     | 24 ------------------------
 4 files changed, 13 insertions(+), 31 deletions(-)

diff --git a/commands/action.go b/commands/action.go
index 1546602..82312f6 100644
--- a/commands/action.go
+++ b/commands/action.go
@@ -230,10 +230,16 @@ var actionGetCmd = &cobra.Command{
         }
 
         if Flags.action.url {
-            actionURL := action.ActionURL(Properties.APIHost,
+            actionURL, err := action.ActionURL(Properties.APIHost,
                 DefaultOpenWhiskApiPath,
                 Properties.APIVersion,
                 qualifiedName.GetPackageName())
+            if err != nil {
+                errStr := wski18n.T("Invalid host address '{{.host}}': {{.err}}",
+                        map[string]interface{}{"host": Properties.APIHost, "err": err})
+                werr := whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
+                return werr
+            }
             printActionGetWithURL(qualifiedName.GetEntity(), actionURL)
         } else if Flags.common.summary {
             printSummary(action)
diff --git a/commands/commands.go b/commands/commands.go
index 0914a73..9d79ad0 100644
--- a/commands/commands.go
+++ b/commands/commands.go
@@ -33,7 +33,7 @@ const DefaultOpenWhiskApiPath string = "/api"
 var UserAgent string = "OpenWhisk-CLI"
 
 func setupClientConfig(cmd *cobra.Command, args []string) (error){
-    baseURL, err := GetURLBase(Properties.APIHost, DefaultOpenWhiskApiPath)
+    baseURL, err := whisk.GetURLBase(Properties.APIHost, DefaultOpenWhiskApiPath)
 
     // Determine if the parent command will require the API host to be set
     apiHostRequired := (cmd.Parent().Name() == "property" && cmd.Name() == "get" && (Flags.property.auth ||
@@ -45,7 +45,7 @@ func setupClientConfig(cmd *cobra.Command, args []string) (error){
 
     // Display an error if the parent command requires an API host to be set, and the current API host is not valid
     if err != nil && !apiHostRequired {
-        whisk.Debug(whisk.DbgError, "getURLBase(%s, %s) error: %s\n", Properties.APIHost, DefaultOpenWhiskApiPath, err)
+        whisk.Debug(whisk.DbgError, "whisk.GetURLBase(%s, %s) error: %s\n", Properties.APIHost, DefaultOpenWhiskApiPath, err)
         errMsg := wski18n.T("The API host is not valid: {{.err}}", map[string]interface{}{"err": err})
         whiskErr := whisk.MakeWskErrorFromWskError(errors.New(errMsg), err, whisk.EXIT_CODE_ERR_GENERAL,
             whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
diff --git a/commands/property.go b/commands/property.go
index d51fdeb..5153e18 100644
--- a/commands/property.go
+++ b/commands/property.go
@@ -106,11 +106,11 @@ var propertySetCmd = &cobra.Command{
         }
 
         if apiHost := Flags.property.apihostSet; len(apiHost) > 0 {
-            baseURL, err := GetURLBase(apiHost, DefaultOpenWhiskApiPath)
+            baseURL, err := whisk.GetURLBase(apiHost, DefaultOpenWhiskApiPath)
 
             if err != nil {
                 // Not aborting now.  Subsequent commands will result in error
-                whisk.Debug(whisk.DbgError, "getURLBase(%s, %s) error: %s", apiHost, DefaultOpenWhiskApiPath, err)
+                whisk.Debug(whisk.DbgError, "whisk.GetURLBase(%s, %s) error: %s", apiHost, DefaultOpenWhiskApiPath, err)
                 errStr := fmt.Sprintf(
                     wski18n.T("Unable to set API host value; the API host value '{{.apihost}}' is invalid: {{.err}}",
                         map[string]interface{}{"apihost": apiHost, "err": err}))
@@ -537,10 +537,10 @@ func parseConfigFlags(cmd *cobra.Command, args []string) error {
 
         if client != nil {
             client.Config.Host = apiHost
-            baseURL, err := GetURLBase(apiHost, DefaultOpenWhiskApiPath)
+            baseURL, err := whisk.GetURLBase(apiHost, DefaultOpenWhiskApiPath)
 
             if err != nil {
-                whisk.Debug(whisk.DbgError, "getURLBase(%s, %s) failed: %s\n", apiHost, DefaultOpenWhiskApiPath, err)
+                whisk.Debug(whisk.DbgError, "whisk.GetURLBase(%s, %s) failed: %s\n", apiHost, DefaultOpenWhiskApiPath, err)
                 errStr := wski18n.T("Invalid host address '{{.host}}': {{.err}}",
                         map[string]interface{}{"host": Properties.APIHost, "err": err})
                 werr := whisk.MakeWskError(errors.New(errStr), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
diff --git a/commands/util.go b/commands/util.go
index 96511c0..7226487 100644
--- a/commands/util.go
+++ b/commands/util.go
@@ -35,7 +35,6 @@ import (
     "compress/gzip"
     "archive/zip"
     "encoding/json"
-    "net/url"
     "io/ioutil"
     "sort"
     "reflect"
@@ -816,29 +815,6 @@ func checkArgs(args []string, minimumArgNumber int, maximumArgNumber int, comman
     }
 }
 
-func GetURLBase(host string, path string) (*url.URL, error)  {
-    if len(host) == 0 {
-        errMsg := wski18n.T("An API host must be provided.")
-        whiskErr := whisk.MakeWskError(errors.New(errMsg), whisk.EXIT_CODE_ERR_GENERAL,
-            whisk.DISPLAY_MSG, whisk.DISPLAY_USAGE)
-        return nil, whiskErr
-    }
-
-    if !strings.HasPrefix(host, "http") {
-        host = "https://" + host
-    }
-
-    urlBase := fmt.Sprintf("%s%s", host, path)
-    url, err := url.Parse(urlBase)
-
-    if len(url.Scheme) == 0 || len(url.Host) == 0 {
-        urlBase = fmt.Sprintf("https://%s%s", host, path)
-        url, err = url.Parse(urlBase)
-    }
-
-    return url, err
-}
-
 func normalizeNamespace(namespace string) (string) {
     if (namespace == "_") {
         namespace = wski18n.T("default")

-- 
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.

[incubator-openwhisk-cli] 03/07: Display content-type in __ow_headers for web actions (#2741)

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git

commit 300a2bb94098a9de003394c1c4d2a25865517c0a
Author: James Dubee <jw...@us.ibm.com>
AuthorDate: Mon Sep 18 16:32:14 2017 -0500

    Display content-type in __ow_headers for web actions (#2741)
---
 .../whisk/core/cli/test/WskWebActionsTests.scala   | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala
index 1a8ff04..e24964b 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala
@@ -59,6 +59,37 @@ class WskWebActionsTests extends TestHelpers with WskTestHelpers with RestUtil w
 
   behavior of "Wsk Web Actions"
 
+  it should "ensure __ow_headers contains the proper content-type" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
+    val name = "webContenttype"
+    val file = Some(TestUtils.getTestActionFilename("echo.js"))
+    val bodyContent = JsObject("key" -> "value".toJson)
+    val host = getServiceURL()
+    val url = s"$host$testRoutePath/$namespace/default/$name.json"
+
+    assetHelper.withCleaner(wsk.action, name) { (action, _) =>
+      action.create(name, file, web = Some("true"))
+    }
+
+    val resWithContentType =
+      RestAssured.given().contentType("application/json").body(bodyContent.compactPrint).config(sslconfig).post(url)
+
+    resWithContentType.statusCode shouldBe 200
+    resWithContentType.header("Content-type") shouldBe "application/json"
+    resWithContentType.body.asString.parseJson.asJsObject
+      .fields("__ow_headers")
+      .asJsObject
+      .fields("content-type") shouldBe "application/json".toJson
+
+    val resWithoutContentType =
+      RestAssured.given().config(sslconfig).get(url)
+
+    resWithoutContentType.statusCode shouldBe 200
+    resWithoutContentType.header("Content-type") shouldBe "application/json"
+    resWithoutContentType.body.asString.parseJson.asJsObject
+      .fields("__ow_headers")
+      .toString should not include ("content-type")
+  }
+
   /**
     * Tests web actions, plus max url limit.
     */

-- 
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.

[incubator-openwhisk-cli] 07/07: Updating the way we print names in the Cli Fixes #1155 (#2462)

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git

commit d6ec0043c684ca090de47fefe99bd76338516009
Author: Jesus Alva <ja...@us.ibm.com>
AuthorDate: Thu Sep 21 11:01:33 2017 -0500

    Updating the way we print names in the Cli Fixes #1155 (#2462)
    
    * Changes so that we are more consistent with quoting names that are not bolded when we print statements
    
    * Fixing up tests related to making quoting consistent in our CLI
---
 tests/src/test/scala/system/basic/WskSdkTests.scala               | 2 +-
 tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/src/test/scala/system/basic/WskSdkTests.scala b/tests/src/test/scala/system/basic/WskSdkTests.scala
index df550b8..3e7e3b2 100644
--- a/tests/src/test/scala/system/basic/WskSdkTests.scala
+++ b/tests/src/test/scala/system/basic/WskSdkTests.scala
@@ -95,7 +95,7 @@ class WskSdkTests extends TestHelpers with WskTestHelpers {
     dir.mkdir() should be(true)
 
     wsk.cli(wskprops.overrides ++ Seq("sdk", "install", "iOS"), workingDir = dir).stdout should include(
-      "Downloaded OpenWhisk iOS starter app. Unzip OpenWhiskIOSStarterApp.zip and open the project in Xcode.")
+      "Downloaded OpenWhisk iOS starter app. Unzip 'OpenWhiskIOSStarterApp.zip' and open the project in Xcode.")
 
     val sdk = new File(dir, "OpenWhiskIOSStarterApp.zip")
     sdk.exists() should be(true)
diff --git a/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala
index c833320..017d4b1 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala
@@ -61,7 +61,7 @@ class WskWebActionsTests extends TestHelpers with WskTestHelpers with RestUtil w
 
   it should "ensure __ow_headers contains the proper content-type" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
     val name = "webContenttype"
-    val file = Some(TestUtils.getTestActionFilename("echo.js"))
+    val file = Some(TestCLIUtils.getTestActionFilename("echo.js"))
     val bodyContent = JsObject("key" -> "value".toJson)
     val host = getServiceURL()
     val url = s"$host$testRoutePath/$namespace/default/$name.json"

-- 
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.

[incubator-openwhisk-cli] 05/07: Don't assume apihost is https for sdk and action urls (#2748)

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git

commit 95e67fc1842e08f6e551092b3090b21a5921703e
Author: Ben Browning <be...@gmail.com>
AuthorDate: Wed Sep 20 15:21:51 2017 -0400

    Don't assume apihost is https for sdk and action urls (#2748)
    
    * Don't assume apihost is https for sdk and action urls
    
    Reuse the getURLBase utility method when computing the URL for sdk
    downloads and action URLs.
    
    This fixes #2720 and fixes #2719.
    
    * Cleanup some trailing whitespace I missed
    
    * Missed this import in last-second rebase
    
    * Update debug messages to match `GetURLBase` method name
---
 .../src/test/scala/system/basic/WskSdkTests.scala  | 19 +++++++++-
 .../whisk/core/cli/test/WskBasicUsageTests.scala   | 42 ++++++++++++++++++----
 2 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/tests/src/test/scala/system/basic/WskSdkTests.scala b/tests/src/test/scala/system/basic/WskSdkTests.scala
index 62c8d60..df550b8 100644
--- a/tests/src/test/scala/system/basic/WskSdkTests.scala
+++ b/tests/src/test/scala/system/basic/WskSdkTests.scala
@@ -24,8 +24,8 @@ import scala.collection.JavaConversions.asScalaBuffer
 import org.apache.commons.io.FileUtils
 import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
-
 import common.TestHelpers
+import common.TestUtils.ERROR_EXIT
 import common.TestUtils.SUCCESS_EXIT
 import common.WhiskProperties
 import common.Wsk
@@ -40,6 +40,23 @@ class WskSdkTests extends TestHelpers with WskTestHelpers {
 
   behavior of "Wsk SDK"
 
+  it should "prefix https to apihost if no scheme given" in {
+    val result = wsk.cli(Seq("--apihost", "localhost:54321", "sdk", "install", "docker"), expectedExitCode = ERROR_EXIT)
+    result.stderr should include regex ("""(?i)Get https://localhost:54321/""")
+  }
+
+  it should "not prefix https to http apihost" in {
+    val result =
+      wsk.cli(Seq("--apihost", "http://localhost:54321", "sdk", "install", "docker"), expectedExitCode = ERROR_EXIT)
+    result.stderr should include regex ("""(?i)Get http://localhost:54321/""")
+  }
+
+  it should "not double prefix https to https apihost" in {
+    val result =
+      wsk.cli(Seq("--apihost", "https://localhost:54321", "sdk", "install", "docker"), expectedExitCode = ERROR_EXIT)
+    result.stderr should include regex ("""(?i)Get https://localhost:54321/""")
+  }
+
   it should "download docker action sdk" in {
     val dir = File.createTempFile("wskinstall", ".tmp")
     dir.delete()
diff --git a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
index 82c3693..ea23ce3 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
@@ -653,9 +653,10 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers {
     val encodedPackageName = URLEncoder.encode(packageName, StandardCharsets.UTF_8.name).replace("+", "%20")
     val encodedWebActionName = URLEncoder.encode(webActionName, StandardCharsets.UTF_8.name).replace("+", "%20")
     val encodedNamespace = URLEncoder.encode(namespace, StandardCharsets.UTF_8.name).replace("+", "%20")
-    val actionPath = "https://%s/api/%s/namespaces/%s/actions/%s"
+    val scheme = "https"
+    val actionPath = "%s://%s/api/%s/namespaces/%s/actions/%s"
     val packagedActionPath = s"$actionPath/%s"
-    val webActionPath = "https://%s/api/%s/web/%s/%s/%s"
+    val webActionPath = "%s://%s/api/%s/web/%s/%s/%s"
 
     assetHelper.withCleaner(wsk.action, actionName) { (action, _) =>
       action.create(actionName, defaultAction)
@@ -678,25 +679,52 @@ class WskBasicUsageTests extends TestHelpers with WskTestHelpers {
     }
 
     wsk.action.get(actionName, url = Some(true)).stdout should include(
-      actionPath.format(wskprops.apihost, wskprops.apiversion, encodedNamespace, encodedActionName))
+      actionPath.format(scheme, wskprops.apihost, wskprops.apiversion, encodedNamespace, encodedActionName))
 
     // Ensure url flag works when a field filter and summary flag are specified
     wsk.action.get(actionName, url = Some(true), fieldFilter = Some("field"), summary = true).stdout should include(
-      actionPath.format(wskprops.apihost, wskprops.apiversion, encodedNamespace, encodedActionName))
+      actionPath.format(scheme, wskprops.apihost, wskprops.apiversion, encodedNamespace, encodedActionName))
 
     wsk.action.get(webActionName, url = Some(true)).stdout should include(
       webActionPath
-        .format(wskprops.apihost, wskprops.apiversion, encodedNamespace, defaultPackageName, encodedWebActionName))
+        .format(
+          scheme,
+          wskprops.apihost,
+          wskprops.apiversion,
+          encodedNamespace,
+          defaultPackageName,
+          encodedWebActionName))
 
     wsk.action.get(packagedAction, url = Some(true)).stdout should include(
       packagedActionPath
-        .format(wskprops.apihost, wskprops.apiversion, encodedNamespace, encodedPackageName, encodedActionName))
+        .format(scheme, wskprops.apihost, wskprops.apiversion, encodedNamespace, encodedPackageName, encodedActionName))
 
     wsk.action.get(packagedWebAction, url = Some(true)).stdout should include(
       webActionPath
-        .format(wskprops.apihost, wskprops.apiversion, encodedNamespace, encodedPackageName, encodedWebActionName))
+        .format(
+          scheme,
+          wskprops.apihost,
+          wskprops.apiversion,
+          encodedNamespace,
+          encodedPackageName,
+          encodedWebActionName))
 
     wsk.action.get(nonExistentActionName, url = Some(true), expectedExitCode = NOT_FOUND)
+
+    val httpsProps = WskProps(apihost = "https://" + wskprops.apihost)
+    wsk.action.get(actionName, url = Some(true))(httpsProps).stdout should include(
+      actionPath
+        .format("https", wskprops.apihost, wskprops.apiversion, encodedNamespace, encodedActionName))
+    wsk.action.get(webActionName, url = Some(true))(httpsProps).stdout should include(
+      webActionPath
+        .format(
+          "https",
+          wskprops.apihost,
+          wskprops.apiversion,
+          encodedNamespace,
+          defaultPackageName,
+          encodedWebActionName))
+
   }
   it should "limit length of HTTP request and response bodies for --verbose" in withAssetCleaner(wskprops) {
     (wp, assetHelper) =>

-- 
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.

[incubator-openwhisk-cli] 04/07: Echo Access-Control-Request-Headers as Access-Control-Allow-Headers instead of hardcoding value for header. (#2771)

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git

commit db5d092ca08b14f141a06df141bd39459b372bb8
Author: rodric rabbah <ro...@gmail.com>
AuthorDate: Wed Sep 20 14:40:19 2017 -0400

    Echo Access-Control-Request-Headers as Access-Control-Allow-Headers instead of hardcoding value for header. (#2771)
---
 .../whisk/core/cli/test/WskWebActionsTests.scala   | 25 ++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala
index e24964b..c833320 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala
@@ -188,11 +188,28 @@ class WskWebActionsTests extends TestHelpers with WskTestHelpers with RestUtil w
       action.create(name, file, web = Some("true"))
     }
 
-    val responses = Seq(
-      RestAssured.given().config(sslconfig).options(s"$url.http"),
-      RestAssured.given().config(sslconfig).get(s"$url.json"))
+    Seq(
+      RestAssured
+        .given()
+        .config(sslconfig)
+        .header("Access-Control-Request-Headers", "x-custom-header")
+        .options(s"$url.http"),
+      RestAssured
+        .given()
+        .config(sslconfig)
+        .header("Access-Control-Request-Headers", "x-custom-header")
+        .get(s"$url.json")).foreach { response =>
+      response.statusCode shouldBe 200
+      response.header("Access-Control-Allow-Origin") shouldBe "*"
+      response.header("Access-Control-Allow-Methods") shouldBe "OPTIONS, GET, DELETE, POST, PUT, HEAD, PATCH"
+      response.header("Access-Control-Allow-Headers") shouldBe "x-custom-header"
+      response.header("Location") shouldBe null
+      response.header("Set-Cookie") shouldBe null
+    }
 
-    responses.foreach { response =>
+    Seq(
+      RestAssured.given().config(sslconfig).options(s"$url.http"),
+      RestAssured.given().config(sslconfig).get(s"$url.json")).foreach { response =>
       response.statusCode shouldBe 200
       response.header("Access-Control-Allow-Origin") shouldBe "*"
       response.header("Access-Control-Allow-Methods") shouldBe "OPTIONS, GET, DELETE, POST, PUT, HEAD, PATCH"

-- 
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.

[incubator-openwhisk-cli] 06/07: update apigw end-to-end to be more resilient (#2724)

Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git

commit f85b26a898191cc6fc64af494801d408916ecbc6
Author: David Cariello <dr...@us.ibm.com>
AuthorDate: Wed Sep 20 16:56:02 2017 -0500

    update apigw end-to-end to be more resilient (#2724)
---
 tests/src/test/scala/apigw/healthtests/ApiGwEndToEndTests.scala | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/src/test/scala/apigw/healthtests/ApiGwEndToEndTests.scala b/tests/src/test/scala/apigw/healthtests/ApiGwEndToEndTests.scala
index d9a94b4..909b609 100644
--- a/tests/src/test/scala/apigw/healthtests/ApiGwEndToEndTests.scala
+++ b/tests/src/test/scala/apigw/healthtests/ApiGwEndToEndTests.scala
@@ -85,6 +85,12 @@ class ApiGwEndToEndTests
     try {
       println("cli namespace: " + clinamespace)
 
+      // Delete any lingering stale api from previous run that may not have been deleted properly
+      wsk.api.delete(
+        basepathOrApiName = testbasepath,
+        expectedExitCode = DONTCARE_EXIT,
+        cliCfgFile = Some(cliWskPropsFile.getCanonicalPath()))
+
       // Create the action for the API.  It must be a "web-action" action.
       val file = TestCLIUtils.getTestActionFilename(s"echo-web-http.js")
       wsk.action.create(

-- 
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.