Skip to content

Commit

Permalink
Prepare version 4.10.1
Browse files Browse the repository at this point in the history
and hamronize logging
  • Loading branch information
maximevw committed Oct 7, 2023
1 parent c1d6329 commit 0e20066
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 63 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## [4.10.1] - 2023-10-07
### Changed
- Update Apache Commons IO to version 2.14.0.
- Harmonize logging.
### Fixed
- Fix multiple issues related the method `findColumn(String)` of `CassandraResultSet` and `CassandraMetadataResultSet`:
- Fix multiple issues related to the method `findColumn(String)` of `CassandraResultSet` and `CassandraMetadataResultSet`:
- Fix issue [#31](https://github.com/ing-bank/cassandra-jdbc-wrapper/issues/31) to return a 1-based index value.
- Return a result even if there's no row in the result set but the column exist in the statement.
- Fix the exception thrown by the method when the given column name does not exist in the result set (was an
Expand Down Expand Up @@ -159,6 +162,7 @@ For this version, the changelog lists the main changes comparatively to the late
- Fix logs in `CassandraConnection` constructor.

[original project]: https://github.com/adejanovski/cassandra-jdbc-wrapper/
[4.10.1]: https://github.com/ing-bank/cassandra-jdbc-wrapper/compare/v4.10.0...v4.10.1
[4.10.0]: https://github.com/ing-bank/cassandra-jdbc-wrapper/compare/v4.9.1...v4.10.0
[4.9.1]: https://github.com/ing-bank/cassandra-jdbc-wrapper/compare/v4.9.0...v4.9.1
[4.9.0]: https://github.com/ing-bank/cassandra-jdbc-wrapper/compare/v4.8.0...v4.9.0
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.ing.data</groupId>
<artifactId>cassandra-jdbc-wrapper</artifactId>
<version>4.10.0</version>
<version>4.10.1</version>
<packaging>jar</packaging>

<name>Cassandra JDBC Wrapper</name>
Expand Down Expand Up @@ -108,7 +108,7 @@
<checkstyle.version>9.3</checkstyle.version>
<caffeine.version>2.9.3</caffeine.version>
<commons-collections.version>4.4</commons-collections.version>
<commons-io.version>2.13.0</commons-io.version>
<commons-io.version>2.14.0</commons-io.version>
<commons-lang3.version>3.13.0</commons-lang3.version>
<datastax.java.driver.version>4.17.0</datastax.java.driver.version>
<jackson.version>2.15.2</jackson.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void close() {
try {
this.connection.removeStatement(this);
} catch (final Exception e) {
LOG.warn("Unable to close the prepared statement: " + e.getMessage());
LOG.warn("Unable to close the prepared statement: {}", e.getMessage());
}
}

Expand All @@ -198,7 +198,7 @@ private void doExecute() throws SQLException {
try {
resetResults();
if (LOG.isTraceEnabled() || this.connection.isDebugMode()) {
LOG.trace("CQL: " + this.cql);
LOG.trace("CQL: {}", this.cql);
}
// Force paging to avoid timeout and node harm.
if (this.boundStatement.getPageSize() == 0) {
Expand Down Expand Up @@ -248,7 +248,7 @@ public int[] executeBatch() throws SQLException {
try {
final List<CompletionStage<AsyncResultSet>> futures = new ArrayList<>();
if (LOG.isTraceEnabled() || this.connection.isDebugMode()) {
LOG.trace("CQL statements: " + this.batchStatements.size());
LOG.trace("CQL statements: {}", this.batchStatements.size());
}
for (final BoundStatement statement : this.batchStatements) {
for (int i = 0; i < statement.getPreparedStatement().getVariableDefinitions().size(); i++) {
Expand All @@ -258,7 +258,7 @@ public int[] executeBatch() throws SQLException {
}
}
if (LOG.isTraceEnabled() || this.connection.isDebugMode()) {
LOG.trace("CQL: " + this.cql);
LOG.trace("CQL: {}", this.cql);
}
final BoundStatement boundStatement = statement.setConsistencyLevel(
this.connection.getDefaultConsistencyLevel());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ private void doExecute(final String cql) throws SQLException {

private com.datastax.oss.driver.api.core.cql.ResultSet executeSingleStatement(final String cql) {
if (LOG.isTraceEnabled() || this.connection.isDebugMode()) {
LOG.debug("CQL: " + cql);
LOG.debug("CQL: {}", cql);
}
SimpleStatement stmt = SimpleStatement.newInstance(cql)
.setConsistencyLevel(this.connection.getDefaultConsistencyLevel())
Expand Down Expand Up @@ -407,12 +407,12 @@ public int[] executeBatch() throws SQLException {
final int[] returnCounts = new int[this.batchQueries.size()];
final List<CompletionStage<AsyncResultSet>> futures = new ArrayList<>();
if (LOG.isTraceEnabled() || this.connection.isDebugMode()) {
LOG.debug("CQL statements: " + this.batchQueries.size());
LOG.debug("CQL statements: {}", this.batchQueries.size());
}

for (final String query : this.batchQueries) {
if (LOG.isTraceEnabled() || this.connection.isDebugMode()) {
LOG.debug("CQL: " + query);
LOG.debug("CQL: {}", query);
}
SimpleStatement stmt = SimpleStatement.newInstance(query)
.setConsistencyLevel(this.connection.getDefaultConsistencyLevel());
Expand Down
20 changes: 10 additions & 10 deletions src/test/java/com/ing/data/cassandra/jdbc/ConnectionUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
import static org.mockito.Mockito.when;

class ConnectionUnitTest extends UsingCassandraContainerTest {
private static final Logger log = LoggerFactory.getLogger(ConnectionUnitTest.class);
private static final Logger LOG = LoggerFactory.getLogger(ConnectionUnitTest.class);

private static final String KEYSPACE = "system";

Expand Down Expand Up @@ -427,15 +427,15 @@ void givenConnection_whenGetMetaData_getExpectedResultSet() throws Exception {
assertNotNull(sqlConnection.getMetaData());

final DatabaseMetaData dbMetadata = sqlConnection.getMetaData();
log.debug("====================================================");
log.debug("Connection Metadata");
log.debug("====================================================");
log.debug("Driver name: {}", dbMetadata.getDriverName());
log.debug("Driver version: {}", dbMetadata.getDriverVersion());
log.debug("DB name: {}", dbMetadata.getDatabaseProductName());
log.debug("DB version: {}", dbMetadata.getDatabaseProductVersion());
log.debug("JDBC version: {}.{}", dbMetadata.getJDBCMajorVersion(), dbMetadata.getJDBCMinorVersion());
log.debug("====================================================");
LOG.debug("====================================================");
LOG.debug("Connection Metadata");
LOG.debug("====================================================");
LOG.debug("Driver name: {}", dbMetadata.getDriverName());
LOG.debug("Driver version: {}", dbMetadata.getDriverVersion());
LOG.debug("DB name: {}", dbMetadata.getDatabaseProductName());
LOG.debug("DB version: {}", dbMetadata.getDatabaseProductVersion());
LOG.debug("JDBC version: {}.{}", dbMetadata.getJDBCMajorVersion(), dbMetadata.getJDBCMinorVersion());
LOG.debug("====================================================");

assertEquals("Cassandra JDBC Driver", dbMetadata.getDriverName());
assertNotEquals(0, dbMetadata.getDriverMajorVersion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
@TestMethodOrder(org.junit.jupiter.api.MethodOrderer.OrderAnnotation.class)
class DbaasAstraIntegrationTest {

private static final Logger log = LoggerFactory.getLogger(DbaasAstraIntegrationTest.class);
private static final Logger LOG = LoggerFactory.getLogger(DbaasAstraIntegrationTest.class);
private static final String ASTRA_DB_TOKEN_ENV_VARIABLE = "ASTRA_DB_APPLICATION_TOKEN";
private static final String ASTRA_DB_TOKEN_PATTERN = "Astra.*";
private static final String DATABASE_NAME = "test_cassandra_jdbc";
Expand All @@ -51,13 +51,13 @@ class DbaasAstraIntegrationTest {
@BeforeAll
static void setupAstra() throws Exception {
if (System.getenv(ASTRA_DB_TOKEN_ENV_VARIABLE) != null) {
log.debug("ASTRA_DB_APPLICATION_TOKEN is provided, AstraDB tests are executed.");
LOG.debug("ASTRA_DB_APPLICATION_TOKEN is provided, AstraDB tests are executed.");

/*
* Devops API Client (create database, resume, delete)
*/
final AstraDbClient astraDbClient = new AstraDbClient(TestUtils.getAstraToken());
log.debug("Connected the DBaaS API.");
LOG.debug("Connected the DBaaS API.");

/*
* Set up a Database in Astra: create if not exist, resume if needed.
Expand All @@ -67,7 +67,7 @@ static void setupAstra() throws Exception {
String dbId = TestUtils.setupVectorDatabase(DATABASE_NAME, KEYSPACE_NAME);
Assertions.assertTrue(astraDbClient.findById(dbId).isPresent());
Assertions.assertEquals(DatabaseStatusType.ACTIVE, astraDbClient.findById(dbId).get().getStatus());
log.debug("Database ready.");
LOG.debug("Database ready.");

/*
* Download cloud secure bundle to connect to the database.
Expand All @@ -77,7 +77,7 @@ static void setupAstra() throws Exception {
astraDbClient
.database(dbId)
.downloadDefaultSecureConnectBundle("/tmp/" + DATABASE_NAME + "_scb.zip");
log.debug("Connection bundle downloaded.");
LOG.debug("Connection bundle downloaded.");

/*
* Building jdbcUrl and sqlConnection.
Expand All @@ -90,7 +90,7 @@ static void setupAstra() throws Exception {
"&consistency=" + "LOCAL_QUORUM" +
"&secureconnectbundle=/tmp/" + DATABASE_NAME + "_scb.zip");
} else {
log.debug("ASTRA_DB_APPLICATION_TOKEN is not defined, skipping AstraDB tests.");
LOG.debug("ASTRA_DB_APPLICATION_TOKEN is not defined, skipping AstraDB tests.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
* <a href="https://github.com/adejanovski/cassandra-jdbc-wrapper/">original project from GitHub</a>.
*/
class JdbcRegressionUnitTest extends UsingCassandraContainerTest {
private static final Logger log = LoggerFactory.getLogger(JdbcRegressionUnitTest.class);

private static final String KEYSPACE = "test_keyspace3";
private static final String TABLE = "regressions_test";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

class MetadataResultSetsUnitTest extends UsingCassandraContainerTest {

private static final Logger log = LoggerFactory.getLogger(MetadataResultSetsUnitTest.class);
private static final Logger LOG = LoggerFactory.getLogger(MetadataResultSetsUnitTest.class);

private static final String KEYSPACE = "test_keyspace";
private static final String ANOTHER_KEYSPACE = "test_keyspace2";
Expand Down Expand Up @@ -285,18 +285,18 @@ void givenStatement_whenGetResultMetadata_returnExpectedValues() throws Exceptio
assertTrue(result.next());
assertEquals(6, result.getMetaData().getColumnCount());
for (int i = 1; i <= result.getMetaData().getColumnCount(); i++) {
log.debug("getColumnName : " + result.getMetaData().getColumnName(i));
log.debug("getCatalogName : " + result.getMetaData().getCatalogName(i));
log.debug("getColumnClassName : " + result.getMetaData().getColumnClassName(i));
log.debug("getColumnDisplaySize : " + result.getMetaData().getColumnDisplaySize(i));
log.debug("getColumnLabel : " + result.getMetaData().getColumnLabel(i));
log.debug("getColumnType : " + result.getMetaData().getColumnType(i));
log.debug("getColumnTypeName : " + result.getMetaData().getColumnTypeName(i));
log.debug("getPrecision : " + result.getMetaData().getPrecision(i));
log.debug("getScale : " + result.getMetaData().getScale(i));
log.debug("getSchemaName : " + result.getMetaData().getSchemaName(i));
log.debug("getTableName : " + result.getMetaData().getTableName(i));
log.debug("==========================");
LOG.debug("getColumnName : {}", result.getMetaData().getColumnName(i));
LOG.debug("getCatalogName : {}", result.getMetaData().getCatalogName(i));
LOG.debug("getColumnClassName : {}", result.getMetaData().getColumnClassName(i));
LOG.debug("getColumnDisplaySize : {}", result.getMetaData().getColumnDisplaySize(i));
LOG.debug("getColumnLabel : {}", result.getMetaData().getColumnLabel(i));
LOG.debug("getColumnType : {}", result.getMetaData().getColumnType(i));
LOG.debug("getColumnTypeName : {}", result.getMetaData().getColumnTypeName(i));
LOG.debug("getPrecision : {}", result.getMetaData().getPrecision(i));
LOG.debug("getScale : {}", result.getMetaData().getScale(i));
LOG.debug("getSchemaName : {}", result.getMetaData().getSchemaName(i));
LOG.debug("getTableName : {}", result.getMetaData().getTableName(i));
LOG.debug("==========================");
}

assertEquals("part_key", result.getMetaData().getColumnName(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;

class PreparedStatementsUnitTest extends UsingCassandraContainerTest {
private static final Logger log = LoggerFactory.getLogger(PreparedStatementsUnitTest.class);

private static final String KEYSPACE = "test_prep_stmt";

Expand Down
Loading

0 comments on commit 0e20066

Please sign in to comment.