KickJava   Java API By Example, From Geeks To Geeks.

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


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_mouEC2.java,v 1.28 2004/05/20 23:28:50 benoitf Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.jtests.clients.entity;
27
28 import java.util.Enumeration JavaDoc;
29 import java.util.Hashtable JavaDoc;
30
31 import javax.naming.NamingException JavaDoc;
32 import javax.rmi.PortableRemoteObject JavaDoc;
33
34 import junit.framework.Test;
35 import junit.framework.TestSuite;
36
37 import org.objectweb.jonas.jtests.beans.relation.mou.AHomeRemote;
38 import org.objectweb.jonas.jtests.beans.relation.mou.ARemote;
39 import org.objectweb.jonas.jtests.beans.relation.mou.BHomeRemote;
40 import org.objectweb.jonas.jtests.beans.relation.mou.BRemote;
41
42 /**
43  * For testing many-to-one unidirectional relationships
44  * @author S.Chassande-Barrioz, J. Camilleri
45  *
46  * This is an advanced test suite for home interface on entity bean CMP2.
47  *
48  **/

49 public class F_Relation_mouEC2 extends A_Cmp2Util {
50
51
52     private static String JavaDoc BEAN_HOME_A = "relation_mou_AHome";
53     protected static AHomeRemote ahome = null;
54     private static String JavaDoc BEAN_HOME_B = "relation_mou_BHome";
55     protected static BHomeRemote bhome = null;
56
57     static Hashtable JavaDoc tbRelationA2B = new Hashtable JavaDoc();
58
59     static {
60         tbRelationA2B.put("a20", "b2");
61         tbRelationA2B.put("a21", "b2");
62         tbRelationA2B.put("a22", "b2");
63         tbRelationA2B.put("a0", "b0");
64         tbRelationA2B.put("a1", "b0");
65         tbRelationA2B.put("a2", "b0");
66         tbRelationA2B.put("a3", "");
67         tbRelationA2B.put("a4", "b4");
68         tbRelationA2B.put("a5", "b4");
69     }
70
71     public F_Relation_mouEC2(String JavaDoc name) {
72         super(name);
73     }
74
75     protected static boolean isInit = false;
76
77     protected void setUp() {
78         super.setUp();
79         boolean ok = false;
80         int nbtry = 0;
81         while (!ok && nbtry < 3) {
82             if (!isInit) {
83                 // load bean if not loaded yet
84
useBeans("mou", false);
85                 // lookup home used in the tests
86
try {
87                     ahome = (AHomeRemote) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME_A),
88                                                                       AHomeRemote.class);
89                     bhome = (BHomeRemote) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME_B),
90                                                                       BHomeRemote.class);
91                 } catch (NamingException JavaDoc e) {
92                     fail("Cannot get bean home: " + e.getMessage());
93                 }
94                 // check if tables have been initialized
95
try {
96                     ahome.findByPrimaryKey("a0");
97                 } catch (Exception JavaDoc e) {
98                     // Make the initialization needed for the tests
99
try {
100                         utx.begin();
101                         ARemote a0 = ahome.create("a0");
102                         ARemote a1 = ahome.create("a1");
103                         ARemote a2 = ahome.create("a2");
104                         ARemote a3 = ahome.create("a3");
105                         ARemote a4 = ahome.create("a4");
106                         ARemote a5 = ahome.create("a5");
107                         ARemote a20 = ahome.create("a20");
108                         ARemote a21 = ahome.create("a21");
109                         ARemote a22 = ahome.create("a22");
110                         bhome.create("b0");
111                         bhome.create("b1");
112                         bhome.create("b2");
113                         bhome.create("b4");
114                         // assign relations only if not null (a3)
115
a0.assignB((String JavaDoc) tbRelationA2B.get("a0"));
116                         a1.assignB((String JavaDoc) tbRelationA2B.get("a1"));
117                         a2.assignB((String JavaDoc) tbRelationA2B.get("a2"));
118                         a4.assignB((String JavaDoc) tbRelationA2B.get("a4"));
119                         a5.assignB((String JavaDoc) tbRelationA2B.get("a5"));
120                         a20.assignB((String JavaDoc) tbRelationA2B.get("a20"));
121                         a21.assignB((String JavaDoc) tbRelationA2B.get("a21"));
122                         a22.assignB((String JavaDoc) tbRelationA2B.get("a22"));
123                     } catch (Exception JavaDoc e2) {
124                         fail("InitialState creation problem: " + e2);
125                     } finally {
126                         try {
127                             utx.commit();
128                         } catch (Exception JavaDoc e3) {
129                         }
130                     }
131                 }
132                 isInit = true;
133             }
134             // Check that all is OK. Sometimes, a test has failed and has corrupted
135
// the bean state in the database. We must unload and reload the bean then.
136
nbtry++;
137             try {
138                 if (initStateOK()) {
139                     ok = true;
140                 }
141             } catch (Exception JavaDoc e) {
142             }
143             if (!ok) {
144                 isInit = false;
145                 unloadBeans("mou");
146             }
147         }
148     }
149
150
151     /*
152      * Check that we are in the same state as after the tables creation for thoses beans A and B
153      * (ie if it is the initial state)
154      */

155     boolean initStateOK() throws Exception JavaDoc {
156         boolean isOk = true;
157         msgerror = new StringBuffer JavaDoc();
158         for (Enumeration JavaDoc ea = tbRelationA2B.keys(); ea.hasMoreElements();) {
159             String JavaDoc aname = (String JavaDoc) (ea.nextElement());
160             ARemote a = ahome.findByPrimaryKey(aname);
161             String JavaDoc BActual = a.retrieveB();
162             // If BActual is empty then convert to "" to match with tbRelationA2B value in this case
163
if (BActual == null) BActual = "";
164             String JavaDoc BExpected = (String JavaDoc) (tbRelationA2B.get(aname));
165             if (!BActual.equals(BExpected)) {
166                 isOk = false;
167                 msgerror = msgerror.append("Wrong relation for " + aname
168                                            + " (expected:" + BExpected
169                                            + ", found:" + BActual + ")");
170             }
171         }
172         return isOk;
173     }
174
175
176
177     /**
178      * Check that the bean 'a3' has no relation.
179      */

180     public void _testBasicGetEmpty(int tx) throws Exception JavaDoc {
181         String JavaDoc c = null;
182         if ((tx == TX_CALL) || (tx == TX_RB)) {
183             utx.begin();
184         }
185         ARemote a = ahome.findByPrimaryKey("a3");
186         if (tx == TX_CONT) {
187             c = a.retrieveBInNewTx();
188         } else {
189             c = a.retrieveB();
190         }
191         if (tx == TX_CALL) {
192             utx.commit();
193         } else if (tx == TX_RB) {
194             utx.rollback();
195         }
196         checkIsInitialState();
197     }
198
199     public void testBasicGetEmptyTxNo() throws Exception JavaDoc {
200         _testBasicGetEmpty(TX_NO);
201     }
202
203     public void testBasicGetEmptyTxCall() throws Exception JavaDoc {
204         _testBasicGetEmpty(TX_CALL);
205     }
206
207     public void testBasicGetEmptyTxCont() throws Exception JavaDoc {
208         _testBasicGetEmpty(TX_CONT);
209     }
210
211     public void testBasicGetEmptyTxRb() throws Exception JavaDoc {
212         _testBasicGetEmpty(TX_RB);
213     }
214
215     /**
216      * Ckeck the new relation a3-b1
217      */

218     public void _testBasicSetEmpty(int tx) throws Exception JavaDoc {
219         String JavaDoc c = null;
220         if ((tx == TX_CALL) || (tx == TX_RB)) {
221             utx.begin();
222         }
223         ARemote a = ahome.findByPrimaryKey("a3");
224         if (tx == TX_CONT) {
225             a.assignBInNewTx("b1");
226         } else {
227             a.assignB("b1");
228         }
229         if (tx == TX_CALL) {
230             utx.commit();
231         } else if (tx == TX_RB) {
232             utx.rollback();
233         }
234         // checking
235
String JavaDoc idB = a.retrieveB();
236         if (tx != TX_RB) {
237             assertEquals("Wrong new relation a3->b1 : ", "b1", idB);
238         } else {
239             assertNull("Wrong new relation a3->b1 : ", idB);
240         }
241         // undo
242
if (tx != TX_RB) {
243             a.assignB(null);
244         }
245         checkIsInitialState();
246     }
247
248     public void testBasicSetEmptyTxNo() throws Exception JavaDoc {
249         _testBasicSetEmpty(TX_NO);
250     }
251
252     public void testBasicSetEmptyTxCall() throws Exception JavaDoc {
253         _testBasicSetEmpty(TX_CALL);
254     }
255
256     public void testBasicSetEmptyTxCont() throws Exception JavaDoc {
257         _testBasicSetEmpty(TX_CONT);
258     }
259
260     public void testBasicSetEmptyTxRb() throws Exception JavaDoc {
261         _testBasicSetEmpty(TX_RB);
262     }
263
264     /**
265      * Check that a1.retrieveB()=b0
266      */

267     public void _testBasicGet(int tx) throws Exception JavaDoc {
268         String JavaDoc b = null;
269         if ((tx == TX_CALL) || (tx == TX_RB)) {
270             utx.begin();
271         }
272         ARemote a1 = ahome.findByPrimaryKey("a1");
273
274         if (tx == TX_CONT) {
275             b = a1.retrieveBInNewTx();
276         } else {
277             b = a1.retrieveB();
278         }
279         if (tx == TX_CALL) {
280             utx.commit();
281         } else if (tx == TX_RB) {
282             utx.rollback();
283         }
284         // checking
285
if (tx != TX_RB) {
286             assertEquals("Wrong relation a1->b0 : ", "b0", b);
287         }
288         checkIsInitialState();
289     }
290
291     public void testBasicGetTxNo() throws Exception JavaDoc {
292         _testBasicGet(TX_NO);
293     }
294
295     public void testBasicGetTxCall() throws Exception JavaDoc {
296         _testBasicGet(TX_CALL);
297     }
298
299     public void testBasicGetTxCont() throws Exception JavaDoc {
300         _testBasicGet(TX_CONT);
301     }
302
303     public void testBasicGetTxRb() throws Exception JavaDoc {
304         _testBasicGet(TX_RB);
305     }
306
307     /**
308      * Check that a1.assignB(null) => a1.retreiveB()=null
309      */

310     public void _testBasicSetNull(int tx) throws Exception JavaDoc {
311         if ((tx == TX_CALL) || (tx == TX_RB)) {
312             utx.begin();
313         }
314         ARemote a1 = ahome.findByPrimaryKey("a1");
315
316         if (tx == TX_CONT) {
317             a1.assignBInNewTx(null);
318         } else {
319             a1.assignB(null);
320         }
321         if (tx == TX_CALL) {
322             utx.commit();
323         } else if (tx == TX_RB) {
324             utx.rollback();
325         }
326         // checking
327
if (tx != TX_RB) {
328             String JavaDoc b = a1.retrieveB();
329             assertNull("Wrong relation a1 : ", b);
330             // Undo
331
a1.assignB("b0");
332         }
333         checkIsInitialState();
334     }
335
336     public void testBasicSetNullTxNo() throws Exception JavaDoc {
337         _testBasicSetNull(TX_NO);
338     }
339
340     public void testBasicSetNullTxCall() throws Exception JavaDoc {
341         _testBasicSetNull(TX_CALL);
342     }
343
344     public void testBasicSetNullTxCont() throws Exception JavaDoc {
345         _testBasicSetNull(TX_CONT);
346     }
347
348     public void testBasicSetNullTxRb() throws Exception JavaDoc {
349         _testBasicSetNull(TX_RB);
350     }
351
352     /**
353      * See 10.3.7.5 : a1j.assignB(a2k.retrieveB()) => a2=a1j.retrieveB()
354      */

355     public void _testBasicSet(int tx) throws Exception JavaDoc {
356         String JavaDoc c = null;
357         if ((tx == TX_CALL) || (tx == TX_RB)) {
358             utx.begin();
359         }
360         ARemote a1 = ahome.findByPrimaryKey("a1");
361         ARemote a21 = ahome.findByPrimaryKey("a21");
362         if (tx == TX_CONT) {
363             a1.assignBInNewTx(a21.retrieveB());
364         } else {
365             a1.assignB(a21.retrieveB());
366         }
367         if (tx == TX_CALL) {
368             utx.commit();
369         } else if (tx == TX_RB) {
370             utx.rollback();
371         }
372         if (tx != TX_RB) {
373             // checking
374
String JavaDoc idB1 = a1.retrieveB();
375             ARemote a0 = ahome.findByPrimaryKey("a0");
376             ARemote a2 = ahome.findByPrimaryKey("a2");
377             ARemote a3 = ahome.findByPrimaryKey("a3");
378             ARemote a20 = ahome.findByPrimaryKey("a20");
379             ARemote a22 = ahome.findByPrimaryKey("a22");
380             String JavaDoc idB0 = a0.retrieveB();
381             String JavaDoc idB2 = a2.retrieveB();
382             String JavaDoc idB3 = a3.retrieveB();
383             String JavaDoc idB20 = a20.retrieveB();
384             String JavaDoc idB21 = a21.retrieveB();
385             String JavaDoc idB22 = a22.retrieveB();
386             assertEquals("Wrong new relation a1->b2 : ", "b2", idB1);
387             assertEquals("Wrong new relation a0->b0 : ", "b0", idB0);
388             assertEquals("Wrong new relation a2->b0 : ", "b0", idB2);
389             assertEquals("Wrong new relation a20->b2 : ", "b2", idB20);
390             assertEquals("Wrong new relation a21->b2 : ", "b2", idB21);
391             assertEquals("Wrong new relation a22->b2 : ", "b2", idB22);
392             // undo
393
a1.assignB("b0");
394         }
395         checkIsInitialState();
396     }
397
398     public void testBasicSetTxNo() throws Exception JavaDoc {
399         _testBasicSet(TX_NO);
400     }
401
402     public void testBasicSetTxCall() throws Exception JavaDoc {
403         _testBasicSet(TX_CALL);
404     }
405
406     public void testBasicSetTxCont() throws Exception JavaDoc {
407         _testBasicSet(TX_CONT);
408     }
409
410     public void testBasicSetTxRb() throws Exception JavaDoc {
411         _testBasicSet(TX_RB);
412     }
413
414     /**
415      * Test of coherence a0.remove()
416      */

417     public void _testCohRemoveA(int tx) throws Exception JavaDoc {
418         if (tx == TX_CONT) {
419             // The transaction attribute of the remove method is TX_SUPPORT,
420
// so the transaction cannot be initiate by the container
421
fail("Transaction cannot be initiate by the container for this test");
422         }
423         if ((tx == TX_CALL) || (tx == TX_RB)) {
424             utx.begin();
425         }
426         ahome.remove("a0");
427         if (tx == TX_CALL) {
428             utx.commit();
429         } else if (tx == TX_RB) {
430             utx.rollback();
431         }
432         // undo
433
if (tx != TX_RB) {
434             ARemote a0 = ahome.create("a0");
435             a0.assignBInNewTx("b0");
436         }
437         checkIsInitialState();
438     }
439
440     public void testCohRemoveATxNo() throws Exception JavaDoc {
441         _testCohRemoveA(TX_NO);
442     }
443
444     public void testCohRemoveATxCall() throws Exception JavaDoc {
445         _testCohRemoveA(TX_CALL);
446     }
447
448     public void testCohRemoveATxRb() throws Exception JavaDoc {
449         _testCohRemoveA(TX_RB);
450     }
451
452     /**
453      * Test of coherence b0.remove()
454      */

455     public void _testCohRemoveB(int tx) throws Exception JavaDoc {
456         if (tx == TX_CONT) {
457             // The transaction attribute of the remove method is TX_SUPPORT,
458
// so the transaction cannot be initiate by the container
459
fail("Transaction cannot be initiate by the container for this test");
460         }
461         if ((tx == TX_CALL) || (tx == TX_RB)) {
462             utx.begin();
463         }
464         bhome.remove("b0");
465         if (tx == TX_CALL) {
466             utx.commit();
467         } else if (tx == TX_RB) {
468             utx.rollback();
469         }
470         // checking
471
if (tx != TX_RB) {
472             ARemote a0 = ahome.findByPrimaryKey("a0");
473             ARemote a1 = ahome.findByPrimaryKey("a1");
474             ARemote a2 = ahome.findByPrimaryKey("a2");
475             String JavaDoc idrela0 = a0.retrieveB();
476             String JavaDoc idrela1 = a1.retrieveB();
477             String JavaDoc idrela2 = a2.retrieveB();
478
479             assertNull("Wrong not null relation a0, found: " + idrela0, idrela0);
480             assertNull("Wrong not null relation a1, found: " + idrela1, idrela1);
481             assertNull("Wrong not null relation a2, found: " + idrela2, idrela2);
482             // undo
483
bhome.create("b0");
484             a0.assignBInNewTx("b0");
485             a1.assignBInNewTx("b0");
486             a2.assignBInNewTx("b0");
487         }
488         checkIsInitialState();
489     }
490
491     public void testCohRemoveBTxNo() throws Exception JavaDoc {
492         _testCohRemoveB(TX_NO);
493     }
494
495     public void testCohRemoveBTxCall() throws Exception JavaDoc {
496         _testCohRemoveB(TX_CALL);
497     }
498
499     public void testCohRemoveBTxRb() throws Exception JavaDoc {
500         _testCohRemoveB(TX_RB);
501     }
502
503     /**
504      * Test of coherence b0.remove() => a0.retrieveB()=null && a1.retrieveB()=null && a2.retrieveB()=null
505      * Same as _testCohRemove except that the called remove method is on the bean
506      * instead of the home.
507      */

508     public void _testCohBeanRemoveB(int tx) throws Exception JavaDoc {
509         if (tx == TX_CONT) {
510             // The transaction attribute of the remove method is TX_SUPPORT,
511
// so the transaction cannot be initiate by the container
512
fail("Transaction cannot be initiate by the container for this test");
513         }
514         if ((tx == TX_CALL) || (tx == TX_RB)) {
515             utx.begin();
516         }
517         BRemote b = bhome.findByPrimaryKey("b0");
518         b.remove();
519         if (tx == TX_CALL) {
520             utx.commit();
521         } else if (tx == TX_RB) {
522             utx.rollback();
523         }
524         // checking
525
if (tx != TX_RB) {
526             ARemote a0 = ahome.findByPrimaryKey("a0");
527             ARemote a1 = ahome.findByPrimaryKey("a1");
528             ARemote a2 = ahome.findByPrimaryKey("a2");
529             String JavaDoc idrela0 = a0.retrieveB();
530             String JavaDoc idrela1 = a1.retrieveB();
531             String JavaDoc idrela2 = a2.retrieveB();
532
533             assertNull("Wrong not null relation a0, found: " + idrela0, idrela0);
534             assertNull("Wrong not null relation a1, found: " + idrela1, idrela1);
535             assertNull("Wrong not null relation a2, found: " + idrela2, idrela2);
536             // undo
537
bhome.create("b0");
538             a0.assignBInNewTx("b0");
539             a1.assignBInNewTx("b0");
540             a2.assignBInNewTx("b0");
541         }
542         checkIsInitialState();
543     }
544
545     public void testCohBeanRemoveBTxNo() throws Exception JavaDoc {
546         _testCohBeanRemoveB(TX_NO);
547     }
548
549     public void testCohBeanRemoveBTxCall() throws Exception JavaDoc {
550         _testCohBeanRemoveB(TX_CALL);
551     }
552
553     public void testCohBeanRemoveBTxRb() throws Exception JavaDoc {
554         _testCohBeanRemoveB(TX_RB);
555     }
556
557     public void testCohRemove2() throws Exception JavaDoc {
558         _testCohRemoveB(TX_NO);
559         _testCohRemoveB(TX_CALL);
560         _testCohRemoveB(TX_NO);
561         _testCohRemoveB(TX_RB);
562     }
563
564     /**
565      * Test that the instances in the pool are correctly reused.
566      * There was a bug because PName was not null for GEnClass at create.
567      */

568     public void testInstanceReuse1() throws Exception JavaDoc {
569
570         ARemote a0 = ahome.findByPrimaryKey("a0");
571         ARemote a1 = ahome.findByPrimaryKey("a1");
572         ARemote a2 = ahome.findByPrimaryKey("a2");
573         ARemote a21 = ahome.findByPrimaryKey("a21");
574
575         //_testBasicSetEmpty(TX_RB);
576
utx.begin();
577         a1.assignB("b1");
578         utx.rollback();
579
580         //_testBasicSet(TX_RB);
581
utx.begin();
582         String JavaDoc bs = a21.retrieveB();
583         a1.assignB(bs);
584         utx.rollback();
585         a1.retrieveB();
586         a21.retrieveB();
587
588         //_testCohRemoveB(TX_NO);
589
bhome.remove("b0");
590         bhome.create("b0");
591         a0.assignBInNewTx("b0");
592
593         //_testCohRemoveB(TX_CALL);
594
utx.begin();
595         bhome.remove("b0");
596         utx.commit();
597         BRemote b0 = bhome.create("b0");
598         a0.assignBInNewTx("b0");
599
600         //_testCohRemoveB(TX_RB);
601
utx.begin();
602         bhome.remove("b0");
603         utx.rollback();
604
605         //_testCohBeanRemoveB(TX_NO);
606
b0.remove();
607         String JavaDoc idrela0 = a0.retrieveB();
608         assertNull("Wrong not null relation a0, found: " + idrela0, idrela0);
609         // undo
610
bhome.create("b0");
611         a0.assignBInNewTx("b0");
612         a1.assignBInNewTx("b0");
613         a2.assignBInNewTx("b0");
614         checkIsInitialState();
615     }
616
617     /**
618      * Test that the instances in the pool are correctly reused.
619      * There was a bug in jonas-3-0-beta0 because GenClass was
620      * already initialized at create.
621      */

622     public void testInstanceReuse2() throws Exception JavaDoc {
623         ARemote a4 = ahome.findByPrimaryKey("a4");
624         ARemote a5 = ahome.findByPrimaryKey("a5");
625
626         utx.begin();
627         a5.assignB("b2");
628         utx.rollback();
629
630         bhome.remove("b4");
631         BRemote b4 = bhome.create("b4");
632         a4.assignB("b4");
633
634         utx.begin();
635         bhome.remove("b4");
636         utx.rollback();
637         String JavaDoc s = a4.retrieveB();
638         assertEquals("Broken relation", "b4", s);
639
640         // remove b4 outside tx
641
b4.remove();
642         s = a4.retrieveB();
643         assertNull("Wrong not null relation a4, found: " + s, s);
644         // undo
645
bhome.create("b4");
646         a4.assignB("b4");
647         a5.assignB("b4");
648         checkIsInitialState();
649     }
650
651     /**
652      * This test did not work after optimization on lazy GenClass reading
653      * this test is equivalent to :
654      * _testCohRemoveB(TX_RB)
655      * _testCohRemoveB(TX_NO)
656      */

657     public void testInstanceReuse3() throws Exception JavaDoc {
658         String JavaDoc id;
659         //_testCohRemoveB(TX_RB);
660
utx.begin();
661         bhome.remove("b0");
662         utx.rollback();
663         //_testCohRemoveB(TX_NO);
664
bhome.remove("b0");
665         // checking
666
ARemote a0 = ahome.findByPrimaryKey("a0");
667         id = a0.retrieveB();
668         assertNull("Wrong not null relation a0, found: " + id, id);
669         ARemote a1 = ahome.findByPrimaryKey("a1");
670         id = a1.retrieveB();
671         assertNull("Wrong not null relation a1, found: " + id, id);
672         ARemote a2 = ahome.findByPrimaryKey("a2");
673         id = a2.retrieveB();
674         assertNull("Wrong not null relation a2, found: " + id, id);
675         // undo
676
bhome.create("b0");
677         a0.assignBInNewTx("b0");
678         a1.assignBInNewTx("b0");
679         a2.assignBInNewTx("b0");
680         checkIsInitialState();
681     }
682
683     public static Test suite() {
684         return new TestSuite(F_Relation_mouEC2.class);
685     }
686
687     public static void main(String JavaDoc args[]) {
688         String JavaDoc testtorun = null;
689         // Get args
690
for (int argn = 0; argn < args.length; argn++) {
691             String JavaDoc s_arg = args[argn];
692             Integer JavaDoc i_arg;
693             if (s_arg.equals("-n")) {
694                 testtorun = args[++argn];
695             }
696         }
697         if (testtorun == null) {
698             junit.textui.TestRunner.run(suite());
699         } else {
700             junit.textui.TestRunner.run(new F_Relation_mouEC2(testtorun));
701         }
702     }
703
704 }
705
Popular Tags