Skip to content

Commit

Permalink
Fix style issues
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Sep 20, 2023
1 parent c536607 commit 0286739
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ configurations {
force "org.xerial.snappy:snappy-java:1.1.10.3"
force "com.google.guava:guava:${guava_version}"

// TODO: Seems like this should be removable
// TODO: Seems like this should be removable
force "org.apache.httpcomponents:httpclient-cache:4.5.13"
force "org.apache.httpcomponents:httpclient:4.5.13"
force "org.apache.httpcomponents:fluent-hc:4.5.13"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@
import org.opensearch.test.framework.cluster.LocalCluster;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.aMapWithSize;
import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
import static org.hamcrest.Matchers.arrayWithSize;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
import static org.opensearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions.Type.ADD;
import static org.opensearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
import static org.opensearch.client.RequestOptions.DEFAULT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.opensearch.test.framework.cluster;

import java.util.Objects;
import java.util.concurrent.TimeUnit;

import javax.net.ssl.SSLContext;

Expand Down Expand Up @@ -60,9 +59,9 @@ public CloseableHttpClient getHTTPClient() {
final HttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
/** TODO: HOW SHOULD THIS BE REPLACED ??? */
// final HttpClientConnectionManager cm = PoolingHttpClientConnectionManagerBuilder.create()
// .setSSLSocketFactory(sslsf)
// .setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(60, TimeUnit.SECONDS).build())
// .build();
// .setSSLSocketFactory(sslsf)
// .setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(60, TimeUnit.SECONDS).build())
// .build();
hcb.setConnectionManager(cm);
if (routePlanner != null) {
hcb.setRoutePlanner(routePlanner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ public LocalAddressRoutePlanner(InetAddress localAddress) {
// */
// @Override
// protected InetAddress determineLocalAddress(HttpHost firstHop, HttpContext context) {
// return localAddress;
// return localAddress;
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ default RestHighLevelClient getRestHighLevelClient(UserCredentialsHolder user) {
default RestHighLevelClient getRestHighLevelClient(UserCredentialsHolder user, Collection<? extends Header> defaultHeaders) {

BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(
new AuthScope(null, -1),
new UsernamePasswordCredentials(user.getName(), user.getPassword())
);
credentialsProvider.setCredentials(new AuthScope(null, -1), new UsernamePasswordCredentials(user.getName(), user.getPassword()));

return getRestHighLevelClient(credentialsProvider, defaultHeaders);
}
Expand All @@ -137,18 +134,19 @@ default RestHighLevelClient getRestHighLevelClient(
RestClientBuilder.HttpClientConfigCallback configCallback = httpClientBuilder -> {
/** TODO: HOW SHOULD THIS BE REPLACED ??? */
// TlsStrategy tlsStrategy = ClientTlsStrategyBuilder.create()
// .setSslContext(getSSLContext())
// .setHostnameVerifier(NoopHostnameVerifier.INSTANCE)
// // See please https://issues.apache.org/jira/browse/HTTPCLIENT-2219
// .setTlsDetailsFactory(new Factory<SSLEngine, TlsDetails>() {
// @Override
// public TlsDetails create(final SSLEngine sslEngine) {
// return new TlsDetails(sslEngine.getSession(), sslEngine.getApplicationProtocol());
// }
// })
// .build();

// final AsyncClientConnectionManager cm = PoolingAsyncClientConnectionManagerBuilder.create().setTlsStrategy(tlsStrategy).build();
// .setSslContext(getSSLContext())
// .setHostnameVerifier(NoopHostnameVerifier.INSTANCE)
// // See please https://issues.apache.org/jira/browse/HTTPCLIENT-2219
// .setTlsDetailsFactory(new Factory<SSLEngine, TlsDetails>() {
// @Override
// public TlsDetails create(final SSLEngine sslEngine) {
// return new TlsDetails(sslEngine.getSession(), sslEngine.getApplicationProtocol());
// }
// })
// .build();

// final AsyncClientConnectionManager cm =
// PoolingAsyncClientConnectionManagerBuilder.create().setTlsStrategy(tlsStrategy).build();

if (credentialsProvider != null) {
httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ public TestRestClientConfiguration credentials(UserCredentialsHolder userCredent
* @return builder
*/
public TestRestClientConfiguration header(final String headerName, final String headerValue) {
this.headers.add(new BasicHeader(
Objects.requireNonNull(headerName, "Header names are required"),
Objects.requireNonNull(headerValue, "Header values are required")));
this.headers.add(
new BasicHeader(
Objects.requireNonNull(headerName, "Header names are required"),
Objects.requireNonNull(headerValue, "Header values are required")
)
);
return this;
}

Expand Down

0 comments on commit 0286739

Please sign in to comment.