Updated data insertion using an array list

This commit is contained in:
sameira 2015-12-09 17:15:15 +05:30
parent ee5fe4a41f
commit 53ea3c63f0
1 changed files with 5 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -79,8 +80,10 @@ public class CassandraTemplateIntegrationTest {
public void whenSavingBooks_thenAllAvailableOnRetrieval() { public void whenSavingBooks_thenAllAvailableOnRetrieval() {
Book javaBook = new Book(UUIDs.timeBased(), "Head First Java", "O'Reilly Media", ImmutableSet.of("Computer", "Software")); Book javaBook = new Book(UUIDs.timeBased(), "Head First Java", "O'Reilly Media", ImmutableSet.of("Computer", "Software"));
Book dPatternBook = new Book(UUIDs.timeBased(), "Head Design Patterns", "O'Reilly Media", ImmutableSet.of("Computer", "Software")); Book dPatternBook = new Book(UUIDs.timeBased(), "Head Design Patterns", "O'Reilly Media", ImmutableSet.of("Computer", "Software"));
cassandraTemplate.insert(javaBook); List<Book> bookList = new ArrayList<>();
cassandraTemplate.insert(dPatternBook); bookList.add(javaBook);
bookList.add(dPatternBook);
cassandraTemplate.insert(bookList);
Select select = QueryBuilder.select().from("book").limit(10); Select select = QueryBuilder.select().from("book").limit(10);
List<Book> retrievedBooks = cassandraTemplate.select(select, Book.class); List<Book> retrievedBooks = cassandraTemplate.select(select, Book.class);