KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > runtime > relations > mn > TestMN


1 /**
2  * Copyright (C) 2001-2004 France Telecom R&D
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package org.objectweb.speedo.runtime.relations.mn;
19
20 import org.objectweb.speedo.SpeedoTestHelper;
21 import org.objectweb.speedo.pobjects.relations.mn.Qsdfgh;
22 import org.objectweb.speedo.pobjects.relations.mn.p1.Azerty;
23
24 import javax.jdo.PersistenceManager;
25
26 /**
27  *
28  * @author S.Chassande-Barrioz
29  */

30 public class TestMN extends SpeedoTestHelper {
31
32     public TestMN(String JavaDoc s) {
33         super(s);
34     }
35
36     protected String JavaDoc getLoggerName() {
37         return LOG_NAME + "rt.relations.mn";
38     }
39
40     public void testA() {
41         PersistenceManager pm = pmf.getPersistenceManager();
42         pm.currentTransaction().begin();
43         Qsdfgh q0 = (Qsdfgh) pm.getObjectById(
44                 pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
45         Qsdfgh q1 = (Qsdfgh) pm.getObjectById(
46                 pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
47         Azerty a0 = (Azerty) pm.getObjectById(
48                 pm.newObjectIdInstance(Azerty.class, "a0"), false);
49         a0.qsds.remove(q0);
50         a0.qsds.remove(q1);
51         pm.currentTransaction().commit();
52         pm.close();
53
54         pm = pmf.getPersistenceManager();
55         pm.currentTransaction().begin();
56         q0 = (Qsdfgh) pm.getObjectById(
57                 pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
58         q1 = (Qsdfgh) pm.getObjectById(
59                 pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
60         a0 = (Azerty) pm.getObjectById(
61                 pm.newObjectIdInstance(Azerty.class, "a0"), false);
62         a0.qsds.add(q0);
63         a0.qsds.add(q1);
64         pm.currentTransaction().commit();
65         pm.close();
66
67         pm = pmf.getPersistenceManager();
68         pm.currentTransaction().begin();
69         q0 = (Qsdfgh) pm.getObjectById(
70                 pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
71         q1 = (Qsdfgh) pm.getObjectById(
72                 pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
73         a0 = (Azerty) pm.getObjectById(
74                 pm.newObjectIdInstance(Azerty.class, "a0"), false);
75         a0.qsds.remove(q0);
76         a0.qsds.remove(q1);
77         pm.currentTransaction().commit();
78         pm.close();
79
80         pm = pmf.getPersistenceManager();
81         pm.currentTransaction().begin();
82         q0 = (Qsdfgh) pm.getObjectById(
83                 pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
84         q1 = (Qsdfgh) pm.getObjectById(
85                 pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
86         a0 = (Azerty) pm.getObjectById(
87                 pm.newObjectIdInstance(Azerty.class, "a0"), false);
88         a0.qsds.add(q0);
89         a0.qsds.add(q1);
90         pm.currentTransaction().commit();
91         pm.close();
92
93         pm = pmf.getPersistenceManager();
94         pm.currentTransaction().begin();
95         q0 = (Qsdfgh) pm.getObjectById(
96                 pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
97         q1 = (Qsdfgh) pm.getObjectById(
98                 pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
99         a0 = (Azerty) pm.getObjectById(
100                 pm.newObjectIdInstance(Azerty.class, "a0"), false);
101         a0.qsds.remove(q0);
102         a0.qsds.remove(q1);
103         pm.currentTransaction().commit();
104         pm.close();
105
106         pm = pmf.getPersistenceManager();
107         pm.currentTransaction().begin();
108         q0 = (Qsdfgh) pm.getObjectById(
109                 pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
110         q1 = (Qsdfgh) pm.getObjectById(
111                 pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
112         a0 = (Azerty) pm.getObjectById(
113                 pm.newObjectIdInstance(Azerty.class, "a0"), false);
114         a0.qsds.add(q0);
115         a0.qsds.add(q1);
116         pm.currentTransaction().commit();
117         pm.close();
118
119         pm = pmf.getPersistenceManager();
120         pm.currentTransaction().begin();
121         q0 = (Qsdfgh) pm.getObjectById(
122                 pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
123         q1 = (Qsdfgh) pm.getObjectById(
124                 pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
125         a0 = (Azerty) pm.getObjectById(
126                 pm.newObjectIdInstance(Azerty.class, "a0"), false);
127         a0.qsds.remove(q0);
128         a0.qsds.remove(q1);
129         pm.currentTransaction().commit();
130         pm.close();
131
132         pm = pmf.getPersistenceManager();
133         pm.currentTransaction().begin();
134         q0 = (Qsdfgh) pm.getObjectById(
135                 pm.newObjectIdInstance(Qsdfgh.class, "q0"), false);
136         q1 = (Qsdfgh) pm.getObjectById(
137                 pm.newObjectIdInstance(Qsdfgh.class, "q1"), false);
138         a0 = (Azerty) pm.getObjectById(
139                 pm.newObjectIdInstance(Azerty.class, "a0"), false);
140         a0.qsds.add(q0);
141         a0.qsds.add(q1);
142         pm.currentTransaction().commit();
143         pm.close();
144     }
145 }
146
Popular Tags