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

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


* @author Max Ross <maxr@google.com>
*/
public class JPALobTest extends JPATestCase {

  public void testInsert() throws EntityNotFoundException {
    HasLob pojo = new HasLob();

    pojo.setBigString("a really big string");
    pojo.setBigByteArray("a really big byte array".getBytes());
    Date now = new Date();
    pojo.setDateList(Utils.newArrayList(now));

    beginTxn();
    em.persist(pojo);
    commitTxn();

    Entity e = ds.get(KeyFactory.createKey(HasLob.class.getSimpleName(), pojo.getId()));
    assertEquals(new Text("a really big string"), e.getProperty("bigString"));
    assertEquals(new Blob("a really big byte array".getBytes()), e.getProperty("bigByteArray"));
    assertEquals(new Blob(SerializationManager.DEFAULT_SERIALIZATION_STRATEGY.serialize(
        Utils.newArrayList(now)).getBytes()), e.getProperty("dateList"));
  }
View Full Code Here


    e.setProperty("dateList", new Blob(SerializationManager.DEFAULT_SERIALIZATION_STRATEGY.serialize(
        Utils.newArrayList(now)).getBytes()));
    ds.put(e);

    beginTxn();
    HasLob pojo = em.find(HasLob.class, e.getKey());
    assertNotNull(pojo);
    assertEquals("a really big string", pojo.getBigString());
    assertTrue(Arrays.equals("a really big byte array".getBytes(), pojo.getBigByteArray()));
    assertEquals(Utils.newArrayList(now), pojo.getDateList());
  }
View Full Code Here

TOP

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

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.