Examples of HasOneToManyListJPA


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

    testInsert_ExistingParentNewChild(new BidirMiddleList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Middle, 3, 3);
  }

  public void testInsert_ExistingParentNewChild_NoTxn() throws Exception {
    testInsert_ExistingParentNewChild(new BidirMiddleList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Middle, 1, 1);
    testInsert_ExistingParentNewChild(new BidirBottomList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Top, 2, 2);
    testInsert_ExistingParentNewChild(new BidirTopList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Bottom, 3, 3);
  }
View Full Code Here

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

    testInsert_ExistingParentNewChild(new BidirTopList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Bottom, 3, 3);
  }

  public void testUpdate_UpdateChildWithMerge() throws Exception {
    testUpdate_UpdateChildWithMerge(new BidirMiddleList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Top, 1, 1);
    testUpdate_UpdateChildWithMerge(new BidirTopList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Bottom, 2, 2);
    testUpdate_UpdateChildWithMerge(new BidirBottomList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Middle, 3, 3);
  }
View Full Code Here

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

    testUpdate_UpdateChildWithMerge(new BidirBottomList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Middle, 3, 3);
  }

  public void testUpdate_UpdateChildWithMerge_NoTxn() throws Exception {
    testUpdate_UpdateChildWithMerge(new BidirTopList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Top, 1, 1);
    testUpdate_UpdateChildWithMerge(new BidirMiddleList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Middle, 2, 2);
    testUpdate_UpdateChildWithMerge(new BidirBottomList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Bottom, 3, 3);
  }
View Full Code Here

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

    testUpdate_UpdateChildWithMerge(new BidirBottomList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Bottom, 3, 3);
  }

  public void testUpdate_UpdateChild() throws Exception {
    testUpdate_UpdateChild(new BidirMiddleList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Middle, 1, 1);
    testUpdate_UpdateChild(new BidirBottomList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Top, 2, 2);
    testUpdate_UpdateChild(new BidirTopList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Bottom, 3, 3);
  }
View Full Code Here

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

    testUpdate_UpdateChild(new BidirTopList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Bottom, 3, 3);
  }

  public void testUpdate_UpdateChild_NoTxn() throws Exception {
    testUpdate_UpdateChild(new BidirTopList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Middle, 1, 1);
    testUpdate_UpdateChild(new BidirMiddleList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Top, 2, 2);
    testUpdate_UpdateChild(new BidirBottomList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Bottom, 3, 3);
  }
View Full Code Here

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

    testUpdate_UpdateChild(new BidirBottomList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Bottom, 3, 3);
  }

  public void testUpdate_NullOutChildren() throws Exception {
    testUpdate_NullOutChildren(new BidirTopList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Bottom, 1);
    testUpdate_NullOutChildren(new BidirBottomList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Middle, 2);
    testUpdate_NullOutChildren(new BidirMiddleList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Top, 3);
  }
View Full Code Here

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

    testUpdate_NullOutChildren(new BidirMiddleList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Top, 3);
  }

  public void testUpdate_NullOutChildren_NoTxn() throws Exception {
    testUpdate_NullOutChildren(new BidirBottomList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Middle, 1);
    testUpdate_NullOutChildren(new BidirTopList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Top, 2);
    testUpdate_NullOutChildren(new BidirMiddleList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Bottom, 3);
  }
View Full Code Here

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

    testUpdate_NullOutChildren(new BidirMiddleList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Bottom, 3);
  }

  public void testUpdate_ClearOutChildren() throws Exception {
    testUpdate_ClearOutChildren(new BidirBottomList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Top, 1);
    testUpdate_ClearOutChildren(new BidirMiddleList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Middle, 2);
    testUpdate_ClearOutChildren(new BidirTopList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Bottom, 3);
  }
View Full Code Here

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

        TXN_START_END, UnidirLevel.Middle, 2);
    testUpdate_ClearOutChildren(new BidirTopList(), new HasOneToManyListJPA(),
        TXN_START_END, UnidirLevel.Bottom, 3);
  }
  public void testUpdate_ClearOutChildren_NoTxn() throws Exception {
    testUpdate_ClearOutChildren(new BidirTopList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Bottom, 1);
    testUpdate_ClearOutChildren(new BidirMiddleList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Middle, 2);
    testUpdate_ClearOutChildren(new BidirBottomList(), new HasOneToManyListJPA(),
        NEW_EM_START_END, UnidirLevel.Top, 3);
  }
View Full Code Here

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

  public void testSwapAtPosition_NoTxn() throws Exception {
    testSwapAtPosition(NEW_EM_START_END);
  }

  private void testSwapAtPosition(StartEnd startEnd) throws Exception {
    HasOneToManyListJPA pojo = new HasOneToManyListJPA();
    pojo.setVal("yar");
    BidirTopList bidir1 = new BidirTopList();
    BidirTopList bidir2 = new BidirBottomList();
    bidir2.setChildVal("yam");
    UnidirTop unidir = newUnidir(UnidirLevel.Bottom);
    HasKeyPkJPA hasKeyPk = new HasKeyPkJPA();

    pojo.getUnidirChildren().add(unidir);
    pojo.getHasKeyPks().add(hasKeyPk);
    pojo.getBidirChildren().add(bidir1);
    bidir1.setParent(pojo);

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

    assertCountsInDatastore(HasOneToManyListJPA.class, BidirTopList.class, 1, 1);

    startEnd.start();
    pojo = em.find(pojo.getClass(), pojo.getId());
    String bidir1Id = pojo.getBidirChildren().get(0).getId();
    String bookId = pojo.getUnidirChildren().get(0).getId();
    Key hasKeyPk1Key = pojo.getHasKeyPks().get(0).getId();
    pojo.getBidirChildren().set(0, bidir2);

    UnidirTop unidir2 = newUnidir(UnidirLevel.Middle);
    String expectedName = unidir2.getName();
    unidir2.setStr("another title");
    pojo.getUnidirChildren().set(0, unidir2);

    HasKeyPkJPA hasKeyPk2 = new HasKeyPkJPA();
    hasKeyPk2.setStr("another str");
    pojo.getHasKeyPks().set(0, hasKeyPk2);
    startEnd.end();

    startEnd.start();
    assertNotNull(pojo.getId());
    assertEquals(1, pojo.getUnidirChildren().size());
    assertEquals(1, pojo.getHasKeyPks().size());
    assertEquals(1, pojo.getBidirChildren().size());
    assertNotNull(bidir2.getId());
    assertNotNull(bidir2.getParent());
    assertNotNull(unidir2.getId());
    assertNotNull(hasKeyPk2.getId());

    Entity pojoEntity = ds.get(KeyFactory.stringToKey(pojo.getId()));
    assertNotNull(pojoEntity);
    assertEquals(4, pojoEntity.getProperties().size());
    assertEquals(Collections.singletonList(KeyFactory.stringToKey(bidir2.getId())), pojoEntity.getProperty("bidirChildren"));
    assertEquals(Collections.singletonList(KeyFactory.stringToKey(unidir2.getId())), pojoEntity.getProperty("unidirChildren"));
    assertEquals(Collections.singletonList(hasKeyPk2.getId()), pojoEntity.getProperty("hasKeyPks"));

    startEnd.end();

    try {
      ds.get(KeyFactory.stringToKey(bidir1Id));
      fail("expected EntityNotFoundException");
    } catch (EntityNotFoundException enfe) {
      // good
    }
    try {
      ds.get(KeyFactory.stringToKey(bookId));
      fail("expected EntityNotFoundException");
    } catch (EntityNotFoundException enfe) {
      // good
    }
    try {
      ds.get(hasKeyPk1Key);
      fail("expected EntityNotFoundException");
    } catch (EntityNotFoundException enfe) {
      // good
    }
    Entity bidirChildEntity = ds.get(KeyFactory.stringToKey(bidir2.getId()));
    assertNotNull(bidirChildEntity);
    assertEquals(bidir2.getClass().getName(), bidirChildEntity.getProperty("DTYPE"));
    assertEquals("yam", bidirChildEntity.getProperty("childVal"));
    assertEquals(KeyFactory.stringToKey(bidir2.getId()), bidirChildEntity.getKey());
    assertKeyParentEquals(pojo.getId(), bidirChildEntity, bidir2.getId());

    Entity unidirEntity = ds.get(KeyFactory.stringToKey(unidir2.getId()));
    assertNotNull(unidirEntity);
    assertEquals(expectedName, unidirEntity.getProperty("name"));
    assertEquals(UnidirLevel.Middle.discriminator, unidirEntity.getProperty("DTYPE"));
    assertEquals("another title", unidirEntity.getProperty("str"));
    assertEquals(KeyFactory.stringToKey(unidir2.getId()), unidirEntity.getKey());
    assertKeyParentEquals(pojo.getId(), unidirEntity, unidir2.getId());

    Entity hasKeyPkEntity = ds.get(hasKeyPk2.getId());
    assertNotNull(hasKeyPkEntity);
    assertEquals("another str", hasKeyPkEntity.getProperty("str"));
    assertEquals(hasKeyPk2.getId(), hasKeyPkEntity.getKey());
    assertKeyParentEquals(pojo.getId(), hasKeyPkEntity, hasKeyPk2.getId());

    Entity parentEntity = ds.get(KeyFactory.stringToKey(pojo.getId()));
    assertNotNull(parentEntity);
    assertEquals(4, parentEntity.getProperties().size());
    assertEquals("yar", parentEntity.getProperty("val"));
    assertEquals(Collections.singletonList(bidirChildEntity.getKey()), pojoEntity.getProperty("bidirChildren"));
    assertEquals(Collections.singletonList(unidirEntity.getKey()), pojoEntity.getProperty("unidirChildren"));
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.