Examples of UnidirMiddle


Examples of com.google.appengine.datanucleus.test.jdo.UnidirectionalSuperclassTableChildJDO.UnidirMiddle

  void testRemoveAll(HasOneToManyJDO pojo, BidirectionalSuperclassTableChildJDO.BidirTop bidir1,
                     BidirectionalSuperclassTableChildJDO.BidirTop bidir2, BidirectionalSuperclassTableChildJDO.BidirTop bidir3, StartEnd startEnd)
      throws EntityNotFoundException {
    UnidirTop unidir1 = new UnidirTop();
    UnidirTop unidir2 = new UnidirMiddle();
    UnidirTop unidir3 = new UnidirBottom();
    pojo.addUnidirChild(unidir1);
    pojo.addUnidirChild(unidir2);
    pojo.addUnidirChild(unidir3);

    pojo.addBidirChild(bidir1);
    pojo.addBidirChild(bidir2);
    pojo.addBidirChild(bidir3);

    startEnd.start();
    pm.makePersistent(pojo);
    startEnd.end();
    startEnd.start();
    pojo = pm.makePersistent(pojo);
    String unidir2Id = unidir2.getId();
    String bidir2Id = bidir2.getId();
    pojo.removeUnidirChildren(Collections.singleton(unidir2));
    pojo.removeBidirChildren(Collections.singleton(bidir2));
    startEnd.end();
    startEnd.start();

    pojo = pm.getObjectById(pojo.getClass(), pojo.getId());

    assertEquals(2, pojo.getUnidirChildren().size());
    Set<String> unidirIds = Utils.newHashSet(unidir1.getId(), unidir2.getId(), unidir3.getId());
    for (UnidirTop unidir : pojo.getUnidirChildren()) {
      unidirIds.remove(unidir.getId());
    }
    assertEquals(1, unidirIds.size());
    assertEquals(unidir2.getId(), unidirIds.iterator().next());

    assertEquals(2, pojo.getBidirChildren().size());
    Set<String> bidirIds = Utils.newHashSet(bidir1.getId(), bidir2.getId(), bidir3.getId());
    for (BidirectionalSuperclassTableChildJDO.BidirTop b : pojo.getBidirChildren()) {
      bidirIds.remove(b.getId());
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.UnidirectionalSuperclassTableChildJDO.UnidirMiddle

  void testRemoveAll_LongPkOnParent(HasOneToManyLongPkJDO pojo, BidirTopLongPk bidir1,
      BidirTopLongPk bidir2, BidirTopLongPk bidir3, StartEnd startEnd)
      throws EntityNotFoundException {
    UnidirTop unidir1 = new UnidirBottom();
    UnidirTop unidir2 = new UnidirMiddle();
    UnidirTop unidir3 = new UnidirTop();
    pojo.addUnidirChild(unidir1);
    pojo.addUnidirChild(unidir2);
    pojo.addUnidirChild(unidir3);

    pojo.addBidirChild(bidir1);
    pojo.addBidirChild(bidir2);
    pojo.addBidirChild(bidir3);

    startEnd.start();
    pm.makePersistent(pojo);
    startEnd.end();
    startEnd.start();
    pojo = pm.makePersistent(pojo);
    String f2Id = unidir2.getId();
    String bidir2Id = bidir2.getId();
    pojo.removeUnidirChildren(Collections.singleton(unidir2));
    pojo.removeBidirChildren(Collections.singleton(bidir2));
    startEnd.end();
    startEnd.start();

    pojo = pm.getObjectById(pojo.getClass(), pojo.getId());
    assertEquals(2, pojo.getUnidirChildren().size());
    Set<String> unidirIds = Utils.newHashSet(unidir1.getId(), unidir2.getId(), unidir3.getId());
    for (UnidirTop f : pojo.getUnidirChildren()) {
      unidirIds.remove(f.getId());
    }
    assertEquals(1, unidirIds.size());
    assertEquals(unidir2.getId(), unidirIds.iterator().next());

    assertEquals(2, pojo.getBidirChildren().size());
    Set<String> bidirIds = Utils.newHashSet(bidir1.getId(), bidir2.getId(), bidir3.getId());
    for (BidirTopLongPk b : pojo.getBidirChildren()) {
      bidirIds.remove(b.getId());
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.UnidirectionalSuperclassTableChildJDO.UnidirMiddle

      BidirTopUnencodedStringPkJDO bidir2,
      BidirTopUnencodedStringPkJDO bidir3, StartEnd startEnd)
      throws EntityNotFoundException {
    UnidirTop unidir1 = new UnidirBottom();
    UnidirTop unidir2 = new UnidirTop();
    UnidirTop unidir3 = new UnidirMiddle();
    pojo.addUnidirChild(unidir1);
    pojo.addUnidirChild(unidir2);
    pojo.addUnidirChild(unidir3);

    pojo.addBidirChild(bidir1);
    pojo.addBidirChild(bidir2);
    pojo.addBidirChild(bidir3);

    startEnd.start();
    pm.makePersistent(pojo);
    startEnd.end();
    startEnd.start();
    pojo = pm.makePersistent(pojo);
    String f2Id = unidir2.getId();
    String bidir2Id = bidir2.getId();
    pojo.removeUnidirChildren(Collections.singleton(unidir2));
    pojo.removeBidirChildren(Collections.singleton(bidir2));
    startEnd.end();
    startEnd.start();

    pojo = pm.getObjectById(pojo.getClass(), pojo.getId());

    assertEquals(2, pojo.getUnidirChildren().size());
    Set<String> unidirIds = Utils.newHashSet(unidir1.getId(), unidir2.getId(), unidir3.getId());
    for (UnidirTop f : pojo.getUnidirChildren()) {
      unidirIds.remove(f.getId());
    }
    assertEquals(1, unidirIds.size());
    assertEquals(unidir2.getId(), unidirIds.iterator().next());

    assertEquals(2, pojo.getBidirChildren().size());
    Set<String> bidirIds = Utils.newHashSet(bidir1.getId(), bidir2.getId(), bidir3.getId());
    for (BidirTopUnencodedStringPkJDO b : pojo.getBidirChildren()) {
      bidirIds.remove(b.getId());
    }
    assertEquals(1, bidirIds.size());
    assertEquals(bidir2.getId(), bidirIds.iterator().next());
    startEnd.end();

    Entity unidirEntity1 = ds.get(KeyFactory.stringToKey(unidir1.getId()));
    Entity unidirEntity3 = ds.get(KeyFactory.stringToKey(unidir3.getId()));
    Entity bidirEntity1 = ds.get(KeyFactory.stringToKey(bidir1.getId()));
    bidirEntity1.setProperty("DISCRIMINATOR", "B");
    Entity bidirEntity3 = ds.get(KeyFactory.stringToKey(bidir3.getId()));
    bidirEntity3.setProperty("DISCRIMINATOR", "M");
    if (isIndexed() && hasIndexPropertyInChild(pm)) {
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jdo.UnidirectionalSuperclassTableChildJDO.UnidirMiddle

      top.setStr("top");
      top.setName("top name");
      return top;

    case Middle:
      UnidirMiddle middle = new UnidirMiddle();
      middle.setStr("middle");
      middle.setName("middle name");
      return middle;

    case Bottom:
      UnidirBottom bottom = new UnidirBottom();
      bottom.setStr("bottom");
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.UnidirectionalSingeTableChildJPA.UnidirMiddle

      unidir = new UnidirTop(nextNamedKey());
      unidir.setName("top name");
      unidir.setStr("top str");
      break;
    case Middle:
      unidir = new UnidirMiddle(nextNamedKey());
      unidir.setName("middle name");
      unidir.setStr("middle str");
      break;
    case Bottom:
      unidir = new UnidirBottom(nextNamedKey());
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.UnidirectionalSingeTableChildJPA.UnidirMiddle

      throws Exception {
    HasPolymorphicRelationsListJPA.HasOneToManyChildAtMultipleLevelsJPA pojo = new HasPolymorphicRelationsListJPA.HasOneToManyChildAtMultipleLevelsJPA();
    UnidirTop unidir1 = new UnidirTop();
    pojo.setUnidirChildren(Utils.newArrayList(unidir1));
    HasPolymorphicRelationsListJPA.HasOneToManyChildAtMultipleLevelsJPA child = new HasPolymorphicRelationsListJPA.HasOneToManyChildAtMultipleLevelsJPA();
    UnidirTop unidir2 = new UnidirMiddle();
    child.setUnidirChildren(Utils.newArrayList(unidir2));
    pojo.setChild(child);
    startEnd.start();
    em.persist(pojo);
    startEnd.end();
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.