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"));