-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test against Apache Cassandra 4 (#7013)
Fixes #7012 Co-authored-by: Eddú Meléndez Gonzales <[email protected]>
- Loading branch information
1 parent
cce90eb
commit 730f689
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
35 changes: 35 additions & 0 deletions
35
modules/cassandra/src/test/java/org/testcontainers/containers/CassandraServer4Test.java
This file contains 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.assertj.core.api.Assertions.assertThat; | ||
|
||
public class CassandraServer4Test { | ||
|
||
@Rule | ||
public CassandraContainer<?> cassandra = new CassandraContainer<>("cassandra:4.1.1"); | ||
|
||
@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")); | ||
|
||
assertThat(keyspace).as("test keyspace created").isNotNull(); | ||
} | ||
} | ||
} |