switchDatasource(PersistenceManagerFactoryName.nontransactional);
getExecutionContext().setProperty(PROP_DETACH_ON_CLOSE, true);
testIndexOf(NEW_PM_START_END);
}
public void testIndexOf(StartEnd startEnd) throws Exception {
HasOneToManyListJDO pojo = new HasOneToManyListJDO();
BidirectionalChildListJDO bidir1 = new BidirectionalChildListJDO();
BidirectionalChildListJDO bidir2 = new BidirectionalChildListJDO();
Flight f1 = newFlight();
Flight f2 = newFlight();
HasKeyPkJDO hasKeyPk1 = new HasKeyPkJDO();
HasKeyPkJDO hasKeyPk2 = new HasKeyPkJDO();
pojo.addBidirChild(bidir1);
pojo.addBidirChild(bidir2);
pojo.addFlight(f1);
pojo.addFlight(f2);
pojo.addHasKeyPk(hasKeyPk1);
pojo.addHasKeyPk(hasKeyPk2);
startEnd.start();
pm.makePersistent(pojo);
startEnd.end();
startEnd.start();
pojo = pm.getObjectById(HasOneToManyListJDO.class, pojo.getId());
bidir1 = pm.getObjectById(bidir1.getClass(), bidir1.getId());
bidir2 = pm.getObjectById(bidir2.getClass(), bidir2.getId());
f1 = pm.getObjectById(f1.getClass(), f1.getId());
f2 = pm.getObjectById(f2.getClass(), f2.getId());
hasKeyPk1 = pm.getObjectById(hasKeyPk1.getClass(), hasKeyPk1.getKey());
hasKeyPk2 = pm.getObjectById(hasKeyPk2.getClass(), hasKeyPk2.getKey());
assertEquals(0, pojo.getBidirChildren().indexOf(bidir1));
assertEquals(1, pojo.getBidirChildren().indexOf(bidir2));
assertEquals(0, pojo.getFlights().indexOf(f1));
assertEquals(1, pojo.getFlights().indexOf(f2));
assertEquals(0, pojo.getHasKeyPks().indexOf(hasKeyPk1));
assertEquals(1, pojo.getHasKeyPks().indexOf(hasKeyPk2));
startEnd.end();
}