pm.close();
}
}
public void testManyMany3() { // tests with manually managed consistency
A a1 = new A("testManyMany3_a1");
A a2 = new A("testManyMany3_a2");
A a3 = new A("testManyMany3_a3");
B b1 = new B("testManyMany3_b1");
B b2 = new B("testManyMany3_b2");
B b3 = new B("testManyMany3_b3");
PersistenceManager pm = pmf.getPersistenceManager();
a1.setBs(Arrays.asList(new Object[] { b1, b2 }));
a2.setBs(Arrays.asList(new Object[] { b1, b2, b3 }));
a3.setBs(Arrays.asList(new Object[] { b2, b3 }));
b1.setAs(Arrays.asList(new Object[] { a1, a2 }));
b2.setAs(Arrays.asList(new Object[] { a1, a2, a3 }));
b3.setAs(Arrays.asList(new Object[] { a2, a3 }));
pm.makePersistent(a1);
pm.makePersistent(a2);
pm.makePersistent(a3);
pm.close();
try {
pm = pmf.getPersistenceManager();
assertTrue(a1.getBs().size() == 2);
assertTrue(a1.getBs().contains(b1));
assertTrue(a1.getBs().contains(b2));
assertTrue(a2.getBs().size() == 3);
assertTrue(a2.getBs().contains(b1));
assertTrue(a2.getBs().contains(b2));
assertTrue(a2.getBs().contains(b3));
assertTrue(a3.getBs().size() == 2);
assertTrue(a3.getBs().contains(b2));
assertTrue(a3.getBs().contains(b3));
assertTrue(b1.getAs().size() == 2);
assertTrue(b1.getAs().contains(a1));
assertTrue(b1.getAs().contains(a2));