diff --git a/CHANGELOG.md b/CHANGELOG.md index 58c6825763..46bed68f00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Bump `commons-logging:commons-logging` from 1.3.5 to 1.3.6 ([#1922](https://github.com/opensearch-project/opensearch-java/pull/1922)) - Bump `gradle-wrapper` from 9.3.1 to 9.5.0 ([#1930](https://github.com/opensearch-project/opensearch-java/pull/1930), [#1934](https://github.com/opensearch-project/opensearch-java/pull/1934), [#1973](https://github.com/opensearch-project/opensearch-java/pull/1973)) - Bump `org.apache.httpcomponents.client5:httpclient5` from 5.6 to 5.6.1 ([#1967](https://github.com/opensearch-project/opensearch-java/pull/1967)) +- Bump Jackson to 2.22.2 / 3.2.2 ([#2125](https://github.com/opensearch-project/opensearch-java/pull/2125)) ### Added - Run Java client integration tests with a Testcontainers-managed OpenSearch instance by default ([#2033](https://github.com/opensearch-project/opensearch-java/pull/2033)) @@ -31,6 +32,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fix `unitTest` task not running the tests in the `test` source set ([#2074](https://github.com/opensearch-project/opensearch-java/pull/2074)) - Run model tests against both JSON mappers instead of picking one at random ([#2085](https://github.com/opensearch-project/opensearch-java/pull/2085)) - Fix currentSize calculation in BulkIngester ([#2113](https://github.com/opensearch-project/opensearch-java/pull/2113)) +- Use protocol version from response (rather than request) ([#2118](https://github.com/opensearch-project/opensearch-java/pull/2118)) ### Changed - Updated API spec download URL to `https://api-spec.opensearch.org` ([#2116](https://github.com/opensearch-project/opensearch-java/pull/2116)) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index b42d66629b..efbca7acd3 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -44,6 +44,6 @@ repositories { dependencies { implementation("org.ajoberstar.grgit:grgit-gradle:5.3.3") - implementation("com.diffplug.spotless", "spotless-plugin-gradle", "6.25.0") + implementation("com.diffplug.spotless", "spotless-plugin-gradle", "8.8.0") } diff --git a/buildSrc/src/main/kotlin/opensearch-java.spotless-conventions.gradle.kts b/buildSrc/src/main/kotlin/opensearch-java.spotless-conventions.gradle.kts index 8f03e2d995..f5f028cb2a 100644 --- a/buildSrc/src/main/kotlin/opensearch-java.spotless-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/opensearch-java.spotless-conventions.gradle.kts @@ -38,21 +38,23 @@ spotless { bumpThisNumberIfACustomStepChanges(1) val wildcardImportRegex = Regex("""^import\s+(?:static\s+)?[^*\s]+\.\*;$""", RegexOption.MULTILINE) - custom("Refuse wildcard imports") { contents -> - // Wildcard imports can't be resolved by spotless itself. - // This will require the developer themselves to adhere to best practices. - val wildcardImports = wildcardImportRegex.findAll(contents) - if (wildcardImports.any()) { - var msg = """ - Please replace the following wildcard imports with explicit imports ('spotlessApply' cannot resolve this issue): - """.trimIndent() - wildcardImports.forEach { - msg += "\n\t- ${it.value}" + custom("Refuse wildcard imports", object : java.io.Serializable, com.diffplug.spotless.FormatterFunc { + override fun apply(contents: String) : String { + // Wildcard imports can't be resolved by spotless itself. + // This will require the developer themselves to adhere to best practices. + val wildcardImports = wildcardImportRegex.findAll(contents) + if (wildcardImports.any()) { + var msg = """ + Please replace the following wildcard imports with explicit imports ('spotlessApply' cannot resolve this issue): + """.trimIndent() + wildcardImports.forEach { + msg += "\n\t- ${it.value}" + } + msg += "\n" + throw AssertionError(msg) } - msg += "\n" - throw AssertionError(msg) - } - contents - } + return contents + } + }) } } \ No newline at end of file diff --git a/java-client-grpc/build.gradle.kts b/java-client-grpc/build.gradle.kts index 951ae9f013..bb1b58e4d0 100644 --- a/java-client-grpc/build.gradle.kts +++ b/java-client-grpc/build.gradle.kts @@ -27,7 +27,7 @@ java { withSourcesJar() } -val opensearchVersion = "3.5.0-SNAPSHOT" +val opensearchVersion = "3.9.0-SNAPSHOT" val grpcVersion = "1.68.0" val protobufVersion = "3.25.5" val opensearchProtobufVersion = "1.2.0" diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 0796d8eb6b..c43e6d313d 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -143,7 +143,7 @@ tasks.build { dependsOn("spotlessJavaCheck") } -val opensearchVersion = "3.5.0-SNAPSHOT" +val opensearchVersion = "3.9.0-SNAPSHOT" val opensearchDockerVersion = opensearchVersion.removeSuffix("-SNAPSHOT") tasks.test { @@ -190,10 +190,10 @@ val integrationTest = task("integrationTest") { } dependencies { - val jacksonVersion = "2.21.2" - val jacksonDatabindVersion = "2.21.2" - val jackson3Version = "3.1.1" - val jackson3DatabindVersion = "3.1.1" + val jacksonVersion = "2.22.2" + val jacksonDatabindVersion = "2.22.2" + val jackson3Version = "3.2.2" + val jackson3DatabindVersion = "3.2.2" // Apache 2.0 api("commons-logging:commons-logging:1.4.0") 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 58644b5b69..3712794498 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 @@ -689,7 +689,7 @@ private ResponseT decodeResponse( return rawEndpoint.responseDeserializer( requestLine.getUri(), requestLine.getMethod(), - requestLine.getProtocolVersion().format(), + statusLine.getProtocolVersion().format(), statusLine.getStatusCode(), statusLine.getReasonPhrase(), Arrays.stream(clientResp.getHeaders()) diff --git a/java-client/src/main/java/org/opensearch/client/transport/rest_client/RestClientTransport.java b/java-client/src/main/java/org/opensearch/client/transport/rest_client/RestClientTransport.java index 1d90fba827..5ccbb96191 100644 --- a/java-client/src/main/java/org/opensearch/client/transport/rest_client/RestClientTransport.java +++ b/java-client/src/main/java/org/opensearch/client/transport/rest_client/RestClientTransport.java @@ -281,7 +281,7 @@ private ResponseT getHighLevelResponse( final ResponseT error = rawEndpoint.responseDeserializer( requestLine.getUri(), requestLine.getMethod(), - requestLine.getProtocolVersion().format(), + statusLine.getProtocolVersion().format(), statusLine.getStatusCode(), statusLine.getReasonPhrase(), Arrays.stream(clientResp.getHeaders()) diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractPingAndInfoIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractPingAndInfoIT.java index d951799c33..8da211a2bb 100644 --- a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractPingAndInfoIT.java +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractPingAndInfoIT.java @@ -15,6 +15,7 @@ import java.util.Collections; import java.util.Map; import org.opensearch.client.opensearch.OpenSearchClient; +import org.opensearch.client.opensearch._types.OpenSearchVersionInfo; import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.generic.Bodies; import org.opensearch.client.opensearch.generic.Requests; @@ -34,7 +35,7 @@ public void testInfo() throws IOException { // compare with what the low level client outputs try (Response response = javaClient().generic().execute(Requests.builder().endpoint("/").method("GET").build())) { assertThat(response.getStatus(), equalTo(200)); - assertThat(response.getProtocol(), equalTo("HTTP/1.1")); + assertThat(response.getProtocol(), equalTo(expectedHttpProtocol(info.version()))); assertThat(response.getBody().isEmpty(), is(false)); Map infoAsMap = response.getBody() @@ -56,4 +57,8 @@ public void testInfo() throws IOException { assertTrue(versionMap.get("number").toString().startsWith(info.version().number())); } } + + protected String expectedHttpProtocol(OpenSearchVersionInfo version) { + return "HTTP/1.1"; + } } diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/PingAndInfoIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/PingAndInfoIT.java index d9397b9f85..ccfa426a68 100644 --- a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/PingAndInfoIT.java +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/httpclient5/PingAndInfoIT.java @@ -8,6 +8,12 @@ package org.opensearch.client.opensearch.integTest.httpclient5; +import org.opensearch.client.opensearch._types.OpenSearchVersionInfo; import org.opensearch.client.opensearch.integTest.AbstractPingAndInfoIT; -public class PingAndInfoIT extends AbstractPingAndInfoIT implements HttpClient5TransportSupport {} +public class PingAndInfoIT extends AbstractPingAndInfoIT implements HttpClient5TransportSupport { + @Override + protected String expectedHttpProtocol(OpenSearchVersionInfo version) { + return isHttps() && version.number().startsWith("3") ? "HTTP/2.0" : "HTTP/1.1"; + } +} diff --git a/java-codegen/build.gradle.kts b/java-codegen/build.gradle.kts index 596ad82661..7341a51633 100644 --- a/java-codegen/build.gradle.kts +++ b/java-codegen/build.gradle.kts @@ -150,8 +150,8 @@ dependencies { implementation("org.apache.logging.log4j", "log4j-slf4j2-impl", "[2.17.1,3.0)") // Apache 2.0 - implementation("com.fasterxml.jackson.core", "jackson-core", "2.17.1") - implementation("com.fasterxml.jackson.core", "jackson-databind", "2.17.1") + implementation("com.fasterxml.jackson.core", "jackson-core", "2.22.2") + implementation("com.fasterxml.jackson.core", "jackson-databind", "2.22.2") // Apache 2.0 implementation("com.diffplug.spotless", "spotless-lib", "2.45.0") @@ -175,7 +175,7 @@ dependencies { implementation("org.commonmark", "commonmark", "0.24.0") // EPL-2.0 - testImplementation(platform("org.junit:junit-bom:6.1.3")) + testImplementation(platform("org.junit:junit-bom:5.14.4")) testImplementation("org.junit.jupiter", "junit-jupiter") testRuntimeOnly("org.junit.platform", "junit-platform-launcher") } diff --git a/samples/build.gradle.kts b/samples/build.gradle.kts index bf83ed2cd3..0be72e1788 100644 --- a/samples/build.gradle.kts +++ b/samples/build.gradle.kts @@ -25,7 +25,7 @@ dependencies { implementation("org.apache.logging.log4j", "log4j-core","[2.17.1,3.0)") implementation("org.apache.logging.log4j", "log4j-slf4j2-impl","[2.17.1,3.0)") implementation("commons-logging", "commons-logging", "1.2") - implementation("com.fasterxml.jackson.core", "jackson-databind", "2.15.2") + implementation("tools.jackson.core", "jackson-databind", "3.2.2") implementation("software.amazon.awssdk", "sdk-core", "[2.21,3.0)") implementation("software.amazon.awssdk", "auth", "[2.21,3.0)") implementation("software.amazon.awssdk", "http-auth-aws", "[2.21,3.0)")