Skip to content

Commit 6f827ba

Browse files
authored
Bumping to gradle 6 (#151)
* Bumping to gradle 6 * Add spray json dependency * Fix test code * Scalafmt
1 parent 60a6022 commit 6f827ba

File tree

6 files changed

+27
-16
lines changed

6 files changed

+27
-16
lines changed

gradle/wrapper/gradle-wrapper.jar

908 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
#
1717
distributionBase=GRADLE_USER_HOME
1818
distributionPath=wrapper/dists
19+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
1920
zipStoreBase=GRADLE_USER_HOME
2021
zipStorePath=wrapper/dists
21-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip

gradlew

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# you may not use this file except in compliance with the License.
88
# You may obtain a copy of the License at
99
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
10+
# https://www.apache.org/licenses/LICENSE-2.0
1111
#
1212
# Unless required by applicable law or agreed to in writing, software
1313
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -44,7 +44,7 @@ APP_NAME="Gradle"
4444
APP_BASE_NAME=`basename "$0"`
4545

4646
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47-
DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8'
47+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
4848

4949
# Use the maximum available, or set MAX_FD != -1 to use that value.
5050
MAX_FD="maximum"

gradlew.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@rem you may not use this file except in compliance with the License.
66
@rem You may obtain a copy of the License at
77
@rem
8-
@rem http://www.apache.org/licenses/LICENSE-2.0
8+
@rem https://www.apache.org/licenses/LICENSE-2.0
99
@rem
1010
@rem Unless required by applicable law or agreed to in writing, software
1111
@rem distributed under the License is distributed on an "AS IS" BASIS,
@@ -30,7 +30,7 @@ set APP_BASE_NAME=%~n0
3030
set APP_HOME=%DIRNAME%
3131

3232
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33-
set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8
33+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
3434

3535
@rem Find java.exe
3636
if defined JAVA_HOME goto findJavaFromJavaHome

tests/build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,13 @@ tasks.withType(Test) {
3434
}
3535

3636
dependencies {
37-
compile "org.scala-lang:scala-library:${gradle.scala.version}"
38-
compile "org.apache.openwhisk:openwhisk-tests:${gradle.openwhisk.version}:tests"
39-
compile "org.apache.openwhisk:openwhisk-tests:${gradle.openwhisk.version}:test-sources"
37+
implementation "junit:junit:4.11"
38+
implementation "org.scala-lang:scala-library:${gradle.scala.version}"
39+
implementation "org.scalatest:scalatest_${gradle.scala.depVersion}:3.0.8"
40+
implementation "io.spray:spray-json_${gradle.scala.depVersion}:1.3.5"
41+
implementation "org.apache.openwhisk:openwhisk-common:${gradle.openwhisk.version}"
42+
implementation "org.apache.openwhisk:openwhisk-tests:${gradle.openwhisk.version}:tests"
43+
implementation "org.apache.openwhisk:openwhisk-tests:${gradle.openwhisk.version}:test-sources"
4044
implementation group: 'com.typesafe.akka', name: "akka-http2-support_${gradle.scala.depVersion}", version: "${gradle.akka_http.version}"
4145
implementation group: 'com.typesafe.akka', name: "akka-http-xml_${gradle.scala.depVersion}", version: "${gradle.akka_http.version}"
4246
implementation group: 'com.typesafe.akka', name: "akka-discovery_${gradle.scala.depVersion}", version: "${gradle.akka.version}"

tests/src/test/scala/runtime/sdk/SwiftSDKTests.scala

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ abstract class SwiftSDKTests extends TestHelpers with WskTestHelpers with WskAct
6969
activation.response.success shouldBe true
7070

7171
// should have a field named "activationId" which is the date action's activationId
72-
activation.response.result.get.fields("activationId").toString.length should be >= 32
72+
activation.response.result.get.asJsObject.fields("activationId").toString.length should be >= 32
7373

7474
// check for "date" field that comes from invoking the date action
7575
org.apache.openwhisk.utils.JsHelpers
76-
.fieldPathExists(activation.response.result.get, "response", "result", "date") should be(true)
76+
.fieldPathExists(activation.response.result.get.asJsObject, "response", "result", "date") should be(true)
7777
}
7878
}
7979

@@ -98,10 +98,11 @@ abstract class SwiftSDKTests extends TestHelpers with WskTestHelpers with WskAct
9898
val run = wsk.action.invoke(actionName, params)
9999
withActivation(wsk.activation, run, initialWait = 5 seconds, totalWait = activationPollDuration) { activation =>
100100
// should not have a "response"
101-
org.apache.openwhisk.utils.JsHelpers.fieldPathExists(activation.response.result.get, "response") shouldBe false
101+
org.apache.openwhisk.utils.JsHelpers
102+
.fieldPathExists(activation.response.result.get.asJsObject, "response") shouldBe false
102103

103104
// should have a field named "activationId" which is the date action's activationId
104-
activation.response.result.get.fields("activationId").toString.length should be >= 32
105+
activation.response.result.get.asJsObject.fields("activationId").toString.length should be >= 32
105106
}
106107
}
107108

@@ -146,7 +147,7 @@ abstract class SwiftSDKTests extends TestHelpers with WskTestHelpers with WskAct
146147
activation.response.success shouldBe true
147148

148149
// should have a field named "activationId" which is the date action's activationId
149-
activation.response.result.get.fields("activationId").toString.length should be >= 32
150+
activation.response.result.get.asJsObject.fields("activationId").toString.length should be >= 32
150151

151152
// should result in an activation for triggerName
152153
val triggerActivations = wsk.activation.pollFor(1, Some(triggerName), retries = 20)
@@ -186,7 +187,7 @@ abstract class SwiftSDKTests extends TestHelpers with WskTestHelpers with WskAct
186187
activation.response.success shouldBe true
187188

188189
// should have a field named "name" which is the name of the trigger created
189-
activation.response.result.get.fields("name") shouldBe JsString(triggerName)
190+
activation.response.result.get.asJsObject.fields("name") shouldBe JsString(triggerName)
190191
}
191192
}
192193

@@ -237,10 +238,16 @@ abstract class SwiftSDKTests extends TestHelpers with WskTestHelpers with WskAct
237238
activation.response.success shouldBe true
238239

239240
// should have a field named "trigger" which is the name of the trigger associated with the rule
240-
activation.response.result.get.fields("trigger").asJsObject.fields("name") shouldBe ruleTriggerName.toJson
241+
activation.response.result.get.asJsObject
242+
.fields("trigger")
243+
.asJsObject
244+
.fields("name") shouldBe ruleTriggerName.toJson
241245

242246
// should have a field named "action" which is the name of the action associated with the rule
243-
activation.response.result.get.fields("action").asJsObject.fields("name") shouldBe ruleActionName.toJson
247+
activation.response.result.get.asJsObject
248+
.fields("action")
249+
.asJsObject
250+
.fields("name") shouldBe ruleActionName.toJson
244251
}
245252
}
246253

0 commit comments

Comments
 (0)