Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BMProxy() extends BaseProxy()
- {
- override def send(data:JsValue):JsValue =
- {
- val id = "--123---"
- val workspaceid = "---xyz---"
- val username = "---username---"
- val password = "---password---"
- val bluemixURL = s"https://gateway.watsonplatform.net/conversation/api/v1/workspaces/$id/message?version=2016-07-11"
- Logger.info(s"data: $data")
- val req = WS.url(bluemixURL).
- withAuth(username, password, WSAuthScheme.BASIC).
- withHeaders("Content-Type" -> "application/json").
- post(data.toString).
- map {
- response => {
- val rawbody = response.body
- val responsecode = response.status
- val responsetext = response.statusText
- Json.parse(rawbody)
- }
- }
- Await.result(req, 5 seconds)
- }
- }
- class Proxies extends Specification {
- "Chatscript proxy" should {
- "gives response" in {
- val data = Json.parse("""{"input":{"text":"Hey"},"context":{"conversation_id":"234234234" } }""")
- val response = new BMProxy().send(data)
- println("---", response)
- Json.stringify(response) must contain ("response")
- }
- }
- }
- [error] Could not create an instance of Proxies
- [error] caused by java.lang.Exception: Could not instantiate class Proxies: null
- [error]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement