Package org.springframework.data.cassandra.test.integration.simpletons

Examples of org.springframework.data.cassandra.test.integration.simpletons.BookReference


  }

  @Test
  public void listSetTest() {

    BookReference b1 = new BookReference();
    b1.setIsbn("123456-1");
    b1.setTitle("Spring Data Cassandra Guide");
    b1.setAuthor("Cassandra Guru");
    b1.setPages(521);
    b1.setSaleDate(new Date());
    b1.setInStock(true);

    Set<String> refs = new HashSet<String>();
    refs.add("Spring Data by O'Reilly");
    refs.add("Spring by Example");
    refs.add("Spring Recipies");
    b1.setReferences(refs);

    List<Integer> marks = new LinkedList<Integer>();
    marks.add(13);
    marks.add(52);
    marks.add(144);
    b1.setBookmarks(marks);

    template.insert(b1);

    Select select = QueryBuilder.select().all().from("bookReference");
    select.where(QueryBuilder.eq("isbn", "123456-1"));

    BookReference b = template.selectOne(select, BookReference.class);

    Assert.assertNotNull(b.getReferences());
    Assert.assertNotNull(b.getBookmarks());

    log.debug("Bookmark List<Integer> Data");
    for (Integer mark : b.getBookmarks()) {
      log.debug("Bookmark set on page  " + mark);
    }

    log.debug("Reference Set<String> Data");
    for (String ref : b.getReferences()) {
      log.debug("Reference -> " + ref);
    }

    Assert.assertEquals(b.getTitle(), "Spring Data Cassandra Guide");
    Assert.assertEquals(b.getAuthor(), "Cassandra Guru");

  }
View Full Code Here

TOP

Related Classes of org.springframework.data.cassandra.test.integration.simpletons.BookReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.