testNewParentNewChild_StringKeyOnParent(NEW_PM_START_END);
}
private void testNewParentNewChild_StringKeyOnParent(StartEnd startEnd) throws EntityNotFoundException {
Flight f = newFlight();
HasKeyPkJDO hasKeyPk = new HasKeyPkJDO();
HasOneToOneStringPkParentJDO hasParent = new HasOneToOneStringPkParentJDO();
HasOneToOneStringPkParentKeyPkJDO hasParentKeyPk = new HasOneToOneStringPkParentKeyPkJDO();
HasOneToOneStringPkJDO pojo = new HasOneToOneStringPkJDO();
pojo.setId("yar");
pojo.setFlight(f);
pojo.setHasKeyPK(hasKeyPk);
pojo.setHasParent(hasParent);
hasParent.setParent(pojo);
pojo.setHasParentKeyPK(hasParentKeyPk);
hasParentKeyPk.setParent(pojo);
makePersistentInTxn(pojo, startEnd);
assertNotNull(f.getId());
assertNotNull(hasKeyPk.getKey());
assertNotNull(hasParent.getKey());
assertNotNull(hasParentKeyPk.getKey());
assertNotNull(pojo.getId());
Entity flightEntity = ds.get(KeyFactory.stringToKey(f.getId()));
assertNotNull(flightEntity);
assertEquals("jimmy", flightEntity.getProperty("name"));
assertEquals("bos", flightEntity.getProperty("origin"));
assertEquals("mia", flightEntity.getProperty("dest"));
assertEquals(2L, flightEntity.getProperty("me"));
assertEquals(3L, flightEntity.getProperty("you"));
assertEquals(44L, flightEntity.getProperty("flight_number"));
assertEquals(KeyFactory.stringToKey(f.getId()), flightEntity.getKey());
assertKeyParentEquals(pojo.getClass(), pojo.getId(), flightEntity, f.getId());
Entity hasKeyPkEntity = ds.get(hasKeyPk.getKey());
assertNotNull(hasKeyPkEntity);
assertEquals(hasKeyPk.getKey(), hasKeyPkEntity.getKey());
assertKeyParentEquals(pojo.getClass(), pojo.getId(), hasKeyPkEntity, hasKeyPk.getKey());
Entity hasParentEntity = ds.get(KeyFactory.stringToKey(hasParent.getKey()));
assertNotNull(hasParentEntity);
assertEquals(KeyFactory.stringToKey(hasParent.getKey()), hasParentEntity.getKey());
assertKeyParentEquals(pojo.getClass(), pojo.getId(), hasParentEntity, hasParent.getKey());
Entity hasParentKeyPkEntity = ds.get(hasParentKeyPk.getKey());
assertNotNull(hasParentKeyPkEntity);
assertEquals(hasParentKeyPk.getKey(), hasParentKeyPkEntity.getKey());
assertKeyParentEquals(pojo.getClass(), pojo.getId(), hasParentKeyPkEntity, hasParentKeyPk.getKey());