use of com.openshift.restclient.ClientBuilder in project jbosstools-openshift by jbosstools.
the class ConnectionFactory method create.
@Override
public Connection create(String url) {
if (StringUtils.isEmpty(url)) {
return null;
}
try {
LazySSLCertificateCallback sslCertCallback = new LazySSLCertificateCallback();
IClient client = new ClientBuilder(url).sslCertificateCallback(sslCertCallback).withMaxRequests(ConnectionProperties.MAX_REQUESTS).withMaxRequestsPerHost(ConnectionProperties.MAX_REQUESTS).build();
return new Connection(client, new LazyCredentialsPrompter());
} catch (OpenShiftException e) {
OpenShiftCoreActivator.pluginLog().logInfo(NLS.bind("Could not create OpenShift connection: Malformed url {0}", url), e);
return null;
}
}
use of com.openshift.restclient.ClientBuilder in project jbosstools-openshift by jbosstools.
the class ConnectionTest method should_not_credentialsEqual_if_different_token.
@Test
public void should_not_credentialsEqual_if_different_token() throws Exception {
// given
connection = new Connection(new ClientBuilder("https://someplace").withUserName("foo").withPassword("bar").usingToken("mytoken").build(), null);
Connection two = (Connection) connection.clone();
assertThat(two).isEqualTo(connection);
assertThat(two.credentialsEqual(connection)).isTrue();
// when
two.setToken("tokenTwo");
// then
assertThat(two).isEqualTo(connection);
assertThat(two.credentialsEqual(connection)).isFalse();
}
Aggregations