-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Update Cassandra driver to 4.x #2830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kiview
merged 11 commits into
testcontainers:master
from
emerkle826:cassandra-driver-upgrade
Aug 4, 2022
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3851d25
Update Cassandra driver to 4.x
emerkle826 503133c
Deprecate Driver 3.x methods and remove some driver coupling
emerkle826 fe6b846
improve verification of test for missing Datacenter
emerkle826 728dcdd
address review comments
emerkle826 281cf33
Merge branch 'master' into cassandra-driver-upgrade
kiview b4b5523
Merge branch 'master' into cassandra-driver-upgrade
eddumelendez b3a3ac4
Read/Write CASSANDRA_DC env
eddumelendez 64bd5f7
Fix message
eddumelendez e7d5f9a
Use code snippets from examples
eddumelendez f8fb105
Update docs/modules/databases/cassandra.md
eddumelendez e354cb4
example removed and add split tests for drivers
eddumelendez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,13 @@ | ||
| description = "TestContainers :: Cassandra" | ||
|
|
||
| configurations.all { | ||
| resolutionStrategy { | ||
| force 'io.dropwizard.metrics:metrics-core:3.2.4' | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| api project(":database-commons") | ||
| api "com.datastax.cassandra:cassandra-driver-core:3.7.1" | ||
| api "com.datastax.cassandra:cassandra-driver-core:3.10.0" | ||
| testImplementation 'com.datastax.oss:java-driver-core:4.8.0' | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
modules/cassandra/src/test/java/org/testcontainers/containers/CassandraDriver3Test.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package org.testcontainers.containers; | ||
|
|
||
| import com.datastax.oss.driver.api.core.CqlIdentifier; | ||
| import com.datastax.oss.driver.api.core.CqlSession; | ||
| import com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata; | ||
| import org.junit.Rule; | ||
| import org.junit.Test; | ||
|
|
||
| import static org.junit.Assert.assertNotNull; | ||
|
|
||
| public class CassandraDriver3Test { | ||
|
|
||
| @Rule | ||
| public CassandraContainer<?> cassandra = new CassandraContainer<>("cassandra:3.11.2"); | ||
|
|
||
| @Test | ||
| public void testCassandraGetContactPoint() { | ||
| try ( | ||
| // cassandra { | ||
| CqlSession session = CqlSession | ||
| .builder() | ||
| .addContactPoint(this.cassandra.getContactPoint()) | ||
| .withLocalDatacenter(this.cassandra.getLocalDatacenter()) | ||
| .build() | ||
| // } | ||
| ) { | ||
| session.execute( | ||
| "CREATE KEYSPACE IF NOT EXISTS test WITH replication = \n" + | ||
| "{'class':'SimpleStrategy','replication_factor':'1'};" | ||
| ); | ||
|
|
||
| KeyspaceMetadata keyspace = session.getMetadata().getKeyspaces().get(CqlIdentifier.fromCql("test")); | ||
|
|
||
| assertNotNull("Failed to create test keyspace", keyspace); | ||
| } | ||
| } | ||
| } |
35 changes: 35 additions & 0 deletions
35
modules/cassandra/src/test/java/org/testcontainers/containers/CassandraDriver4Test.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| package org.testcontainers.containers; | ||
|
|
||
| import com.datastax.oss.driver.api.core.CqlIdentifier; | ||
| import com.datastax.oss.driver.api.core.CqlSession; | ||
| import com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata; | ||
| import org.junit.Rule; | ||
| import org.junit.Test; | ||
|
|
||
| import static org.junit.Assert.assertNotNull; | ||
|
|
||
| public class CassandraDriver4Test { | ||
|
|
||
| @Rule | ||
| public CassandraContainer<?> cassandra = new CassandraContainer<>("cassandra:3.11.2"); | ||
|
|
||
| @Test | ||
| public void testCassandraGetContactPoint() { | ||
| try ( | ||
| CqlSession session = CqlSession | ||
| .builder() | ||
| .addContactPoint(this.cassandra.getContactPoint()) | ||
| .withLocalDatacenter(this.cassandra.getLocalDatacenter()) | ||
| .build() | ||
| ) { | ||
| session.execute( | ||
| "CREATE KEYSPACE IF NOT EXISTS test WITH replication = \n" + | ||
| "{'class':'SimpleStrategy','replication_factor':'1'};" | ||
| ); | ||
|
|
||
| KeyspaceMetadata keyspace = session.getMetadata().getKeyspaces().get(CqlIdentifier.fromCql("test")); | ||
|
|
||
| assertNotNull("Failed to create test keyspace", keyspace); | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice that you added it, it was missing before.