Updated test cases adding increased timeouts and sleeps to enhance the stability, updated Spring Data Cassandra Version.

This commit is contained in:
sameira 2015-12-20 21:45:36 +05:30 committed by David Morley
parent 97ccb91558
commit 2fdedb0e98
2 changed files with 5 additions and 3 deletions

View File

@ -11,7 +11,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org.springframework.data.version>1.3.1.RELEASE</org.springframework.data.version> <org.springframework.data.version>1.3.2.RELEASE</org.springframework.data.version>
<org.springframework.version>4.2.2.RELEASE</org.springframework.version> <org.springframework.version>4.2.2.RELEASE</org.springframework.version>
<junit.version>4.11</junit.version> <junit.version>4.11</junit.version>
<org.slf4j.version>1.7.12</org.slf4j.version> <org.slf4j.version>1.7.12</org.slf4j.version>

View File

@ -51,7 +51,7 @@ public class CQLQueriesIntegrationTest {
@BeforeClass @BeforeClass
public static void startCassandraEmbedded() throws InterruptedException, TTransportException, ConfigurationException, IOException { public static void startCassandraEmbedded() throws InterruptedException, TTransportException, ConfigurationException, IOException {
EmbeddedCassandraServerHelper.startEmbeddedCassandra(); EmbeddedCassandraServerHelper.startEmbeddedCassandra(25000);
Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withPort(9142).build(); Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withPort(9142).build();
LOGGER.info("Server Started at 127.0.0.1:9142... "); LOGGER.info("Server Started at 127.0.0.1:9142... ");
Session session = cluster.connect(); Session session = cluster.connect();
@ -87,7 +87,7 @@ public class CQLQueriesIntegrationTest {
} }
@Test @Test
public void whenSavingBook_thenAvailableOnRetrieval_usingPreparedStatements() { public void whenSavingBook_thenAvailableOnRetrieval_usingPreparedStatements() throws InterruptedException {
UUID uuid = UUIDs.timeBased(); UUID uuid = UUIDs.timeBased();
String insertPreparedCql = "insert into book (id, title, publisher, tags) values (?, ?, ?, ?)"; String insertPreparedCql = "insert into book (id, title, publisher, tags) values (?, ?, ?, ?)";
List<Object> singleBookArgsList = new ArrayList<>(); List<Object> singleBookArgsList = new ArrayList<>();
@ -98,6 +98,8 @@ public class CQLQueriesIntegrationTest {
singleBookArgsList.add(ImmutableSet.of("Software")); singleBookArgsList.add(ImmutableSet.of("Software"));
bookList.add(singleBookArgsList); bookList.add(singleBookArgsList);
cassandraTemplate.ingest(insertPreparedCql, bookList); cassandraTemplate.ingest(insertPreparedCql, bookList);
//This may not be required, just added to avoid any transient issues
Thread.sleep(5000);
Select select = QueryBuilder.select().from("book"); Select select = QueryBuilder.select().from("book");
Book retrievedBook = cassandraTemplate.selectOne(select, Book.class); Book retrievedBook = cassandraTemplate.selectOne(select, Book.class);
assertEquals(uuid, retrievedBook.getId()); assertEquals(uuid, retrievedBook.getId());