Skip to content

Commit

Permalink
Follow-up to previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
absurdfarce committed Jul 7, 2023
1 parent a572d5f commit fc79bb7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<ProtocolVersion> downgraded = registry.downgrade(V4);
Expand Down
4 changes: 3 additions & 1 deletion manual/core/native_protocol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

```
Expand Down

0 comments on commit fc79bb7

Please sign in to comment.