Package com.google.appengine.datanucleus.test.jpa

Examples of com.google.appengine.datanucleus.test.jpa.Book


  }

  public void testSimpleFetch_Id_IntIdOnly() {
    Key key = ds.put(Book.newBookEntity("max", "47", "yam"));

    Book book = em.find(Book.class, Long.valueOf(key.getId()).intValue());
    assertNotNull(book);
    String keyStr = KeyFactory.keyToString(key);
    assertEquals(keyStr, book.getId());
    assertEquals("max", book.getAuthor());
    assertEquals("47", book.getIsbn());
    assertEquals("yam", book.getTitle());
  }
View Full Code Here


  public void testSimpleFetchWithNamedKey() {
    Key key = ds.put(Book.newBookEntity("named key", "max", "47", "yam"));

    String keyStr = KeyFactory.keyToString(key);
    Book book = em.find(Book.class, keyStr);
    assertNotNull(book);
    assertEquals(keyStr, book.getId());
    assertEquals("max", book.getAuthor());
    assertEquals("47", book.getIsbn());
    assertEquals("yam", book.getTitle());
    assertEquals("named key", KeyFactory.stringToKey(book.getId()).getName());
  }
View Full Code Here

  }

  public void testSimpleFetchWithNamedKey_NameOnly() {
    Key key = ds.put(Book.newBookEntity("named key", "max", "47", "yam"));

    Book book = em.find(Book.class, key.getName());
    assertNotNull(book);
    String keyStr = KeyFactory.keyToString(key);
    assertEquals(keyStr, book.getId());
    assertEquals("max", book.getAuthor());
    assertEquals("47", book.getIsbn());
    assertEquals("yam", book.getTitle());
    assertEquals("named key", KeyFactory.stringToKey(book.getId()).getName());
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jpa.Book

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.