Search in sources :

Example 31 with IamAuthenticator

use of com.ibm.cloud.sdk.core.security.IamAuthenticator in project java-sdk by watson-developer-cloud.

the class PersonalityInsightsIT 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("PERSONALITY_INSIGHTS_APIKEY");
    Assert.assertNotNull("PERSONALITY_INSIGHTS_APIKEY is not defined", apiKey);
    Authenticator authenticator = new IamAuthenticator(apiKey);
    service = new PersonalityInsights(VERSION, authenticator);
    service.setServiceUrl(System.getenv("PERSONALITY_INSIGHTS_URL"));
    service.setDefaultHeaders(getDefaultHeaders());
}
Also used : IamAuthenticator(com.ibm.cloud.sdk.core.security.IamAuthenticator) IamAuthenticator(com.ibm.cloud.sdk.core.security.IamAuthenticator) Authenticator(com.ibm.cloud.sdk.core.security.Authenticator) Before(org.junit.Before)

Example 32 with IamAuthenticator

use of com.ibm.cloud.sdk.core.security.IamAuthenticator in project java-sdk by watson-developer-cloud.

the class VisualRecognitionIT 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 iamApiKey = System.getenv("VISUAL_RECOGNITION_APIKEY");
    assertNotNull("VISUAL_RECOGNITION_APIKEY is not defined", iamApiKey);
    Authenticator authenticator = new IamAuthenticator(iamApiKey);
    service = new VisualRecognition(VERSION, authenticator);
    service.setDefaultHeaders(getDefaultHeaders());
}
Also used : IamAuthenticator(com.ibm.cloud.sdk.core.security.IamAuthenticator) IamAuthenticator(com.ibm.cloud.sdk.core.security.IamAuthenticator) Authenticator(com.ibm.cloud.sdk.core.security.Authenticator) Before(org.junit.Before)

Aggregations

IamAuthenticator (com.ibm.cloud.sdk.core.security.IamAuthenticator)32 Authenticator (com.ibm.cloud.sdk.core.security.Authenticator)30 Before (org.junit.Before)15 SpeechRecognitionResults (com.ibm.watson.speech_to_text.v1.model.SpeechRecognitionResults)5 File (java.io.File)4 Response (com.ibm.cloud.sdk.core.http.Response)2 MessageInput (com.ibm.watson.assistant.v1.model.MessageInput)2 MessageOptions (com.ibm.watson.assistant.v1.model.MessageOptions)2 MessageResponse (com.ibm.watson.assistant.v1.model.MessageResponse)2 TranslateOptions (com.ibm.watson.language_translator.v3.model.TranslateOptions)2 TranslationResult (com.ibm.watson.language_translator.v3.model.TranslationResult)2 RecognizeWithWebsocketsOptions (com.ibm.watson.speech_to_text.v1.model.RecognizeWithWebsocketsOptions)2 BaseRecognizeCallback (com.ibm.watson.speech_to_text.v1.websocket.BaseRecognizeCallback)2 ToneAnalysis (com.ibm.watson.tone_analyzer.v3.model.ToneAnalysis)2 ToneOptions (com.ibm.watson.tone_analyzer.v3.model.ToneOptions)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InputStream (java.io.InputStream)2 JsonObject (com.google.gson.JsonObject)1 HttpConfigOptions (com.ibm.cloud.sdk.core.http.HttpConfigOptions)1 ServiceCallback (com.ibm.cloud.sdk.core.http.ServiceCallback)1