Package com.google.appengine.datanucleus.test.jpa.HasPolymorphicRelationsListJPA

Examples of com.google.appengine.datanucleus.test.jpa.HasPolymorphicRelationsListJPA.HasOneToManyLongPkListJPA


    String expectedStr = unidir.getStr();

    HasKeyPkJPA hasKeyPk = new HasKeyPkJPA();
    hasKeyPk.setStr("yag");

    HasOneToManyLongPkListJPA parent = new HasOneToManyLongPkListJPA();
    parent.getBidirChildren().add(bidirChild);
    bidirChild.setParent(parent);
    parent.getUnidirChildren().add(unidir);
    parent.getHasKeyPks().add(hasKeyPk);
    parent.setVal("yar");

    startEnd.start();
    em.persist(parent);
    startEnd.end();

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

    Entity bidirChildEntity = ds.get(KeyFactory.stringToKey(bidirChild.getId()));
    assertNotNull(bidirChildEntity);
    assertEquals(discriminator, bidirChildEntity.getProperty("DTYPE"));
    assertEquals("yam", bidirChildEntity.getProperty("childVal"));
    assertEquals(KeyFactory.stringToKey(bidirChild.getId()), bidirChildEntity.getKey());
    assertKeyParentEquals(parent.getClass(), parent.getId(), bidirChildEntity, bidirChild.getId());

    Entity unidirEntity = ds.get(KeyFactory.stringToKey(unidir.getId()));
    assertNotNull(unidirEntity);
    assertEquals(expectedName, unidirEntity.getProperty("name"));
    assertEquals(expectedStr, unidirEntity.getProperty("str"));
    assertEquals(KeyFactory.stringToKey(unidir.getId()), unidirEntity.getKey());
    assertKeyParentEquals(parent.getClass(), parent.getId(), unidirEntity, unidir.getId());

    Entity hasKeyPkEntity = ds.get(hasKeyPk.getId());
    assertNotNull(hasKeyPkEntity);
    assertEquals("yag", hasKeyPkEntity.getProperty("str"));
    assertEquals(hasKeyPk.getId(), hasKeyPkEntity.getKey());
    assertKeyParentEquals(parent.getClass(), parent.getId(), hasKeyPkEntity, hasKeyPk.getId());

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


  public void testFetchOfOneToManyParentWithKeyPk_NoTxn() throws Exception {
    testFetchOfOneToManyParentWithKeyPk(new HasOneToManyKeyPkListJPA(), NEW_EM_START_END);
  }

  public void testFetchOfOneToManyParentWithLongPk() throws Exception {
    testFetchOfOneToManyParentWithLongPk(new HasOneToManyLongPkListJPA(), TXN_START_END);
  }
View Full Code Here

  public void testFetchOfOneToManyParentWithLongPk() throws Exception {
    testFetchOfOneToManyParentWithLongPk(new HasOneToManyLongPkListJPA(), TXN_START_END);
  }
  public void testFetchOfOneToManyParentWithLongPk_NoTxn() throws Exception {
    testFetchOfOneToManyParentWithLongPk(new HasOneToManyLongPkListJPA(), NEW_EM_START_END);
  }
View Full Code Here

  public void testFetchOfOneToManyParentWithUnencodedStringPk_NoTxn() throws Exception {
    testFetchOfOneToManyParentWithUnencodedStringPk(new HasOneToManyUnencodedStringPkListJPA(), NEW_EM_START_END);
  }

  public void testAddChildToOneToManyParentWithLongPk() throws Exception {
    testAddChildToOneToManyParentWithLongPk(new HasOneToManyLongPkListJPA(), new BidirMiddleLongPkList(),
  TXN_START_END, UnidirLevel.Top, "M");
    testAddChildToOneToManyParentWithLongPk(new HasOneToManyLongPkListJPA(), new BidirTopLongPkList(),
  TXN_START_END, UnidirLevel.Middle, "T");
    testAddChildToOneToManyParentWithLongPk(new HasOneToManyLongPkListJPA(), new BidirBottomLongPkList(),
  TXN_START_END, UnidirLevel.Bottom, "B");
  }
View Full Code Here

  TXN_START_END, UnidirLevel.Middle, "T");
    testAddChildToOneToManyParentWithLongPk(new HasOneToManyLongPkListJPA(), new BidirBottomLongPkList(),
  TXN_START_END, UnidirLevel.Bottom, "B");
  }
  public void testAddChildToOneToManyParentWithLongPk_NoTxn() throws Exception {
    testAddChildToOneToManyParentWithLongPk(new HasOneToManyLongPkListJPA(), new BidirTopLongPkList(),
  NEW_EM_START_END, UnidirLevel.Bottom, "T");
    testAddChildToOneToManyParentWithLongPk(new HasOneToManyLongPkListJPA(), new BidirMiddleLongPkList(),
  NEW_EM_START_END, UnidirLevel.Middle, "M");
    testAddChildToOneToManyParentWithLongPk(new HasOneToManyLongPkListJPA(), new BidirBottomLongPkList(),
  NEW_EM_START_END, UnidirLevel.Top, "B");
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jpa.HasPolymorphicRelationsListJPA.HasOneToManyLongPkListJPA

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.