This is an automated email from the ASF dual-hosted git repository.
dubeejw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new 1113f2d Replace JsBoolean() with JsTrue/False. (#4508)
1113f2d is described below
commit 1113f2d435fefc433018075ed5985402a4e76fc1
Author: rodric rabbah <[email protected]>
AuthorDate: Mon Jun 10 23:27:24 2019 -0400
Replace JsBoolean() with JsTrue/False. (#4508)
---
.../main/scala/org/apache/openwhisk/core/controller/Actions.scala | 2 +-
tests/src/test/scala/invokerShoot/ShootInvokerTests.scala | 8 ++++----
.../apache/openwhisk/core/cli/test/WskRestBasicUsageTests.scala | 8 ++++----
.../openwhisk/core/containerpool/test/ContainerProxyTests.scala | 2 +-
.../apache/openwhisk/core/controller/test/ActionsApiTests.scala | 8 +++-----
.../scala/org/apache/openwhisk/core/entity/test/SchemaTests.scala | 8 ++++----
tests/src/test/scala/system/basic/WskConsoleTests.scala | 2 +-
tests/src/test/scala/system/basic/WskRestBasicTests.scala | 8 +++-----
8 files changed, 21 insertions(+), 25 deletions(-)
diff --git
a/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
b/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
index 2e7fa64..71d1bfe 100644
---
a/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
+++
b/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
@@ -73,7 +73,7 @@ object WhiskActionsApi {
.get(Annotations.ProvideApiKeyAnnotationName)
.map(_ => annotations)
.getOrElse {
- annotations ++ Parameters(Annotations.ProvideApiKeyAnnotationName,
JsBoolean(false))
+ annotations ++ Parameters(Annotations.ProvideApiKeyAnnotationName,
JsFalse)
}
} else annotations
newAnnotations ++ execAnnotation(exec)
diff --git a/tests/src/test/scala/invokerShoot/ShootInvokerTests.scala
b/tests/src/test/scala/invokerShoot/ShootInvokerTests.scala
index 56e576c..c02dac3 100644
--- a/tests/src/test/scala/invokerShoot/ShootInvokerTests.scala
+++ b/tests/src/test/scala/invokerShoot/ShootInvokerTests.scala
@@ -186,10 +186,10 @@ class ShootInvokerTests extends TestHelpers with
WskTestHelpers with JsHelpers w
JsObject("key" -> JsString("origParam2"), "value" -> JsNumber(999)))
val resAnnots = Seq(
JsObject("key" -> JsString("origAnnot1"), "value" ->
JsString("origAnnotValue1")),
- JsObject("key" -> JsString("copiedAnnot2"), "value" ->
JsBoolean(false)),
+ JsObject("key" -> JsString("copiedAnnot2"), "value" -> JsFalse),
JsObject("key" -> JsString("copiedAnnot1"), "value" ->
JsString("copiedAnnotValue1")),
- JsObject("key" -> JsString("origAnnot2"), "value" -> JsBoolean(true)),
- JsObject("key" -> Annotations.ProvideApiKeyAnnotationName.toJson,
"value" -> JsBoolean(false)))
+ JsObject("key" -> JsString("origAnnot2"), "value" -> JsTrue),
+ JsObject("key" -> Annotations.ProvideApiKeyAnnotationName.toJson,
"value" -> JsFalse))
assetHelper.withCleaner(wsk.action, origName) {
val file = Some(TestUtils.getTestActionFilename("echo.js"))
@@ -267,7 +267,7 @@ class ShootInvokerTests extends TestHelpers with
WskTestHelpers with JsHelpers w
action.create(
name,
Some(TestUtils.getTestActionFilename("wcbin.js")),
- annotations = Map(Annotations.ProvideApiKeyAnnotationName ->
JsBoolean(true)))
+ annotations = Map(Annotations.ProvideApiKeyAnnotationName -> JsTrue))
}
assetHelper.withCleaner(wsk.action, child) { (action, _) =>
action.create(child, Some(TestUtils.getTestActionFilename("wc.js")))
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskRestBasicUsageTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskRestBasicUsageTests.scala
index def7167..6fbc421 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskRestBasicUsageTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/cli/test/WskRestBasicUsageTests.scala
@@ -476,13 +476,13 @@ class WskRestBasicUsageTests extends TestHelpers with
WskTestHelpers with WskAct
}
val baseAnnotations =
- Parameters("web-export", JsBoolean(true)) ++
- Parameters("raw-http", JsBoolean(false)) ++
- Parameters("final", JsBoolean(true))
+ Parameters("web-export", JsTrue) ++
+ Parameters("raw-http", JsFalse) ++
+ Parameters("final", JsTrue)
val testAnnotations = if (requireAPIKeyAnnotation) {
baseAnnotations ++
- Parameters(Annotations.ProvideApiKeyAnnotationName, JsBoolean(false))
+ Parameters(Annotations.ProvideApiKeyAnnotationName, JsFalse)
} else {
baseAnnotations
}
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala
index 75377a2..68d5b23 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala
@@ -1091,7 +1091,7 @@ class ContainerProxyTests
preWarm(machine)
- val keyFalsyAnnotation =
Parameters(Annotations.ProvideApiKeyAnnotationName, JsBoolean(false))
+ val keyFalsyAnnotation =
Parameters(Annotations.ProvideApiKeyAnnotationName, JsFalse)
val actionWithFalsyKeyAnnotation =
ExecutableWhiskAction(EntityPath("actionSpace"),
EntityName("actionName"), exec, annotations = keyFalsyAnnotation)
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala
index d462e69..20e3cc4 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala
@@ -1712,14 +1712,14 @@ class WhiskActionsApiTests extends FlatSpec with
Matchers with ExecHelpers {
val baseParams = Parameters("a", JsString("A")) ++ Parameters("b",
JsString("B"))
val keyTruthyAnnotation = Parameters(ProvideApiKeyAnnotationName,
JsBoolean(true))
- val keyFalsyAnnotation = Parameters(ProvideApiKeyAnnotationName,
JsString("")) // falsy other than JsBoolean(false)
+ val keyFalsyAnnotation = Parameters(ProvideApiKeyAnnotationName,
JsString("")) // falsy other than JsFalse
val execAnnotation = Parameters(execFieldName, JsString("foo"))
val exec: Exec = jsDefault("??")
it should "add key annotation if it is not present already" in {
Seq(Parameters(), baseParams).foreach { p =>
amendAnnotations(p, exec) shouldBe {
- p ++ Parameters(ProvideApiKeyAnnotationName, JsBoolean(false)) ++
+ p ++ Parameters(ProvideApiKeyAnnotationName, JsFalse) ++
Parameters(WhiskAction.execFieldName, exec.kind)
}
}
@@ -1735,9 +1735,7 @@ class WhiskActionsApiTests extends FlatSpec with Matchers
with ExecHelpers {
it should "override system annotation as necessary" in {
amendAnnotations(baseParams ++ execAnnotation, exec) shouldBe {
- baseParams ++ Parameters(ProvideApiKeyAnnotationName, JsBoolean(false))
++ Parameters(
- WhiskAction.execFieldName,
- exec.kind)
+ baseParams ++ Parameters(ProvideApiKeyAnnotationName, JsFalse) ++
Parameters(WhiskAction.execFieldName, exec.kind)
}
}
}
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/SchemaTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/SchemaTests.scala
index 468a409..044e44c 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/SchemaTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/SchemaTests.scala
@@ -672,16 +672,16 @@ class SchemaTests extends FlatSpec with BeforeAndAfter
with ExecHelpers with Mat
}
it should "recognize truthy values" in {
- Seq(JsBoolean(true), JsNumber(1), JsString("x")).foreach { v =>
+ Seq(JsTrue, JsNumber(1), JsString("x")).foreach { v =>
Parameters("x", v).isTruthy("x") shouldBe true
}
- Seq(JsBoolean(false), JsNumber(0), JsString(""), JsNull).foreach { v =>
+ Seq(JsFalse, JsNumber(0), JsString(""), JsNull).foreach { v =>
Parameters("x", v).isTruthy("x") shouldBe false
}
- Parameters("x", JsBoolean(true)).isTruthy("y") shouldBe false
- Parameters("x", JsBoolean(true)).isTruthy("y", valueForNonExistent = true)
shouldBe true
+ Parameters("x", JsTrue).isTruthy("y") shouldBe false
+ Parameters("x", JsTrue).isTruthy("y", valueForNonExistent = true) shouldBe
true
}
it should "serialize to json" in {
diff --git a/tests/src/test/scala/system/basic/WskConsoleTests.scala
b/tests/src/test/scala/system/basic/WskConsoleTests.scala
index c3fd142..a0c8e35 100644
--- a/tests/src/test/scala/system/basic/WskConsoleTests.scala
+++ b/tests/src/test/scala/system/basic/WskConsoleTests.scala
@@ -92,7 +92,7 @@ abstract class WskConsoleTests extends TestHelpers with
WskTestHelpers {
action.create(
name,
Some(TestUtils.getTestActionFilename("countdown.js")),
- annotations = Map(Annotations.ProvideApiKeyAnnotationName ->
JsBoolean(true)))
+ annotations = Map(Annotations.ProvideApiKeyAnnotationName -> JsTrue))
}
val count = 3
diff --git a/tests/src/test/scala/system/basic/WskRestBasicTests.scala
b/tests/src/test/scala/system/basic/WskRestBasicTests.scala
index 7780f84..2155e7a 100644
--- a/tests/src/test/scala/system/basic/WskRestBasicTests.scala
+++ b/tests/src/test/scala/system/basic/WskRestBasicTests.scala
@@ -174,7 +174,7 @@ class WskRestBasicTests extends TestHelpers with
WskTestHelpers with WskActorSys
"description" ->
JsString("Parameter description 2")))),
JsObject(
"key" ->
Annotations.ProvideApiKeyAnnotationName.toJson,
- "value" -> JsBoolean(false)))
+ "value" -> JsFalse))
} else {
JsArray(
JsObject(
@@ -405,9 +405,7 @@ class WskRestBasicTests extends TestHelpers with
WskTestHelpers with WskActorSys
.filter(annotation => annotation.fields("key").convertTo[String] !=
"exec")
.toJson shouldBe (if (requireAPIKeyAnnotation) {
JsArray(
- JsObject(
- "key" ->
Annotations.ProvideApiKeyAnnotationName.toJson,
- "value" -> JsBoolean(false)))
+ JsObject("key" ->
Annotations.ProvideApiKeyAnnotationName.toJson, "value" -> JsFalse))
} else {
JsArray()
})
@@ -540,7 +538,7 @@ class WskRestBasicTests extends TestHelpers with
WskTestHelpers with WskActorSys
"description" -> JsString("Parameter
description 2")))),
JsObject(
"key" ->
Annotations.ProvideApiKeyAnnotationName.toJson,
- "value" -> JsBoolean(false)))
+ "value" -> JsFalse))
} else {
JsArray(
JsObject(