KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > clients > entity > F_Relation_ombEC2


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: F_Relation_ombEC2.java,v 1.32 2004/10/15 07:52:59 joaninh Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.jtests.clients.entity;
27
28 import java.util.ArrayList JavaDoc;
29 import java.util.Collection JavaDoc;
30 import java.util.Enumeration JavaDoc;
31 import java.util.Hashtable JavaDoc;
32 import java.util.Iterator JavaDoc;
33
34 import javax.naming.NamingException JavaDoc;
35 import javax.rmi.PortableRemoteObject JavaDoc;
36
37 import junit.framework.Test;
38 import junit.framework.TestSuite;
39
40 import org.objectweb.jonas.jtests.beans.relation.omb.AHomeRemote;
41 import org.objectweb.jonas.jtests.beans.relation.omb.ARemote;
42 import org.objectweb.jonas.jtests.beans.relation.omb.BHomeRemote;
43 import org.objectweb.jonas.jtests.beans.relation.omb.BRemote;
44 import org.objectweb.jonas.jtests.beans.relation.omb.Front;
45 import org.objectweb.jonas.jtests.beans.relation.omb.FrontHome;
46
47 /**
48  * For testing one-to-many bidirectional relationships
49  * @author Helene Joanin
50  */

51 public class F_Relation_ombEC2 extends A_Cmp2Util {
52
53
54     private static String JavaDoc BEAN_HOME_A = "relation_omb_AHome";
55     protected static AHomeRemote ahome = null;
56     private static String JavaDoc BEAN_HOME_B = "relation_omb_BHome";
57     protected static BHomeRemote bhome = null;
58     private static String JavaDoc BEAN_HOME_FRONT = "relation_omb_FrontHome";
59     protected static FrontHome fhome = null;
60
61     static Hashtable JavaDoc a2b = new Hashtable JavaDoc();
62     static String JavaDoc[][] b2a = {
63         {"bs0", null},
64         {"bs1_1", "as1"},
65         {"bs2_1", "as2"},
66         {"bs2_2", "as2"},
67         {"bs2_3", "as2"},
68         {"bs3", null},
69         {"b0", null},
70         {"b1_1", "a1"},
71         {"b1_2", "a1"},
72         {"b1_3", "a1"},
73         {"b2_1", "a2"},
74         {"b2_2", "a2"},
75         {"b2_3", "a2"},
76         {"b3_1", "a3"}};
77
78     static {
79         a2b.put("as0", new String JavaDoc[]{});
80         a2b.put("as1", new String JavaDoc[]{"bs1_1"});
81         a2b.put("as2", new String JavaDoc[]{"bs2_1", "bs2_2", "bs2_3"});
82         a2b.put("a0", new String JavaDoc[]{});
83         a2b.put("a1", new String JavaDoc[]{"b1_1", "b1_2", "b1_3"});
84         a2b.put("a2", new String JavaDoc[]{"b2_1", "b2_2", "b2_3"});
85         a2b.put("a3", new String JavaDoc[]{"b3_1"});
86         a2b.put("ax0", new String JavaDoc[]{});
87
88         // Translate the String[] to a Collection of String
89
for (Iterator JavaDoc it = a2b.keySet().iterator(); it.hasNext();) {
90             String JavaDoc aname = (String JavaDoc) (it.next());
91             String JavaDoc[] tb = (String JavaDoc[]) a2b.get(aname);
92             ArrayList JavaDoc col = new ArrayList JavaDoc(tb.length);
93             for (int i = 0; i < tb.length; i++) {
94                 col.add(tb[i]);
95             }
96             a2b.put(aname, col);
97         }
98     }
99
100
101     public F_Relation_ombEC2(String JavaDoc name) {
102         super(name);
103     }
104
105     protected static boolean isInit = false;
106
107     protected void setUp() {
108         super.setUp();
109         boolean ok = false;
110         int nbtry = 0;
111         while (!ok && nbtry < 3) {
112             if (!isInit) {
113                 // load bean if not loaded yet
114
useBeans("omb", false);
115                 try {
116                     ahome = (AHomeRemote) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME_A),
117                                                                       AHomeRemote.class);
118                     bhome = (BHomeRemote) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME_B),
119                                                                       BHomeRemote.class);
120                     fhome = (FrontHome) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME_FRONT),
121                                                                               FrontHome.class);
122                     assertNotNull(ahome);
123                     assertNotNull(bhome);
124                 } catch (NamingException JavaDoc e) {
125                     fail("Cannot get bean home: " + e.getMessage());
126                 }
127                 // check if tables have been initialized
128
try {
129                     ahome.findByPrimaryKey("a0");
130                 } catch (Exception JavaDoc e) {
131                     try {
132                         utx.begin();
133                         bhome.create("bs0");
134                         bhome.create("bs1_1");
135                         bhome.create("bs2_1");
136                         bhome.create("bs2_2");
137                         bhome.create("bs2_3");
138                         bhome.create("bs3");
139                         bhome.create("b0");
140                         bhome.create("b1_1");
141                         bhome.create("b1_2");
142                         bhome.create("b1_3");
143                         bhome.create("b2_1");
144                         bhome.create("b2_2");
145                         bhome.create("b2_3");
146                         bhome.create("b3_1");
147                         ahome.create("as0");
148                         ahome.create("as1").assignB((Collection JavaDoc) a2b.get("as1"));
149                         ahome.create("as2").assignB((Collection JavaDoc) a2b.get("as2"));
150                         ahome.create("a0");
151                         ahome.create("a1").assignB((Collection JavaDoc) a2b.get("a1"));
152                         ahome.create("a2").assignB((Collection JavaDoc) a2b.get("a2"));
153                         ahome.create("a3").assignB((Collection JavaDoc) a2b.get("a3"));
154                         ahome.create("ax0");
155                     } catch (Exception JavaDoc i) {
156                         fail("InitialState creation problem: " + i);
157                     } finally {
158                         try {
159                             utx.commit();
160                         } catch (Exception JavaDoc ii) {
161                         }
162                     }
163                 }
164                 isInit = true;
165             }
166             // Check that all is OK. Sometimes, a test has failed and has corrupted
167
// the bean state in the database. We must unload and reload the bean then.
168
nbtry++;
169             try {
170                 if (initStateOK()) {
171                     ok = true;
172                 }
173             } catch (Exception JavaDoc e) {
174             }
175             if (!ok) {
176                 isInit = false;
177                 unloadBeans("omb");
178             }
179         }
180     }
181
182     /**
183      * Check that we are in the same state as after the tables creation for thoses beans A and B
184      * (ie if it is the initial state)
185      */

186     boolean initStateOK() throws Exception JavaDoc {
187         boolean isOk = true;
188         msgerror = new StringBuffer JavaDoc();
189         // Check the relations A => B
190
for (Enumeration JavaDoc ea = a2b.keys(); ea.hasMoreElements();) {
191             String JavaDoc aname = (String JavaDoc) (ea.nextElement());
192             ARemote a = ahome.findByPrimaryKey(aname);
193             Collection JavaDoc colActual = a.retrieveB();
194             Collection JavaDoc colExpected = (Collection JavaDoc) (a2b.get(aname));
195             if (!isCollectionEqual(colExpected, colActual)) {
196                 isOk = false;
197                 msgerror = msgerror.append("\nWrong relation for " + aname
198                                            + " (expected:" + colExpected
199                                            + ", found:" + colActual + ")");
200             }
201         }
202         // Check the relation B => A
203
for (int i = 0; i < b2a.length; i++) {
204             BRemote b = bhome.findByPrimaryKey(b2a[i][0]);
205             String JavaDoc pkb = b.getId();
206             String JavaDoc pka = b.retrieveA();
207             if (b2a[i][1] == null && pka != null
208                 || b2a[i][1] != null && !b2a[i][1].equals(pka)) {
209                 isOk = false;
210                 msgerror = msgerror.append("\nWrong relation for " + pkb
211                                            + " (expected:" + b2a[i][1]
212                                            + ", found:" + pka + ")");
213             }
214
215         }
216         return isOk;
217     }
218
219
220     /**
221      * Check that the bean 'as0' has no relation.
222      */

223     public void tBasicGetEmptyA2B(int tx) throws Exception JavaDoc {
224         Collection JavaDoc c = null;
225         if ((tx == TX_CALL) || (tx == TX_RB)) {
226             utx.begin();
227         }
228         ARemote a = ahome.findByPrimaryKey("as0");
229         if (tx == TX_CONT) {
230             c = a.retrieveBInNewTx();
231         } else {
232             c = a.retrieveB();
233         }
234         if (tx == TX_CALL) {
235             utx.commit();
236         } else if (tx == TX_RB) {
237             utx.rollback();
238         }
239         // checking
240
checkIsInitialState();
241     }
242
243     public void testBasicGetEmptyA2BTxNo() throws Exception JavaDoc {
244         tBasicGetEmptyA2B(TX_NO);
245     }
246     public void testBasicGetEmptyA2BTxCall() throws Exception JavaDoc {
247         tBasicGetEmptyA2B(TX_CALL);
248     }
249     public void testBasicGetEmptyA2BTxCont() throws Exception JavaDoc {
250         tBasicGetEmptyA2B(TX_CONT);
251     }
252     public void testBasicGetEmptyA2BTxRb() throws Exception JavaDoc {
253         tBasicGetEmptyA2B(TX_RB);
254     }
255
256     /**
257      * Check that the bean 'bs0' has no relation.
258      */

259     public void tBasicGetEmptyB2A(int tx) throws Exception JavaDoc {
260         if ((tx == TX_CALL) || (tx == TX_RB)) {
261             utx.begin();
262         }
263         String JavaDoc pka = null;
264         BRemote b = bhome.findByPrimaryKey("bs0");
265         if (tx == TX_CONT) {
266             pka = b.retrieveAInNewTx();
267         } else {
268             pka = b.retrieveA();
269         }
270         if (tx == TX_CALL) {
271             utx.commit();
272         } else if (tx == TX_RB) {
273             utx.rollback();
274         }
275         // checking
276
checkIsInitialState();
277     }
278     public void testBasicGetEmptyB2ANoTx() throws Exception JavaDoc {
279         tBasicGetEmptyB2A(TX_NO);
280     }
281     public void testBasicGetEmptyB2ATxCall() throws Exception JavaDoc {
282         tBasicGetEmptyB2A(TX_CALL);
283     }
284     public void testBasicGetEmptyB2ATxCont() throws Exception JavaDoc {
285         tBasicGetEmptyB2A(TX_CONT);
286     }
287     public void testBasicGetEmptyB2ATxRb() throws Exception JavaDoc {
288         tBasicGetEmptyB2A(TX_RB);
289     }
290
291
292     /**
293      * Check that the bean 'as1' has only one relation with 'bs1_1'.
294      */

295     public void tBasicGetOneA2B(int tx) throws Exception JavaDoc {
296
297         Collection JavaDoc c = null;
298         if ((tx == TX_CALL) || (tx == TX_RB)) {
299             utx.begin();
300         }
301         ARemote a = ahome.findByPrimaryKey("as1");
302         if (tx == TX_CONT) {
303             c = a.retrieveBInNewTx();
304         } else {
305             c = a.retrieveB();
306         }
307         if (tx == TX_CALL) {
308             utx.commit();
309         } else if (tx == TX_RB) {
310             utx.rollback();
311         }
312         // checking
313
assertEquals("Relations size of: ", 1, c.size());
314         String JavaDoc s = "bs1_1";
315         assertTrue("Relation missing " + s + ": ", c.contains(s));
316         checkIsInitialState();
317     }
318
319     public void testBasicGetOneA2BTxNo() throws Exception JavaDoc {
320         tBasicGetOneA2B(TX_NO);
321     }
322
323     public void testBasicGetOneA2BTxCall() throws Exception JavaDoc {
324         tBasicGetOneA2B(TX_CALL);
325     }
326
327     public void testBasicGetOneA2BTxCont() throws Exception JavaDoc {
328         tBasicGetOneA2B(TX_CONT);
329     }
330
331     public void testBasicGetOneA2BTxRb() throws Exception JavaDoc {
332         tBasicGetOneA2B(TX_RB);
333     }
334
335
336     /**
337      * Check that the bean 'as2' has many relations with 'bs2_1', 'bs2_2', 'bs2_3'.
338      */

339     public void tBasicGetManyA2B(int tx) throws Exception JavaDoc {
340
341         Collection JavaDoc c = null;
342         if ((tx == TX_CALL) || (tx == TX_RB)) {
343             utx.begin();
344         }
345         ARemote a = ahome.findByPrimaryKey("as2");
346         if (tx == TX_CONT) {
347             c = a.retrieveBInNewTx();
348         } else {
349             c = a.retrieveB();
350         }
351         if (tx == TX_CALL) {
352             utx.commit();
353         } else if (tx == TX_RB) {
354             utx.rollback();
355         }
356         // checking
357
assertEquals("Relations size of: ", 3, c.size());
358         String JavaDoc s = "bs2_1";
359         assertTrue("Relation missing " + s + ": ", c.contains(s));
360         s = "bs2_2";
361         assertTrue("Relation missing " + s + ": ", c.contains(s));
362         s = "bs2_3";
363         assertTrue("Relation missing " + s + ": ", c.contains(s));
364         checkIsInitialState();
365     }
366
367     public void testBasicGetManyA2BTxNo() throws Exception JavaDoc {
368         tBasicGetManyA2B(TX_NO);
369     }
370
371     public void testBasicGetManyA2BTxCall() throws Exception JavaDoc {
372         tBasicGetManyA2B(TX_CALL);
373     }
374
375     public void testBasicGetManyA2BTxCont() throws Exception JavaDoc {
376         tBasicGetManyA2B(TX_CONT);
377     }
378
379     public void testBasicGetManyA2BTxRb() throws Exception JavaDoc {
380         tBasicGetManyA2B(TX_RB);
381     }
382
383
384     /**
385      * Set a A2B relation to empty.
386      * Before: as1 <-> bs1_1
387      * After: as1 bs1_1
388      * Check also the assignement rules for relationships.
389      */

390     public void tCohSetEmptyA2B(int tx) throws Exception JavaDoc {
391         ArrayList JavaDoc ce = new ArrayList JavaDoc();
392         if ((tx == TX_CALL) || (tx == TX_RB)) {
393             utx.begin();
394         }
395         ARemote a = ahome.findByPrimaryKey("as1");
396         if (tx == TX_CONT) {
397             a.assignBInNewTx(ce);
398         } else {
399             a.assignB(ce);
400         }
401         if (tx == TX_CALL) {
402             utx.commit();
403         } else if (tx == TX_RB) {
404             utx.rollback();
405         }
406         if (tx != TX_RB) {
407             // checking
408
Collection JavaDoc ca = a.retrieveB();
409             assertEquals("Relations size for as1 ", 0, ca.size());
410             BRemote b = bhome.findByPrimaryKey("bs1_1");
411             assertNull("Bad relation for bs1_1", b.retrieveA());
412             // undo
413
a.addInB("bs1_1");
414         }
415         checkIsInitialState();
416     }
417
418     public void testCohSetEmptyA2BTxNo() throws Exception JavaDoc {
419         tCohSetEmptyA2B(TX_NO);
420     }
421
422     public void testCohSetEmptyA2BTxCall() throws Exception JavaDoc {
423         tCohSetEmptyA2B(TX_CALL);
424     }
425
426     public void testCohSetEmptyA2BTxCont() throws Exception JavaDoc {
427         tCohSetEmptyA2B(TX_CONT);
428     }
429
430     public void testCohSetEmptyA2BTxRb() throws Exception JavaDoc {
431         tCohSetEmptyA2B(TX_RB);
432     }
433
434
435     /**
436      * Set a A2B relation to empty by clearing the collection.
437      * Before: as1 <-> bs1_1
438      * After: as1 bs1_1
439      * Check also the assignement rules for relationships.
440      */

441     public void tCohClearA2B(int tx) throws Exception JavaDoc {
442         if ((tx == TX_CALL) || (tx == TX_RB)) {
443             utx.begin();
444         }
445         ARemote a = ahome.findByPrimaryKey("as1");
446         if (tx == TX_CONT) {
447             a.clearBInNewTx();
448         } else {
449             a.clearB();
450         }
451         if (tx == TX_CALL) {
452             utx.commit();
453         } else if (tx == TX_RB) {
454             utx.rollback();
455         }
456         if (tx != TX_RB) {
457             // checking
458
Collection JavaDoc c = a.retrieveB();
459             BRemote b = bhome.findByPrimaryKey("bs1_1");
460             String JavaDoc r = b.retrieveA();
461             assertEquals("Expected empty collection for as1 relation: ", 0, c.size());
462             assertNull("Expected no relation for bs1_1", r);
463             // undo
464
b.assignA("as1");
465         }
466         checkIsInitialState();
467     }
468
469     public void testCohClearA2BTxNo() throws Exception JavaDoc {
470         tCohClearA2B(TX_NO);
471     }
472
473     public void testCohClearA2BTxCall() throws Exception JavaDoc {
474         tCohClearA2B(TX_CALL);
475     }
476
477     public void testCohClearA2BTxCont() throws Exception JavaDoc {
478         tCohClearA2B(TX_CONT);
479     }
480
481     public void testCohClearA2BTxRb() throws Exception JavaDoc {
482         tCohClearA2B(TX_RB);
483     }
484
485
486     /**
487      * Set an empty A2B relation with 1 element.
488      * This added element was'nt already in an other relation.
489      * Before: as0 b0
490      * After: as0 <-> b0
491      * Check also the assignement rules for relationships.
492      */

493     public void tCohSetOneA2B(int tx) throws Exception JavaDoc {
494         ArrayList JavaDoc ce = new ArrayList JavaDoc();
495         ce.add("b0");
496         if ((tx == TX_CALL) || (tx == TX_RB)) {
497             utx.begin();
498         }
499         ARemote a = ahome.findByPrimaryKey("as0");
500         if (tx == TX_CONT) {
501             a.assignBInNewTx(ce);
502         } else {
503             a.assignB(ce);
504         }
505         if (tx == TX_CALL) {
506             utx.commit();
507         } else if (tx == TX_RB) {
508             utx.rollback();
509         }
510         if (tx != TX_RB) {
511             // checking
512
Collection JavaDoc ca = a.retrieveB();
513             BRemote b = bhome.findByPrimaryKey("b0");
514             String JavaDoc r = b.retrieveA();
515             assertTrue("Bad relations for as0 (required:" + ce + ", found:" + ca
516                        + ")", isCollectionEqual(ce, ca));
517             assertEquals("Bad relation for b0: ", "as0", r);
518             // undo
519
a.assignB(new ArrayList JavaDoc());
520         }
521         checkIsInitialState();
522     }
523
524     public void testCohSetOneA2BTxNo() throws Exception JavaDoc {
525         tCohSetOneA2B(TX_NO);
526     }
527
528     public void testCohSetOneA2BTxCall() throws Exception JavaDoc {
529         tCohSetOneA2B(TX_CALL);
530     }
531
532     public void testCohSetOneA2BTxCont() throws Exception JavaDoc {
533         tCohSetOneA2B(TX_CONT);
534     }
535
536     public void testCohSetOneA2BTxRb() throws Exception JavaDoc {
537         tCohSetOneA2B(TX_RB);
538     }
539
540
541     /**
542      * Set a null B2A relation with 1 element.
543      * This element was'nt already in an other relation.
544      * Before: b0 as0
545      * After: b0 <-> as0
546      * Check also the assignement rules for relationships.
547      */

548     public void tCohSet1B2A(int tx) throws Exception JavaDoc {
549         if ((tx == TX_CALL) || (tx == TX_RB)) {
550             utx.begin();
551         }
552         BRemote b = bhome.findByPrimaryKey("b0");
553         if (tx == TX_CONT) {
554             b.assignAInNewTx("as0");
555         } else {
556             b.assignA("as0");
557         }
558         if (tx == TX_CALL) {
559             utx.commit();
560         } else if (tx == TX_RB) {
561             utx.rollback();
562         }
563         // checking
564
String JavaDoc r = b.retrieveA();
565         ARemote a = ahome.findByPrimaryKey("as0");
566         Collection JavaDoc ca = a.retrieveB();
567         ArrayList JavaDoc ce = new ArrayList JavaDoc();
568         ce.add("b0");
569         if (tx != TX_RB) {
570             assertEquals("Bad relation for b0: ", "as0", r);
571             assertTrue("Bad relations for as0 (required:" + ce + ", found:" + ca
572                        + ")", isCollectionEqual(ce, ca));
573             // undo
574
b.assignA(null);
575         }
576         checkIsInitialState();
577     }
578
579     public void testCohSet1B2ATxNo() throws Exception JavaDoc {
580         tCohSet1B2A(TX_NO);
581     }
582
583     public void testCohSet1B2ATxCall() throws Exception JavaDoc {
584         tCohSet1B2A(TX_CALL);
585     }
586
587     public void testCohSet1B2ATxCont() throws Exception JavaDoc {
588         tCohSet1B2A(TX_CONT);
589     }
590
591     public void testCohSet1B2ATxRb() throws Exception JavaDoc {
592         tCohSet1B2A(TX_RB);
593     }
594
595
596
597     /**
598      * Add an element to a empty relation.
599      * Same as tCohSetOneA2B except that we add the element in the collection
600      * instead of we set directly the collection.
601      * Before: as0 bs0
602      * After: as0 <-> bs0
603      * Check also the assignement rules for relationships.
604      */

605     public void tCohAddOneA2B(int tx) throws Exception JavaDoc {
606         ArrayList JavaDoc ce = new ArrayList JavaDoc();
607         ce.add("bs0");
608         if ((tx == TX_CALL) || (tx == TX_RB)) {
609             utx.begin();
610         }
611         ARemote a = ahome.findByPrimaryKey("as0");
612         if (tx == TX_CONT) {
613             a.addInBInNewTx("bs0");
614         } else {
615             a.addInB("bs0");
616         }
617         if (tx == TX_CALL) {
618             utx.commit();
619         } else if (tx == TX_RB) {
620             utx.rollback();
621         }
622         if (tx != TX_RB) {
623             // checking
624
Collection JavaDoc ca = a.retrieveB();
625             BRemote b = bhome.findByPrimaryKey("bs0");
626             String JavaDoc r = b.retrieveA();
627             assertTrue("Bad relations for as0 (required:" + ce + ", found:" + ca
628                        + ")", isCollectionEqual(ce, ca));
629             assertEquals("Bad relation for bs0", "as0", r);
630             // undo
631
a.assignB(new ArrayList JavaDoc());
632         }
633         checkIsInitialState();
634     }
635
636     public void testCohAddOneA2BTxNo() throws Exception JavaDoc {
637         tCohAddOneA2B(TX_NO);
638     }
639
640     public void testCohAddOneA2BTxCall() throws Exception JavaDoc {
641         tCohAddOneA2B(TX_CALL);
642     }
643
644     public void testCohAddOneA2BTxCont() throws Exception JavaDoc {
645         tCohAddOneA2B(TX_CONT);
646     }
647
648     public void testCohAddOneA2BTxRb() throws Exception JavaDoc {
649         tCohAddOneA2B(TX_RB);
650     }
651
652
653     /**
654      * Re-Set a relation with N element.
655      * Before: as1 <-> bs1_1
656      * bs0
657      * bs3
658      * After: bs1_1
659      * as1 <-> bs0
660      * as1 <-> bs3
661      */

662     public void tCohSetMultiA2B(int tx) throws Exception JavaDoc {
663         ArrayList JavaDoc ce = new ArrayList JavaDoc(2);
664         ce.add("bs0");
665         ce.add("bs3");
666         if ((tx == TX_CALL) || (tx == TX_RB)) {
667             utx.begin();
668         }
669         ARemote a = ahome.findByPrimaryKey("as1");
670         Collection JavaDoc co = a.retrieveB();
671         if (tx == TX_CONT) {
672             a.assignBInNewTx(ce);
673         } else {
674             a.assignB(ce);
675         }
676         if (tx == TX_CALL) {
677             utx.commit();
678         } else if (tx == TX_RB) {
679             utx.rollback();
680         }
681         if (tx != TX_RB) {
682             // checking
683
Collection JavaDoc ca = a.retrieveB();
684             BRemote bs1_1 = bhome.findByPrimaryKey("bs1_1");
685             BRemote bs0 = bhome.findByPrimaryKey("bs0");
686             BRemote bs3 = bhome.findByPrimaryKey("bs3");
687             assertTrue("Bad relations for as1 (required:" + ce + ", found:" + ca
688                        + ")", isCollectionEqual(ce, ca));
689             assertNull("Not null relation for bs1_1", bs1_1.retrieveA());
690             assertEquals("Bad relation for bs0: ", "as1", bs0.retrieveA());
691             assertEquals("Bad relation for bs3: ", "as1", bs3.retrieveA());
692             // undo
693
a.assignB(co);
694         }
695         checkIsInitialState();
696     }
697
698     public void testCohSetMultiA2BTxNo() throws Exception JavaDoc {
699         tCohSetMultiA2B(TX_NO);
700     }
701
702     public void testCohSetMultiA2BTxCall() throws Exception JavaDoc {
703         tCohSetMultiA2B(TX_CALL);
704     }
705
706     public void testCohSetMultiA2BTxCont() throws Exception JavaDoc {
707         tCohSetMultiA2B(TX_CONT);
708     }
709
710     public void testCohSetMultiA2BTxRb() throws Exception JavaDoc {
711         tCohSetMultiA2B(TX_RB);
712     }
713
714
715     /**
716      * Set a B2A relation with 1 element.
717      * This element wasn't already in an other relation.
718      * Before: bs1_1 <-> as1
719      * as0
720      * Change: bs1_1.assignA(as0);
721      * After: bs1_1 <-> as0
722      * as1
723      * Check also the assignement rules for relationships.
724      *
725      */

726     public void tCohSet2B2A(int tx) throws Exception JavaDoc {
727         if ((tx == TX_CALL) || (tx == TX_RB)) {
728             utx.begin();
729         }
730         BRemote b = bhome.findByPrimaryKey("bs1_1");
731         if (tx == TX_CONT) {
732             b.assignAInNewTx("as0");
733         } else {
734             b.assignA("as0");
735         }
736         if (tx == TX_CALL) {
737             utx.commit();
738         } else if (tx == TX_RB) {
739             utx.rollback();
740         }
741         if (tx != TX_RB) {
742             // checking
743
String JavaDoc r = b.retrieveA();
744             assertEquals("Bad relation for bs1_1: ", "as0", r);
745             ARemote as0 = ahome.findByPrimaryKey("as0");
746             Collection JavaDoc cas0 = as0.retrieveB();
747             ARemote as1 = ahome.findByPrimaryKey("as1");
748             Collection JavaDoc cas1 = as1.retrieveB();
749             ArrayList JavaDoc ce = new ArrayList JavaDoc();
750             ce.add("bs1_1");
751             assertTrue("Bad relations for as0 (required:" + ce + ", found:" + cas0
752                        + ")", isCollectionEqual(ce, cas0));
753             ce = new ArrayList JavaDoc();
754             assertTrue("Bad relations for as1 (required:" + ce + ", found:" + cas1
755                        + ")", isCollectionEqual(ce, cas1));
756             // undo
757
b.assignA("as1");
758         }
759         checkIsInitialState();
760     }
761
762     public void testCohSet2B2ATxNo() throws Exception JavaDoc {
763         tCohSet2B2A(TX_NO);
764     }
765
766     public void testCohSet2B2ATxCall() throws Exception JavaDoc {
767         tCohSet2B2A(TX_CALL);
768     }
769
770     public void testCohSet2B2ATxCont() throws Exception JavaDoc {
771         tCohSet2B2A(TX_CONT);
772     }
773
774     public void testCohSet2B2ATxRb() throws Exception JavaDoc {
775         tCohSet2B2A(TX_RB);
776     }
777
778
779     /**
780      * Set a B2A relation with 1 element.
781      * This element was already in an other relation.
782      * Before: bs1_1 <-> as1
783      * b3_1 <-> a3
784      * Change: bs1_1.assignA(b3_1.retrieveA())
785      * After: bs1_1 <-> a3
786      * b3_1 <->
787      * as1
788      * Check also the assignement rules for relationships.
789      *
790      * See Spec chapter 10.3.7.3, change example: b2m.setA(b1n.getA())
791      */

792     public void tCohSet3B2A(int tx) throws Exception JavaDoc {
793         if ((tx == TX_CALL) || (tx == TX_RB)) {
794             utx.begin();
795         }
796         BRemote bs1_1 = bhome.findByPrimaryKey("bs1_1");
797         if (tx == TX_CONT) {
798             bs1_1.assignAInNewTx("a3");
799         } else {
800             bs1_1.assignA("a3");
801         }
802         if (tx == TX_CALL) {
803             utx.commit();
804         } else if (tx == TX_RB) {
805             utx.rollback();
806         }
807         if (tx != TX_RB) {
808             // checking
809
String JavaDoc rbs1_1 = bs1_1.retrieveA();
810             ARemote as1 = ahome.findByPrimaryKey("as1");
811             Collection JavaDoc cas1 = as1.retrieveB();
812             ARemote a3 = ahome.findByPrimaryKey("a3");
813             Collection JavaDoc ca3 = a3.retrieveB();
814             assertEquals("Bad relation for bs1_1: ", "a3", rbs1_1);
815             ArrayList JavaDoc ce = new ArrayList JavaDoc();
816             ce.add("bs1_1");
817             ce.add("b3_1");
818             assertTrue("Bad relations for a3 (required:" + ce + ", found:" + ca3
819                        + ")", isCollectionEqual(ce, ca3));
820             ce = new ArrayList JavaDoc();
821             assertTrue("Bad relations for as1 (required:" + ce + ", found:" + cas1
822                        + ")", isCollectionEqual(ce, cas1));
823             // undo
824
bs1_1.assignA("as1");
825         }
826         checkIsInitialState();
827     }
828
829     public void testCohSet3B2ATxNo() throws Exception JavaDoc {
830         tCohSet3B2A(TX_NO);
831     }
832
833     public void testCohSet3B2ATxCall() throws Exception JavaDoc {
834         tCohSet3B2A(TX_CALL);
835     }
836
837     public void testCohSet3B2ATxCont() throws Exception JavaDoc {
838         tCohSet3B2A(TX_CONT);
839     }
840
841     public void testCohSet3B2ATxRb() throws Exception JavaDoc {
842         tCohSet3B2A(TX_RB);
843     }
844
845
846     /**
847      * Remove an element in a relation.
848      * Before: a3 <-> b3_1
849      * Change: a3.retrieveB().remove(b3_1)
850      * After: a3 b3_1
851      * See Spec chapter 10.3.7.3, change example: a1.getB().remove(b1n)
852      */

853     public void tCohRemoveInRelA2B(int tx) throws Exception JavaDoc {
854         if ((tx == TX_CALL) || (tx == TX_RB)) {
855             utx.begin();
856         }
857         ARemote a = ahome.findByPrimaryKey("a3");
858         if (tx == TX_CONT) {
859             a.removeFromBInNewTx("b3_1");
860         } else {
861             a.removeFromB("b3_1");
862         }
863         if (tx == TX_CALL) {
864             utx.commit();
865         } else if (tx == TX_RB) {
866             utx.rollback();
867         }
868         if (tx != TX_RB) {
869             // checking
870
Collection JavaDoc ca = a.retrieveB();
871             BRemote b = bhome.findByPrimaryKey("b3_1");
872             String JavaDoc r = b.retrieveA();
873             ArrayList JavaDoc ce = new ArrayList JavaDoc();
874             assertTrue("Bad relations for a3: (required:" + ce + ", found:" + ca
875                        + ")", isCollectionEqual(ce, ca));
876             assertNull("Bad not null relation for b3_1", r);
877             // undo
878
a.addInB("b3_1");
879         }
880         // check to initial state
881
checkIsInitialState();
882
883     }
884
885     public void testCohRemoveInRelA2BTxNo() throws Exception JavaDoc {
886         tCohRemoveInRelA2B(TX_NO);
887     }
888
889     public void testCohRemoveInRelA2BTxCall() throws Exception JavaDoc {
890         tCohRemoveInRelA2B(TX_CALL);
891     }
892
893     public void testCohRemoveInRelA2BTxCont() throws Exception JavaDoc {
894         tCohRemoveInRelA2B(TX_CONT);
895     }
896
897     public void testCohRemoveInRelA2BTxRb() throws Exception JavaDoc {
898         tCohRemoveInRelA2B(TX_RB);
899     }
900
901
902     /**
903      * Remove a bean B which is in a relation.
904      * Before: a3 <-> b3_1
905      * change: B.remove(b3_1)
906      * After: a3
907      *
908      */

909     public void tCohRemoveB(int tx) throws Exception JavaDoc {
910         if (tx == TX_CONT) {
911             // The transaction attribute of the remove method is TX_SUPPORT,
912
// so the transaction cannot be initiate by the container
913
fail("Transaction cannot be initiate by the container for this test");
914         }
915         if ((tx == TX_CALL) || (tx == TX_RB)) {
916             utx.begin();
917         }
918         bhome.remove("b3_1");
919         if (tx == TX_CALL) {
920             utx.commit();
921         } else if (tx == TX_RB) {
922             utx.rollback();
923         }
924         if (tx != TX_RB) {
925             // checking
926
ARemote a = ahome.findByPrimaryKey("a3");
927             Collection JavaDoc ca = a.retrieveB();
928             assertEquals("Wrong relations size for a3: (expected: 0 found:"
929                          + ca.size(), 0, ca.size());
930             // undo
931
bhome.create("b3_1");
932             a.addInBInNewTx("b3_1");
933         }
934         checkIsInitialState();
935     }
936
937     public void testCohRemoveBTxNo() throws Exception JavaDoc {
938         tCohRemoveB(TX_NO);
939     }
940
941     public void testCohRemoveBTxCall() throws Exception JavaDoc {
942         tCohRemoveB(TX_CALL);
943     }
944
945     public void testCohRemoveBTxRb() throws Exception JavaDoc {
946         tCohRemoveB(TX_RB);
947     }
948
949
950     /**
951      * Remove a bean B which is in a relation.
952      * Same as tCohRemoveB except that the called remove method is on the bean
953      * instead of the home.
954      * Before: a3 <-> b3_1
955      * change: B.remove(b3_1)
956      * After: a3
957      *
958      */

959     public void tCohBeanRemoveB(int tx) throws Exception JavaDoc {
960         if (tx == TX_CONT) {
961             // The transaction attribute of the remove method is TX_SUPPORT,
962
// so the transaction cannot be initiate by the container
963
fail("Transaction cannot be initiate by the container for this test");
964         }
965         if ((tx == TX_CALL) || (tx == TX_RB)) {
966             utx.begin();
967         }
968         BRemote b = bhome.findByPrimaryKey("b3_1");
969         b.remove();
970         if (tx == TX_CALL) {
971             utx.commit();
972         } else if (tx == TX_RB) {
973             utx.rollback();
974         }
975         if (tx != TX_RB) {
976             // checking
977
ARemote a = ahome.findByPrimaryKey("a3");
978             Collection JavaDoc ca = a.retrieveB();
979             assertEquals("Wrong relations size for a3: (expected: 0 found:"
980                          + ca.size(), 0, ca.size());
981             // undo
982
bhome.create("b3_1");
983             a.addInBInNewTx("b3_1");
984         }
985         checkIsInitialState();
986     }
987
988     public void testCohBeanRemoveBTxNo() throws Exception JavaDoc {
989         tCohBeanRemoveB(TX_NO);
990     }
991
992     public void testCohBeanRemoveBTxCall() throws Exception JavaDoc {
993         tCohBeanRemoveB(TX_CALL);
994     }
995
996     public void testCohBeanRemoveBTxRb() throws Exception JavaDoc {
997         tCohBeanRemoveB(TX_RB);
998     }
999
1000
1001
1002    /**
1003     * Set a empty relation A2B with 1 element.
1004     * This added element was already in a other relation.
1005     * Before: a0
1006     * a3 <-> b3_1
1007     * Change: a0.assignB({b3_1})
1008     * After: a0 <-> b3_1
1009     * a3
1010     */

1011    public void tCohSetOne2A2B(int tx) throws Exception JavaDoc {
1012        ArrayList JavaDoc ce = new ArrayList JavaDoc();
1013        ce.add("b3_1");
1014        if ((tx == TX_CALL) || (tx == TX_RB)) {
1015            utx.begin();
1016        }
1017        ARemote a = ahome.findByPrimaryKey("a0");
1018        if (tx == TX_CONT) {
1019            a.assignBInNewTx(ce);
1020        } else {
1021            a.assignB(ce);
1022        }
1023        if (tx == TX_CALL) {
1024            utx.commit();
1025        } else if (tx == TX_RB) {
1026            utx.rollback();
1027        }
1028        if (tx != TX_RB) {
1029            // checking
1030
Collection JavaDoc ca = a.retrieveB();
1031            ARemote a3 = ahome.findByPrimaryKey("a3");
1032            Collection JavaDoc ca3 = a3.retrieveB();
1033            BRemote b = bhome.findByPrimaryKey("b3_1");
1034            String JavaDoc r = b.retrieveA();
1035            assertTrue("Wrong relations a0 (required:" + ce + ", found:" + ca
1036                       + ")", isCollectionEqual(ce, ca));
1037            assertTrue("Wrong relations for b3_1" + ": found:" + ca3 ,
1038                       !ca3.contains("b3_1"));
1039            assertEquals("Bad relation for b3_1: ", "a0", r);
1040            // undo
1041
a.assignB(new ArrayList JavaDoc());
1042            a3.addInB("b3_1");
1043        }
1044        checkIsInitialState();
1045    }
1046
1047    public void testCohSetOne2A2BTxNo() throws Exception JavaDoc {
1048        tCohSetOne2A2B(TX_NO);
1049    }
1050
1051    public void testCohSetOne2A2BTxCall() throws Exception JavaDoc {
1052        tCohSetOne2A2B(TX_CALL);
1053    }
1054
1055    public void testCohSetOne2A2BTxCont() throws Exception JavaDoc {
1056        tCohSetOne2A2B(TX_CONT);
1057    }
1058
1059    public void testCohSetOne2A2BTxRb() throws Exception JavaDoc {
1060        tCohSetOne2A2B(TX_RB);
1061    }
1062
1063
1064    /**
1065     * Add an element to a relation A2B already multiple.
1066     * The element was already in a relation.
1067     * Check also the assignement rules for relationships.
1068     * Before: a1 <-> b1_1
1069     * <-> b1_2
1070     * <-> b1_3
1071     * a3 <-> b3_1
1072     * Change: a1.addInB(b3_1)
1073     * After: a1 <-> b1_1
1074     * <-> b1_2
1075     * <-> b1_3
1076     * <-> b3_1
1077     * a3
1078     *
1079     * See Spec chapter 10.3.7.3, change example: a1.getB().add(b2m)
1080     *
1081     */

1082    public void tCohAddOneInMultiA2B(int tx) throws Exception JavaDoc {
1083
1084        ArrayList JavaDoc ce = new ArrayList JavaDoc();
1085        ce.add("b1_1");
1086        ce.add("b1_2");
1087        ce.add("b1_3");
1088        String JavaDoc bAdded = "b3_1";
1089        if ((tx == TX_CALL) || (tx == TX_RB)) {
1090            utx.begin();
1091        }
1092        ARemote a = ahome.findByPrimaryKey("a1");
1093        if (tx == TX_CONT) {
1094            a.addInBInNewTx(bAdded);
1095        } else {
1096            a.addInB(bAdded);
1097        }
1098        ce.add(bAdded);
1099        if (tx == TX_CALL) {
1100            utx.commit();
1101        } else if (tx == TX_RB) {
1102            utx.rollback();
1103        }
1104        if (tx != TX_RB) {
1105            // checking
1106
Collection JavaDoc ca1 = a.retrieveB();
1107            ARemote a3 = ahome.findByPrimaryKey("a3");
1108            Collection JavaDoc ca3 = a3.retrieveB();
1109            assertTrue("Bad relations for a1 (required:" + ce + ", found:" + ca1 + ")",
1110                       isCollectionEqual(ce, ca1));
1111            ce = new ArrayList JavaDoc();
1112            assertTrue("Bad relations for a3 (required:" + ce + ", found:" + ca3 + ")",
1113                       isCollectionEqual(ce, ca3));
1114            BRemote b = bhome.findByPrimaryKey(bAdded);
1115            assertEquals("Bad relation for b3_1: ", "a1", b.retrieveA());
1116            // undo
1117
a3.addInB(bAdded);
1118        }
1119
1120        checkIsInitialState();
1121    }
1122
1123    public void testCohAddOneInMultiA2BTxNo() throws Exception JavaDoc {
1124        tCohAddOneInMultiA2B(TX_NO);
1125    }
1126
1127    public void testCohAddOneInMultiA2BTxCall() throws Exception JavaDoc {
1128        tCohAddOneInMultiA2B(TX_CALL);
1129    }
1130
1131    public void testCohAddOneInMultiA2BTxCont() throws Exception JavaDoc {
1132        tCohAddOneInMultiA2B(TX_CONT);
1133    }
1134
1135    public void testCohAddOneInMultiA2BTxRb() throws Exception JavaDoc {
1136        tCohAddOneInMultiA2B(TX_RB);
1137    }
1138
1139
1140    /*
1141     * Set a relation to multiple.
1142     * All of element was already in an other relation.
1143     * Check also the assignement rules for relationships.
1144     * Before: a1 <-> b1_1
1145     * <-> b1_2
1146     * <-> b1_3
1147     * a2 <-> b2_1
1148     * <-> b2_2
1149     * <-> b2_3
1150     * Change: a1.assignB(a2.retrieveB())
1151     * After: a1 <-> b2_1
1152     * <-> b2_2
1153     * <-> b2_3
1154     * a2
1155     * b1_1
1156     * b1_2
1157     * b1_3
1158     *
1159     * Spec chapter 10.3.7.3, change example: a1.setB(a2.getB())
1160     *
1161     */

1162    public void tCohSetMultiBisA2B(int tx) throws Exception JavaDoc {
1163        if ((tx == TX_CALL) || (tx == TX_RB)) {
1164            utx.begin();
1165        }
1166        ARemote a1 = ahome.findByPrimaryKey("a1");
1167        Collection JavaDoc co1 = a1.retrieveB();
1168        ARemote a2 = ahome.findByPrimaryKey("a2");
1169        Collection JavaDoc co2 = a2.retrieveB();
1170        if (tx == TX_CONT) {
1171            a1.assignBInNewTx(co2);
1172        } else {
1173            a1.assignB(co2);
1174        }
1175        if (tx == TX_CALL) {
1176            utx.commit();
1177        } else if (tx == TX_RB) {
1178            utx.rollback();
1179        }
1180        if (tx != TX_RB) {
1181            // checking
1182
Collection JavaDoc ca1 = a1.retrieveB();
1183            assertTrue("Wrong relations for a1 (required:" + co2 + ", found:" + ca1 + ")", isCollectionEqual(co2, ca1));
1184            Collection JavaDoc ca2 = a2.retrieveB();
1185            assertEquals("Wrong relations size for a2: ", 0, ca2.size());
1186            BRemote b;
1187            b = bhome.findByPrimaryKey("b1_1");
1188            assertNull("Wrong not null relation for b1_1: ", b.retrieveA());
1189            b = bhome.findByPrimaryKey("b1_2");
1190            assertNull("Wrong not null relation for b1_2: ", b.retrieveA());
1191            b = bhome.findByPrimaryKey("b1_3");
1192            assertNull("Wrong not null relation for b1_3: ", b.retrieveA());
1193            b = bhome.findByPrimaryKey("b2_1");
1194            assertEquals("Wrong relation for b2_1: ", "a1", b.retrieveA());
1195            b = bhome.findByPrimaryKey("b2_2");
1196            assertEquals("Wrong relation for b2_2: ", "a1", b.retrieveA());
1197            b = bhome.findByPrimaryKey("b2_3");
1198            assertEquals("Wrong relation for b2_3: ", "a1", b.retrieveA());
1199            // Undo
1200
a1.assignB(co1);
1201            a2.assignB(co2);
1202        }
1203        checkIsInitialState();
1204    }
1205
1206    public void testCohSetMultiBisA2BTxNo() throws Exception JavaDoc {
1207        tCohSetMultiBisA2B(TX_NO);
1208    }
1209
1210    public void testCohSetMultiBisA2BTxCall() throws Exception JavaDoc {
1211        tCohSetMultiBisA2B(TX_CALL);
1212    }
1213
1214    public void testCohSetMultiBisA2BTxCont() throws Exception JavaDoc {
1215        tCohSetMultiBisA2B(TX_CONT);
1216    }
1217
1218    public void testCohSetMultiBisA2BTxRb() throws Exception JavaDoc {
1219        tCohSetMultiBisA2B(TX_RB);
1220    }
1221
1222    /**
1223     * This test check it isn't allowed to reset the pk
1224     * and that the container throw the java.lang.IllegalStateException.
1225     * See spec 2.0, chapter 10.3.5, page 134.
1226     */

1227    public void testResetPkForbidden() throws Exception JavaDoc {
1228        ARemote a = ahome.findByPrimaryKey("ax0");
1229        assertTrue("IllegalStateException not thrown when a pk value is reset",
1230                   a.testResetPkForbidden("aY0"));
1231    }
1232
1233    /**
1234     * Test that we can create a bean and find it in the same transaction.
1235     */

1236    public void testCreateFindTx() throws Exception JavaDoc {
1237        utx.begin();
1238        ARemote project = ahome.create("project");
1239        BRemote role = bhome.create("role");
1240        project.addInB("role");
1241        bhome.findByName("role", "project");
1242        utx.rollback();
1243        checkIsInitialState();
1244    }
1245
1246    /**
1247     * Test that we can create a bean and find it in the same transaction,
1248     * using a method in A bean.
1249     */

1250    public void testCreateFindTx2() throws Exception JavaDoc {
1251        utx.begin();
1252        ARemote project = ahome.create("project");
1253        project.addNewB("role");
1254        bhome.findByName("role", "project");
1255        utx.rollback();
1256        checkIsInitialState();
1257    }
1258
1259    /**
1260     * Reproduce the bug #300156: Error on creating Array from cmr-collection
1261     */

1262    public void testNewArrayListOnCmr() throws Exception JavaDoc {
1263        ArrayList JavaDoc ce = new ArrayList JavaDoc();
1264        ce.add("bs2_1");
1265        ce.add("bs2_2");
1266        ce.add("bs2_3");
1267        Collection JavaDoc ca = null;
1268        ARemote as2 = ahome.findByPrimaryKey("as2");
1269        // Test of retrieveB()
1270
ca = as2.retrieveB();
1271        assertTrue("Bad relations for as2.retrieveB() (required:" + ce + ", found:" + ca
1272                   + ")", isCollectionEqual(ce, ca));
1273        // Test of retrieveBisB()
1274
ca = as2.retrieveBisB();
1275        assertTrue("Bad relations for as2.retrieveBisB() (required:" + ce + ", found:" + ca
1276                   + ")", isCollectionEqual(ce, ca));
1277    }
1278
1279    /**
1280    * Ensure the javax.ejb.EJBException is thrown when trying
1281    * to invoke an accessor method on a deleted entitybean object
1282    */

1283    public void testRemove1() throws Exception JavaDoc {
1284        Front fb = fhome.create();
1285        fb.testRemove1();
1286        
1287    }
1288 
1289    /**
1290     * Ensure the IllegalArgumentException is thrown when trying
1291     * to assign a deleted object as the value of a cmr-field
1292     * (Bug #300519)
1293     */

1294    /*
1295    public void testSetCmr1() throws Exception {
1296        Front fb = fhome.create();
1297        fb.testSetCmr1();
1298    }
1299    */

1300    /*
1301     * A TransactionRolledbackLocalException (an EJBException) should
1302     * occur when calling the business method of another bean with the
1303     * client's tx context.
1304     * We expect an EJBException here.
1305     */

1306    public void testSetCmrWithDeleted() throws Exception JavaDoc {
1307        Front fb = fhome.create();
1308        fb.testSetCmrWithDeleted();
1309    }
1310
1311    /**
1312     * Ensure the IllegalArgumentException is thrown when trying
1313     * to set a collection cmr-field to a wrong relationship type
1314     */

1315    public void testSetCmrWithWrongType() throws Exception JavaDoc {
1316        Front fb = fhome.create();
1317        fb.testSetCmrWithWrongType();
1318        
1319    }
1320
1321    public static Test suite() {
1322        return new TestSuite(F_Relation_ombEC2.class);
1323    }
1324
1325    public static void main(String JavaDoc args[]) {
1326        String JavaDoc testtorun = null;
1327        // Get args
1328
for (int argn = 0; argn < args.length; argn++) {
1329            String JavaDoc s_arg = args[argn];
1330            Integer JavaDoc i_arg;
1331            if (s_arg.equals("-n")) {
1332                testtorun = args[++argn];
1333            }
1334        }
1335        if (testtorun == null) {
1336            junit.textui.TestRunner.run(suite());
1337        } else {
1338            junit.textui.TestRunner.run(new F_Relation_ombEC2(testtorun));
1339        }
1340    }
1341
1342}
1343
Popular Tags