Examples of HasEnumJDO


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

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

  public void testRoundtrip() {
    HasEnumJDO pojo = new HasEnumJDO();
    pojo.setMyEnum(V1);
    pojo.setMyEnumArray(new MyEnum[] {V2, V1, V2});
    pojo.setMyEnumList(Utils.newArrayList(V1, V2, V1));
    beginTxn();
    pm.makePersistent(pojo);
    commitTxn();

    beginTxn();
    pojo = pm.getObjectById(HasEnumJDO.class, pojo.getKey());
    assertEquals(HasEnumJDO.MyEnum.V1, pojo.getMyEnum());
    assertTrue(Arrays.equals(new MyEnum[] {V2, V1, V2 }, pojo.getMyEnumArray()));
    assertEquals(Utils.newArrayList(V1, V2, V1), pojo.getMyEnumList());
    commitTxn();
  }
View Full Code Here

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

    assertEquals(Utils.newArrayList(V1, V2, V1), pojo.getMyEnumList());
    commitTxn();
  }

  public void testRoundtrip_Null() {
    HasEnumJDO pojo = new HasEnumJDO();
    beginTxn();
    pm.makePersistent(pojo);
    commitTxn();

    beginTxn();
    pojo = pm.getObjectById(HasEnumJDO.class, pojo.getKey());
    assertNull(pojo.getMyEnum());
    assertNotNull(pojo.getMyEnumArray());
    assertEquals(0, pojo.getMyEnumArray().length);
    assertNotNull(pojo.getMyEnumList());
    assertTrue(pojo.getMyEnumList().isEmpty());
    commitTxn();
  }
View Full Code Here

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

    assertTrue(pojo.getMyEnumList().isEmpty());
    commitTxn();
  }

  public void testRoundtrip_NullContainerVals() {
    HasEnumJDO pojo = new HasEnumJDO();
    pojo.setMyEnumArray(new MyEnum[] {null, V2});
    pojo.setMyEnumList(Utils.newArrayList(null, V2));
    beginTxn();
    pm.makePersistent(pojo);
    commitTxn();

    beginTxn();
    pojo = pm.getObjectById(HasEnumJDO.class, pojo.getKey());
    assertNull(pojo.getMyEnum());
    assertTrue(Arrays.equals(new MyEnum[] {null, V2}, pojo.getMyEnumArray()));
    assertEquals(Utils.newArrayList(null, V2), pojo.getMyEnumList());
    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.