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

Examples of com.google.appengine.datanucleus.test.jdo.HasPolymorphicRelationsListJDO.HasOneToManyChildAtMultipleLevels


    testOneToManyChildAtMultipleLevels(startEnd, UnidirLevel.Middle, UnidirLevel.Bottom, 2);
    testOneToManyChildAtMultipleLevels(startEnd, UnidirLevel.Bottom, UnidirLevel.Bottom, 3);
  }
  private void testOneToManyChildAtMultipleLevels(StartEnd startEnd,
      UnidirLevel unidirLevel1, UnidirLevel unidirLevel2, int count) {
    HasOneToManyChildAtMultipleLevels pojo = new HasOneToManyChildAtMultipleLevels();
    UnidirTop unidir1 = newUnidir(unidirLevel1);
    pojo.setUnidirChildren(Utils.newArrayList(unidir1));
    HasOneToManyChildAtMultipleLevels child = new HasOneToManyChildAtMultipleLevels();
    UnidirTop unidir2 = newUnidir(unidirLevel2);
    child.setUnidirChildren(Utils.newArrayList(unidir2));
    pojo.setChild(child);
    startEnd.start();
    pm.makePersistent(pojo);
    startEnd.end();
    startEnd.start();
    assertEquals(2 * count, countForClass(UnidirTop.class));
    pojo = pm.getObjectById(HasOneToManyChildAtMultipleLevels.class, pojo.getId());
    assertEquals(child.getId(), pojo.getChild().getId());
    assertEquals(1, pojo.getUnidirChildren().size());
    assertTrue(pojo.getUnidirChildren().get(0).customEquals(unidir1));
    assertTrue(child.getUnidirChildren().get(0).customEquals(unidir2));
    assertEquals(1, child.getUnidirChildren().size());
    startEnd.end();
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jdo.HasPolymorphicRelationsListJDO.HasOneToManyChildAtMultipleLevels

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.