/** * Logs the driver version to the console. * * <p>This method logs the version using the logger {@code com.datastax.driver.core} and level * {@code INFO}. */ public static void logDriverVersion() { Logger core = LoggerFactory.getLogger("com.datastax.driver.core"); core.info("DataStax Java driver {} for Apache Cassandra", getDriverVersion()); }
Startup(ProtocolOptions.Compression compression, boolean noCompact) { super(Message.Request.Type.STARTUP); this.compression = compression; this.noCompact = noCompact; ImmutableMap.Builder<String, String> map = new ImmutableMap.Builder<String, String>(); map.put(CQL_VERSION_OPTION, CQL_VERSION); if (compression != ProtocolOptions.Compression.NONE) map.put(COMPRESSION_OPTION, compression.toString()); if (noCompact) map.put(NO_COMPACT_OPTION, "true"); map.put(DRIVER_VERSION_OPTION, Cluster.getDriverVersion()); map.put(DRIVER_NAME_OPTION, DRIVER_NAME); this.options = map.build(); }
/** * Ensures that when connecting, the driver STARTUP message contains DRIVER_NAME and * DRIVER_VERSION configuration in its option map. This should be reflected in the * system_views.clients table. */ @Test(groups = "short") public void should_send_driver_name_and_version() { ResultSet result = session().execute("select driver_name, driver_version from system_views.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("DataStax Java Driver"); } } }
public CassandraConnection(CassandraConfiguration driverConfig) { super(driverConfig); _keyspace = driverConfig.getKeyspace(); _session = DataStaxSessionFactory.getSession(driverConfig); // populate meta data metaData.setProperty(KEY_DRIVER_NAME, DRIVER_NAME); metaData.setProperty(KEY_DRIVER_VERSION, new StringBuilder() .append(CassandraConfiguration.DRIVER_VERSION) .append(' ') .append('(') .append(PROVIDER_NAME) .append(' ') .append(Cluster.getDriverVersion()) .append(')') .toString()); }
/** * Ensures that when connecting, the driver STARTUP message contains DRIVER_NAME and * DRIVER_VERSION configuration in its option map. This should be reflected in the * system_views.clients table. */ @Test(groups = "short") public void should_send_driver_name_and_version() { ResultSet result = session().execute("select driver_name, driver_version from system_views.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("DataStax DSE Java Driver"); } } }