pm.close();
}
}
public void testManyManyDelete() {
C c1 = new C("testManyManyDelete_c1");
C c2 = new C("testManyManyDelete_c2");
C c3 = new C("testManyManyDelete_c3");
D d1 = new D("testManyManyDelete_d1");
D d2 = new D("testManyManyDelete_d2");
D d3 = new D("testManyManyDelete_d3");
PersistenceManager pm = pmf.getPersistenceManager();
pm.makePersistent(c1);
pm.makePersistent(c2);
pm.makePersistent(c3);
pm.makePersistent(d1);
pm.makePersistent(d2);
pm.makePersistent(d3);
logger.log(BasicLevel.DEBUG, "testManyManyDelete:after makePersistent");
pm.close();
logger.log(BasicLevel.DEBUG, "testManyManyDelete:after close");
try {
pm = pmf.getPersistenceManager();
c1.getDs().add(d1);
c1.getDs().add(d2);
c2.getDs().add(d1);
c2.getDs().add(d2);
c2.getDs().add(d3);
c3.getDs().add(d2);
c3.getDs().add(d3);
logger.log(BasicLevel.DEBUG, "testManyManyDelete:after ad collection content");
pm.close();
logger.log(BasicLevel.DEBUG, "testManyManyDelete:after close");
pm = pmf.getPersistenceManager();
pm.currentTransaction().begin();
assertTrue(d1.getCs().contains(c1));
assertTrue(d2.getCs().contains(c1));
assertTrue(d1.getCs().contains(c2));
assertTrue(d2.getCs().contains(c2));
assertTrue(d3.getCs().contains(c2));
assertTrue(d2.getCs().contains(c3));
assertTrue(d3.getCs().contains(c3));
pm.deletePersistent(d2);
logger.log(BasicLevel.DEBUG, "testManyManyDelete:after delete d2");
pm.currentTransaction().commit();
pm.close();
logger.log(BasicLevel.DEBUG, "testManyManyDelete:after close");
pm = pmf.getPersistenceManager();
assertTrue(c1.getDs().size() == 1);
logger.log(BasicLevel.DEBUG, "testManyManyDelete:c1.nds.size()==1 : " + (c1.getDs().size()==1));
assertTrue(c1.getDs().contains(d1));
logger.log(BasicLevel.DEBUG, "testManyManyDelete:c1.nds.contains(d1) : " + (c1.getDs().contains(d1)));
assertTrue(c2.getDs().size() == 2);
logger.log(BasicLevel.DEBUG, "testManyManyDelete:c2.nds.size()==1 : " + (c2.getDs().size()==1));
assertTrue(c2.getDs().contains(d1));
logger.log(BasicLevel.DEBUG, "testManyManyDelete:c2.nds.contains(d1) : " + (c2.getDs().contains(d1)));
assertTrue(c2.getDs().contains(d3));
logger.log(BasicLevel.DEBUG, "testManyManyDelete:c2.nds.contains(d3) : " + (c2.getDs().contains(d3)));
assertTrue(c3.getDs().size() == 1);
logger.log(BasicLevel.DEBUG, "testManyManyDelete:c3.nds.size()==1 : " + (c3.getDs().size()==1));
assertTrue(c3.getDs().contains(d3));
logger.log(BasicLevel.DEBUG, "testManyManyDelete:c3.nds.contains(d3) : " + (c3.getDs().contains(d3)));
assertTrue(d1.getCs().contains(c1));
logger.log(BasicLevel.DEBUG, "testManyManyDelete:d1.cs.contains(c1) : " + (d1.getCs().contains(c1)));
assertTrue(d1.getCs().contains(c2));
logger.log(BasicLevel.DEBUG, "testManyManyDelete:d1.cs.contains(c2) : " + (d1.getCs().contains(c2)));