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

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

本文整理了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

/**
 * 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());
}

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

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();
}

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

/**
  * 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");
  }
 }
}

代码示例来源:origin: zhicwu/cassandra-jdbc-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());
}

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

/**
  * 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");
  }
 }
}

相关文章