com.datastax.driver.core.Cluster.getDriverVersion()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中com.datastax.driver.core.Cluster.getDriverVersion()方法的一些代码示例,展示了Cluster.getDriverVersion()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cluster.getDriverVersion()方法的具体详情如下:
包路径:com.datastax.driver.core.Cluster
类名称:Cluster
方法名:getDriverVersion

Cluster.getDriverVersion介绍

[英]Returns the current version of the driver.

This is intended for products that wrap or extend the driver, as a way to check compatibility if end-users override the driver version in their application.
[中]

代码示例

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

  1. /**
  2. * Logs the driver version to the console.
  3. *
  4. * <p>This method logs the version using the logger {@code com.datastax.driver.core} and level
  5. * {@code INFO}.
  6. */
  7. public static void logDriverVersion() {
  8. Logger core = LoggerFactory.getLogger("com.datastax.driver.core");
  9. core.info("DataStax Java driver {} for Apache Cassandra", getDriverVersion());
  10. }

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

  1. Startup(ProtocolOptions.Compression compression, boolean noCompact) {
  2. super(Message.Request.Type.STARTUP);
  3. this.compression = compression;
  4. this.noCompact = noCompact;
  5. ImmutableMap.Builder<String, String> map = new ImmutableMap.Builder<String, String>();
  6. map.put(CQL_VERSION_OPTION, CQL_VERSION);
  7. if (compression != ProtocolOptions.Compression.NONE)
  8. map.put(COMPRESSION_OPTION, compression.toString());
  9. if (noCompact) map.put(NO_COMPACT_OPTION, "true");
  10. map.put(DRIVER_VERSION_OPTION, Cluster.getDriverVersion());
  11. map.put(DRIVER_NAME_OPTION, DRIVER_NAME);
  12. this.options = map.build();
  13. }

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

  1. /**
  2. * Ensures that when connecting, the driver STARTUP message contains DRIVER_NAME and
  3. * DRIVER_VERSION configuration in its option map. This should be reflected in the
  4. * system_views.clients table.
  5. */
  6. @Test(groups = "short")
  7. public void should_send_driver_name_and_version() {
  8. ResultSet result =
  9. session().execute("select driver_name, driver_version from system_views.clients");
  10. // Should be at least 2 connections (1 control connection, 1 pooled connection)
  11. assertThat(result.getAvailableWithoutFetching()).isGreaterThanOrEqualTo(2);
  12. for (Row row : result) {
  13. assertThat(row.getString("driver_version")).isEqualTo(Cluster.getDriverVersion());
  14. assertThat(row.getString("driver_name")).isEqualTo("DataStax Java Driver");
  15. }
  16. }
  17. }

代码示例来源:origin: zhicwu/cassandra-jdbc-driver

  1. public CassandraConnection(CassandraConfiguration driverConfig) {
  2. super(driverConfig);
  3. _keyspace = driverConfig.getKeyspace();
  4. _session = DataStaxSessionFactory.getSession(driverConfig);
  5. // populate meta data
  6. metaData.setProperty(KEY_DRIVER_NAME, DRIVER_NAME);
  7. metaData.setProperty(KEY_DRIVER_VERSION, new StringBuilder()
  8. .append(CassandraConfiguration.DRIVER_VERSION)
  9. .append(' ')
  10. .append('(')
  11. .append(PROVIDER_NAME)
  12. .append(' ')
  13. .append(Cluster.getDriverVersion())
  14. .append(')')
  15. .toString());
  16. }

代码示例来源:origin: com.datastax.dse/dse-java-driver-core

  1. /**
  2. * Ensures that when connecting, the driver STARTUP message contains DRIVER_NAME and
  3. * DRIVER_VERSION configuration in its option map. This should be reflected in the
  4. * system_views.clients table.
  5. */
  6. @Test(groups = "short")
  7. public void should_send_driver_name_and_version() {
  8. ResultSet result =
  9. session().execute("select driver_name, driver_version from system_views.clients");
  10. // Should be at least 2 connections (1 control connection, 1 pooled connection)
  11. assertThat(result.getAvailableWithoutFetching()).isGreaterThanOrEqualTo(2);
  12. for (Row row : result) {
  13. assertThat(row.getString("driver_version")).isEqualTo(Cluster.getDriverVersion());
  14. assertThat(row.getString("driver_name")).isEqualTo("DataStax DSE Java Driver");
  15. }
  16. }
  17. }

相关文章