File tree 11 files changed +96
-22
lines changed
assistant/src/test/java/com/ibm/watson/assistant
discovery/src/test/java/com/ibm/watson/discovery
language-translator/src/test/java/com/ibm/watson/language_translator/v3
natural-language-classifier/src/test/java/com/ibm/watson/natural_language_classifier/v1
natural-language-understanding/src/test/java/com/ibm/watson/natural_language_understanding/v1
speech-to-text/src/test/java/com/ibm/watson/speech_to_text/v1
text-to-speech/src/test/java/com/ibm/watson/text_to_speech/v1
11 files changed +96
-22
lines changed Original file line number Diff line number Diff line change @@ -497,6 +497,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
497
497
<td align="center"><a href="https://www.linkedin.com/in/logan-patino/"><img src="https://avatars2.githubusercontent.com/u/8710772?v=4" width="100px;" alt=""/><br /><sub><b>Logan Patino</b></sub></a><br /><a href="https://github.com/watson-developer-cloud/java-sdk/commits?author=lpatino10" title="Code">💻</a> <a href="#design-lpatino10" title="Design">🎨</a> <a href="https://github.com/watson-developer-cloud/java-sdk/issues?q=author%3Alpatino10" title="Bug reports">🐛</a></td>
498
498
<td align="center"><a href="https://github.com/mediumTaj"><img src="https://avatars1.githubusercontent.com/u/4381558?v=4" width="100px;" alt=""/><br /><sub><b>Ajiemar Santiago</b></sub></a><br /><a href="https://github.com/watson-developer-cloud/java-sdk/commits?author=mediumTaj" title="Code">💻</a> <a href="#design-mediumTaj" title="Design">🎨</a> <a href="https://github.com/watson-developer-cloud/java-sdk/issues?q=author%3AmediumTaj" title="Bug reports">🐛</a></td>
499
499
<td align="center"><a href="https://germanattanasio.com"><img src="https://avatars3.githubusercontent.com/u/313157?v=4" width="100px;" alt=""/><br /><sub><b>German Attanasio</b></sub></a><br /><a href="https://github.com/watson-developer-cloud/java-sdk/commits?author=germanattanasio" title="Code">💻</a> <a href="#design-germanattanasio" title="Design">🎨</a> <a href="https://github.com/watson-developer-cloud/java-sdk/commits?author=germanattanasio" title="Documentation">📖</a> <a href="https://github.com/watson-developer-cloud/java-sdk/commits?author=germanattanasio" title="Tests">⚠️</a></td>
500
+ <td align="center"><a href="https://github.com/kevinkowa"><img src="https://avatars.githubusercontent.com/u/15097482?v=4" width="100px;" alt=""/><br /><sub><b>Kevin Kowalski</b></sub></a><br /><a href="https://github.com/watson-developer-cloud/java-sdk/commits?author=kevinkowa" title="Code">💻</a> <a href="#design-kevinkowa" title="Design">🎨</a> <a href="https://github.com/watson-developer-cloud/java-sdk/issues?q=author%3Akevinkowa+" title="Bug reports">🐛</a> <a href="https://github.com/watson-developer-cloud/java-sdk/commits?author=kevinkowa" title="Documentation">📖</a> <a href="https://github.com/watson-developer-cloud/java-sdk/commits?author=kevinkowa" title="Tests">⚠️</a> <a href="https://github.com/watson-developer-cloud/java-sdk/issues?q=mentions%3Akevinkowa+is%3Aclosed+" title="questions">💬️</a></td>
500
501
</tr >
501
502
</table >
502
503
Original file line number Diff line number Diff line change @@ -58,12 +58,19 @@ public void setUp() throws Exception {
58
58
super .setUp ();
59
59
String apiKey = System .getenv ("ASSISTANT_APIKEY" );
60
60
workspaceId = System .getenv ("ASSISTANT_WORKSPACE_ID" );
61
+ String serviceUrl = System .getenv ("ASSISTANT_URL" );
61
62
62
- Assume .assumeFalse ("ASSISTANT_APIKEY is not defined" , apiKey == null );
63
+ if (apiKey == null ) {
64
+ apiKey = getProperty ("assistant.apikey" );
65
+ workspaceId = getProperty ("assistant.workspace_id" );
66
+ serviceUrl = getProperty ("assistant.url" );
67
+ }
68
+
69
+ Assume .assumeFalse ("ASSISTANT_APIKEY is not defined and config.properties doesn't have valid credentials." , apiKey == null );
63
70
64
71
Authenticator authenticator = new IamAuthenticator (apiKey );
65
72
service = new Assistant ("2019-02-28" , authenticator );
66
- service .setServiceUrl (System . getenv ( "ASSISTANT_URL" ) );
73
+ service .setServiceUrl (serviceUrl );
67
74
service .setDefaultHeaders (getDefaultHeaders ());
68
75
}
69
76
Original file line number Diff line number Diff line change @@ -58,12 +58,19 @@ public void setUp() throws Exception {
58
58
super .setUp ();
59
59
String apiKey = System .getenv ("ASSISTANT_APIKEY" );
60
60
assistantId = System .getenv ("ASSISTANT_ASSISTANT_ID" );
61
+ String serviceUrl = System .getenv ("ASSISTANT_URL" );
61
62
62
- Assume .assumeFalse ("ASSISTANT_APIKEY is not defined" , apiKey == null );
63
+ if (apiKey == null ) {
64
+ apiKey = getProperty ("assistant.apikey" );
65
+ assistantId = getProperty ("assistant.assistant_id" );
66
+ serviceUrl = getProperty ("assistant.url" );
67
+ }
68
+
69
+ Assume .assumeFalse ("ASSISTANT_APIKEY is not defined and config.properties doesn't have valid credentials." , apiKey == null );
63
70
64
71
Authenticator authenticator = new IamAuthenticator (apiKey );
65
72
service = new Assistant ("2019-02-28" , authenticator );
66
- service .setServiceUrl (System . getenv ( "ASSISTANT_URL" ) );
73
+ service .setServiceUrl (serviceUrl );
67
74
service .setDefaultHeaders (getDefaultHeaders ());
68
75
}
69
76
Original file line number Diff line number Diff line change @@ -94,7 +94,11 @@ public static void setupClass() throws Exception {
94
94
dummyTest = new DiscoveryServiceIT ();
95
95
String apiKey = System .getenv ("DISCOVERY_APIKEY" );
96
96
97
- assertNotNull ("DISCOVERY_APIKEY is not defined" , apiKey );
97
+ if (apiKey == null ) {
98
+ apiKey = dummyTest .getProperty ("discovery.apikey" );
99
+ }
100
+
101
+ assertNotNull ("DISCOVERY_APIKEY is not defined and config.properties doesn't have valid credentials." , apiKey );
98
102
99
103
dummyTest .setup ();
100
104
@@ -143,10 +147,16 @@ public static void cleanupClass() throws Exception {
143
147
public void setup () throws Exception {
144
148
super .setUp ();
145
149
String apiKey = System .getenv ("DISCOVERY_APIKEY" );
146
- String url = System .getenv ("DISCOVERY_URL" );
150
+ String serviceUrl = System .getenv ("DISCOVERY_URL" );
151
+
152
+ if (apiKey == null ) {
153
+ apiKey = getProperty ("discovery.apikey" );
154
+ serviceUrl = getProperty ("discovery.url" );
155
+ }
156
+
147
157
Authenticator authenticator = new IamAuthenticator (apiKey );
148
158
discovery = new Discovery ("2019-04-30" , authenticator );
149
- discovery .setServiceUrl (url );
159
+ discovery .setServiceUrl (serviceUrl );
150
160
discovery .setDefaultHeaders (getDefaultHeaders ());
151
161
152
162
uniqueName = UUID .randomUUID ().toString ();
Original file line number Diff line number Diff line change @@ -65,12 +65,19 @@ public void setUp() throws Exception {
65
65
super .setUp ();
66
66
67
67
String apiKey = System .getenv ("DISCOVERY_V2_APIKEY" );
68
- assertNotNull ("DISCOVERY_V2_APIKEY is not defined" , apiKey );
68
+ String serviceUrl = System .getenv ("DISCOVERY_V2_URL" );
69
+
70
+ if (apiKey == null ) {
71
+ apiKey = getProperty ("discovery_v2.apikey" );
72
+ serviceUrl = getProperty ("discovery_v2.url" );
73
+ }
74
+
75
+ assertNotNull ("DISCOVERY_V2_APIKEY is not defined and config.properties doesn't have valid credentials." , apiKey );
69
76
70
77
Authenticator authenticator = new IamAuthenticator (apiKey );
71
78
service = new Discovery (VERSION , authenticator );
72
79
service .setDefaultHeaders (getDefaultHeaders ());
73
- service .setServiceUrl (System . getenv ( "DISCOVERY_V2_URL" ) );
80
+ service .setServiceUrl (serviceUrl );
74
81
75
82
HttpConfigOptions configOptions =
76
83
new HttpConfigOptions .Builder ().disableSslVerification (true ).build ();
Original file line number Diff line number Diff line change @@ -69,12 +69,18 @@ public class LanguageTranslatorIT extends WatsonServiceTest {
69
69
public void setUp () throws Exception {
70
70
super .setUp ();
71
71
String iamApiKey = System .getenv ("LANGUAGE_TRANSLATOR_APIKEY" );
72
+ String serviceUrl = System .getenv ("LANGUAGE_TRANSLATOR_URL" );
72
73
73
- assertNotNull ("LANGUAGE_TRANSLATOR_APIKEY is not defined" , iamApiKey );
74
+ if (iamApiKey == null ) {
75
+ iamApiKey = getProperty ("language_translator.apikey" );
76
+ serviceUrl = getProperty ("language_translator.url" );
77
+ }
78
+
79
+ assertNotNull ("LANGUAGE_TRANSLATOR_APIKEY is not defined and config.properties doesn't have valid credentials." , iamApiKey );
74
80
75
81
Authenticator authenticator = new IamAuthenticator (iamApiKey );
76
82
service = new LanguageTranslator ("2018-05-01" , authenticator );
77
- service .setServiceUrl (System . getenv ( "LANGUAGE_TRANSLATOR_URL" ) );
83
+ service .setServiceUrl (serviceUrl );
78
84
79
85
// issue currently where document translation fails with learning opt-out
80
86
Map <String , String > headers = new HashMap <>();
Original file line number Diff line number Diff line change @@ -65,15 +65,23 @@ public class NaturalLanguageClassifierIT extends WatsonServiceTest {
65
65
public void setUp () throws Exception {
66
66
super .setUp ();
67
67
String apiKey = System .getenv ("NATURAL_LANGUAGE_CLASSIFIER_APIKEY" );
68
+ String serviceUrl = System .getenv ("NATURAL_LANGUAGE_CLASSIFIER_URL" );
69
+ preCreatedClassifierId = System .getenv ("NATURAL_LANGUAGE_CLASSIFIER_ID" );
70
+
71
+ if (apiKey == null ) {
72
+ apiKey = getProperty ("natural_language_classifier.apikey" );
73
+ serviceUrl = getProperty ("natural_language_classifier.url" );
74
+ preCreatedClassifierId = getProperty ("natural_language_classifier.classifier_id" );
75
+ }
68
76
69
- assertNotNull ("NATURAL_LANGUAGE_CLASSIFIER_APIKEY is not defined" , apiKey );
77
+ assertNotNull ("NATURAL_LANGUAGE_CLASSIFIER_APIKEY is not defined and config.properties doesn't have valid credentials. " , apiKey );
70
78
71
79
Authenticator authenticator = new IamAuthenticator (apiKey );
72
80
service = new NaturalLanguageClassifier (authenticator );
73
81
service .setDefaultHeaders (getDefaultHeaders ());
74
- service .setServiceUrl (System .getenv ("NATURAL_LANGUAGE_CLASSIFIER_URL" ));
82
+ service .setServiceUrl (serviceUrl );
83
+
75
84
76
- preCreatedClassifierId = System .getenv ("NATURAL_LANGUAGE_CLASSIFIER_ID" );
77
85
}
78
86
79
87
/**
Original file line number Diff line number Diff line change @@ -58,13 +58,19 @@ public class NaturalLanguageUnderstandingIT extends WatsonServiceTest {
58
58
public void setUp () throws Exception {
59
59
super .setUp ();
60
60
String apiKey = System .getenv ("NATURAL_LANGUAGE_UNDERSTANDING_APIKEY" );
61
+ String serviceUrl = System .getenv ("NATURAL_LANGUAGE_UNDERSTANDING_URL" );
61
62
62
- assertNotNull ("NATURAL_LANGUAGE_UNDERSTANDING_APIKEY is not defined" , apiKey );
63
+ if (apiKey == null ) {
64
+ apiKey = getProperty ("natural_language_understanding.apikey" );
65
+ serviceUrl = getProperty ("natural_language_understanding.url" );
66
+ }
67
+
68
+ assertNotNull ("NATURAL_LANGUAGE_UNDERSTANDING_APIKEY is not defined and config.properties doesn't have valid credentials." , apiKey );
63
69
64
70
Authenticator authenticator = new IamAuthenticator (apiKey );
65
71
service = new NaturalLanguageUnderstanding ("2019-07-12" , authenticator );
66
72
service .setDefaultHeaders (getDefaultHeaders ());
67
- service .setServiceUrl (System . getenv ( "NATURAL_LANGUAGE_UNDERSTANDING_URL" ) );
73
+ service .setServiceUrl (serviceUrl );
68
74
}
69
75
70
76
/**
Original file line number Diff line number Diff line change @@ -133,12 +133,20 @@ public void setUp() throws Exception {
133
133
this .acousticCustomizationId = System .getenv ("SPEECH_TO_TEXT_ACOUSTIC_CUSTOM_ID" );
134
134
135
135
String apiKey = System .getenv ("SPEECH_TO_TEXT_APIKEY" );
136
+ String serviceUrl = System .getenv ("SPEECH_TO_TEXT_URL" );
136
137
137
- assertNotNull ("SPEECH_TO_TEXT_APIKEY is not defined" , apiKey );
138
+ if (apiKey == null ) {
139
+ apiKey = getProperty ("speech_to_text.apikey" );
140
+ this .customizationId = getProperty ("speech_to_text.customization_id" );
141
+ this .acousticCustomizationId = getProperty ("speech_to_text.acoustic_customization_id" );
142
+ serviceUrl = getProperty ("speech_to_text.url" );
143
+ }
144
+
145
+ assertNotNull ("SPEECH_TO_TEXT_APIKEY is not defined and config.properties doesn't have valid credentials." , apiKey );
138
146
139
147
Authenticator authenticator = new IamAuthenticator (apiKey );
140
148
service = new SpeechToText (authenticator );
141
- service .setServiceUrl (System . getenv ( "SPEECH_TO_TEXT_URL" ) );
149
+ service .setServiceUrl (serviceUrl );
142
150
service .setDefaultHeaders (getDefaultHeaders ());
143
151
}
144
152
Original file line number Diff line number Diff line change @@ -56,11 +56,18 @@ public class CustomizationsIT extends WatsonServiceTest {
56
56
public void setUp () throws Exception {
57
57
super .setUp ();
58
58
String apiKey = System .getenv ("TEXT_TO_SPEECH_APIKEY" );
59
- assertNotNull ("TEXT_TO_SPEECH_APIKEY is not defined" , apiKey );
59
+ String serviceUrl = System .getenv ("TEXT_TO_SPEECH_URL" );
60
+
61
+ if (apiKey == null ) {
62
+ apiKey = getProperty ("text_to_speech.apikey" );
63
+ serviceUrl = getProperty ("text_to_speech.url" );
64
+ }
65
+
66
+ assertNotNull ("TEXT_TO_SPEECH_APIKEY is not defined and config.properties doesn't have valid credentials." , apiKey );
60
67
61
68
Authenticator authenticator = new IamAuthenticator (apiKey );
62
69
service = new TextToSpeech (authenticator );
63
- service .setServiceUrl (System . getenv ( "TEXT_TO_SPEECH_URL" ) );
70
+ service .setServiceUrl (serviceUrl );
64
71
service .setDefaultHeaders (getDefaultHeaders ());
65
72
}
66
73
Original file line number Diff line number Diff line change @@ -98,11 +98,18 @@ public class TextToSpeechIT extends WatsonServiceTest {
98
98
public void setUp () throws Exception {
99
99
super .setUp ();
100
100
String apiKey = System .getenv ("TEXT_TO_SPEECH_APIKEY" );
101
- assertNotNull ("TEXT_TO_SPEECH_APIKEY is not defined" , apiKey );
101
+ String serviceUrl = System .getenv ("TEXT_TO_SPEECH_URL" );
102
+
103
+ if (apiKey == null ) {
104
+ apiKey = getProperty ("text_to_speech.apikey" );
105
+ serviceUrl = getProperty ("text_to_speech.url" );
106
+ }
107
+
108
+ assertNotNull ("TEXT_TO_SPEECH_APIKEY is not defined and config.properties doesn't have valid credentials." , apiKey );
102
109
103
110
Authenticator authenticator = new IamAuthenticator (apiKey );
104
111
service = new TextToSpeech (authenticator );
105
- service .setServiceUrl (System . getenv ( "TEXT_TO_SPEECH_URL" ) );
112
+ service .setServiceUrl (serviceUrl );
106
113
service .setDefaultHeaders (getDefaultHeaders ());
107
114
voiceName = "en-US_MichaelVoice" ;
108
115
You can’t perform that action at this time.
0 commit comments