Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit df258b2

Browse files
falkzollmhenke1
authored andcommitted
Update to gradlew 5.6.2, fix for removed getVCAPcredentials. (#66)
1 parent 7b60337 commit df258b2

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip

tests/src/test/scala/runtime/integration/CredentialsIBMSwiftActionWatsonTests.scala

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ package runtime.integration
2020
import java.io.File
2121

2222
import common.rest.WskRestOperations
23-
import common.{TestHelpers, TestUtils, WskActorSystem, WskProps, WskTestHelpers}
23+
import common.{TestHelpers, WhiskProperties, WskActorSystem, WskProps, WskTestHelpers}
24+
import scala.io.Source
2425
import spray.json._
2526

2627
abstract class CredentialsIBMSwiftActionWatsonTests extends TestHelpers with WskTestHelpers with WskActorSystem {
@@ -32,7 +33,15 @@ abstract class CredentialsIBMSwiftActionWatsonTests extends TestHelpers with Wsk
3233
lazy val dictWatsonFile = "testWatsonAction.swift"
3334
lazy val codWatsonFile = "testWatsonActionCodable.swift"
3435

35-
var creds = TestUtils.getVCAPcredentials("language_translator")
36+
// read credentials from from vcap_services.json
37+
val vcapFile = WhiskProperties.getProperty("vcap.services.file")
38+
val vcapString = Source.fromFile(vcapFile).getLines.mkString
39+
val vcapInfo =
40+
JsonParser(ParserInput(vcapString)).asJsObject.fields("language_translator").asInstanceOf[JsArray].elements(0)
41+
val creds = vcapInfo.asJsObject.fields("credentials").asJsObject
42+
val url = creds.fields("url").asInstanceOf[JsString]
43+
val username = creds.fields("username").asInstanceOf[JsString]
44+
val password = creds.fields("password").asInstanceOf[JsString]
3645

3746
/*
3847
Uses Watson Translation Service to translate the word "Hello" in English, to "Hola" in Spanish.
@@ -47,10 +56,7 @@ abstract class CredentialsIBMSwiftActionWatsonTests extends TestHelpers with Wsk
4756
file,
4857
main = Some("main"),
4958
kind = Some(actionKind),
50-
parameters = Map(
51-
"url" -> JsString(creds.get("url")),
52-
"username" -> JsString(creds.get("username")),
53-
"password" -> JsString(creds.get("password"))))
59+
parameters = Map("url" -> url, "username" -> username, "password" -> password))
5460
}
5561

5662
withActivation(wsk.activation, wsk.action.invoke("testWatsonAction")) { activation =>
@@ -70,10 +76,7 @@ abstract class CredentialsIBMSwiftActionWatsonTests extends TestHelpers with Wsk
7076
file,
7177
main = Some("main"),
7278
kind = Some(actionKind),
73-
parameters = Map(
74-
"url" -> JsString(creds.get("url")),
75-
"username" -> JsString(creds.get("username")),
76-
"password" -> JsString(creds.get("password"))))
79+
parameters = Map("url" -> url, "username" -> username, "password" -> password))
7780
}
7881

7982
withActivation(wsk.activation, wsk.action.invoke("testWatsonActionCodable")) { activation =>

0 commit comments

Comments
 (0)