01: /**
02: * Copyright (C) 2001-2004 France Telecom R&D
03: */package org.objectweb.speedo.runtime.collection;
04:
05: import org.objectweb.speedo.SpeedoTestHelper;
06: import org.objectweb.speedo.pobjects.collection.AutoRef;
07:
08: import javax.jdo.PersistenceManager;
09: import java.util.Arrays;
10:
11: /**
12: *
13: *
14: * @author chassase
15: */
16: public class TestAutoRef extends SpeedoTestHelper {
17:
18: /**
19: * @param s
20: */
21: public TestAutoRef(String s) {
22: super (s);
23: }
24:
25: /**
26: * @see org.objectweb.speedo.SpeedoTestHelper#getLoggerName()
27: */
28: protected String getLoggerName() {
29: return "TestAutoRef";
30: }
31:
32: public void testA() {
33: AutoRef ar1 = new AutoRef("testA_ar1");
34: ar1.setMyRef(new AutoRef("testA_ar2"));
35: ar1.setMyRefs(Arrays.asList(new AutoRef[] {
36: new AutoRef("testA_ar3"), new AutoRef("testA_ar4") }));
37: PersistenceManager pm = pmf.getPersistenceManager();
38: pm.currentTransaction().begin();
39: pm.makePersistent(ar1);
40: ar1 = null;
41: pm.currentTransaction().commit();
42: pm.evictAll();
43: pm.currentTransaction().begin();
44: ar1 = (AutoRef) pm.getObjectById(pm.newObjectIdInstance(
45: AutoRef.class, "testA_ar1"), false);
46: pm.deletePersistentAll(ar1.getMyRefs());
47: pm.deletePersistent(ar1.getMyRef());
48: pm.deletePersistent(ar1);
49: pm.currentTransaction().commit();
50: pm.close();
51: }
52: }
|