From 2880734dedc4644534b94bc42dbd59508e917647 Mon Sep 17 00:00:00 2001 From: dblock Date: Wed, 11 Jan 2023 18:04:03 -0500 Subject: [PATCH] Fix: responseCompression option. Signed-off-by: dblock --- CHANGELOG.md | 1 + .../aws/AwsSdk2TransportOptions.java | 1 + .../aws/AwsSdk2TransportOptionsTestCase.java | 24 +++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 java-client/src/test/java/org/opensearch/client/transport/aws/AwsSdk2TransportOptionsTestCase.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 07e7abc4de..d0475dc850 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Fixed - Make ChildrenAggregate as a SingleBucketAggregate ([#306](https://github.com/opensearch-project/opensearch-java/pull/306)) - Fix /_nodes/stats, /_nodes/info throwing serialization error ([#315](https://github.com/opensearch-project/opensearch-java/pull/315)) +- Fix AwsSdk2TransportOptions.responseCompression ([#322](https://github.com/opensearch-project/opensearch-java/pull/322)) ### Security diff --git a/java-client/src/main/java/org/opensearch/client/transport/aws/AwsSdk2TransportOptions.java b/java-client/src/main/java/org/opensearch/client/transport/aws/AwsSdk2TransportOptions.java index ef8eb0a738..187c1b69bd 100644 --- a/java-client/src/main/java/org/opensearch/client/transport/aws/AwsSdk2TransportOptions.java +++ b/java-client/src/main/java/org/opensearch/client/transport/aws/AwsSdk2TransportOptions.java @@ -173,6 +173,7 @@ class DefaultImpl extends TransportOptions.DefaultImpl implements AwsSdk2Transpo super(builder); credentials = builder.credentials; requestCompressionSize = builder.requestCompressionSize; + responseCompression = builder.responseCompression; mapper = builder.mapper; } diff --git a/java-client/src/test/java/org/opensearch/client/transport/aws/AwsSdk2TransportOptionsTestCase.java b/java-client/src/test/java/org/opensearch/client/transport/aws/AwsSdk2TransportOptionsTestCase.java new file mode 100644 index 0000000000..05b77ead26 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/transport/aws/AwsSdk2TransportOptionsTestCase.java @@ -0,0 +1,24 @@ +/* + * 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.transport.aws; + +import org.junit.Assert; +import org.junit.Test; + +public class AwsSdk2TransportOptionsTestCase extends Assert { + @Test + public void testBuilderResponseCompression() throws Exception { + AwsSdk2TransportOptions options = AwsSdk2TransportOptions.builder() + .setResponseCompression(true) + .setRequestCompressionSize(10) + .build(); + assertEquals(10, options.requestCompressionSize().intValue()); + assertTrue(options.responseCompression()); + } +}