You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by md...@apache.org on 2018/07/03 20:20:52 UTC

[incubator-openwhisk] 06/19: Remove return statements.

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

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

commit a4ac8f75a6303c751e9d0517be47aa2549c4269a
Author: Rodric Rabbah <ro...@gmail.com>
AuthorDate: Fri Jun 8 15:14:42 2018 -0400

    Remove return statements.
---
 .../scala/apigw/healthtests/ApiGwEndToEndTests.scala  |  6 ++----
 .../apigw/healthtests/ApiGwRestEndToEndTests.scala    |  4 ++--
 tests/src/test/scala/common/rest/WskRest.scala        | 15 +++++++--------
 .../actions/test/ApiGwRoutemgmtActionTests.scala      | 19 +++++++++----------
 .../scala/whisk/core/cli/test/ApiGwRestTests.scala    |  2 +-
 5 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/tests/src/test/scala/apigw/healthtests/ApiGwEndToEndTests.scala b/tests/src/test/scala/apigw/healthtests/ApiGwEndToEndTests.scala
index 8995c7a..1b0f5e0 100644
--- a/tests/src/test/scala/apigw/healthtests/ApiGwEndToEndTests.scala
+++ b/tests/src/test/scala/apigw/healthtests/ApiGwEndToEndTests.scala
@@ -98,12 +98,10 @@ abstract class ApiGwEndToEndTests
     val bw = new BufferedWriter(new FileWriter(swaggerfile))
     bw.write(rr.stdout)
     bw.close()
-    return swaggerfile
+    swaggerfile
   }
 
-  def getSwaggerApiUrl(rr: RunResult): String = {
-    return rr.stdout.split("\n")(1)
-  }
+  def getSwaggerApiUrl(rr: RunResult): String = rr.stdout.split("\n")(1)
 
   behavior of "Wsk api"
 
diff --git a/tests/src/test/scala/apigw/healthtests/ApiGwRestEndToEndTests.scala b/tests/src/test/scala/apigw/healthtests/ApiGwRestEndToEndTests.scala
index 279da3c..2f92185 100644
--- a/tests/src/test/scala/apigw/healthtests/ApiGwRestEndToEndTests.scala
+++ b/tests/src/test/scala/apigw/healthtests/ApiGwRestEndToEndTests.scala
@@ -83,11 +83,11 @@ class ApiGwRestEndToEndTests extends ApiGwEndToEndTests {
     val apidoc = RestResult.getFieldJsObject(apiValue, "apidoc")
     bw.write(apidoc.toString())
     bw.close()
-    return swaggerfile
+    swaggerfile
   }
 
   override def getSwaggerApiUrl(rr: RunResult): String = {
     val apiResultRest = rr.asInstanceOf[RestResult]
-    return apiResultRest.getField("gwApiUrl") + "/path"
+    apiResultRest.getField("gwApiUrl") + "/path"
   }
 }
diff --git a/tests/src/test/scala/common/rest/WskRest.scala b/tests/src/test/scala/common/rest/WskRest.scala
index b981013..a4cc09f 100644
--- a/tests/src/test/scala/common/rest/WskRest.scala
+++ b/tests/src/test/scala/common/rest/WskRest.scala
@@ -1201,14 +1201,13 @@ class WskRestApi extends RunWskRestCmd with BaseApi {
       Map("spaceguid" -> wp.authKey.split(":")(0).toJson)
     }
 
-    val rr = invokeAction(
+    invokeAction(
       name = "apimgmt/deleteApi",
       parameters = parms,
       blocking = true,
       result = true,
       web = true,
       expectedExitCode = expectedExitCode)(wp)
-    return rr
   }
 }
 
@@ -1244,7 +1243,7 @@ class RunWskRestCmd() extends FlatSpec with Matchers with ScalaFutures with WskA
   }
 
   def getNamePath(noun: String, name: String)(implicit wp: WskProps): Path = {
-    return Path(s"$basePath/namespaces/${wp.namespace}/$noun/$name")
+    Path(s"$basePath/namespaces/${wp.namespace}/$noun/$name")
   }
 
   def getExt(filePath: String)(implicit wp: WskProps) = {
@@ -1441,9 +1440,9 @@ object RestResult {
   }
 
   def convertStausCodeToExitCode(statusCode: StatusCode, blocking: Boolean = false): Int = {
-    if ((statusCode == OK) || (!blocking && (statusCode == Accepted)))
-      return 0
-    if (statusCode.intValue < BadRequest.intValue) statusCode.intValue else statusCode.intValue - codeConversion
+    if ((statusCode == OK) || (!blocking && (statusCode == Accepted))) 0
+    else if (statusCode.intValue < BadRequest.intValue) statusCode.intValue
+    else statusCode.intValue - codeConversion
   }
 
   def convertHttpResponseToStderr(respData: String): String = {
@@ -1499,8 +1498,8 @@ class ApiAction(var name: String,
                 var backendMethod: String = "POST",
                 var backendUrl: String,
                 var authkey: String) {
-  def toJson(): JsObject = {
-    return JsObject(
+  def toJson() = {
+    JsObject(
       "name" -> name.toJson,
       "namespace" -> namespace.toJson,
       "backendMethod" -> backendMethod.toJson,
diff --git a/tests/src/test/scala/whisk/core/apigw/actions/test/ApiGwRoutemgmtActionTests.scala b/tests/src/test/scala/whisk/core/apigw/actions/test/ApiGwRoutemgmtActionTests.scala
index 57449e6..b283af5 100644
--- a/tests/src/test/scala/whisk/core/apigw/actions/test/ApiGwRoutemgmtActionTests.scala
+++ b/tests/src/test/scala/whisk/core/apigw/actions/test/ApiGwRoutemgmtActionTests.scala
@@ -99,7 +99,7 @@ abstract class ApiGwRoutemgmtActionTests
         case e: Exception =>
           JsArray.empty
       }
-    return apiJsArray.elements
+    apiJsArray.elements
   }
 
   def createApi(namespace: Option[String] = Some("_"),
@@ -155,13 +155,12 @@ abstract class ApiGwRoutemgmtActionTests
       } getOrElse Map[String, JsValue]()
     }
 
-    val rr = wsk.action.invoke(
+    wsk.action.invoke(
       name = "apimgmt/createApi",
       parameters = parm,
       blocking = true,
       result = true,
       expectedExitCode = expectedExitCode)(wskprops)
-    return rr
   }
 
   def deleteApi(namespace: Option[String] = Some("_"),
@@ -202,13 +201,12 @@ abstract class ApiGwRoutemgmtActionTests
       } getOrElse Map[String, JsValue]()
     }
 
-    val rr = wsk.action.invoke(
+    wsk.action.invoke(
       name = "apimgmt/deleteApi",
       parameters = parms,
       blocking = true,
       result = true,
       expectedExitCode = expectedExitCode)(wskprops)
-    return rr
   }
 
   def apiMatch(apiarr: Vector[JsValue],
@@ -256,7 +254,8 @@ abstract class ApiGwRoutemgmtActionTests
         }
       }
     }
-    return matches
+
+    matches
   }
 
   def actionMatch(jsAction: JsObject, action: ApiAction): Boolean = {
@@ -265,10 +264,10 @@ abstract class ApiGwRoutemgmtActionTests
     System.out.println(
       "actionMatch: namespace " + jsAction.fields("namespace").convertTo[String] + "; namespace " + action.namespace)
     System.out.println("actionMatch: action " + jsAction.fields("action").convertTo[String] + "; action " + action.name)
-    val matches = jsAction.fields("url").convertTo[String] == action.backendUrl &&
-      jsAction.fields("namespace").convertTo[String] == action.namespace &&
-      jsAction.fields("action").convertTo[String] == action.name
-    return matches
+
+    jsAction.fields("url").convertTo[String] == action.backendUrl &&
+    jsAction.fields("namespace").convertTo[String] == action.namespace &&
+    jsAction.fields("action").convertTo[String] == action.name
   }
 
   behavior of "API Gateway apimgmt action parameter validation"
diff --git a/tests/src/test/scala/whisk/core/cli/test/ApiGwRestTests.scala b/tests/src/test/scala/whisk/core/cli/test/ApiGwRestTests.scala
index 43a95be..b118e81 100644
--- a/tests/src/test/scala/whisk/core/cli/test/ApiGwRestTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/ApiGwRestTests.scala
@@ -249,7 +249,7 @@ class ApiGwRestTests extends ApiGwRestBasicTests with RestUtil {
 
   def getSwaggerApiUrl(rr: RunResult): String = {
     val apiResultRest = rr.asInstanceOf[RestResult]
-    return apiResultRest.getField("gwApiUrl") + "/path"
+    apiResultRest.getField("gwApiUrl") + "/path"
   }
 
   def getParametersFromJson(rr: RunResult, pathName: String): Vector[JsObject] = {