Examples of HasExtraTypes1JDO


Examples of com.google.appengine.datanucleus.test.jdo.HasExtraTypes1JDO

* Tests for persistence of various non-standard Java types
*/
public class JDOTypesTest extends JDOTestCase {

  public void testTypes1() {
    HasExtraTypes1JDO holder = new HasExtraTypes1JDO();
    holder.setCurrency(Currency.getInstance("GBP"));
    holder.setLocale(Locale.ENGLISH);
    holder.setStringBuffer(new StringBuffer("sausages"));
    holder.setTimezone(TimeZone.getTimeZone("GMT"));

    beginTxn();
    pm.makePersistent(holder);
    commitTxn();
    Object id = pm.getObjectId(holder);
    pm.evictAll();

    beginTxn();
    HasExtraTypes1JDO extra = (HasExtraTypes1JDO)pm.getObjectById(id);
    assertEquals("GBP", extra.getCurrency().getCurrencyCode());
    assertEquals("en", extra.getLocale().toString());
    assertEquals("sausages", extra.getStringBuffer().toString());
    assertEquals("GMT", extra.getTimezone().getID());
    commitTxn();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.