use of com.ibm.cloud.sdk.core.security.BasicAuthenticator in project cloudant-java-sdk by IBM.
the class SdkTimeoutTest method testBasicAuthTimeout.
@Test
void testBasicAuthTimeout() throws NoSuchFieldException, IllegalAccessException {
BasicAuthenticator basicAuth = new BasicAuthenticator.Builder().username("user").password("psw").build();
CloudantBaseService myService = createCloudantBaseService(basicAuth, "https://cloudant.example");
Request testRequest = createTestRequest(myService);
for (int i = 0; i < 2; i++) {
if (i == 1) {
setCustomTimeout(myService, testCases[i]);
}
RealCall testRequestCall = createServiceCall(myService, testRequest);
assertEquals(TimeUnit.MILLISECONDS.toSeconds(testRequestCall.getClient().readTimeoutMillis()), testCases[i]);
}
}
use of com.ibm.cloud.sdk.core.security.BasicAuthenticator in project java-sdk by watson-developer-cloud.
the class AssistantServiceIT method pingBadCredentialsThrowsException.
/**
* Ping bad credentials throws exception.
*/
@Test(expected = UnauthorizedException.class)
public void pingBadCredentialsThrowsException() {
Assistant badService = new Assistant("2019-02-28", new BasicAuthenticator("foo", "bar"));
MessageOptions options = new MessageOptions.Builder(workspaceId).build();
badService.message(options).execute().getResult();
}
use of com.ibm.cloud.sdk.core.security.BasicAuthenticator in project java-sdk by watson-developer-cloud.
the class DiscoveryServiceIT method badCredentialsThrowsException.
/**
* Bad credentials throws exception.
*/
@Test(expected = UnauthorizedException.class)
public void badCredentialsThrowsException() {
Discovery badService = new Discovery("2019-04-30", new BasicAuthenticator("foo", "bar"));
badService.listEnvironments(null).execute().getResult();
}
Aggregations