diff --git a/README.md b/README.md
index 8b15d371b33..8eca47aee19 100644
--- a/README.md
+++ b/README.md
@@ -74,7 +74,7 @@ All the services:
Only Assistant:
```gradle
-'com.ibm.watson.developer_cloud:assistant:5.0.1'
+'com.ibm.watson.developer_cloud:assistant:5.1.1'
```
##### Development Snapshots
@@ -97,7 +97,7 @@ And then reference the snapshot version on your app module gradle
Only Speech to Text:
```gradle
-'com.ibm.watson.developer_cloud:speech-to-text:5.1.1-SNAPSHOT'
+'com.ibm.watson.developer_cloud:speech-to-text:5.1.2-SNAPSHOT'
```
##### JAR
diff --git a/assistant/README.md b/assistant/README.md
index cdbdd3ae467..fcc4c5e6d0b 100644
--- a/assistant/README.md
+++ b/assistant/README.md
@@ -5,9 +5,9 @@
##### Maven
```xml
- com.ibm.watson.developer_cloud
- assistant
- 5.0.0
+ com.ibm.watson.developer_cloud
+ assistant
+ 5.1.1
```
@@ -25,7 +25,9 @@ Assistant service = new Assistant("2018-02-16");
service.setUsernameAndPassword("", "");
InputData input = new InputData.Builder("Hi").build();
-MessageOptions options = new MessageOptions.Builder(workspaceId).input(input).build();
+MessageOptions options = new MessageOptions.Builder(workspaceId)
+ .input(input)
+ .build();
MessageResponse response = service.message(options).execute();
System.out.println(response);
```
@@ -37,19 +39,19 @@ Context context = null;
// first message
MessageOptions newMessageOptions = new MessageOptions.Builder()
- .workspaceId("")
- .input(new InputData.Builder("First message").build())
- .context(context)
- .build();
+ .workspaceId("")
+ .input(new InputData.Builder("First message").build())
+ .context(context)
+ .build();
MessageResponse response = service.message(newMessageOptions).execute();
// second message
newMessageOptions = new MessageOptions.Builder()
- .workspaceId("")
- .input(new InputData.Builder("Second message").build())
- .context(response.getContext()) // output context from the first message
- .build();
+ .workspaceId("")
+ .input(new InputData.Builder("Second message").build())
+ .context(response.getContext()) // output context from the first message
+ .build();
response = service.message(newMessageOptions).execute();
diff --git a/config.properties.enc b/config.properties.enc
index 67c33f77a15..82f1693e7e4 100644
Binary files a/config.properties.enc and b/config.properties.enc differ
diff --git a/conversation/README.md b/conversation/README.md
index 7125bd79273..778492cdfe3 100644
--- a/conversation/README.md
+++ b/conversation/README.md
@@ -5,9 +5,9 @@
##### Maven
```xml
- com.ibm.watson.developer_cloud
- conversation
- 5.1.1
+ com.ibm.watson.developer_cloud
+ conversation
+ 5.1.1
```
@@ -25,7 +25,9 @@ Conversation service = new Conversation("2018-02-16");
service.setUsernameAndPassword("", "");
InputData input = new InputData.Builder("Hi").build();
-MessageOptions options = new MessageOptions.Builder(workspaceId).input(input).build();
+MessageOptions options = new MessageOptions.Builder(workspaceId)
+ .input(input)
+ .build();
MessageResponse response = service.message(options).execute();
System.out.println(response);
```
@@ -37,19 +39,19 @@ Context context = null;
// first message
MessageOptions newMessageOptions = new MessageOptions.Builder()
- .workspaceId("")
- .input(new InputData.Builder("First message").build())
- .context(context)
- .build();
+ .workspaceId("")
+ .input(new InputData.Builder("First message").build())
+ .context(context)
+ .build();
MessageResponse response = service.message(newMessageOptions).execute();
// second message
newMessageOptions = new MessageOptions.Builder()
- .workspaceId("")
- .input(new InputData.Builder("Second message").build())
- .context(response.getContext()) // output context from the first message
- .build();
+ .workspaceId("")
+ .input(new InputData.Builder("Second message").build())
+ .context(response.getContext()) // output context from the first message
+ .build();
response = service.message(newMessageOptions).execute();
diff --git a/core/src/test/java/com/ibm/watson/developer_cloud/util/CredentialUtilsTest.java b/core/src/test/java/com/ibm/watson/developer_cloud/util/CredentialUtilsTest.java
index 445d344d1b4..5a2d6ff8e29 100644
--- a/core/src/test/java/com/ibm/watson/developer_cloud/util/CredentialUtilsTest.java
+++ b/core/src/test/java/com/ibm/watson/developer_cloud/util/CredentialUtilsTest.java
@@ -21,6 +21,7 @@
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import com.ibm.watson.developer_cloud.WatsonServiceTest;
@@ -129,6 +130,7 @@ public void testGetUserCredentialsWithPlan() {
* it always fails there.
*/
@Test
+ @Ignore
public void testGetAPIUrlFromJDNI() {
assertEquals(CredentialUtils.getAPIUrlTest(SERVICE_NAME), PERSONALITY_INSIGHTS_URL);
}
diff --git a/examples/build.gradle b/examples/build.gradle
index 6c78533e37a..a683a0af5b4 100644
--- a/examples/build.gradle
+++ b/examples/build.gradle
@@ -33,5 +33,5 @@ checkstyle {
}
dependencies {
- compile group: 'com.ibm.watson.developer_cloud', name: 'java-sdk', version: '3.7.2'
+ compile group: 'com.ibm.watson.developer_cloud', name: 'java-sdk', version: '5.1.1'
}
diff --git a/examples/conversation_tone_analyzer_integration/README.md b/examples/conversation_tone_analyzer_integration/README.md
deleted file mode 100644
index 48c280d1b66..00000000000
--- a/examples/conversation_tone_analyzer_integration/README.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# Conversation and Tone Analyzer Integration Example
-
-This example provides sample code for integrating [Tone Analyzer][tone_analyzer] and [Conversation][conversation].
-
- * [ToneDetection.java][tone_conversation_integration_example_tone_detection] - sample code to initialize a user object in the conversation payload's context (initUser), to call Tone Analyzer to retrieve tone for a user's input (invokeToneAsync), and to update tone in the user object in the conversation payload's context (updateUserTone).
-
- * [ToneConversationIntegrationV1.java][tone_conversation_integration_example] - sample code to use ToneDetection.java to add tone to the payload and send a request to the Conversation Service's message endpoint in an asynchronous manner.
-
-
-Requirements to run the sample code
-
- * [Tone Analyzer Service credentials][bluemix_tone_analyzer_service]
- * [Conversation Service credentials][bluemix_conversation_service]
- * [Conversation Workspace ID][conversation_simple_workspace]
-
-Credentials & the Workspace ID can be set in a properties, tone_conversation_integration.properties, or directly in the code.
-
-Dependencies provided in
-`build.gradle`
-
-## To run the example
-
-To run the code, use the provided [gradle](http://gradle.org/) build file and wrapper configuration.
-
-On Mac or Linux:
-
- ./gradlew run
-
-
-[conversation]: https://console.bluemix.net/docs/services/conversation/index.html
-[tone_analyzer]: https://console.bluemix.net/docs/services/tone-analyzer/index.html
-[bluemix_conversation_service]: https://console.ng.bluemix.net/catalog/services/conversation/
-[bluemix_tone_analyzer_service]: https://console.ng.bluemix.net/catalog/services/tone-analyzer/
-[conversation_simple_workspace]: https://github.com/watson-developer-cloud/conversation-simple#workspace
-[tone_conversation_integration_example]: https://github.com/aprilwebster/java-sdk/blob/master/examples/java/com/ibm/watson/developer_cloud/conversation_tone_analyzer_integration/src/main/java/com/ibm/watson/developer_cloud/conversation_tone_analyzer_integration/v1/ToneConversationIntegrationV1.java
-[tone_conversation_integration_example_tone_detection]: https://github.com/aprilwebster/java-sdk/blob/master/examples/java/com/ibm/watson/developer_cloud/conversation_tone_analyzer_integration/src/main/java/com/ibm/watson/developer_cloud/conversation_tone_analyzer_integration/v1/ToneDetection.java
\ No newline at end of file
diff --git a/examples/conversation_tone_analyzer_integration/build.gradle b/examples/conversation_tone_analyzer_integration/build.gradle
deleted file mode 100644
index abd84df1e77..00000000000
--- a/examples/conversation_tone_analyzer_integration/build.gradle
+++ /dev/null
@@ -1,28 +0,0 @@
-apply plugin: 'java'
-apply plugin: 'eclipse'
-apply plugin: 'application'
-
-
-mainClassName = "com.ibm.watson.developer_cloud.conversation_tone_analyzer_integration.v1.ToneConversationIntegrationV1"
-
-repositories {
- mavenCentral()
-}
-
-jar {
- baseName = 'conversation_tone_analyzer_integration'
- version = '0.1.0'
- manifest {
- attributes 'Main-Class': "com.ibm.watson.developer_cloud.conversation_tone_analyzer_integration.v1.ToneConversationIntegrationV1"
- }
-}
-
-
-
-sourceCompatibility = 1.7
-targetCompatibility = 1.7
-
-dependencies {
- compile "com.ibm.watson.developer_cloud:java-sdk:3.5.0"
- compile "commons-io:commons-io:2.4"
-}
\ No newline at end of file
diff --git a/examples/conversation_tone_analyzer_integration/src/main/java/com/ibm/watson/developer_cloud/conversation_tone_analyzer_integration/v1/ToneConversationIntegrationV1.java b/examples/conversation_tone_analyzer_integration/src/main/java/com/ibm/watson/developer_cloud/conversation_tone_analyzer_integration/v1/ToneConversationIntegrationV1.java
deleted file mode 100644
index 69cef2a9f14..00000000000
--- a/examples/conversation_tone_analyzer_integration/src/main/java/com/ibm/watson/developer_cloud/conversation_tone_analyzer_integration/v1/ToneConversationIntegrationV1.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Copyright 2017 IBM Corp. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
-package com.ibm.watson.developer_cloud.conversation_tone_analyzer_integration.v1;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import org.apache.commons.io.FileUtils;
-
-import com.ibm.watson.developer_cloud.conversation.v1.ConversationService;
-import com.ibm.watson.developer_cloud.conversation.v1.model.MessageRequest;
-import com.ibm.watson.developer_cloud.conversation.v1.model.MessageResponse;
-import com.ibm.watson.developer_cloud.http.ServiceCallback;
-import com.ibm.watson.developer_cloud.tone_analyzer.v3.ToneAnalyzer;
-import com.ibm.watson.developer_cloud.tone_analyzer.v3.model.ToneAnalysis;
-
-/**
- * Example of how to call the {@link ConversationService#message(String, MessageRequest)}
- * method asynchronously.
- *
- * @version v1
- */
-public class ToneConversationIntegrationV1 {
-
- public static void main(String[] args) throws Exception {
-
- // load the properties file
- Properties props = new Properties();
- props.load(FileUtils.openInputStream(new File("tone_conversation_integration.properties.example")));
-
- // instantiate the conversation service
- final ConversationService conversationService = new ConversationService(ConversationService
- .VERSION_DATE_2016_07_11);
- conversationService.setUsernameAndPassword(
- props.getProperty("CONVERSATION_USERNAME", ""),
- props.getProperty("CONVERSATION_PASSWORD", "")
- );
-
- // instantiate the tone analyzer service
- ToneAnalyzer toneService = new ToneAnalyzer(ToneAnalyzer.VERSION_DATE_2016_05_19);
- toneService.setUsernameAndPassword(
- props.getProperty("TONE_ANALYZER_USERNAME", ""),
- props.getProperty("TONE_ANALYZER_PASSWORD", "")
- );
-
- // workspace id
- final String workspaceId = props.getProperty("WORKSPACE_ID", "");
-
- // maintain history in the context variable - will add a history variable to
- // each of the emotion, social and language tones
- final Boolean maintainHistory = false;
-
- /**
- * Input for the conversation service: input (String): an input string (the user's conversation turn) and context
- * (Map: any context that needs to be maintained - either added by the client app or passed in the
- * response from the conversation service on the previous conversation turn.
- */
- final String input = "I am happy";
- final Map context = new HashMap();
-
- // UPDATE CONTEXT HERE IF CONTINUING AN ONGOING CONVERSATION
- // set local context variable to the context from the last response from the
- // Conversation Service
- // (see the getContext() method of the MessageResponse class in
- // com.ibm.watson.developer_cloud.conversation.v1.model)
-
- // async call to Tone Analyzer
- toneService.getTone(input, null).enqueue(new ServiceCallback() {
- @Override
- public void onResponse(ToneAnalysis toneResponsePayload) {
-
- // update context with the tone data returned by the Tone Analyzer
- ToneDetection.updateUserTone(context, toneResponsePayload, maintainHistory);
-
- // call Conversation Service with the input and tone-aware context
- MessageRequest newMessage = new MessageRequest.Builder().inputText(input).context(context).build();
- conversationService.message(workspaceId, newMessage).enqueue(new ServiceCallback() {
- @Override
- public void onResponse(MessageResponse response) {
- System.out.println(response);
- }
-
- @Override
- public void onFailure(Exception e) { }
- });
- }
-
- @Override
- public void onFailure(Exception e) { }
- });
- }
-}
diff --git a/examples/conversation_tone_analyzer_integration/src/main/java/com/ibm/watson/developer_cloud/conversation_tone_analyzer_integration/v1/ToneDetection.java b/examples/conversation_tone_analyzer_integration/src/main/java/com/ibm/watson/developer_cloud/conversation_tone_analyzer_integration/v1/ToneDetection.java
deleted file mode 100644
index 60d4029ae3c..00000000000
--- a/examples/conversation_tone_analyzer_integration/src/main/java/com/ibm/watson/developer_cloud/conversation_tone_analyzer_integration/v1/ToneDetection.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/**
- * Copyright 2017 IBM Corp. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
-package com.ibm.watson.developer_cloud.conversation_tone_analyzer_integration.v1;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.ibm.watson.developer_cloud.tone_analyzer.v3.model.ToneAnalysis;
-import com.ibm.watson.developer_cloud.tone_analyzer.v3.model.ToneCategory;
-import com.ibm.watson.developer_cloud.tone_analyzer.v3.model.ToneScore;
-
-/**
- * ToneDetection.
- */
-public class ToneDetection {
-
- /**
- * Thresholds for identifying meaningful tones returned by the Watson Tone Analyzer. Current values are based on the
- * recommendations made by the Watson Tone Analyzer at
- * https://console.bluemix.net/docs/services/tone-analyzer/using-tone.html These thresholds can be
- * adjusted to client/domain requirements.
- */
- private static final Double PRIMARY_EMOTION_SCORE_THRESHOLD = 0.5;
- private static final Double LANGUAGE_HIGH_SCORE_THRESHOLD = 0.75;
- private static final Double LANGUAGE_NO_SCORE_THRESHOLD = 0.0;
- private static final Double SOCIAL_HIGH_SCORE_THRESHOLD = 0.75;
- private static final Double SOCIAL_LOW_SCORE_THRESHOLD = 0.25;
-
- /**
- * Instantiates a new tone detection.
- */
- private ToneDetection() { }
-
- /**
- * Labels for the tone categories returned by the Watson Tone Analyzer.
- */
- private static final String EMOTION_TONE_LABEL = "emotion_tone";
- private static final String LANGUAGE_TONE_LABEL = "language_tone";
- private static final String SOCIAL_TONE_LABEL = "social_tone";
-
- /**
- * updateUserTone processes the Tone Analyzer payload to pull out the emotion, language and social tones, and identify
- * the meaningful tones (i.e., those tones that meet the specified thresholds). The conversationPayload json object is
- * updated to include these tones.
- *
- * @param context the context
- * @param toneAnalyzerPayload json object returned by the Watson Tone Analyzer Service
- * @param maintainHistory the maintain history
- * @return the map
- * @returns conversationPayload where the user object has been updated with tone information from the
- * toneAnalyzerPayload
- */
- public static Map updateUserTone(Map context, ToneAnalysis toneAnalyzerPayload,
- Boolean maintainHistory) {
-
- List emotionTone = new ArrayList();
- List languageTone = new ArrayList();
- List socialTone = new ArrayList();
-
- // If the context doesn't already contain the user object, initialize it
- if (!context.containsKey("user")) {
- context.put("user", initUser());
- }
-
- // For convenience sake, define a variable for the user object to
- @SuppressWarnings("unchecked")
- Map user = (Map) context.get("user");
-
- if (toneAnalyzerPayload != null && toneAnalyzerPayload.getDocumentTone() != null) {
- List tones = toneAnalyzerPayload.getDocumentTone().getTones();
- for (ToneCategory tone : tones) {
- if (tone.getId().equals(EMOTION_TONE_LABEL)) {
- emotionTone = tone.getTones();
- }
- if (tone.getId().equals(LANGUAGE_TONE_LABEL)) {
- languageTone = tone.getTones();
- }
- if (tone.getId().equals(SOCIAL_TONE_LABEL)) {
- socialTone = tone.getTones();
- }
- }
-
- updateEmotionTone(user, emotionTone, maintainHistory);
- updateLanguageTone(user, languageTone, maintainHistory);
- updateSocialTone(user, socialTone, maintainHistory);
-
- }
-
- context.put("user", user);
- return user;
- }
-
- /**
- * initUser initializes a user containing tone data (from the Watson Tone Analyzer).
- *
- * @return the map
- * @returns user with the emotion, language and social tones. The current tone identifies the tone for a specific
- * conversation turn, and the history provides the conversation for all tones up to the current tone for a
- * conversation instance with a user.
- */
- public static Map initUser() {
-
- Map user = new HashMap();
- Map tone = new HashMap();
-
- Map emotionTone = new HashMap();
- emotionTone.put("current", null);
-
- Map socialTone = new HashMap();
- socialTone.put("current", null);
-
- Map languageTone = new HashMap();
- languageTone.put("current", null);
-
- tone.put("emotion", emotionTone);
- tone.put("social", socialTone);
- tone.put("language", languageTone);
-
- user.put("tone", tone);
-
- return user;
- }
-
- /**
- * updateEmotionTone updates the user emotion tone with the primary emotion - the emotion tone that has a score
- * greater than or equal to the EMOTION_SCORE_THRESHOLD; otherwise primary emotion will be 'neutral'.
- *
- * @param user a json object representing user information (tone) to be used in conversing with the Conversation
- * Service
- * @param emotionTone a json object containing the emotion tones in the payload returned by the Tone Analyzer
- */
- @SuppressWarnings("unchecked")
- private static void updateEmotionTone(Map user, List emotionTone,
- Boolean maintainHistory) {
-
- Double maxScore = 0.0;
- String primaryEmotion = null;
- Double primaryEmotionScore = null;
-
- for (ToneScore tone : emotionTone) {
- if (tone.getScore() > maxScore) {
- maxScore = tone.getScore();
- primaryEmotion = tone.getName().toLowerCase();
- primaryEmotionScore = tone.getScore();
- }
- }
-
- if (maxScore <= PRIMARY_EMOTION_SCORE_THRESHOLD) {
- primaryEmotion = "neutral";
- primaryEmotionScore = null;
- }
-
- // update user emotion tone
- Map emotion = (Map) ((Map) (user.get("tone"))).get("emotion");
- emotion.put("current", primaryEmotion);
-
- if (maintainHistory) {
- List