1 4 package org.objectweb.speedo.runtime.collection; 5 6 import org.objectweb.speedo.SpeedoTestHelper; 7 import org.objectweb.speedo.pobjects.collection.AutoRef; 8 9 import javax.jdo.PersistenceManager; 10 import java.util.Arrays ; 11 12 17 public class TestAutoRef extends SpeedoTestHelper { 18 19 22 public TestAutoRef(String s) { 23 super(s); 24 } 25 26 29 protected String getLoggerName() { 30 return "TestAutoRef"; 31 } 32 33 34 public void testA() { 35 AutoRef ar1 = new AutoRef("testA_ar1"); 36 ar1.setMyRef(new AutoRef("testA_ar2")); 37 ar1.setMyRefs(Arrays.asList(new AutoRef[]{ 38 new AutoRef("testA_ar3"), new AutoRef("testA_ar4")})); 39 PersistenceManager pm = pmf.getPersistenceManager(); 40 pm.currentTransaction().begin(); 41 pm.makePersistent(ar1); 42 ar1 = null; 43 pm.currentTransaction().commit(); 44 pm.evictAll(); 45 pm.currentTransaction().begin(); 46 ar1 = (AutoRef) pm.getObjectById( 47 pm.newObjectIdInstance(AutoRef.class, "testA_ar1"), false); 48 pm.deletePersistentAll(ar1.getMyRefs()); 49 pm.deletePersistent(ar1.getMyRef()); 50 pm.deletePersistent(ar1); 51 pm.currentTransaction().commit(); 52 pm.close(); 53 } 54 } 55 | Popular Tags |