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

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


  }

  @Test
  public void mapTest() {

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

    Map<String, Integer> checkOutMap = new HashMap<String, Integer>();
    checkOutMap.put("dwebb", 50);
    checkOutMap.put("madams", 100);
    checkOutMap.put("jmcpeek", 150);

    b1.setCheckOuts(checkOutMap);

    template.insert(b1);

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

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

    Assert.assertNotNull(b.getCheckOuts());

    log.debug("Checkouts map data");
    for (String username : b.getCheckOuts().keySet()) {
      log.debug(username + " has " + b.getCheckOuts().get(username) + " checkouts of this book.");
    }

    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.BookHistory

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.