From fc79bb7ae57a3c1fbd9500418402a4bbec0d6665 Mon Sep 17 00:00:00 2001 From: Bret McGuire Date: Fri, 7 Jul 2023 17:40:04 -0500 Subject: [PATCH] Follow-up to previous commit --- .../core/DefaultProtocolVersionRegistryTest.java | 10 ++++++++++ manual/core/native_protocol/README.md | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/com/datastax/oss/driver/internal/core/DefaultProtocolVersionRegistryTest.java b/core/src/test/java/com/datastax/oss/driver/internal/core/DefaultProtocolVersionRegistryTest.java index 9d81a3bdd3d..0bf571da20c 100644 --- a/core/src/test/java/com/datastax/oss/driver/internal/core/DefaultProtocolVersionRegistryTest.java +++ b/core/src/test/java/com/datastax/oss/driver/internal/core/DefaultProtocolVersionRegistryTest.java @@ -24,6 +24,7 @@ import static com.datastax.oss.driver.internal.core.DefaultProtocolFeature.DATE_TYPE; import static com.datastax.oss.driver.internal.core.DefaultProtocolFeature.SMALLINT_AND_TINYINT_TYPES; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import com.datastax.dse.driver.api.core.DseProtocolVersion; import com.datastax.dse.driver.api.core.metadata.DseNodeProperties; @@ -51,6 +52,15 @@ public void should_find_version_by_name() { assertThat(registry.fromName("DSE_V1")).isEqualTo(DseProtocolVersion.DSE_V1); } + + @Test + public void should_fail_to_find_version_by_name_different_case() { + assertThatThrownBy(() -> registry.fromName("v4")).isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> registry.fromName("dse_v1")).isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> registry.fromName("dDSE_v1")).isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> registry.fromName("dse_v1")).isInstanceOf(IllegalArgumentException.class); + } + @Test public void should_downgrade_if_lower_version_available() { Optional downgraded = registry.downgrade(V4); diff --git a/manual/core/native_protocol/README.md b/manual/core/native_protocol/README.md index b28c72f6300..2bc075be3be 100644 --- a/manual/core/native_protocol/README.md +++ b/manual/core/native_protocol/README.md @@ -62,12 +62,14 @@ the [configuration](../configuration/): ``` datastax-java-driver { advanced.protocol { - # The V in the version parameter must be capitalized version = V3 } } ``` +Note that the protocol version you specify above is case sensitive so make sure to only use uppercase letters. +"V3" is correct, "v3" is not. + If you force a version that is too high for the server, you'll get an error: ```