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

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


    switchDatasource(PersistenceManagerFactoryName.nontransactional);
    getExecutionContext().setProperty(PROP_DETACH_ON_CLOSE, true);
    testRemoveAll_LongPkOnParent(NEW_PM_DETACH_ON_CLOSE_START_END);
  }
  private void testRemoveAll_LongPkOnParent(StartEnd startEnd) throws EntityNotFoundException {
    testRemoveAll_LongPkOnParent(new HasOneToManyListLongPk(), new BidirTopLongPk(),
                  new BidirMiddleLongPk(), new BidirBottomLongPk(),
                  startEnd);
  }
View Full Code Here


    UnidirTop unidir = newUnidir(unidirLevel);
    String expectedStr = unidir.getStr();
    String expectedName = unidir.getName();

    HasOneToManyListLongPk parent = new HasOneToManyListLongPk();
    parent.addBidirChild(bidirChild);
    bidirChild.setParent(parent);
    parent.addUnidirChild(unidir);
    parent.setVal("yar");

    startEnd.start();
    pm.makePersistent(parent);
    startEnd.end();

    assertNotNull(bidirChild.getId());
    assertNotNull(unidir.getId());

    Entity bidirChildEntity = ds.get(KeyFactory.stringToKey(bidirChild.getId()));
    assertNotNull(bidirChildEntity);
    assertEquals(getEntityKind(BidirTopLongPk.class), bidirChildEntity.getKind());
    assertEquals(bidirChild.getClass().getName(), bidirChildEntity.getProperty("DISCRIMINATOR"));
    assertEquals("yam", bidirChildEntity.getProperty("childVal"));
    assertEquals(KeyFactory.stringToKey(bidirChild.getId()), bidirChildEntity.getKey());
    PolymorphicTestUtils.assertKeyParentEquals(parent.getClass(), parent.getId(), bidirChildEntity, bidirChild.getId());
    if (isIndexed() && hasIndexPropertyInChild(pm)) {
      assertEquals(0L, bidirChildEntity.getProperty("bidirChildren_INTEGER_IDX"));
    }

    Entity unidirChildEntity = ds.get(KeyFactory.stringToKey(unidir.getId()));
    assertNotNull(unidirChildEntity);
    assertEquals(getEntityKind(UnidirTop.class), unidirChildEntity.getKind());
    int numProps = unidir.getPropertyCount();
    if (hasIndexPropertyInChild(pm)) {
      numProps += getIndexPropertyCount();
    }
    assertEquals(numProps, unidirChildEntity.getProperties().size());
    assertEquals(unidirLevel.discriminator, unidirChildEntity.getProperty("TYPE"));
    assertEquals(expectedStr, unidirChildEntity.getProperty("str"));
    assertEquals(expectedName, unidirChildEntity.getProperty("name"));
    assertEquals(KeyFactory.stringToKey(unidir.getId()), unidirChildEntity.getKey());
    PolymorphicTestUtils.assertKeyParentEquals(parent.getClass(), parent.getId(), unidirChildEntity, unidir.getId());
    if (isIndexed() && hasIndexPropertyInChild(pm)) {
      assertEquals(0L, unidirChildEntity.getProperty("unidirChildren_INTEGER_IDX_longpk"));
    }

    Entity parentEntity = ds.get(KeyFactory.createKey(getEntityKind(parent.getClass()), parent.getId()));
    assertNotNull(parentEntity);
    assertEquals(3, parentEntity.getProperties().size());
    assertEquals("yar", parentEntity.getProperty("val"));
    assertEquals(Lists.newArrayList(bidirChildEntity.getKey()), parentEntity.getProperty("bidirChildren"));
    assertEquals(Lists.newArrayList(unidirChildEntity.getKey()), parentEntity.getProperty("unidirChildren"));
View Full Code Here

    switchDatasource(PersistenceManagerFactoryName.nontransactional);
    getExecutionContext().setProperty(PROP_DETACH_ON_CLOSE, true);
    testFetchOfOneToManyParentWithLongPk(NEW_PM_START_END);
  }
  private void testFetchOfOneToManyParentWithLongPk(StartEnd startEnd) {
    testFetchOfOneToManyParentWithLongPk(new HasOneToManyListLongPk(), startEnd);
  }
View Full Code Here

    getExecutionContext().setProperty(PROP_DETACH_ON_CLOSE, true);
    testAddChildToOneToManyParentWithLongPk(NEW_PM_START_END);
  }
  private void testAddChildToOneToManyParentWithLongPk(StartEnd startEnd) throws EntityNotFoundException {
    testAddChildToOneToManyParentWithLongPk(
        new HasOneToManyListLongPk(), new BidirTopLongPk(), startEnd, UnidirLevel.Top);
    testAddChildToOneToManyParentWithLongPk(
        new HasOneToManyListLongPk(), new BidirMiddleLongPk(), startEnd, UnidirLevel.Middle);
    testAddChildToOneToManyParentWithLongPk(
        new HasOneToManyListLongPk(), new BidirBottomLongPk(), startEnd, UnidirLevel.Bottom);
  }
View Full Code Here

TOP

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

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.