use of com.ibm.cloud.sdk.core.security.IamAuthenticator in project java-sdk by watson-developer-cloud.
the class NaturalLanguageUnderstandingIT method setUp.
/**
* Sets up the tests.
*
* @throws Exception the exception
*/
/*
* (non-Javadoc)
* @see com.ibm.watson.common.WatsonServiceTest#setUp()
*/
@Override
@Before
public void setUp() throws Exception {
super.setUp();
String apiKey = System.getenv("NATURAL_LANGUAGE_UNDERSTANDING_APIKEY");
String serviceUrl = System.getenv("NATURAL_LANGUAGE_UNDERSTANDING_URL");
if (apiKey == null) {
apiKey = getProperty("natural_language_understanding.apikey");
serviceUrl = getProperty("natural_language_understanding.url");
}
assertNotNull("NATURAL_LANGUAGE_UNDERSTANDING_APIKEY is not defined and config.properties doesn't have valid credentials.", apiKey);
Authenticator authenticator = new IamAuthenticator(apiKey);
service = new NaturalLanguageUnderstanding("2019-07-12", authenticator);
service.setDefaultHeaders(getDefaultHeaders());
service.setServiceUrl(serviceUrl);
}
use of com.ibm.cloud.sdk.core.security.IamAuthenticator in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceIT method setup.
/**
* Setup.
*
* @throws Exception the exception
*/
@Before
public void setup() throws Exception {
super.setUp();
String apiKey = System.getenv("DISCOVERY_APIKEY");
String serviceUrl = System.getenv("DISCOVERY_URL");
if (apiKey == null) {
apiKey = getProperty("discovery.apikey");
serviceUrl = getProperty("discovery.url");
}
Authenticator authenticator = new IamAuthenticator(apiKey);
discovery = new Discovery("2019-04-30", authenticator);
discovery.setServiceUrl(serviceUrl);
discovery.setDefaultHeaders(getDefaultHeaders());
uniqueName = UUID.randomUUID().toString();
}
use of com.ibm.cloud.sdk.core.security.IamAuthenticator in project java-sdk by watson-developer-cloud.
the class SpeechToTextIT method setUp.
/**
* Sets up the tests.
*
* @throws Exception the exception
*/
/*
* (non-Javadoc)
*
* @see com.ibm.watson.common.WatsonServiceTest#setUp()
*/
@Override
@Before
public void setUp() throws Exception {
super.setUp();
this.customizationId = System.getenv("SPEECH_TO_TEXT_CUSTOM_ID");
this.acousticCustomizationId = System.getenv("SPEECH_TO_TEXT_ACOUSTIC_CUSTOM_ID");
String apiKey = System.getenv("SPEECH_TO_TEXT_APIKEY");
String serviceUrl = System.getenv("SPEECH_TO_TEXT_URL");
if (apiKey == null) {
apiKey = getProperty("speech_to_text.apikey");
this.customizationId = getProperty("speech_to_text.customization_id");
this.acousticCustomizationId = getProperty("speech_to_text.acoustic_customization_id");
serviceUrl = getProperty("speech_to_text.url");
}
assertNotNull("SPEECH_TO_TEXT_APIKEY is not defined and config.properties doesn't have valid credentials.", apiKey);
Authenticator authenticator = new IamAuthenticator(apiKey);
service = new SpeechToText(authenticator);
service.setServiceUrl(serviceUrl);
service.setDefaultHeaders(getDefaultHeaders());
}
use of com.ibm.cloud.sdk.core.security.IamAuthenticator in project java-sdk by watson-developer-cloud.
the class CustomizationsIT method setUp.
/*
* (non-Javadoc)
* @see com.ibm.watson.common.WatsonServiceTest#setUp()
*/
@Override
@Before
public void setUp() throws Exception {
super.setUp();
String apiKey = System.getenv("TEXT_TO_SPEECH_APIKEY");
String serviceUrl = System.getenv("TEXT_TO_SPEECH_URL");
if (apiKey == null) {
apiKey = getProperty("text_to_speech.apikey");
serviceUrl = getProperty("text_to_speech.url");
}
assertNotNull("TEXT_TO_SPEECH_APIKEY is not defined and config.properties doesn't have valid credentials.", apiKey);
Authenticator authenticator = new IamAuthenticator(apiKey);
service = new TextToSpeech(authenticator);
service.setServiceUrl(serviceUrl);
service.setDefaultHeaders(getDefaultHeaders());
}
use of com.ibm.cloud.sdk.core.security.IamAuthenticator in project java-sdk by watson-developer-cloud.
the class TextToSpeechIT method setUp.
/**
* Sets up the tests.
*
* @throws Exception the exception
*/
/*
* (non-Javadoc)
* @see com.ibm.watson.common.WatsonServiceTest#setUp()
*/
@Override
@Before
public void setUp() throws Exception {
super.setUp();
String apiKey = System.getenv("TEXT_TO_SPEECH_APIKEY");
String serviceUrl = System.getenv("TEXT_TO_SPEECH_URL");
if (apiKey == null) {
apiKey = getProperty("text_to_speech.apikey");
serviceUrl = getProperty("text_to_speech.url");
}
assertNotNull("TEXT_TO_SPEECH_APIKEY is not defined and config.properties doesn't have valid credentials.", apiKey);
Authenticator authenticator = new IamAuthenticator(apiKey);
service = new TextToSpeech(authenticator);
service.setServiceUrl(serviceUrl);
service.setDefaultHeaders(getDefaultHeaders());
voiceName = "en-US_MichaelVoice";
byteArrayOutputStream = new ByteArrayOutputStream();
returnedTimings = new ArrayList<>();
returnedMarks = new ArrayList<>();
}
Aggregations