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

Examples of com.google.appengine.datanucleus.test.jpa.HasPolymorphicRelationsJPA.HasOneToManyJPA


    pojoEntity.setProperty("bidirChildren", Utils.newArrayList(bidirEntity.getKey()));
    ds.put(pojoEntity);

    startEnd.start();
    registerSubclasses();
    HasOneToManyJPA pojo = em.find(pojoClass, KeyFactory.keyToString(pojoEntity.getKey()));
    assertNotNull(pojo);
    assertNotNull(pojo.getUnidirChildren());
    assertEquals(1, pojo.getUnidirChildren().size());
    assertEquals(unidirLevel.clazz, pojo.getUnidirChildren().iterator().next().getClass());
    assertEquals("name1", pojo.getUnidirChildren().iterator().next().getName());
    assertNotNull(pojo.getHasKeyPks());
    assertEquals(1, pojo.getHasKeyPks().size());
    assertEquals("yar", pojo.getHasKeyPks().iterator().next().getStr());
    assertNotNull(pojo.getBidirChildren());
    assertEquals(bidirClass, pojo.getBidirChildren().iterator().next().getClass());
    assertEquals("yap", pojo.getBidirChildren().iterator().next().getChildVal());
    assertEquals(pojo, pojo.getBidirChildren().iterator().next().getParent());
    startEnd.end();
  }
View Full Code Here


        "select from " + pojoClass.getName() + " b where id = :key");
    q.setParameter("key", KeyFactory.keyToString(pojoEntity.getKey()));
    @SuppressWarnings("unchecked")
    List<HasOneToManyJPA> result = (List<HasOneToManyJPA>) q.getResultList();
    assertEquals(1, result.size());
    HasOneToManyJPA pojo = result.get(0);
    assertNotNull(pojo.getUnidirChildren());
    assertEquals(1, pojo.getUnidirChildren().size());
    assertEquals(unidirLevel.clazz, pojo.getUnidirChildren().iterator().next().getClass());
    assertEquals("name", pojo.getUnidirChildren().iterator().next().getName());
    assertEquals(1, pojo.getUnidirChildren().size());
    assertNotNull(pojo.getHasKeyPks());
    assertEquals(1, pojo.getHasKeyPks().size());
    assertEquals("yar", pojo.getHasKeyPks().iterator().next().getStr());
    assertNotNull(pojo.getBidirChildren());
    assertEquals(1, pojo.getBidirChildren().size());
    assertEquals(bidirClass, pojo.getBidirChildren().iterator().next().getClass());
    assertEquals("yap", pojo.getBidirChildren().iterator().next().getChildVal());
    assertEquals(pojo, pojo.getBidirChildren().iterator().next().getParent());
    startEnd.end();
  }
View Full Code Here

      // the only get we're going to perform is for the pojo
      EasyMock.expect(mockDatastore.get(txn, pojoEntity.getKey())).andReturn(pojoEntity);
      EasyMock.replay(mockDatastore);

      beginTxn();
      HasOneToManyJPA pojo = em.find(pojoClass, KeyFactory.keyToString(pojoEntity.getKey()));
      assertNotNull(pojo);
      pojo.getId();
      commitTxn();
    } finally {
      // need to close the pmf before we restore the original datastore service
      emf.close();
      DatastoreServiceFactoryInternal.setDatastoreService(original);
View Full Code Here

    pojoEntity.setProperty("bidirChildren", Utils.newArrayList(bidirEntity.getKey()));
    ds.put(pojoEntity);

    startEnd.start();
    registerSubclasses();
    HasOneToManyJPA pojo = em.find(pojoClass, KeyFactory.keyToString(pojoEntity.getKey()));
    em.remove(pojo);
    startEnd.end();
    assertCountsInDatastore(pojoClass, bidirClass, 0, 0);
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jpa.HasPolymorphicRelationsJPA.HasOneToManyJPA

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.