Skip to content

Commit

Permalink
Update changelog after merging PR #69
Browse files Browse the repository at this point in the history
  • Loading branch information
maximevw committed Jul 8, 2024
1 parent c5c4c43 commit 0d45182
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
[#55](https://github.com/ing-bank/cassandra-jdbc-wrapper/pull/55)).
- Add support for the special CQL command `CONSISTENCY [level]` in `CassandraStatement` (inspired by PR
[#56](https://github.com/ing-bank/cassandra-jdbc-wrapper/pull/56)).
- Add a method `setComplianceMode(String)` in `CassandraDataSource` to specify a specific compliance mode when getting
the connection from a `DataSource` (see issue [#68](https://github.com/ing-bank/cassandra-jdbc-wrapper/issues/68)).
### Changed
- Update Java Driver for Apache Cassandra® to version 4.18.1.
- Update Jackson dependencies to version 2.17.1.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,27 @@ public class CassandraDataSource implements ConnectionPoolDataSource, DataSource
* The Cassandra data source description.
*/
protected static final String DATA_SOURCE_DESCRIPTION = "Cassandra Data Source";

/**
* The contact points of the data source.
*/
protected List<ContactPoint> contactPoints;

/**
* The database name. In case of Cassandra, i.e. the keyspace used as data source.
*/
protected String databaseName;

/**
* The username used to connect to the data source.
*/
protected String user;

/**
* The password used to connect to the data source.
*/
protected String password;

/**
* The consistency level.
* <p>
Expand All @@ -88,6 +93,7 @@ public class CassandraDataSource implements ConnectionPoolDataSource, DataSource
* The compliance mode.
*/
protected String complianceMode = null;

/**
* The local datacenter.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,14 @@ void givenParameters_whenConstructDataSource_returnCassandraDataSource() throws
assertEquals(USER, cds.getUser());
assertEquals(PASSWORD, cds.getPassword());

CassandraDataSource cds2 = new CassandraDataSource(Collections.singletonList(ContactPoint.of(
final CassandraDataSource ds = new CassandraDataSource(Collections.singletonList(ContactPoint.of(
cassandraContainer.getContactPoint().getHostName(), cassandraContainer.getContactPoint().getPort())),
KEYSPACE, USER, PASSWORD, CONSISTENCY, "datacenter1");
cds2.setComplianceMode(COMPLIANCE_MODE);
final DataSource ds = cds2;
ds.setComplianceMode(COMPLIANCE_MODE);
assertNotNull(ds);

// null username and password
java.sql.Connection cnx = ds.getConnection(null, null);
CassandraConnection cnx = ds.getConnection(null, null);
assertFalse(cnx.isClosed());
ds.setLoginTimeout(5);
assertEquals(5, ds.getLoginTimeout());
Expand All @@ -67,8 +66,8 @@ void givenParameters_whenConstructDataSource_returnCassandraDataSource() throws
cnx = ds.getConnection();
assertFalse(cnx.isClosed());
ds.setLoginTimeout(5);
assertEquals(CONSISTENCY, ((CassandraConnection) cnx).getConnectionProperties().get(TAG_CONSISTENCY_LEVEL));
assertEquals(COMPLIANCE_MODE, ((CassandraConnection) cnx).getConnectionProperties().get(TAG_COMPLIANCE_MODE));
assertEquals(CONSISTENCY, cnx.getConnectionProperties().get(TAG_CONSISTENCY_LEVEL));
assertEquals(COMPLIANCE_MODE, cnx.getConnectionProperties().get(TAG_COMPLIANCE_MODE));

assertEquals(5, ds.getLoginTimeout());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class PooledUnitTest extends UsingCassandraContainerTest {
private static final String PASSWORD = "secret";
private static final String CONSISTENCY = "ONE";
private static final String LOCAL_DATACENTER = "datacenter1";
private static final String COMPLIANCE_MODE = "Liquibase";

@Test
void givenPooledDataSource_whenGetAndCloseConnection2MillionTimes_manageConnectionsProperly() throws Exception {
Expand Down

0 comments on commit 0d45182

Please sign in to comment.