Skip to content

Commit 2fdedb0

Browse files
SameeraNeldavidmorley
authored andcommitted
Updated test cases adding increased timeouts and sleeps to enhance the stability, updated Spring Data Cassandra Version.
1 parent 97ccb91 commit 2fdedb0

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎spring-data-cassandra/pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<properties>
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14-
<org.springframework.data.version>1.3.1.RELEASE</org.springframework.data.version>
14+
<org.springframework.data.version>1.3.2.RELEASE</org.springframework.data.version>
1515
<org.springframework.version>4.2.2.RELEASE</org.springframework.version>
1616
<junit.version>4.11</junit.version>
1717
<org.slf4j.version>1.7.12</org.slf4j.version>

‎spring-data-cassandra/src/test/java/org/baeldung/spring/data/cassandra/repository/CQLQueriesIntegrationTest.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class CQLQueriesIntegrationTest {
5151

5252
@BeforeClass
5353
public static void startCassandraEmbedded() throws InterruptedException, TTransportException, ConfigurationException, IOException {
54-
EmbeddedCassandraServerHelper.startEmbeddedCassandra();
54+
EmbeddedCassandraServerHelper.startEmbeddedCassandra(25000);
5555
Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withPort(9142).build();
5656
LOGGER.info("Server Started at 127.0.0.1:9142... ");
5757
Session session = cluster.connect();
@@ -87,7 +87,7 @@ public void whenSavingBook_thenAvailableOnRetrieval_usingCQLStatements() {
8787
}
8888

8989
@Test
90-
public void whenSavingBook_thenAvailableOnRetrieval_usingPreparedStatements() {
90+
public void whenSavingBook_thenAvailableOnRetrieval_usingPreparedStatements() throws InterruptedException {
9191
UUID uuid = UUIDs.timeBased();
9292
String insertPreparedCql = "insert into book (id, title, publisher, tags) values (?, ?, ?, ?)";
9393
List<Object> singleBookArgsList = new ArrayList<>();
@@ -98,6 +98,8 @@ public void whenSavingBook_thenAvailableOnRetrieval_usingPreparedStatements() {
9898
singleBookArgsList.add(ImmutableSet.of("Software"));
9999
bookList.add(singleBookArgsList);
100100
cassandraTemplate.ingest(insertPreparedCql, bookList);
101+
//This may not be required, just added to avoid any transient issues
102+
Thread.sleep(5000);
101103
Select select = QueryBuilder.select().from("book");
102104
Book retrievedBook = cassandraTemplate.selectOne(select, Book.class);
103105
assertEquals(uuid, retrievedBook.getId());

0 commit comments

Comments
 (0)