Skip to content

Merge release changes into develop #403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 13, 2018
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ To get started with the Watson Services in Unity, click on each service below to
* [Assistant](/Scripts/Services/Assistant/v1)
* [Conversation](/Scripts/Services/Conversation/v1)
* [Discovery](/Scripts/Services/Discovery/v1)
* [Language Translator](/Scripts/Services/LanguageTranslator/v2)
* [Language Translator V2](/Scripts/Services/LanguageTranslator/v2)
* [Language Translator V3](/Scripts/Services/LanguageTranslator/v3)
* [Natural Language Classifier](/Scripts/Services/NaturalLanguageClassifier/v2)
* [Natural Language Understanding](/Scripts/Services/NaturalLanguageUnderstanding/v1)
* [Personality Insights](/Scripts/Services/PersonalityInsights/v3)
Expand Down
2 changes: 1 addition & 1 deletion Scripts/UnitTests/TestLanguageTranslatorV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public override IEnumerator RunTest()
throw new WatsonException(r.FormattedMessages);

// Set credentials from imported credntials
Credential credential = vcapCredentials.GetCredentialByname("language-translator-sdk")[0].Credentials;
Credential credential = vcapCredentials.GetCredentialByname("language-translator-sdk-v2-sdk-cf")[0].Credentials;
_username = credential.Username.ToString();
_password = credential.Password.ToString();
_url = credential.Url.ToString();
Expand Down
2 changes: 1 addition & 1 deletion Scripts/UnitTests/TestLanguageTranslatorV3CF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public override IEnumerator RunTest()
throw new WatsonException(r.FormattedMessages);

// Set credentials from imported credntials
Credential credential = vcapCredentials.GetCredentialByname("language-translator-v3-cf-staging")[0].Credentials;
Credential credential = vcapCredentials.GetCredentialByname("language-translator-v3-sdk-cf")[0].Credentials;
_username = credential.Username.ToString();
_password = credential.Password.ToString();
_url = credential.Url.ToString();
Expand Down
41 changes: 2 additions & 39 deletions Scripts/UnitTests/TestLanguageTranslatorV3RC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,13 @@ namespace IBM.Watson.DeveloperCloud.UnitTests
public class TestLanguageTranslatorV3RC : UnitTest
{
private string _pharseToTranslate = "Hello, welcome to IBM Watson!";
private string _username = null;
private string _password = null;
//private string _token = "<authentication-token>";
private fsSerializer _serializer = new fsSerializer();

private LanguageTranslator _languageTranslator;
private string _baseModelName = "en-es";
private string _customModelName = "Texan";
private string _forcedGlossaryFilePath;
private string _customLanguageModelId;

private bool _getTranslationTested = false;
private bool _getModelsTested = false;
private bool _createModelTested = false;
private bool _getModelTested = false;
private bool _deleteModelTested = false;
private bool _identifyTested = false;
private bool _getLanguagesTested = false;
private string _versionDate = "2018-05-01";
Expand Down Expand Up @@ -81,7 +72,7 @@ public override IEnumerator RunTest()
throw new WatsonException(r.FormattedMessages);

// Set credentials from imported credntials
Credential credential = vcapCredentials.GetCredentialByname("language-translator-v3-iam-staging")[0].Credentials;
Credential credential = vcapCredentials.GetCredentialByname("language-translator-v3-sdk-rc-wdc")[0].Credentials;
_url = credential.Url.ToString();

// Create credential and instantiate service
Expand All @@ -99,8 +90,6 @@ public override IEnumerator RunTest()

_languageTranslator = new LanguageTranslator(_versionDate, credentials);

_forcedGlossaryFilePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/glossary.tmx";

if (!_languageTranslator.GetTranslation(OnGetTranslation, OnFail, _pharseToTranslate, "en", "es"))
Log.Debug("TestLanguageTranslator.GetTranslation()", "Failed to translate.");
while (!_getTranslationTested)
Expand All @@ -111,21 +100,11 @@ public override IEnumerator RunTest()
while (!_getModelsTested)
yield return null;

if (!_languageTranslator.CreateModel(OnCreateModel, OnFail, _baseModelName, _customModelName, _forcedGlossaryFilePath))
Log.Debug("TestLanguageTranslator.CreateModel()", "Failed to create model.");
while (!_createModelTested)
yield return null;

if (!_languageTranslator.GetModel(OnGetModel, OnFail, _customLanguageModelId))
if (!_languageTranslator.GetModel(OnGetModel, OnFail, "en-es"))
Log.Debug("TestLanguageTranslator.GetModel()", "Failed to get model.");
while (!_getModelTested)
yield return null;

if (!_languageTranslator.DeleteModel(OnDeleteModel, OnFail, _customLanguageModelId))
Log.Debug("TestLanguageTranslator.DeleteModel()", "Failed to delete model.");
while (!_deleteModelTested)
yield return null;

if (!_languageTranslator.Identify(OnIdentify, OnFail, _pharseToTranslate))
Log.Debug("TestLanguageTranslator.Identify()", "Failed to identify language.");
while (!_identifyTested)
Expand All @@ -148,29 +127,13 @@ private void OnGetModels(TranslationModels models, Dictionary<string, object> cu
_getModelsTested = true;
}

private void OnCreateModel(TranslationModel model, Dictionary<string, object> customData)
{
Log.Debug("TestLanguageTranslator.OnCreateModel()", "Language Translator - Create model response: {0}", customData["json"].ToString());
_customLanguageModelId = model.model_id;
Test(model != null);
_createModelTested = true;
}

private void OnGetModel(TranslationModel model, Dictionary<string, object> customData)
{
Log.Debug("TestLanguageTranslator.OnGetModel()", "Language Translator - Get model response: {0}", customData["json"].ToString());
Test(model != null);
_getModelTested = true;
}

private void OnDeleteModel(DeleteModelResult deleteModelResult, Dictionary<string, object> customData)
{
Log.Debug("TestLanguageTranslator.OnDeleteModel()", "Language Translator - Delete model response: success: {0}", customData["json"].ToString());
_customLanguageModelId = null;
Test(deleteModelResult != null);
_deleteModelTested = true;
}

private void OnGetTranslation(Translations translation, Dictionary<string, object> customData)
{
Log.Debug("TestLanguageTranslator.OnGetTranslation()", "Langauge Translator - Translate Response: {0}", customData["json"].ToString());
Expand Down
6 changes: 5 additions & 1 deletion Scripts/UnitTests/TestVisualRecognitionCF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
//#define TRAIN_CLASSIFIER
// Uncommnent to delete the trained classifier
//#define DELETE_TRAINED_CLASSIFIER
// Uncomment to test CF
//#define TEST_CF

using UnityEngine;
using System.Collections;
Expand All @@ -32,6 +34,7 @@

namespace IBM.Watson.DeveloperCloud.UnitTests
{
#if TEST_CF
public class TestVisualRecognitionCF : UnitTest
{
private string _apikey;
Expand Down Expand Up @@ -93,7 +96,7 @@ public override IEnumerator RunTest()
throw new WatsonException(r.FormattedMessages);

// Set credentials from imported credntials
Credential credential = vcapCredentials.GetCredentialByname("visual-recognition-sdk")[0].Credentials;
Credential credential = vcapCredentials.GetCredentialByname("visual-recognition-sdk-cf")[0].Credentials;
_apikey = credential.ApiKey.ToString();
_url = credential.Url.ToString();

Expand Down Expand Up @@ -314,4 +317,5 @@ private void OnFail(RESTConnector.Error error, Dictionary<string, object> custom
Log.Error("TestVisualRecognition.OnFail()", "Error received: {0}", error.ToString());
}
}
#endif
}
4 changes: 2 additions & 2 deletions Scripts/UnitTests/TestVisualRecognitionRC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// Uncommnent to delete the trained classifier
//#define DELETE_TRAINED_CLASSIFIER
// Uncomment to test RC
//#define TEST_RC
#define TEST_RC

using UnityEngine;
using System.Collections;
Expand Down Expand Up @@ -96,7 +96,7 @@ public override IEnumerator RunTest()
throw new WatsonException(r.FormattedMessages);

// Set credentials from imported credntials
Credential credential = vcapCredentials.GetCredentialByname("visual-recognition-iam-sdk")[0].Credentials;
Credential credential = vcapCredentials.GetCredentialByname("visual-recognition-sdk-rc")[0].Credentials;

// Create credential and instantiate service
TokenOptions tokenOptions = new TokenOptions()
Expand Down