Skip to content

Commit

Permalink
Addressing comments
Browse files Browse the repository at this point in the history
Signed-off-by: Vacha Shah <[email protected]>
  • Loading branch information
VachaShah committed Jan 23, 2023
1 parent 4d917fe commit 8d74b0a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public void close() {
}

@CheckForNull
public <RequestT> OpenSearchRequestBodyBuffer prepareRequestBody(
protected <RequestT> OpenSearchRequestBodyBuffer prepareRequestBody(
RequestT request,
Endpoint<RequestT, ?, ?> endpoint,
TransportOptions options
Expand All @@ -321,7 +321,7 @@ public <RequestT> OpenSearchRequestBodyBuffer prepareRequestBody(
return null;
}

public <RequestT> SdkHttpFullRequest prepareRequest(
protected <RequestT> SdkHttpFullRequest prepareRequest(
RequestT request,
Endpoint<RequestT, ?, ?> endpoint,
@CheckForNull TransportOptions options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.opensearch.client.opensearch.indices.CreateIndexResponse;
import org.opensearch.client.opensearch.indices.OpenSearchIndicesClient;
import org.opensearch.client.transport.JsonEndpoint;
import org.opensearch.client.transport.aws.AwsSdk2Transport;
import org.opensearch.client.util.OpenSearchRequestBodyBuffer;
import software.amazon.awssdk.http.SdkHttpFullRequest;

Expand Down Expand Up @@ -162,7 +161,7 @@ public void testContentShaHeader() throws Exception {
CreateIndexRequest request = new CreateIndexRequest.Builder().index(TEST_INDEX).build();
JsonEndpoint<CreateIndexRequest, CreateIndexResponse, ErrorResponse> endpoint =
(JsonEndpoint<CreateIndexRequest, CreateIndexResponse, ErrorResponse>) CreateIndexRequest._ENDPOINT;
AwsSdk2Transport transport = new AwsSdk2Transport(
AwsSdk2TransportMock transport = new AwsSdk2TransportMock(
getHttpClient(),
getTestClusterHost(),
getTestClusterServiceName(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.client.opensearch.integTest.aws;

import org.opensearch.client.transport.Endpoint;
import org.opensearch.client.transport.TransportOptions;
import org.opensearch.client.transport.aws.AwsSdk2Transport;
import org.opensearch.client.transport.aws.AwsSdk2TransportOptions;
import org.opensearch.client.util.OpenSearchRequestBodyBuffer;
import software.amazon.awssdk.http.SdkHttpClient;
import software.amazon.awssdk.http.SdkHttpFullRequest;
import software.amazon.awssdk.regions.Region;

import java.io.IOException;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

public class AwsSdk2TransportMock extends AwsSdk2Transport {

public AwsSdk2TransportMock(
@Nonnull SdkHttpClient httpClient,
@Nonnull String host,
@Nonnull String signingServiceName,
@Nonnull Region signingRegion,
@CheckForNull AwsSdk2TransportOptions options) {
super(httpClient, null, host, signingServiceName, signingRegion, options);
}

@Override
public <RequestT> OpenSearchRequestBodyBuffer prepareRequestBody(RequestT request,
Endpoint<RequestT, ?, ?> endpoint, TransportOptions options) throws IOException {
return super.prepareRequestBody(request, endpoint, options);
}
@Override
public <RequestT> SdkHttpFullRequest prepareRequest(RequestT request, Endpoint<RequestT, ?, ?> endpoint,
TransportOptions options, OpenSearchRequestBodyBuffer body) {
return super.prepareRequest(request, endpoint, options, body);
}
}

0 comments on commit 8d74b0a

Please sign in to comment.