Package com.google.appengine.datanucleus.test.jdo

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


*/
public class JDOUnownedOneToManyTest extends JDOTestCase {

  public void testSetPersistUniNewBoth() throws EntityNotFoundException {
    // Persist A-B as unowned
    UnownedJDOOneToManyUniSetSideA a = new UnownedJDOOneToManyUniSetSideA();
    a.setName("Side A");
    UnownedJDOOneToManyUniSideB b = new UnownedJDOOneToManyUniSideB();
    b.setName("Side B");
    a.addOther(b);

    pm.makePersistent(a);

    Object aId = pm.getObjectId(a);
    Object bId = pm.getObjectId(b);

    pm.evictAll(); // Make sure we go to the datastore

    // Retrieve by id and check
    UnownedJDOOneToManyUniSetSideA a2 = (UnownedJDOOneToManyUniSetSideA)pm.getObjectById(aId);
    assertNotNull(a2);
    assertEquals("Side A", a2.getName());
    Set<UnownedJDOOneToManyUniSideB> others = a2.getOthers();
    assertNotNull(others);
    assertEquals(1, others.size());
    UnownedJDOOneToManyUniSideB b2 = others.iterator().next();
    assertNotNull(b2);
    assertNotNull("Side B", b2.getName());
View Full Code Here


    assertNotNull("Side B", b2.getName());
    assertEquals(bId, pm.getObjectId(b2));
  }

  public void testSetDeleteOwnerNotDependent() {
    UnownedJDOOneToManyUniSetSideA a = new UnownedJDOOneToManyUniSetSideA();
    a.setName("Side A");
    UnownedJDOOneToManyUniSideB b1 = new UnownedJDOOneToManyUniSideB();
    b1.setName("First B");
    UnownedJDOOneToManyUniSideB b2 = new UnownedJDOOneToManyUniSideB();
    b2.setName("Second B");
    a.addOther(b1);
    a.addOther(b2);
    pm.makePersistent(a);
    pm.close();

    pm = pmf.getPersistenceManager();
    List<UnownedJDOOneToManyUniSetSideA> as = (List<UnownedJDOOneToManyUniSetSideA>)
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jdo.UnownedJDOOneToManyUniSetSideA

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.