Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import java.io.File
import spray.json._
import scala.io.Source
import org.scalatest.BeforeAndAfterAll

@RunWith(classOf[JUnitRunner])
Expand All @@ -33,13 +34,20 @@ class CredentialsIBMPythonCOSTests extends TestHelpers with WskTestHelpers with
val datdir = "tests/dat/cos"
val actionName = "testCOSService"
val actionFileName = "testCOSService.py"
val creds = TestUtils.getCredentials("cloud-object-storage")
val apikey = creds.get("apikey").getAsString()
var resource_instance_id = creds.get("resource_instance_id").getAsString()

// read credentials from from vcap_services.json
val vcapFile = WhiskProperties.getProperty("vcap.services.file")
val vcapString = Source.fromFile(vcapFile).getLines.mkString
val vcapInfo =
JsonParser(ParserInput(vcapString)).asJsObject.fields("cloud-object-storage").asInstanceOf[JsArray].elements(0)
val creds = vcapInfo.asJsObject.fields("credentials").asJsObject

val apikey = creds.fields("apikey").asInstanceOf[JsString]

var resource_instance_id = creds.fields("resource_instance_id").asInstanceOf[JsString]

val __bx_creds = JsObject(
"cloud-object-storage" -> JsObject(
"apikey" -> JsString(apikey),
"resource_instance_id" -> JsString(resource_instance_id)))
"cloud-object-storage" -> JsObject("apikey" -> apikey, "resource_instance_id" -> resource_instance_id))

it should "Test connection to Cloud Object Storage COS on IBM Cloud" in withAssetCleaner(wskprops) {
(wp, assetHelper) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
*/
package integration

import common.{TestHelpers, TestUtils, WskActorSystem, WskProps, WskTestHelpers}
import common.{TestHelpers, WhiskProperties, WskActorSystem, WskProps, WskTestHelpers}
import common.rest.WskRestOperations
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import java.io.File
import scala.io.Source
import spray.json._

@RunWith(classOf[JUnitRunner])
Expand All @@ -30,7 +31,17 @@ class CredentialsIBMPythonCloudantTests extends TestHelpers with WskTestHelpers
implicit val wskprops: WskProps = WskProps()
val wsk = new WskRestOperations
val datdir = "tests/dat/cloudant/"
var creds = TestUtils.getVCAPcredentials("cloudantNoSQLDB")

// read credentials from from vcap_services.json
val vcapFile = WhiskProperties.getProperty("vcap.services.file")
val vcapString = Source.fromFile(vcapFile).getLines.mkString
val vcapInfo =
JsonParser(ParserInput(vcapString)).asJsObject.fields("cloudantNoSQLDB").asInstanceOf[JsArray].elements(0)
val creds = vcapInfo.asJsObject.fields("credentials").asJsObject
val username = creds.fields("username").asInstanceOf[JsString]
val password = creds.fields("password").asInstanceOf[JsString]
val host = creds.fields("host").asInstanceOf[JsString]

val actionName = "testCloudantService"
val actionFileName = "testCloudantService.py"

Expand All @@ -44,10 +55,7 @@ class CredentialsIBMPythonCloudantTests extends TestHelpers with WskTestHelpers
file,
main = Some("main"),
kind = defaultKind,
parameters = Map(
"username" -> JsString(creds.get("username")),
"password" -> JsString(creds.get("password")),
"host" -> JsString(creds.get("host"))))
parameters = Map("username" -> username, "password" -> password, "host" -> host))
}

withActivation(wsk.activation, wsk.action.invoke(actionName)) { activation =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import java.io.File
import spray.json._
import scala.io.Source

@RunWith(classOf[JUnitRunner])
class CredentialsIBMPythonDb2CloudTests extends TestHelpers with WskTestHelpers with WskActorSystem {
Expand All @@ -33,9 +34,15 @@ class CredentialsIBMPythonDb2CloudTests extends TestHelpers with WskTestHelpers
val actionName = "testDB2Service"
val actionFileName = "testDB2Service.py"

val creds = TestUtils.getVCAPcredentials("dashDB")
val ssldsn = creds.get("ssldsn")
val __bx_creds = JsObject("dashDB" -> JsObject("ssldsn" -> JsString(ssldsn)))
// read credentials from from vcap_services.json
val vcapFile = WhiskProperties.getProperty("vcap.services.file")
val vcapString = Source.fromFile(vcapFile).getLines.mkString
val vcapInfo =
JsonParser(ParserInput(vcapString)).asJsObject.fields("dashDB").asInstanceOf[JsArray].elements(0)
val creds = vcapInfo.asJsObject.fields("credentials").asJsObject

val ssldsn = creds.fields("ssldsn")
val __bx_creds = JsObject("dashDB" -> JsObject("ssldsn" -> ssldsn))

it should "Test connection to DB2 on IBM Cloud" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
val file = Some(new File(datdir, actionFileName).toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import common.rest.WskRestOperations
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import java.io.File
import scala.io.Source
import spray.json._

@RunWith(classOf[JUnitRunner])
Expand All @@ -33,7 +34,15 @@ class CredentialsIBMPythonWatsonTests extends TestHelpers with WskTestHelpers wi
val actionName = "testWatsonService"
val actionFileName = "testWatsonService.py"

var creds = TestUtils.getVCAPcredentials("language_translator")
// read credentials from from vcap_services.json
val vcapFile = WhiskProperties.getProperty("vcap.services.file")
val vcapString = Source.fromFile(vcapFile).getLines.mkString
val vcapInfo =
JsonParser(ParserInput(vcapString)).asJsObject.fields("language_translator").asInstanceOf[JsArray].elements(0)
val creds = vcapInfo.asJsObject.fields("credentials").asJsObject
val url = creds.fields("url").asInstanceOf[JsString]
val username = creds.fields("username").asInstanceOf[JsString]
val password = creds.fields("password").asInstanceOf[JsString]

/*
Uses Watson Translation Service to translate the word "Hello" in English, to "Hola" in Spanish.
Expand All @@ -46,10 +55,7 @@ class CredentialsIBMPythonWatsonTests extends TestHelpers with WskTestHelpers wi
file,
main = Some("main"),
kind = defaultKind,
parameters = Map(
"url" -> JsString(creds.get("url")),
"username" -> JsString(creds.get("username")),
"password" -> JsString(creds.get("password"))))
parameters = Map("url" -> url, "username" -> username, "password" -> password))
}

withActivation(wsk.activation, wsk.action.invoke(actionName)) { activation =>
Expand Down