From 081a17e61a4674779775bc8ab8c0b7397924c967 Mon Sep 17 00:00:00 2001 From: Andriy Redko Date: Tue, 2 Jan 2024 12:07:04 -0500 Subject: [PATCH] [Backport] [2.x] Restore support for Java 8 (#767) (#777) * Restore support for Java 8 (#767) * Restore support for Java 8 Signed-off-by: Andriy Redko * Address code review comments (update compatibility) Signed-off-by: Andriy Redko --------- Signed-off-by: Andriy Redko (cherry picked from commit ff5e0a2d5f04acb4c11c3217b6e8fc71161a2a4b) * Update build.gradle.kts to use OpenSearch 2.12.0-SNAPSHOT Signed-off-by: Andriy Redko --------- Signed-off-by: Andriy Redko --- .../workflows/test-integration-unreleased.yml | 1 + CHANGELOG.md | 1 + COMPATIBILITY.md | 2 +- java-client/build.gradle.kts | 46 ++++++++++++++- .../client/opensearch/cat/CatRequestBase.java | 4 +- .../client/transport/TransportOptions.java | 7 ++- .../transport/aws/AwsSdk2Transport.java | 58 ++++++++++++------- .../ApacheHttpClient5Transport.java | 10 +++- .../_types/mapping/KnnVectorMethodTest.java | 4 +- .../core/GetMappingsResponseTest.java | 40 ++++++------- .../opensearch/experiments/ParsingTests.java | 28 ++++----- .../integTest/aws/AwsSdk2BulkRequestIT.java | 4 +- .../integTest/aws/AwsSdk2SearchIT.java | 9 ++- .../aws/AwsSdk2TransportTestCase.java | 18 +++--- .../client/opensearch/model/EnumTest.java | 6 +- .../httpclient5/ResponseExceptionTest.java | 2 +- .../HeapBufferedAsyncEntityConsumerTest.java | 18 +++--- .../AbstractAggregationRequestIT.java | 0 .../integTest/AbstractCatClientIT.java | 0 .../integTest/AbstractClusterClientIT.java | 0 .../opensearch/integTest/AbstractCrudIT.java | 0 .../integTest/AbstractHighlightIT.java | 0 .../integTest/AbstractIndicesClientIT.java | 0 .../opensearch/integTest/AbstractKnnIT.java | 0 .../AbstractMultiSearchRequestIT.java | 0 .../opensearch/integTest/AbstractNodesIT.java | 0 .../integTest/AbstractPingAndInfoIT.java | 0 .../integTest/AbstractRequestIT.java | 0 .../integTest/AbstractSearchRequestIT.java | 0 .../AbstractSearchTemplateRequestIT.java | 0 .../OpenSearchJavaClientTestCase.java | 0 .../integTest/OpenSearchTransportSupport.java | 0 .../httpclient5/AggregationRequestIT.java | 0 .../integTest/httpclient5/CatIT.java | 0 .../httpclient5/ClusterClientIT.java | 0 .../integTest/httpclient5/CrudIT.java | 0 .../integTest/httpclient5/HighlightIT.java | 0 .../HttpClient5TransportSupport.java | 0 .../httpclient5/IndicesClientIT.java | 0 .../integTest/httpclient5/KnnIT.java | 0 .../httpclient5/MultiSearchRequestIT.java | 0 .../integTest/httpclient5/NodesIT.java | 0 .../integTest/httpclient5/PingAndInfoIT.java | 0 .../integTest/httpclient5/RequestIT.java | 0 .../httpclient5/SearchRequestIT.java | 0 .../httpclient5/SearchTemplateRequestIT.java | 0 .../restclient/AggregationRequestIT.java | 0 .../integTest/restclient/CatIT.java | 0 .../integTest/restclient/ClusterClientIT.java | 0 .../integTest/restclient/CrudIT.java | 0 .../integTest/restclient/HighlightIT.java | 0 .../integTest/restclient/IndicesClientIT.java | 0 .../integTest/restclient/KnnIT.java | 0 .../restclient/MultiSearchRequestIT.java | 0 .../integTest/restclient/NodesIT.java | 0 .../integTest/restclient/PingAndInfoIT.java | 0 .../integTest/restclient/RequestIT.java | 0 .../integTest/restclient/SearchRequestIT.java | 0 .../restclient/SearchTemplateRequestIT.java | 0 .../client/transport/RequestOptionsTest.java | 0 60 files changed, 163 insertions(+), 95 deletions(-) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractAggregationRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractCatClientIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractCrudIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractHighlightIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractIndicesClientIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractKnnIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractMultiSearchRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractNodesIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractPingAndInfoIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractSearchRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/OpenSearchJavaClientTestCase.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/OpenSearchTransportSupport.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/AggregationRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/CatIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/ClusterClientIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/CrudIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/HighlightIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/HttpClient5TransportSupport.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/IndicesClientIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/KnnIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/MultiSearchRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/NodesIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/PingAndInfoIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/RequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/SearchRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/httpclient5/SearchTemplateRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/AggregationRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/CatIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/ClusterClientIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/CrudIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/HighlightIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/IndicesClientIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/KnnIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/MultiSearchRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/NodesIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/PingAndInfoIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/RequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/SearchRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/opensearch/integTest/restclient/SearchTemplateRequestIT.java (100%) rename java-client/src/test/{java => java11}/org/opensearch/client/transport/RequestOptionsTest.java (100%) diff --git a/.github/workflows/test-integration-unreleased.yml b/.github/workflows/test-integration-unreleased.yml index 8cee43c124..2c0d59a450 100644 --- a/.github/workflows/test-integration-unreleased.yml +++ b/.github/workflows/test-integration-unreleased.yml @@ -18,6 +18,7 @@ jobs: - { opensearch_ref: '1.x', java: 11 } - { opensearch_ref: '2.x', java: 11 } - { opensearch_ref: '2.x', java: 17 } + - { opensearch_ref: '2.x', java: 21 } - { opensearch_ref: 'main', java: 11 } - { opensearch_ref: 'main', java: 17 } - { opensearch_ref: 'main', java: 21 } diff --git a/CHANGELOG.md b/CHANGELOG.md index 12292bac0a..160ac76496 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bumps `org.apache.httpcomponents.client5:httpclient5` from 5.2.1 to 5.3 ### Changed +- Restore support for Java 8 ([#767](https://github.com/opensearch-project/opensearch-java/pull/767)) ### Deprecated diff --git a/COMPATIBILITY.md b/COMPATIBILITY.md index f439c8060e..bdab6cc899 100644 --- a/COMPATIBILITY.md +++ b/COMPATIBILITY.md @@ -19,7 +19,7 @@ The below matrix shows the compatibility of the [`opensearch-java-client`](https | Client Version | JDK | |----------------|--------------------| | 1.0.0 | 8 | -| 2.x.0 | 11 / 17 / 21 | +| 2.x.0 | 8 / 11 / 17 / 21 | ## Upgrading diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index cdf6a8eef9..a4a67c789b 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -61,8 +61,8 @@ configurations { } java { - targetCompatibility = JavaVersion.VERSION_11 - sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_8 withJavadocJar() withSourcesJar() @@ -146,15 +146,20 @@ val integrationTest = task("integrationTest") { System.getProperty("tests.awsSdk2support.domainRegion", "us-east-1")) } +val opensearchVersion = "2.12.0-SNAPSHOT" + dependencies { - val opensearchVersion = "2.7.0" val jacksonVersion = "2.15.2" val jacksonDatabindVersion = "2.15.2" // Apache 2.0 implementation("org.opensearch.client", "opensearch-rest-client", opensearchVersion) testImplementation("org.opensearch.test", "framework", opensearchVersion) + testImplementation("org.hamcrest:hamcrest:2.2") + testImplementation("com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.1") { + exclude(group = "junit") + } // Apache 2.0 // https://search.maven.org/artifact/com.google.code.findbugs/jsr305 @@ -327,3 +332,38 @@ publishing { } } } + +if (JavaVersion.current() >= JavaVersion.VERSION_11) { + val java11: SourceSet = sourceSets.create("java11") { + java { + compileClasspath += sourceSets.main.get().output + sourceSets.test.get().output + runtimeClasspath += sourceSets.main.get().output + sourceSets.test.get().output + srcDir("src/test/java11") + } + } + + configurations[java11.implementationConfigurationName].extendsFrom(configurations.testImplementation.get()) + configurations[java11.runtimeOnlyConfigurationName].extendsFrom(configurations.testRuntimeOnly.get()) + + dependencies { + testImplementation("org.opensearch.test", "framework", opensearchVersion) { + exclude(group = "org.hamcrest") + } + } + + tasks.named("compileJava11Java") { + targetCompatibility = JavaVersion.VERSION_11.toString() + sourceCompatibility = JavaVersion.VERSION_11.toString() + } + + tasks.named("compileTestJava") { + targetCompatibility = JavaVersion.VERSION_11.toString() + sourceCompatibility = JavaVersion.VERSION_11.toString() + } + + tasks.test { + testClassesDirs += java11.output.classesDirs + classpath = sourceSets["java11"].runtimeClasspath + } + +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/CatRequestBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/CatRequestBase.java index 92372d2693..173ddb1f49 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/CatRequestBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/CatRequestBase.java @@ -61,10 +61,10 @@ public CatRequestBase(CatRequestBaseBuilder builder) { protected final Map queryParameters() { Map params = new HashMap<>(); - if (headers != null && !headers.isBlank()) { + if (headers != null && !headers.trim().isEmpty()) { params.put("h", headers); } - if (sort != null && !sort.isBlank()) { + if (sort != null && !sort.trim().isEmpty()) { params.put("s", sort); } params.put("format", "json"); diff --git a/java-client/src/main/java/org/opensearch/client/transport/TransportOptions.java b/java-client/src/main/java/org/opensearch/client/transport/TransportOptions.java index 18c9d51065..a2223447a1 100644 --- a/java-client/src/main/java/org/opensearch/client/transport/TransportOptions.java +++ b/java-client/src/main/java/org/opensearch/client/transport/TransportOptions.java @@ -32,6 +32,7 @@ package org.opensearch.client.transport; +import java.util.AbstractMap; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -98,7 +99,7 @@ public Builder addHeader(String name, String value) { if (headers.isEmpty()) { headers = new ArrayList<>(); } - headers.add(Map.entry(name, value)); + headers.add(new AbstractMap.SimpleEntry<>(name, value)); return this; } @@ -135,8 +136,8 @@ class DefaultImpl implements TransportOptions { private final Function, Boolean> onWarnings; protected DefaultImpl(BuilderImpl builder) { - this.headers = builder.headers.isEmpty() ? Collections.emptyList() : List.copyOf(builder.headers); - this.params = builder.queryParameters.isEmpty() ? Collections.emptyMap() : Map.copyOf(builder.queryParameters); + this.headers = builder.headers.isEmpty() ? Collections.emptyList() : new ArrayList<>(builder.headers); + this.params = builder.queryParameters.isEmpty() ? Collections.emptyMap() : new HashMap<>(builder.queryParameters); this.onWarnings = builder.onWarnings; } diff --git a/java-client/src/main/java/org/opensearch/client/transport/aws/AwsSdk2Transport.java b/java-client/src/main/java/org/opensearch/client/transport/aws/AwsSdk2Transport.java index 2e4145f3bb..2269b8e13b 100644 --- a/java-client/src/main/java/org/opensearch/client/transport/aws/AwsSdk2Transport.java +++ b/java-client/src/main/java/org/opensearch/client/transport/aws/AwsSdk2Transport.java @@ -13,16 +13,17 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; +import java.util.function.Supplier; import java.util.zip.GZIPInputStream; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; @@ -261,11 +262,12 @@ private OpenSearchRequestBodyBuffer prepareRequestBody( .map(o -> o instanceof AwsSdk2TransportOptions ? ((AwsSdk2TransportOptions) o) : null) .map(AwsSdk2TransportOptions::mapper) .orElse(defaultMapper); - final int maxUncompressedSize = Optional.ofNullable(options) - .map(o -> o instanceof AwsSdk2TransportOptions ? ((AwsSdk2TransportOptions) o) : null) - .map(AwsSdk2TransportOptions::requestCompressionSize) - .or(() -> Optional.ofNullable(transportOptions.requestCompressionSize())) - .orElse(DEFAULT_REQUEST_COMPRESSION_SIZE); + final int maxUncompressedSize = or( + Optional.ofNullable(options) + .map(o -> o instanceof AwsSdk2TransportOptions ? ((AwsSdk2TransportOptions) o) : null) + .map(AwsSdk2TransportOptions::requestCompressionSize), + () -> Optional.ofNullable(transportOptions.requestCompressionSize()) + ).orElse(DEFAULT_REQUEST_COMPRESSION_SIZE); OpenSearchRequestBodyBuffer buffer = new OpenSearchRequestBodyBuffer(mapper, maxUncompressedSize); buffer.addContent(request); @@ -280,7 +282,7 @@ private SdkHttpFullRequest prepareRequest( Endpoint endpoint, @CheckForNull TransportOptions options, @CheckForNull OpenSearchRequestBodyBuffer body - ) { + ) throws UnsupportedEncodingException { SdkHttpFullRequest.Builder req = SdkHttpFullRequest.builder().method(SdkHttpMethod.fromValue(endpoint.method(request))); StringBuilder url = new StringBuilder(); @@ -293,9 +295,9 @@ private SdkHttpFullRequest prepareRequest( Map params = endpoint.queryParameters(request); if (params != null && !params.isEmpty()) { char sep = '?'; - for (var ent : params.entrySet()) { + for (Map.Entry ent : params.entrySet()) { url.append(sep).append(ent.getKey()).append('='); - url.append(URLEncoder.encode(ent.getValue(), StandardCharsets.UTF_8)); + url.append(URLEncoder.encode(ent.getValue(), "UTF-8")); sep = '&'; } } @@ -321,22 +323,24 @@ private SdkHttpFullRequest prepareRequest( req.putHeader("x-amz-content-sha256", "required"); } - boolean responseCompression = Optional.ofNullable(options) - .map(o -> o instanceof AwsSdk2TransportOptions ? ((AwsSdk2TransportOptions) o) : null) - .map(AwsSdk2TransportOptions::responseCompression) - .or(() -> Optional.ofNullable(transportOptions.responseCompression())) - .orElse(Boolean.TRUE); + boolean responseCompression = or( + Optional.ofNullable(options) + .map(o -> o instanceof AwsSdk2TransportOptions ? ((AwsSdk2TransportOptions) o) : null) + .map(AwsSdk2TransportOptions::responseCompression), + () -> Optional.ofNullable(transportOptions.responseCompression()) + ).orElse(Boolean.TRUE); if (responseCompression) { req.putHeader("Accept-Encoding", "gzip"); } else { req.removeHeader("Accept-Encoding"); } - final AwsCredentialsProvider credentials = Optional.ofNullable(options) - .map(o -> o instanceof AwsSdk2TransportOptions ? ((AwsSdk2TransportOptions) o) : null) - .map(AwsSdk2TransportOptions::credentials) - .or(() -> Optional.ofNullable(transportOptions.credentials())) - .orElse(DefaultCredentialsProvider.create()); + final AwsCredentialsProvider credentials = or( + Optional.ofNullable(options) + .map(o -> o instanceof AwsSdk2TransportOptions ? ((AwsSdk2TransportOptions) o) : null) + .map(AwsSdk2TransportOptions::credentials), + () -> Optional.ofNullable(transportOptions.credentials()) + ).orElse(DefaultCredentialsProvider.create()); Aws4SignerParams signerParams = Aws4SignerParams.builder() .awsCredentials(credentials.resolveCredentials()) @@ -346,7 +350,7 @@ private SdkHttpFullRequest prepareRequest( return Aws4Signer.create().sign(req.build(), signerParams); } - private void applyOptionsParams(StringBuilder url, TransportOptions options) { + private void applyOptionsParams(StringBuilder url, TransportOptions options) throws UnsupportedEncodingException { if (options == null) { return; } @@ -355,7 +359,7 @@ private void applyOptionsParams(StringBuilder url, TransportOptions options) { char sep = url.indexOf("?") < 0 ? '?' : '&'; for (Map.Entry param : params.entrySet()) { url.append(sep).append(param.getKey()).append('='); - url.append(URLEncoder.encode(param.getValue(), StandardCharsets.UTF_8)); + url.append(URLEncoder.encode(param.getValue(), "UTF-8")); sep = '?'; } } @@ -524,4 +528,16 @@ private ResponseT parseResponse( } } } + + private static Optional or(Optional opt, Supplier> supplier) { + Objects.requireNonNull(opt); + Objects.requireNonNull(supplier); + if (opt.isPresent()) { + return opt; + } else { + @SuppressWarnings("unchecked") + Optional r = (Optional) supplier.get(); + return Objects.requireNonNull(r); + } + } } diff --git a/java-client/src/main/java/org/opensearch/client/transport/httpclient5/ApacheHttpClient5Transport.java b/java-client/src/main/java/org/opensearch/client/transport/httpclient5/ApacheHttpClient5Transport.java index c4142d7f85..28be09ae05 100644 --- a/java-client/src/main/java/org/opensearch/client/transport/httpclient5/ApacheHttpClient5Transport.java +++ b/java-client/src/main/java/org/opensearch/client/transport/httpclient5/ApacheHttpClient5Transport.java @@ -932,9 +932,15 @@ public long getContentLength() { if (chunkedEnabled.get()) { return -1L; } else { - long size; + long size = 0; + final byte[] buf = new byte[8192]; + int nread = 0; + try (InputStream is = getContent()) { - size = is.readAllBytes().length; + // read to EOF which may read more or less than buffer size + while ((nread = is.read(buf)) > 0) { + size += nread; + } } catch (IOException ex) { size = -1L; } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/mapping/KnnVectorMethodTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/mapping/KnnVectorMethodTest.java index 538eef9d15..abe3e5812a 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/_types/mapping/KnnVectorMethodTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/mapping/KnnVectorMethodTest.java @@ -12,7 +12,7 @@ import jakarta.json.stream.JsonParser; import java.io.StringReader; -import java.util.Map; +import java.util.Collections; import junit.framework.TestCase; import org.junit.Test; import org.opensearch.client.json.JsonData; @@ -30,7 +30,7 @@ public void testCreateKnnVectorMethodWithAll() { KnnVectorMethod knnVectorMethod = new KnnVectorMethod.Builder().name("hnsw") .spaceType("l2") .engine("nmslib") - .parameters(Map.of("ef_construction", JsonData.of(128))) + .parameters(Collections.singletonMap("ef_construction", JsonData.of(128))) .build(); assertEquals("hnsw", knnVectorMethod.name()); assertEquals("l2", knnVectorMethod.spaceType()); diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/GetMappingsResponseTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/GetMappingsResponseTest.java index 9f72b6cca0..38f0f3fe31 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/core/GetMappingsResponseTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/GetMappingsResponseTest.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.json.stream.JsonParser; import java.io.StringReader; import java.util.Collections; import java.util.HashMap; @@ -12,7 +13,9 @@ import org.opensearch.client.json.jsonb.JsonbJsonpMapper; import org.opensearch.client.opensearch._types.mapping.IcuCollationKeywordProperty; import org.opensearch.client.opensearch._types.mapping.Property; +import org.opensearch.client.opensearch._types.mapping.TypeMapping; import org.opensearch.client.opensearch.indices.GetTemplateResponse; +import org.opensearch.client.opensearch.indices.TemplateMapping; public class GetMappingsResponseTest extends Assert { @@ -36,32 +39,27 @@ public void deserialize_IcuCollationKeywordExists_propertyDeserializes() throws icuCollationConfig.put("strength", "quaternary"); icuCollationConfig.put("variable_top", "$"); - mappingTemplate.put( - "test-index", - Map.of( - "aliases", - Collections.emptyMap(), - "index_patterns", - Collections.singletonList("test-pattern*"), - "mappings", - Map.of("properties", Map.of("icu_test_field", icuCollationConfig)), - "order", - 0, - "settings", - Collections.emptyMap(), - "version", - 1 - ) + final Map mappingTemplateMap = new HashMap<>(); + mappingTemplateMap.put("aliases", Collections.emptyMap()); + mappingTemplateMap.put("index_patterns", Collections.singletonList("test-pattern*")); + mappingTemplateMap.put( + "mappings", + Collections.singletonMap("properties", Collections.singletonMap("icu_test_field", icuCollationConfig)) ); + mappingTemplateMap.put("order", 0); + mappingTemplateMap.put("settings", Collections.emptyMap()); + mappingTemplateMap.put("version", 1); + mappingTemplate.put("test-index", mappingTemplateMap); + final JsonpMapper mapper = new JsonbJsonpMapper(); final String indexTemplate = new ObjectMapper().writeValueAsString(mappingTemplate); - final var parser = mapper.jsonProvider().createParser(new StringReader(indexTemplate)); + final JsonParser parser = mapper.jsonProvider().createParser(new StringReader(indexTemplate)); final GetTemplateResponse response = GetTemplateResponse._DESERIALIZER.deserialize(parser, mapper); - final var template = response.get("test-index"); - final var mappings = template.mappings(); - final var properties = mappings.properties(); - final var property = properties.get("icu_test_field"); + final TemplateMapping template = response.get("test-index"); + final TypeMapping mappings = template.mappings(); + final Map properties = mappings.properties(); + final Property property = properties.get("icu_test_field"); final IcuCollationKeywordProperty icu = property.icuCollationKeyword(); assertEquals(property._kind(), Property.Kind.IcuCollationKeyword); diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/experiments/ParsingTests.java b/java-client/src/test/java/org/opensearch/client/opensearch/experiments/ParsingTests.java index ab46a8418d..6963f82f89 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/experiments/ParsingTests.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/experiments/ParsingTests.java @@ -32,7 +32,7 @@ package org.opensearch.client.opensearch.experiments; -import java.util.List; +import java.util.Arrays; import java.util.Map; import org.junit.Test; import org.opensearch.client.opensearch._types.Time; @@ -76,13 +76,13 @@ public void testFoo() { @Test public void testIndexSettingsTranslogOptionsParsing() { - var indexSettings = IndexSettings.of( + final IndexSettings indexSettings = IndexSettings.of( _1 -> _1.translog( Translog.of(tr -> tr.syncInterval(Time.of(t -> t.time("10s"))).durability("async").flushThresholdSize("256mb")) ) ); - var str = toJson(indexSettings); + final String str = toJson(indexSettings); assertEquals("{\"translog\":{\"durability\":\"async\",\"flush_threshold_size\":\"256mb\"," + "\"sync_interval\":\"10s\"}}", str); IndexSettings deserialized = fromJson(str, IndexSettings._DESERIALIZER); @@ -90,7 +90,7 @@ public void testIndexSettingsTranslogOptionsParsing() { assertEquals(indexSettings.translog().durability(), deserialized.translog().durability()); assertEquals(indexSettings.translog().flushThresholdSize(), deserialized.translog().flushThresholdSize()); - var deprecatedForm = "{\"translog\":{\"sync_interval\":\"10s\"},\"translog.durability\":\"async\",\"translog" + final String deprecatedForm = "{\"translog\":{\"sync_interval\":\"10s\"},\"translog.durability\":\"async\",\"translog" + ".flush_threshold_size\":\"256mb\"}"; IndexSettings deprecatedDeserialized = fromJson(deprecatedForm, IndexSettings._DESERIALIZER); assertEquals(indexSettings.translog().syncInterval().time(), deprecatedDeserialized.translog().syncInterval().time()); @@ -101,7 +101,7 @@ public void testIndexSettingsTranslogOptionsParsing() { @Test public void testIndexSettingsMappingParsing() { - var mapping = IndexSettingsMapping.of( + final IndexSettingsMapping mapping = IndexSettingsMapping.of( b -> b.totalFields(d -> d.limit(1L)) .depth(d -> d.limit(2L)) .nestedFields(d -> d.limit(3L)) @@ -109,14 +109,14 @@ public void testIndexSettingsMappingParsing() { .fieldNameLength(d -> d.limit(5L)) ); - var str = toJson(mapping); + final String str = toJson(mapping); assertEquals( "{\"total_fields\":{\"limit\":1},\"depth\":{\"limit\":2},\"nested_fields\":{\"limit\":3}," + "\"nested_objects\":{\"limit\":4},\"field_name_length\":{\"limit\":5}}", str ); - var deserialized = fromJson(str, IndexSettingsMapping._DESERIALIZER); + final IndexSettingsMapping deserialized = fromJson(str, IndexSettingsMapping._DESERIALIZER); assertEquals(mapping.totalFields().limit(), deserialized.totalFields().limit()); assertEquals(mapping.depth().limit(), deserialized.depth().limit()); assertEquals(mapping.nestedFields().limit(), deserialized.nestedFields().limit()); @@ -159,7 +159,7 @@ public void testSmartcn_StopFilter() { @Test public void testCjk_Analyzer() { - final Analyzer analyzer = new Analyzer.Builder().cjk(b -> b.stopwords(List.of("a", "b", "c")).stopwordsPath("path")).build(); + final Analyzer analyzer = new Analyzer.Builder().cjk(b -> b.stopwords(Arrays.asList("a", "b", "c")).stopwordsPath("path")).build(); assertTrue(analyzer.isCjk()); @@ -280,7 +280,7 @@ public void testTermvectorsResponseOptionals() { @Test public void testIndexSettingsIndexing() { - var indexing = IndexSettingsIndexing.of( + final IndexSettingsIndexing indexing = IndexSettingsIndexing.of( is -> is.slowlog( s -> s.level("info") .source(0) @@ -295,14 +295,14 @@ public void testIndexSettingsIndexing() { ) ); - var str = toJson(indexing); + final String str = toJson(indexing); assertEquals( "{\"slowlog\":{\"level\":\"info\",\"source\":0,\"threshold\":{\"index\":{" + "\"warn\":\"5000ms\",\"info\":\"1000ms\",\"debug\":\"500ms\",\"trace\":\"200ms\"}}}}", str ); - var deserialized = fromJson(str, IndexSettingsIndexing._DESERIALIZER); + final IndexSettingsIndexing deserialized = fromJson(str, IndexSettingsIndexing._DESERIALIZER); assertEquals(indexing.slowlog().level(), deserialized.slowlog().level()); assertEquals(indexing.slowlog().source(), deserialized.slowlog().source()); assertEquals(indexing.slowlog().threshold().index().debug().time(), deserialized.slowlog().threshold().index().debug().time()); @@ -315,7 +315,7 @@ public void testIndexSettingsIndexing() { @Test public void testIndexSettingsSearch() { - var search = IndexSettingsSearch.of( + final IndexSettingsSearch search = IndexSettingsSearch.of( is -> is.slowlog( s -> s.level("info") .threshold( @@ -335,7 +335,7 @@ public void testIndexSettingsSearch() { ).idle(id -> id.after(a -> a.time("5s"))) ); - var str = toJson(search); + final String str = toJson(search); assertEquals( "{\"idle\":{\"after\":\"5s\"},\"slowlog\":{\"level\":\"info\"," + "\"threshold\":{\"query\":{\"warn\":\"5000ms\",\"info\":\"1000ms\",\"debug\":\"500ms\"," @@ -344,7 +344,7 @@ public void testIndexSettingsSearch() { str ); - var deserialized = fromJson(str, IndexSettingsSearch._DESERIALIZER); + final IndexSettingsSearch deserialized = fromJson(str, IndexSettingsSearch._DESERIALIZER); assertEquals(search.slowlog().level(), deserialized.slowlog().level()); assertEquals(search.slowlog().threshold().query().debug().time(), deserialized.slowlog().threshold().query().debug().time()); assertEquals(search.slowlog().threshold().query().info().time(), deserialized.slowlog().threshold().query().info().time()); diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2BulkRequestIT.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2BulkRequestIT.java index 759909cddb..c49277182d 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2BulkRequestIT.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2BulkRequestIT.java @@ -9,7 +9,7 @@ package org.opensearch.client.opensearch.integTest.aws; import java.util.ArrayList; -import java.util.List; +import java.util.Collections; import org.junit.Assert; import org.junit.Test; import org.opensearch.client.opensearch.OpenSearchClient; @@ -43,7 +43,7 @@ public void testBulkRequest() throws Exception { Query query = Query.of(qb -> qb.match(mb -> mb.field("title").query(fv -> fv.stringValue("Document")))); final SearchRequest.Builder searchReq = new SearchRequest.Builder().allowPartialSearchResults(false) - .index(List.of(TEST_INDEX)) + .index(Collections.singletonList(TEST_INDEX)) .size(10) .source(sc -> sc.fetch(false)) .ignoreThrottled(false) diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2SearchIT.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2SearchIT.java index 343c1f18d1..7ec5b1f654 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2SearchIT.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2SearchIT.java @@ -8,6 +8,7 @@ package org.opensearch.client.opensearch.integTest.aws; +import java.util.Arrays; import java.util.List; import java.util.concurrent.CompletableFuture; import org.junit.Assert; @@ -90,7 +91,7 @@ void testClientAsync(boolean async) throws Exception { CompletableFuture> r1 = query(client, "NotPresent", null); CompletableFuture> r2 = query(client, "Document", null); CompletableFuture> r3 = query(client, "1", null); - return CompletableFuture.allOf(r1, r2, r3).thenApply(u2 -> List.of(r1.getNow(null), r2.getNow(null), r3.getNow(null))); + return CompletableFuture.allOf(r1, r2, r3).thenApply(u2 -> Arrays.asList(r1.getNow(null), r2.getNow(null), r3.getNow(null))); }).get(); SearchResponse response = results.get(0); @@ -114,7 +115,9 @@ private CompletableFuture addDoc(OpenSearchAsyncClient client, St try { return client.index(req.build()); } catch (Exception e) { - return CompletableFuture.failedFuture(e); + final CompletableFuture failed = new CompletableFuture<>(); + failed.completeExceptionally(e); + return failed; } } @@ -124,7 +127,7 @@ public void testDoubleWrappedException() throws Exception { resetTestIndex(false); // attempt to create the same index a second time OpenSearchIndicesClient client = getIndexesClient(false, null, null); - var req = new CreateIndexRequest.Builder().index(TEST_INDEX); + final CreateIndexRequest.Builder req = new CreateIndexRequest.Builder().index(TEST_INDEX); Exception exception = Assert.assertThrows(OpenSearchException.class, () -> { client.create(req.build()); }); // error message contains the actual error, not a generic [http_exception] Assert.assertTrue(exception.getMessage().contains("[resource_already_exists_exception]")); diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2TransportTestCase.java b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2TransportTestCase.java index a1ec172c41..79c4985b81 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2TransportTestCase.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/integTest/aws/AwsSdk2TransportTestCase.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.io.IOException; -import java.util.List; +import java.util.Collections; import java.util.Objects; import java.util.concurrent.CompletableFuture; import javax.annotation.CheckForNull; @@ -209,14 +209,14 @@ public void resetTestIndex(boolean async) throws Exception { } } if (indexExists) { - client.delete(b -> b.index(List.of(TEST_INDEX))); + client.delete(b -> b.index(Collections.singletonList(TEST_INDEX))); } - var req = new CreateIndexRequest.Builder().index(TEST_INDEX); + final CreateIndexRequest.Builder req = new CreateIndexRequest.Builder().index(TEST_INDEX); client.create(req.build()); } protected SearchResponse query(OpenSearchClient client, String title, String text) throws Exception { - var query = Query.of(qb -> { + final Query query = Query.of(qb -> { if (title != null) { qb.match(mb -> mb.field("title").query(vb -> vb.stringValue(title))); } @@ -226,7 +226,7 @@ protected SearchResponse query(OpenSearchClient client, String title return qb; }); final SearchRequest.Builder req = new SearchRequest.Builder().allowPartialSearchResults(false) - .index(List.of(TEST_INDEX)) + .index(Collections.singletonList(TEST_INDEX)) .size(10) .ignoreThrottled(false) .sort( @@ -239,7 +239,7 @@ protected SearchResponse query(OpenSearchClient client, String title } protected CompletableFuture> query(OpenSearchAsyncClient client, String title, String text) { - var query = Query.of(qb -> { + Query query = Query.of(qb -> { if (title != null) { qb.match(mb -> mb.field("title").query(vb -> vb.stringValue(title))); } @@ -249,7 +249,7 @@ protected CompletableFuture> query(OpenSearchAsyncCli return qb; }); final SearchRequest.Builder req = new SearchRequest.Builder().allowPartialSearchResults(false) - .index(List.of(TEST_INDEX)) + .index(Collections.singletonList(TEST_INDEX)) .size(10) .ignoreThrottled(false) .sort( @@ -261,7 +261,9 @@ protected CompletableFuture> query(OpenSearchAsyncCli try { return client.search(req.build(), SimplePojo.class); } catch (Exception e) { - return CompletableFuture.failedFuture(e); + final CompletableFuture> failed = new CompletableFuture<>(); + failed.completeExceptionally(e); + return failed; } } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/model/EnumTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/model/EnumTest.java index f16f0795a8..adbe18465c 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/model/EnumTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/model/EnumTest.java @@ -58,13 +58,13 @@ public void testEnumWithAliases() { @Test public void testEnumWithBooleanSupport() { - var booleanAsString = fromJson("\"true\"", DynamicMapping.class); + DynamicMapping booleanAsString = fromJson("\"true\"", DynamicMapping.class); assertEquals(booleanAsString, DynamicMapping.True); - var nonBooleanEnumValue = fromJson("\"runtime\"", DynamicMapping.class); + DynamicMapping nonBooleanEnumValue = fromJson("\"runtime\"", DynamicMapping.class); assertEquals(nonBooleanEnumValue, DynamicMapping.Runtime); - var booleanPrimitive = fromJson("false", DynamicMapping.class); + DynamicMapping booleanPrimitive = fromJson("false", DynamicMapping.class); assertEquals(booleanPrimitive, DynamicMapping.False); } } diff --git a/java-client/src/test/java/org/opensearch/client/transport/httpclient5/ResponseExceptionTest.java b/java-client/src/test/java/org/opensearch/client/transport/httpclient5/ResponseExceptionTest.java index 41de5ee77e..9f8084ca1f 100644 --- a/java-client/src/test/java/org/opensearch/client/transport/httpclient5/ResponseExceptionTest.java +++ b/java-client/src/test/java/org/opensearch/client/transport/httpclient5/ResponseExceptionTest.java @@ -15,7 +15,7 @@ public class ResponseExceptionTest { @Test public void testStatus() throws IOException { - final var response = this.buildResponseException(HttpStatus.SC_BAD_REQUEST); + final ResponseException response = this.buildResponseException(HttpStatus.SC_BAD_REQUEST); assertThat(response.status(), equalTo(HttpStatus.SC_BAD_REQUEST)); } diff --git a/java-client/src/test/java/org/opensearch/client/transport/httpclient5/internal/HeapBufferedAsyncEntityConsumerTest.java b/java-client/src/test/java/org/opensearch/client/transport/httpclient5/internal/HeapBufferedAsyncEntityConsumerTest.java index 283a7acd8b..e1b042825d 100644 --- a/java-client/src/test/java/org/opensearch/client/transport/httpclient5/internal/HeapBufferedAsyncEntityConsumerTest.java +++ b/java-client/src/test/java/org/opensearch/client/transport/httpclient5/internal/HeapBufferedAsyncEntityConsumerTest.java @@ -36,39 +36,39 @@ public void tearDown() { @Test public void testConsumerAllocatesBufferLimit() throws IOException { - consumer.consume(randomByteBufferOfLength(1000).flip()); + consumer.consume((ByteBuffer) randomByteBufferOfLength(1000).flip()); assertThat(consumer.getBuffer().capacity(), equalTo(1000)); } @Test public void testConsumerAllocatesEmptyBuffer() throws IOException { - consumer.consume(ByteBuffer.allocate(0).flip()); + consumer.consume((ByteBuffer) ByteBuffer.allocate(0).flip()); assertThat(consumer.getBuffer().capacity(), equalTo(0)); } @Test public void testConsumerExpandsBufferLimits() throws IOException { - consumer.consume(randomByteBufferOfLength(1000).flip()); - consumer.consume(randomByteBufferOfLength(2000).flip()); - consumer.consume(randomByteBufferOfLength(3000).flip()); + consumer.consume((ByteBuffer) randomByteBufferOfLength(1000).flip()); + consumer.consume((ByteBuffer) randomByteBufferOfLength(2000).flip()); + consumer.consume((ByteBuffer) randomByteBufferOfLength(3000).flip()); assertThat(consumer.getBuffer().capacity(), equalTo(6000)); } @Test public void testConsumerAllocatesLimit() throws IOException { - consumer.consume(randomByteBufferOfLength(BUFFER_LIMIT).flip()); + consumer.consume((ByteBuffer) randomByteBufferOfLength(BUFFER_LIMIT).flip()); assertThat(consumer.getBuffer().capacity(), equalTo(BUFFER_LIMIT)); } @Test public void testConsumerFailsToAllocateOverLimit() throws IOException { - assertThrows(ContentTooLongException.class, () -> consumer.consume(randomByteBufferOfLength(BUFFER_LIMIT + 1).flip())); + assertThrows(ContentTooLongException.class, () -> consumer.consume((ByteBuffer) randomByteBufferOfLength(BUFFER_LIMIT + 1).flip())); } @Test public void testConsumerFailsToExpandOverLimit() throws IOException { - consumer.consume(randomByteBufferOfLength(BUFFER_LIMIT).flip()); - assertThrows(ContentTooLongException.class, () -> consumer.consume(randomByteBufferOfLength(1).flip())); + consumer.consume((ByteBuffer) randomByteBufferOfLength(BUFFER_LIMIT).flip()); + assertThrows(ContentTooLongException.class, () -> consumer.consume((ByteBuffer) randomByteBufferOfLength(1).flip())); } private static ByteBuffer randomByteBufferOfLength(int length) { diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractAggregationRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractAggregationRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractAggregationRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractAggregationRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractCatClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractCatClientIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractCatClientIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractCatClientIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractCrudIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractCrudIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractCrudIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractCrudIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractHighlightIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractHighlightIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractHighlightIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractHighlightIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractIndicesClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractIndicesClientIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractIndicesClientIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractIndicesClientIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractKnnIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractKnnIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractKnnIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractKnnIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractMultiSearchRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractMultiSearchRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractMultiSearchRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractMultiSearchRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractNodesIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractNodesIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractNodesIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractNodesIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractPingAndInfoIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractPingAndInfoIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractPingAndInfoIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractPingAndInfoIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractSearchRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractSearchRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractSearchRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractSearchRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractSearchTemplateRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/OpenSearchJavaClientTestCase.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/OpenSearchJavaClientTestCase.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/OpenSearchJavaClientTestCase.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/OpenSearchJavaClientTestCase.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/OpenSearchTransportSupport.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/OpenSearchTransportSupport.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/OpenSearchTransportSupport.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/OpenSearchTransportSupport.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/AggregationRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/AggregationRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/AggregationRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/AggregationRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/CatIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/CatIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/CatIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/CatIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/ClusterClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/ClusterClientIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/ClusterClientIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/ClusterClientIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/CrudIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/CrudIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/CrudIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/CrudIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/HighlightIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/HighlightIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/HighlightIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/HighlightIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/HttpClient5TransportSupport.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/HttpClient5TransportSupport.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/HttpClient5TransportSupport.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/HttpClient5TransportSupport.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/IndicesClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/IndicesClientIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/IndicesClientIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/IndicesClientIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/KnnIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/KnnIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/KnnIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/KnnIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/MultiSearchRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/MultiSearchRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/MultiSearchRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/MultiSearchRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/NodesIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/NodesIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/NodesIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/NodesIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/PingAndInfoIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/PingAndInfoIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/PingAndInfoIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/PingAndInfoIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/RequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/RequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/RequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/RequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/SearchRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/SearchRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/SearchRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/SearchRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/SearchTemplateRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/SearchTemplateRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/httpclient5/SearchTemplateRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/SearchTemplateRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/AggregationRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/AggregationRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/AggregationRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/AggregationRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/CatIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/CatIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/CatIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/CatIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/ClusterClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/ClusterClientIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/ClusterClientIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/ClusterClientIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/CrudIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/CrudIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/CrudIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/CrudIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/HighlightIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/HighlightIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/HighlightIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/HighlightIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/IndicesClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/IndicesClientIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/IndicesClientIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/IndicesClientIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/KnnIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/KnnIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/KnnIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/KnnIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/MultiSearchRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/MultiSearchRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/MultiSearchRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/MultiSearchRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/NodesIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/NodesIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/NodesIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/NodesIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/PingAndInfoIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/PingAndInfoIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/PingAndInfoIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/PingAndInfoIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/RequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/RequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/RequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/RequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/SearchRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/SearchRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/SearchRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/SearchRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/SearchTemplateRequestIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/SearchTemplateRequestIT.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/opensearch/integTest/restclient/SearchTemplateRequestIT.java rename to java-client/src/test/java11/org/opensearch/client/opensearch/integTest/restclient/SearchTemplateRequestIT.java diff --git a/java-client/src/test/java/org/opensearch/client/transport/RequestOptionsTest.java b/java-client/src/test/java11/org/opensearch/client/transport/RequestOptionsTest.java similarity index 100% rename from java-client/src/test/java/org/opensearch/client/transport/RequestOptionsTest.java rename to java-client/src/test/java11/org/opensearch/client/transport/RequestOptionsTest.java