Examples of UnidirBottom


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

  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());
    }
    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()));
    Entity bidirEntity3 = ds.get(KeyFactory.stringToKey(bidir3.getId()));
    if (isIndexed() && hasIndexPropertyInChild(pm)) {
      // Only have index property when using older storageVersions
      assertEquals(0L, unidirEntity1.getProperty("unidirChildren_INTEGER_IDX"));
View Full Code Here

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


  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());
    }
    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()));
    Entity bidirEntity3 = ds.get(KeyFactory.stringToKey(bidir3.getId()));
    if (isIndexed() && hasIndexPropertyInChild(pm)) {
      // Only have index property when using older storageVersions
View Full Code Here

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

 
  void testRemoveAll_UnencodedStringPkOnParent(HasOneToManyUnencodedStringPkJDO pojo, BidirTopUnencodedStringPkJDO bidir1,
      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");
View Full Code Here

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

          throw new ConcurrentModificationException("kaboom");
        }
      }
    };
    DatastoreServiceInterceptor.install(getStoreManager(), policy);
    UnidirTop unidir2 = new UnidirBottom();
    try {
      pmf.close();
      switchDatasource(PersistenceManagerFactoryName.nontransactional);
      pojo = pm.getObjectById(pojo.getClass(), pojo.getId());
      pojo.addUnidirChild(unidir2);
      pm.close();
      fail("expected exception");
    } catch (ConcurrentModificationException cme) {
      // good
    } finally {
      DatastoreServiceInterceptor.uninstall();
    }
    // prove that the book entity exists
    ds.get(KeyFactory.stringToKey(unidir2.getId()));
    Entity pojoEntity = ds.get(KeyFactory.stringToKey(pojo.getId()));
    // the parent has a reference to the first book that was already there
    // but no reference to the second book
    assertEquals(
        Collections.singletonList(KeyFactory.stringToKey(unidir1.getId())),
View Full Code Here

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

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

    case Bottom:
      UnidirBottom bottom = new UnidirBottom();
      bottom.setStr("bottom");
      bottom.setName("bottom name");
      return bottom;

    default:
      return null;
    }
View Full Code Here

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

      unidir = new UnidirMiddle(nextNamedKey());
      unidir.setName("middle name");
      unidir.setStr("middle str");
      break;
    case Bottom:
      unidir = new UnidirBottom(nextNamedKey());
      unidir.setName("bottom name");
      unidir.setStr("bottom str");
      break;
    }
    return unidir;
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.