001: /**
002: * Copyright (C) 2001-2004 France Telecom R&D
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */package org.objectweb.speedo.runtime.relations.mn;
018:
019: import org.objectweb.speedo.SpeedoTestHelper;
020: import org.objectweb.speedo.pobjects.relations.mn.Qsdfgh;
021: import org.objectweb.speedo.pobjects.relations.mn.p1.Azerty;
022:
023: import javax.jdo.PersistenceManager;
024:
025: /**
026: *
027: * @author S.Chassande-Barrioz
028: */
029: public class TestMN extends SpeedoTestHelper {
030:
031: public TestMN(String s) {
032: super (s);
033: }
034:
035: protected String getLoggerName() {
036: return LOG_NAME + "rt.relations.mn";
037: }
038:
039: public void testA() {
040: PersistenceManager pm = pmf.getPersistenceManager();
041: pm.currentTransaction().begin();
042: Qsdfgh q0 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
043: Qsdfgh.class, "q0"), false);
044: Qsdfgh q1 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
045: Qsdfgh.class, "q1"), false);
046: Azerty a0 = (Azerty) pm.getObjectById(pm.newObjectIdInstance(
047: Azerty.class, "a0"), false);
048: a0.qsds.remove(q0);
049: a0.qsds.remove(q1);
050: pm.currentTransaction().commit();
051: pm.close();
052:
053: pm = pmf.getPersistenceManager();
054: pm.currentTransaction().begin();
055: q0 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
056: Qsdfgh.class, "q0"), false);
057: q1 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
058: Qsdfgh.class, "q1"), false);
059: a0 = (Azerty) pm.getObjectById(pm.newObjectIdInstance(
060: Azerty.class, "a0"), false);
061: a0.qsds.add(q0);
062: a0.qsds.add(q1);
063: pm.currentTransaction().commit();
064: pm.close();
065:
066: pm = pmf.getPersistenceManager();
067: pm.currentTransaction().begin();
068: q0 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
069: Qsdfgh.class, "q0"), false);
070: q1 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
071: Qsdfgh.class, "q1"), false);
072: a0 = (Azerty) pm.getObjectById(pm.newObjectIdInstance(
073: Azerty.class, "a0"), false);
074: a0.qsds.remove(q0);
075: a0.qsds.remove(q1);
076: pm.currentTransaction().commit();
077: pm.close();
078:
079: pm = pmf.getPersistenceManager();
080: pm.currentTransaction().begin();
081: q0 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
082: Qsdfgh.class, "q0"), false);
083: q1 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
084: Qsdfgh.class, "q1"), false);
085: a0 = (Azerty) pm.getObjectById(pm.newObjectIdInstance(
086: Azerty.class, "a0"), false);
087: a0.qsds.add(q0);
088: a0.qsds.add(q1);
089: pm.currentTransaction().commit();
090: pm.close();
091:
092: pm = pmf.getPersistenceManager();
093: pm.currentTransaction().begin();
094: q0 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
095: Qsdfgh.class, "q0"), false);
096: q1 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
097: Qsdfgh.class, "q1"), false);
098: a0 = (Azerty) pm.getObjectById(pm.newObjectIdInstance(
099: Azerty.class, "a0"), false);
100: a0.qsds.remove(q0);
101: a0.qsds.remove(q1);
102: pm.currentTransaction().commit();
103: pm.close();
104:
105: pm = pmf.getPersistenceManager();
106: pm.currentTransaction().begin();
107: q0 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
108: Qsdfgh.class, "q0"), false);
109: q1 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
110: Qsdfgh.class, "q1"), false);
111: a0 = (Azerty) pm.getObjectById(pm.newObjectIdInstance(
112: Azerty.class, "a0"), false);
113: a0.qsds.add(q0);
114: a0.qsds.add(q1);
115: pm.currentTransaction().commit();
116: pm.close();
117:
118: pm = pmf.getPersistenceManager();
119: pm.currentTransaction().begin();
120: q0 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
121: Qsdfgh.class, "q0"), false);
122: q1 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
123: Qsdfgh.class, "q1"), false);
124: a0 = (Azerty) pm.getObjectById(pm.newObjectIdInstance(
125: Azerty.class, "a0"), false);
126: a0.qsds.remove(q0);
127: a0.qsds.remove(q1);
128: pm.currentTransaction().commit();
129: pm.close();
130:
131: pm = pmf.getPersistenceManager();
132: pm.currentTransaction().begin();
133: q0 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
134: Qsdfgh.class, "q0"), false);
135: q1 = (Qsdfgh) pm.getObjectById(pm.newObjectIdInstance(
136: Qsdfgh.class, "q1"), false);
137: a0 = (Azerty) pm.getObjectById(pm.newObjectIdInstance(
138: Azerty.class, "a0"), false);
139: a0.qsds.add(q0);
140: a0.qsds.add(q1);
141: pm.currentTransaction().commit();
142: pm.close();
143: }
144: }
|