use of com.ibm.cloud.sdk.core.http.HttpConfigOptions in project cloudant-java-sdk by IBM.
the class CouchDbSessionAuthenticatorTest method setHttpConfigOptions.
/**
* Test that options set on the client apply to the token request
*/
@Test
void setHttpConfigOptions() {
CouchDbSessionAuthenticator a = Mockito.spy(testAuthenticator);
TestCloudantService testCloudantService = new TestCloudantService("test", a);
HttpConfigOptions options = new HttpConfigOptions.Builder().build();
testCloudantService.configureClient(options);
// Verify the setter was called
Mockito.verify(a).setHttpConfigOptions(options);
}
use of com.ibm.cloud.sdk.core.http.HttpConfigOptions in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceIT method testGetAutocompletion.
/**
* This only works on a Cloud Pak for Data instance, so ignoring to just run manually.
*/
@Test
@Ignore
public void testGetAutocompletion() {
// fill in
Authenticator authenticator = new BearerTokenAuthenticator("");
Discovery service = new Discovery("2019-10-03", authenticator);
service.setServiceUrl("");
HttpConfigOptions configOptions = new HttpConfigOptions.Builder().disableSslVerification(true).build();
service.configureClient(configOptions);
GetAutocompletionOptions options = new GetAutocompletionOptions.Builder().environmentId(// fill in
"").collectionId(// fill in
"").prefix("Ba").count(10L).build();
Completions response = service.getAutocompletion(options).execute().getResult();
// System.out.println(response);
}
use of com.ibm.cloud.sdk.core.http.HttpConfigOptions in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceIT method testQueryWithSpellingSuggestions.
/**
* This only works on a Cloud Pak for Data instance, so ignoring to just run manually.
*/
@Test
@Ignore
public void testQueryWithSpellingSuggestions() {
// fill in
Authenticator authenticator = new BearerTokenAuthenticator("");
Discovery service = new Discovery("2019-10-03", authenticator);
service.setServiceUrl("");
HttpConfigOptions configOptions = new HttpConfigOptions.Builder().disableSslVerification(true).build();
service.configureClient(configOptions);
QueryOptions options = new QueryOptions.Builder().naturalLanguageQuery("cluod").spellingSuggestions(true).environmentId(// fill in
"").collectionId(// fill in
"").build();
QueryResponse response = service.query(options).execute().getResult();
// System.out.println(response);
}
use of com.ibm.cloud.sdk.core.http.HttpConfigOptions in project java-sdk by watson-developer-cloud.
the class DiscoveryIT 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("DISCOVERY_V2_APIKEY");
String serviceUrl = System.getenv("DISCOVERY_V2_URL");
if (apiKey == null) {
apiKey = getProperty("discovery_v2.apikey");
serviceUrl = getProperty("discovery_v2.url");
}
assertNotNull("DISCOVERY_V2_APIKEY is not defined and config.properties doesn't have valid credentials.", apiKey);
Authenticator authenticator = new IamAuthenticator(apiKey);
service = new Discovery(VERSION, authenticator);
service.setDefaultHeaders(getDefaultHeaders());
service.setServiceUrl(serviceUrl);
HttpConfigOptions configOptions = new HttpConfigOptions.Builder().disableSslVerification(true).build();
service.configureClient(configOptions);
}
Aggregations