From fe319a33dc52ea2eac2d88fa5c5fe3092e2f629d Mon Sep 17 00:00:00 2001 From: Dmitry Kropachev Date: Wed, 15 Jan 2025 20:18:35 -0400 Subject: [PATCH] 3.x: Fix code and docs regarding driver name (#406) * Fix driver name in comments and docs * Check if driver reports correct driver name to the server * Add scylla.version property It doesn't do anything, just to keep in organized * Log correct dirver name * Install peotry with --no-root Otherwise it fails with: ``` Installing the current project: java-driver (3.7.1) Error: The current project could not be installed: No file/folder found for package java-driver If you do not want to install the current project use --no-root. If you want to use Poetry only for dependency management but not for packaging, you can disable package mode by setting package-mode = false in your pyproject.toml file. If you did intend to install the current project, you may need to set `packages` in your pyproject.toml file. ``` --- docs/Makefile | 2 +- .../com/datastax/driver/core/Cluster.java | 4 ++-- .../driver/core/exceptions/package-info.java | 2 +- .../driver/core/policies/package-info.java | 4 +--- .../driver/core/StartupOptionTest.java | 19 +++++++++++++++++-- driver-examples/README.md | 7 +++---- manual/logging/README.md | 2 +- manual/tuples/README.md | 2 +- pom.xml | 1 + .../migrating_from_astyanax/README.md | 4 ++-- .../configuration/README.md | 2 +- 11 files changed, 31 insertions(+), 18 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index 622f182c8eb..e0b018addac 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -23,7 +23,7 @@ setupenv: .PHONY: setup setup: - $(POETRY) install + $(POETRY) install --no-root $(POETRY) update @if [ ! -d "$(SOURCEDIR)" ]; then mkdir -p "$(SOURCEDIR)"; fi cp -RL source/* $(SOURCEDIR) diff --git a/driver-core/src/main/java/com/datastax/driver/core/Cluster.java b/driver-core/src/main/java/com/datastax/driver/core/Cluster.java index 3363b9b88fc..ac5a17fbe95 100644 --- a/driver-core/src/main/java/com/datastax/driver/core/Cluster.java +++ b/driver-core/src/main/java/com/datastax/driver/core/Cluster.java @@ -275,8 +275,8 @@ public static String getDriverVersion() { * {@code INFO}. */ public static void logDriverVersion() { - Logger core = LoggerFactory.getLogger("com.datastax.driver.core"); - core.info("DataStax Java driver {} for Apache Cassandra", getDriverVersion()); + LoggerFactory.getLogger("com.datastax.driver.core") + .info("ScyllaDB Java Driver {}", getDriverVersion()); } /** diff --git a/driver-core/src/main/java/com/datastax/driver/core/exceptions/package-info.java b/driver-core/src/main/java/com/datastax/driver/core/exceptions/package-info.java index e3980a58b57..482cb60d732 100644 --- a/driver-core/src/main/java/com/datastax/driver/core/exceptions/package-info.java +++ b/driver-core/src/main/java/com/datastax/driver/core/exceptions/package-info.java @@ -13,5 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** Exceptions thrown by the DataStax Java driver for Cassandra. */ +/** Exceptions thrown by the ScyllaDB Java driver. */ package com.datastax.driver.core.exceptions; diff --git a/driver-core/src/main/java/com/datastax/driver/core/policies/package-info.java b/driver-core/src/main/java/com/datastax/driver/core/policies/package-info.java index 54117d969ec..082c611f51e 100644 --- a/driver-core/src/main/java/com/datastax/driver/core/policies/package-info.java +++ b/driver-core/src/main/java/com/datastax/driver/core/policies/package-info.java @@ -13,7 +13,5 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/** - * Policies that allow to control some of the behavior of the DataStax Java driver for Cassandra. - */ +/** Policies that allow to control some of the behavior of the ScyllaDB Java driver. */ package com.datastax.driver.core.policies; diff --git a/driver-core/src/test/java/com/datastax/driver/core/StartupOptionTest.java b/driver-core/src/test/java/com/datastax/driver/core/StartupOptionTest.java index 06adc010449..dbf890b0f89 100644 --- a/driver-core/src/test/java/com/datastax/driver/core/StartupOptionTest.java +++ b/driver-core/src/test/java/com/datastax/driver/core/StartupOptionTest.java @@ -18,9 +18,9 @@ import static org.assertj.core.api.Assertions.assertThat; import com.datastax.driver.core.utils.CassandraVersion; +import com.datastax.driver.core.utils.ScyllaVersion; import org.testng.annotations.Test; -@CassandraVersion("4.0.0") public class StartupOptionTest extends CCMTestsSupport { /** @@ -28,6 +28,7 @@ public class StartupOptionTest extends CCMTestsSupport { * DRIVER_VERSION configuration in its option map. This should be reflected in the * system_views.clients table. */ + @CassandraVersion("4.0.0") @Test(groups = "short") public void should_send_driver_name_and_version() { ResultSet result = @@ -38,7 +39,21 @@ public void should_send_driver_name_and_version() { for (Row row : result) { assertThat(row.getString("driver_version")).isEqualTo(Cluster.getDriverVersion()); - assertThat(row.getString("driver_name")).isEqualTo("DataStax Java Driver"); + assertThat(row.getString("driver_name")).isEqualTo("ScyllaDB Java Driver"); + } + } + + @ScyllaVersion(minOSS = "5.2.0", minEnterprise = "2019.1") + @Test(groups = "short") + public void should_send_driver_name_and_version_scylla() { + ResultSet result = session().execute("select driver_name, driver_version from system.clients"); + + // Should be at least 2 connections (1 control connection, 1 pooled connection) + assertThat(result.getAvailableWithoutFetching()).isGreaterThanOrEqualTo(2); + + for (Row row : result) { + assertThat(row.getString("driver_version")).isEqualTo(Cluster.getDriverVersion()); + assertThat(row.getString("driver_name")).isEqualTo("ScyllaDB Java Driver"); } } } diff --git a/driver-examples/README.md b/driver-examples/README.md index 553cdbc5117..0200e23d353 100644 --- a/driver-examples/README.md +++ b/driver-examples/README.md @@ -1,10 +1,9 @@ -# DataStax Java Driver for Apache Cassandra - Examples +# ScyllaDB Java Driver - Examples -This module contains examples of how to use the DataStax Java driver for -Apache Cassandra. +This module contains examples of how to use the ScyllaDB Java driver. ## Usage -Unless otherwise stated, all examples assume that you have a single-node Cassandra 3.0 cluster +Unless otherwise stated, all examples assume that you have a single-node ScyllaDB 6.2 cluster listening on localhost:9042. diff --git a/manual/logging/README.md b/manual/logging/README.md index a421be520ad..43b0e2d3769 100644 --- a/manual/logging/README.md +++ b/manual/logging/README.md @@ -2,7 +2,7 @@ ### Setup -DataStax Java driver uses the popular [SLF4J](http://www.slf4j.org) library to emit log messages; +The driver uses the popular [SLF4J](http://www.slf4j.org) library to emit log messages; SLF4J has the advantage of providing a logging API that is entirely decoupled from concrete implementations, letting client applications free to seamlessly connect SLF4J to their preferred logging backend. diff --git a/manual/tuples/README.md b/manual/tuples/README.md index f0b9f0061b8..cb0540b58ee 100644 --- a/manual/tuples/README.md +++ b/manual/tuples/README.md @@ -14,7 +14,7 @@ CREATE TABLE ks.collect_things ( ### Fetching Tuples from Rows results -The DataStax Java driver exposes a special [`TupleValue`][TupleValue] class to handle such columns. +The driver exposes a special [`TupleValue`][TupleValue] class to handle such columns. [`TupleValue`][TupleValue] exposes getters allowing to extract from the tuple all the data types supported by Cassandra: diff --git a/pom.xml b/pom.xml index 19c200f5eb9..b49050fb7f1 100644 --- a/pom.xml +++ b/pom.xml @@ -50,6 +50,7 @@ UTF-8 UTF-8 3.11.2 + 1.8 1.2.17 1.7.25 diff --git a/upgrade_guide/migrating_from_astyanax/README.md b/upgrade_guide/migrating_from_astyanax/README.md index f48b08834a4..bfddda5ae86 100644 --- a/upgrade_guide/migrating_from_astyanax/README.md +++ b/upgrade_guide/migrating_from_astyanax/README.md @@ -1,12 +1,12 @@ # Migrating from Astyanax This section is a guide for users previously using *Astyanax* and looking for -migrating to the *DataStax Java driver*. +migrating to the *ScyllaDB Java driver*. See the child pages for more information: * [Changes at the language level](language_level_changes/) -* [Migrating Astyanax configurations to DataStax Java driver configurations](configuration/) +* [Migrating Astyanax configurations to ScyllaDB Java driver configurations](configuration/) * [Querying and retrieving results comparisons.](queries_and_results/) ```{eval-rst} diff --git a/upgrade_guide/migrating_from_astyanax/configuration/README.md b/upgrade_guide/migrating_from_astyanax/configuration/README.md index c6629113d7f..316e15d8bd9 100644 --- a/upgrade_guide/migrating_from_astyanax/configuration/README.md +++ b/upgrade_guide/migrating_from_astyanax/configuration/README.md @@ -15,7 +15,7 @@ Configuring a `Cluster` works with the *Builder* pattern. The `Builder` takes al the configurations into account before building the `Cluster`. Following are some examples of the most important configurations that were -possible with *Astyanax* and how to translate them into *DataStax Java driver* +possible with *Astyanax* and how to translate them into *ScyllaDB Java driver* configurations. Please note that the Java driver has been optimized to handle most use cases at best and even though the following sections show how to tune some various options, the driver should provide the best performances with the default configurations