KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openejb > test > entity > bmp > BmpRmiIiopTests


1 /**
2  * Redistribution and use of this software and associated documentation
3  * ("Software"), with or without modification, are permitted provided
4  * that the following conditions are met:
5  *
6  * 1. Redistributions of source code must retain copyright
7  * statements and notices. Redistributions must also contain a
8  * copy of this document.
9  *
10  * 2. Redistributions in binary form must reproduce the
11  * above copyright notice, this list of conditions and the
12  * following disclaimer in the documentation and/or other
13  * materials provided with the distribution.
14  *
15  * 3. The name "Exolab" must not be used to endorse or promote
16  * products derived from this Software without prior written
17  * permission of Exoffice Technologies. For written permission,
18  * please contact info@exolab.org.
19  *
20  * 4. Products derived from this Software may not be called "Exolab"
21  * nor may "Exolab" appear in their names without prior written
22  * permission of Exoffice Technologies. Exolab is a registered
23  * trademark of Exoffice Technologies.
24  *
25  * 5. Due credit should be given to the Exolab Project
26  * (http://www.exolab.org/).
27  *
28  * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
29  * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
30  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
31  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
32  * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
39  * OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
42  *
43  * $Id: BmpRmiIiopTests.java 1096 2004-03-26 21:41:16Z dblevins $
44  */

45 package org.openejb.test.entity.bmp;
46
47 import javax.ejb.EJBHome JavaDoc;
48 import javax.ejb.EJBMetaData JavaDoc;
49 import javax.ejb.EJBObject JavaDoc;
50 import javax.ejb.Handle JavaDoc;
51
52 import org.openejb.test.object.ObjectGraph;
53
54 /**
55  *
56  * @author <a HREF="mailto:david.blevins@visi.com">David Blevins</a>
57  * @author <a HREF="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
58  */

59 public class BmpRmiIiopTests extends BmpTestClient{
60
61     protected RmiIiopBmpHome ejbHome;
62     protected RmiIiopBmpObject ejbObject;
63
64     public BmpRmiIiopTests(){
65         super("RMI_IIOP.");
66     }
67
68     protected void setUp() throws Exception JavaDoc{
69         super.setUp();
70         Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/RMI-over-IIOP/EJBHome");
71         ejbHome = (RmiIiopBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, RmiIiopBmpHome.class);
72         ejbObject = ejbHome.create("RMI-IIOP TestBean");
73     }
74
75 /*-------------------------------------------------*/
76 /* String */
77 /*-------------------------------------------------*/
78
79     public void test01_returnStringObject() {
80         try{
81             String JavaDoc expected = new String JavaDoc("1");
82             String JavaDoc actual = ejbObject.returnStringObject(expected);
83             assertEquals(expected, actual);
84         } catch (Exception JavaDoc e){
85             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
86         }
87     }
88
89     public void test02_returnStringObjectArray() {
90         try{
91             String JavaDoc[] expected = {"1","2","3"};
92             String JavaDoc[] actual = ejbObject.returnStringObjectArray(expected);
93
94             assertNotNull("The array returned is null", actual);
95             assertEquals(expected.length, actual.length);
96             for (int i=0; i < actual.length; i++){
97                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
98             }
99         } catch (Exception JavaDoc e){
100             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
101         }
102     }
103
104
105 /*-------------------------------------------------*/
106 /* Character */
107 /*-------------------------------------------------*/
108
109     public void test03_returnCharacterObject() {
110         try{
111             Character JavaDoc expected = new Character JavaDoc('1');
112             Character JavaDoc actual = ejbObject.returnCharacterObject(expected);
113             assertEquals(expected, actual);
114         } catch (Exception JavaDoc e){
115             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
116         }
117     }
118
119     public void test04_returnCharacterPrimitive() {
120         try{
121             char expected = '1';
122             char actual = ejbObject.returnCharacterPrimitive(expected);
123             assertEquals(expected, actual);
124         } catch (Exception JavaDoc e){
125             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
126         }
127     }
128
129     public void test05_returnCharacterObjectArray() {
130         try{
131             Character JavaDoc[] expected = {new Character JavaDoc('1'),new Character JavaDoc('2'),new Character JavaDoc('3')};
132             Character JavaDoc[] actual = ejbObject.returnCharacterObjectArray(expected);
133
134             assertNotNull("The array returned is null", actual);
135             assertEquals(expected.length, actual.length);
136             for (int i=0; i < actual.length; i++){
137                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
138             }
139         } catch (Exception JavaDoc e){
140             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
141         }
142     }
143
144     public void test06_returnCharacterPrimitiveArray() {
145         try{
146             char[] expected = {'1','2','3'};
147             char[] actual = ejbObject.returnCharacterPrimitiveArray(expected);
148
149             assertNotNull("The array returned is null", actual);
150             assertEquals(expected.length, actual.length);
151             for (int i=0; i < actual.length; i++){
152                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
153             }
154         } catch (Exception JavaDoc e){
155             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
156         }
157     }
158
159
160 /*-------------------------------------------------*/
161 /* Boolean */
162 /*-------------------------------------------------*/
163
164     public void test07_returnBooleanObject() {
165         try{
166             Boolean JavaDoc expected = new Boolean JavaDoc(true);
167             Boolean JavaDoc actual = ejbObject.returnBooleanObject(expected);
168             assertEquals(expected, actual);
169         } catch (Exception JavaDoc e){
170             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
171         }
172     }
173
174     public void test08_returnBooleanPrimitive() {
175         try{
176             boolean expected = true;
177             boolean actual = ejbObject.returnBooleanPrimitive(expected);
178             assertEquals(""+expected, ""+actual);
179         } catch (Exception JavaDoc e){
180             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
181         }
182     }
183
184     public void test09_returnBooleanObjectArray() {
185         try{
186             Boolean JavaDoc[] expected = {new Boolean JavaDoc(true),new Boolean JavaDoc(false),new Boolean JavaDoc(true)};
187             Boolean JavaDoc[] actual = ejbObject.returnBooleanObjectArray(expected);
188
189             assertNotNull("The array returned is null", actual);
190             assertEquals(expected.length, actual.length);
191             for (int i=0; i < actual.length; i++){
192                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
193             }
194         } catch (Exception JavaDoc e){
195             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
196         }
197     }
198
199     public void test10_returnBooleanPrimitiveArray() {
200         try{
201             boolean[] expected = {false,true,true};
202             boolean[] actual = ejbObject.returnBooleanPrimitiveArray(expected);
203
204             assertNotNull("The array returned is null", actual);
205             assertEquals(expected.length, actual.length);
206             for (int i=0; i < actual.length; i++){
207                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
208             }
209         } catch (Exception JavaDoc e){
210             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
211         }
212     }
213
214
215 /*-------------------------------------------------*/
216 /* Byte */
217 /*-------------------------------------------------*/
218
219     public void test11_returnByteObject() {
220         try{
221             Byte JavaDoc expected = new Byte JavaDoc("1");
222             Byte JavaDoc actual = ejbObject.returnByteObject(expected);
223             assertEquals(expected, actual);
224         } catch (Exception JavaDoc e){
225             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
226         }
227     }
228
229     public void test12_returnBytePrimitive() {
230         try{
231             byte expected = (byte)1;
232             byte actual = ejbObject.returnBytePrimitive(expected);
233             assertEquals(expected, actual);
234         } catch (Exception JavaDoc e){
235             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
236         }
237     }
238
239     public void test13_returnByteObjectArray() {
240         try{
241             Byte JavaDoc[] expected = {new Byte JavaDoc("1"),new Byte JavaDoc("2"),new Byte JavaDoc("3")};
242             Byte JavaDoc[] actual = ejbObject.returnByteObjectArray(expected);
243
244             assertNotNull("The array returned is null", actual);
245             assertEquals(expected.length, actual.length);
246             for (int i=0; i < actual.length; i++){
247                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
248             }
249         } catch (Exception JavaDoc e){
250             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
251         }
252     }
253
254     public void test14_returnBytePrimitiveArray() {
255         try{
256             byte[] expected = {(byte)1,(byte)2,(byte)3};
257             byte[] actual = ejbObject.returnBytePrimitiveArray(expected);
258
259             assertNotNull("The array returned is null", actual);
260             assertEquals(expected.length, actual.length);
261             for (int i=0; i < actual.length; i++){
262                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
263             }
264         } catch (Exception JavaDoc e){
265             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
266         }
267     }
268
269
270 /*-------------------------------------------------*/
271 /* Short */
272 /*-------------------------------------------------*/
273
274     public void test15_returnShortObject() {
275         try{
276             Short JavaDoc expected = new Short JavaDoc("1");
277             Short JavaDoc actual = ejbObject.returnShortObject(expected);
278             assertEquals(expected, actual);
279         } catch (Exception JavaDoc e){
280             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
281         }
282     }
283
284     public void test16_returnShortPrimitive() {
285         try{
286             short expected = (short)1;
287             short actual = ejbObject.returnShortPrimitive(expected);
288             assertEquals(expected, actual);
289         } catch (Exception JavaDoc e){
290             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
291         }
292     }
293
294     public void test17_returnShortObjectArray() {
295         try{
296             Short JavaDoc[] expected = {new Short JavaDoc("1"),new Short JavaDoc("2"),new Short JavaDoc("3")};
297             Short JavaDoc[] actual = ejbObject.returnShortObjectArray(expected);
298
299             assertNotNull("The array returned is null", actual);
300             assertEquals(expected.length, actual.length);
301             for (int i=0; i < actual.length; i++){
302                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
303             }
304         } catch (Exception JavaDoc e){
305             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
306         }
307     }
308
309     public void test18_returnShortPrimitiveArray() {
310         try{
311             short[] expected = {(short)1,(short)2,(short)3};
312             short[] actual = ejbObject.returnShortPrimitiveArray(expected);
313
314             assertNotNull("The array returned is null", actual);
315             assertEquals(expected.length, actual.length);
316             for (int i=0; i < actual.length; i++){
317                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
318             }
319         } catch (Exception JavaDoc e){
320             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
321         }
322     }
323
324
325 /*-------------------------------------------------*/
326 /* Integer */
327 /*-------------------------------------------------*/
328
329     public void test19_returnIntegerObject() {
330         try{
331             Integer JavaDoc expected = new Integer JavaDoc(1);
332             Integer JavaDoc actual = ejbObject.returnIntegerObject(expected);
333             assertEquals(expected, actual);
334         } catch (Exception JavaDoc e){
335             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
336         }
337     }
338
339     public void test20_returnIntegerPrimitive() {
340         try{
341             int expected = 1;
342             int actual = ejbObject.returnIntegerPrimitive(expected);
343             assertEquals(expected, actual);
344         } catch (Exception JavaDoc e){
345             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
346         }
347     }
348
349     public void test21_returnIntegerObjectArray() {
350         try{
351             Integer JavaDoc[] expected = {new Integer JavaDoc(1),new Integer JavaDoc(2),new Integer JavaDoc(3)};
352             Integer JavaDoc[] actual = ejbObject.returnIntegerObjectArray(expected);
353
354             assertNotNull("The array returned is null", actual);
355             assertEquals(expected.length, actual.length);
356             for (int i=0; i < actual.length; i++){
357                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
358             }
359         } catch (Exception JavaDoc e){
360             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
361         }
362     }
363
364     public void test22_returnIntegerPrimitiveArray() {
365         try{
366             int[] expected = {1,2,3};
367             int[] actual = ejbObject.returnIntegerPrimitiveArray(expected);
368
369             assertNotNull("The array returned is null", actual);
370             assertEquals(expected.length, actual.length);
371             for (int i=0; i < actual.length; i++){
372                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
373             }
374         } catch (Exception JavaDoc e){
375             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
376         }
377     }
378
379
380 /*-------------------------------------------------*/
381 /* Long */
382 /*-------------------------------------------------*/
383
384     public void test23_returnLongObject() {
385         try{
386             Long JavaDoc expected = new Long JavaDoc("1");
387             Long JavaDoc actual = ejbObject.returnLongObject(expected);
388             assertEquals(expected, actual);
389         } catch (Exception JavaDoc e){
390             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
391         }
392     }
393
394     public void test24_returnLongPrimitive() {
395         try{
396             long expected = 1;
397             long actual = ejbObject.returnLongPrimitive(expected);
398             assertEquals(expected, actual);
399         } catch (Exception JavaDoc e){
400             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
401         }
402     }
403
404     public void test25_returnLongObjectArray() {
405         try{
406             Long JavaDoc[] expected = {new Long JavaDoc("1"),new Long JavaDoc("2"),new Long JavaDoc("3")};
407             Long JavaDoc[] actual = ejbObject.returnLongObjectArray(expected);
408
409             assertNotNull("The array returned is null", actual);
410             assertEquals(expected.length, actual.length);
411             for (int i=0; i < actual.length; i++){
412                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
413             }
414         } catch (Exception JavaDoc e){
415             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
416         }
417     }
418
419     public void test26_returnLongPrimitiveArray() {
420         try{
421             long[] expected = {1,2,3};
422             long[] actual = ejbObject.returnLongPrimitiveArray(expected);
423
424             assertNotNull("The array returned is null", actual);
425             assertEquals(expected.length, actual.length);
426             for (int i=0; i < actual.length; i++){
427                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
428             }
429         } catch (Exception JavaDoc e){
430             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
431         }
432     }
433
434
435 /*-------------------------------------------------*/
436 /* Float */
437 /*-------------------------------------------------*/
438
439     public void test27_returnFloatObject() {
440         try{
441             Float JavaDoc expected = new Float JavaDoc("1.3");
442             Float JavaDoc actual = ejbObject.returnFloatObject(expected);
443             assertEquals(expected, actual);
444         } catch (Exception JavaDoc e){
445             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
446         }
447     }
448
449     public void test28_returnFloatPrimitive() {
450         try{
451             float expected = 1.2F;
452             float actual = ejbObject.returnFloatPrimitive(expected);
453             assertEquals(expected, actual, 0.00D);
454         } catch (Exception JavaDoc e){
455             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
456         }
457     }
458
459     public void test29_returnFloatObjectArray() {
460         try{
461             Float JavaDoc[] expected = {new Float JavaDoc("1.1"),new Float JavaDoc("2.2"),new Float JavaDoc("3.3")};
462             Float JavaDoc[] actual = ejbObject.returnFloatObjectArray(expected);
463
464             assertNotNull("The array returned is null", actual);
465             assertEquals(expected.length, actual.length);
466             for (int i=0; i < actual.length; i++){
467                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
468             }
469         } catch (Exception JavaDoc e){
470             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
471         }
472     }
473
474     public void test30_returnFloatPrimitiveArray() {
475         try{
476             float[] expected = {1.2F,2.3F,3.4F};
477             float[] actual = ejbObject.returnFloatPrimitiveArray(expected);
478
479             assertNotNull("The array returned is null", actual);
480             assertEquals(expected.length, actual.length);
481             for (int i=0; i < actual.length; i++){
482                 assertEquals("Array values are not equal at index "+i , expected[i], actual[i], 0.0D);
483             }
484         } catch (Exception JavaDoc e){
485             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
486         }
487     }
488
489
490 /*-------------------------------------------------*/
491 /* Double */
492 /*-------------------------------------------------*/
493
494     public void test31_returnDoubleObject() {
495         try{
496             Double JavaDoc expected = new Double JavaDoc("1.1");
497             Double JavaDoc actual = ejbObject.returnDoubleObject(expected);
498             assertEquals(expected, actual);
499         } catch (Exception JavaDoc e){
500             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
501         }
502     }
503
504     public void test32_returnDoublePrimitive() {
505         try{
506             double expected = 1.2;
507             double actual = ejbObject.returnDoublePrimitive(expected);
508             assertEquals(expected, actual, 0.0D);
509         } catch (Exception JavaDoc e){
510             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
511         }
512     }
513
514     public void test33_returnDoubleObjectArray() {
515         try{
516             Double JavaDoc[] expected = {new Double JavaDoc("1.3"),new Double JavaDoc("2.4"),new Double JavaDoc("3.5")};
517             Double JavaDoc[] actual = ejbObject.returnDoubleObjectArray(expected);
518
519             assertNotNull("The array returned is null", actual);
520             assertEquals(expected.length, actual.length);
521             for (int i=0; i < actual.length; i++){
522                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]);
523             }
524         } catch (Exception JavaDoc e){
525             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
526         }
527     }
528
529     public void test34_returnDoublePrimitiveArray() {
530         try{
531             double[] expected = {1.4,2.5,3.6};
532             double[] actual = ejbObject.returnDoublePrimitiveArray(expected);
533
534             assertNotNull("The array returned is null", actual);
535             assertEquals(expected.length, actual.length);
536             for (int i=0; i < actual.length; i++){
537                 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i],0.0D);
538             }
539         } catch (Exception JavaDoc e){
540             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
541         }
542     }
543
544
545 /*-------------------------------------------------*/
546 /* EJBHome */
547 /*-------------------------------------------------*/
548
549     public void test35_returnEJBHome() {
550         try{
551             Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
552             EncBmpHome expected = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
553             assertNotNull("The EJBHome returned from JNDI is null", expected);
554
555             EncBmpHome actual = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( ejbObject.returnEJBHome(expected), EncBmpHome.class);
556             assertNotNull("The EJBHome returned is null", actual);
557
558         } catch (Exception JavaDoc e){
559             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
560         }
561     }
562
563     public void test36_returnEJBHome2() {
564         try{
565             EncBmpHome actual = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( ejbObject.returnEJBHome(), EncBmpHome.class);
566             assertNotNull("The EJBHome returned is null", actual);
567
568         } catch (Exception JavaDoc e){
569             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
570         }
571     }
572
573     public void test37_returnNestedEJBHome() {
574         try{
575             Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
576             EncBmpHome expected = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
577             assertNotNull("The EJBHome returned from JNDI is null", expected);
578
579             ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected));
580             assertNotNull("The ObjectGraph is null", graph);
581
582             EncBmpHome actual = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( graph.getObject(), EncBmpHome.class);
583             assertNotNull("The EJBHome returned is null", actual);
584         } catch (Exception JavaDoc e){
585             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
586         }
587     }
588
589     public void test38_returnNestedEJBHome2() {
590         try{
591             ObjectGraph graph = ejbObject.returnNestedEJBHome();
592             assertNotNull("The ObjectGraph is null", graph);
593
594             EncBmpHome actual = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( graph.getObject(), EncBmpHome.class);
595             assertNotNull("The EJBHome returned is null", actual);
596         } catch (Exception JavaDoc e){
597             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
598         }
599     }
600
601     public void test39_returnEJBHomeArray() {
602         try{
603
604             EncBmpHome expected[] = new EncBmpHome[3];
605             for (int i=0; i < expected.length; i++){
606                 Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
607                 expected[i] = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
608                 assertNotNull("The EJBHome returned from JNDI is null", expected[i]);
609             }
610
611             EJBHome JavaDoc[] actual = ejbObject.returnEJBHomeArray(expected);
612             assertNotNull("The EJBHome array returned is null", actual);
613             assertEquals(expected.length, actual.length);
614
615         } catch (Exception JavaDoc e){
616             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
617         }
618     }
619
620
621 /*-------------------------------------------------*/
622 /* EJBObject */
623 /*-------------------------------------------------*/
624
625     public void test40_returnEJBObject() {
626         try{
627             Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
628             EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
629             assertNotNull("The EJBHome returned from JNDI is null", home);
630
631             EncBmpObject expected = home.create("test_40 BmpBean");
632             assertNotNull("The EJBObject created is null", expected);
633
634             EncBmpObject actual = (EncBmpObject)javax.rmi.PortableRemoteObject.narrow( ejbObject.returnEJBObject(expected), EncBmpObject.class);
635             assertNotNull("The EJBObject returned is null", actual);
636
637             assertTrue("The EJBObejcts are not identical", expected.isIdentical(actual));
638         } catch (Exception JavaDoc e){
639             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
640         }
641     }
642
643     public void test41_returnEJBObject2() {
644         try{
645             EncBmpObject actual = (EncBmpObject)javax.rmi.PortableRemoteObject.narrow(ejbObject.returnEJBObject(), EncBmpObject.class);
646             assertNotNull("The EJBObject returned is null", actual);
647
648         } catch (Exception JavaDoc e){
649             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
650         }
651     }
652
653     public void test42_returnNestedEJBObject() {
654         try{
655             Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
656             EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
657             assertNotNull("The EJBHome returned from JNDI is null", home);
658
659             EncBmpObject expected = home.create("test_42 BmpBean");
660             assertNotNull("The EJBObject created is null", expected);
661
662             ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected));
663             assertNotNull("The ObjectGraph is null", graph);
664
665             EncBmpObject actual = (EncBmpObject)(EncBmpObject)javax.rmi.PortableRemoteObject.narrow( graph.getObject(), EncBmpObject.class);
666             assertNotNull("The EJBObject returned is null", actual);
667
668             assertTrue("The EJBObejcts are not identical", expected.isIdentical(actual));
669         } catch (Exception JavaDoc e){
670             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
671         }
672     }
673
674     public void test43_returnNestedEJBObject2() {
675         try{
676             ObjectGraph graph = ejbObject.returnNestedEJBObject();
677             assertNotNull("The ObjectGraph is null", graph);
678
679             EncBmpObject actual = (EncBmpObject)(EncBmpObject)javax.rmi.PortableRemoteObject.narrow( graph.getObject(), EncBmpObject.class);
680             assertNotNull("The EJBHome returned is null", actual);
681         } catch (Exception JavaDoc e){
682             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
683         }
684     }
685
686     public void test44_returnEJBObjectArray() {
687         try{
688             Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
689             EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
690             assertNotNull("The EJBHome returned from JNDI is null", home);
691
692             EncBmpObject expected[] = new EncBmpObject[3];
693             for (int i=0; i < expected.length; i++){
694                 expected[i] = home.create("test_44 BmpBean");
695                 assertNotNull("The EJBObject created is null", expected[i]);
696             }
697
698             EJBObject JavaDoc[] actual = ejbObject.returnEJBObjectArray(expected);
699             assertNotNull("The EJBObject array returned is null", actual);
700             assertEquals(expected.length, actual.length);
701
702             for (int i=0; i < actual.length; i++){
703                 assertTrue("The EJBObjects are not identical", expected[i].isIdentical(actual[i]));
704             }
705
706         } catch (Exception JavaDoc e){
707             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
708         }
709     }
710
711 /*-------------------------------------------------*/
712 /* EJBMetaData */
713 /*-------------------------------------------------*/
714
715     public void test45_returnEJBMetaData() {
716         try{
717             Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
718             EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
719             assertNotNull("The EJBHome returned from JNDI is null", home);
720
721             EJBMetaData JavaDoc expected = home.getEJBMetaData();
722             assertNotNull("The EJBMetaData returned is null", expected);
723
724             EJBMetaData JavaDoc actual = ejbObject.returnEJBMetaData(expected);
725             assertNotNull("The EJBMetaData returned is null", actual);
726             assertEquals(expected.getHomeInterfaceClass(), actual.getHomeInterfaceClass());
727             assertEquals(expected.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass());
728         } catch (Exception JavaDoc e){
729             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
730         }
731     }
732
733     public void test46_returnEJBMetaData() {
734         try{
735             EJBMetaData JavaDoc actual = ejbObject.returnEJBMetaData();
736             assertNotNull("The EJBMetaData returned is null", actual);
737             assertEquals(actual.getHomeInterfaceClass(), actual.getHomeInterfaceClass());
738             assertEquals(actual.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass());
739         } catch (Exception JavaDoc e){
740             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
741         }
742     }
743
744     public void test47_returnNestedEJBMetaData() {
745         try{
746             Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
747             EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
748             assertNotNull("The EJBHome returned from JNDI is null", home);
749
750             EJBMetaData JavaDoc expected = home.getEJBMetaData();
751             assertNotNull("The EJBMetaData returned is null", expected);
752
753             ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected));
754             assertNotNull("The ObjectGraph is null", graph);
755
756             EJBMetaData JavaDoc actual = (EJBMetaData JavaDoc)graph.getObject();
757             assertNotNull("The EJBMetaData returned is null", actual);
758             assertEquals(expected.getHomeInterfaceClass(), actual.getHomeInterfaceClass());
759             assertEquals(expected.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass());
760         } catch (Exception JavaDoc e){
761             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
762         }
763     }
764
765     public void test48_returnNestedEJBMetaData2() {
766         try{
767             ObjectGraph graph = ejbObject.returnNestedEJBMetaData();
768             assertNotNull("The ObjectGraph is null", graph);
769
770             EJBMetaData JavaDoc actual = (EJBMetaData JavaDoc)graph.getObject();
771             assertNotNull("The EJBMetaData returned is null", actual);
772             assertNotNull("The home interface class of the EJBMetaData is null", actual.getHomeInterfaceClass());
773             assertNotNull("The remote interface class of the EJBMetaData is null", actual.getRemoteInterfaceClass());
774         } catch (Exception JavaDoc e){
775             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
776         }
777     }
778
779     public void test49_returnEJBMetaDataArray() {
780         try{
781
782             Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
783             EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
784             assertNotNull("The EJBHome returned from JNDI is null", home);
785
786             EJBMetaData JavaDoc expected[] = new EJBMetaData JavaDoc[3];
787             for (int i=0; i < expected.length; i++){
788                 expected[i] = home.getEJBMetaData();
789                 assertNotNull("The EJBMetaData returned is null", expected[i]);
790             }
791
792             EJBMetaData JavaDoc[] actual = (EJBMetaData JavaDoc[])ejbObject.returnEJBMetaDataArray(expected);
793             assertNotNull("The EJBMetaData array returned is null", actual);
794             assertEquals(expected.length, actual.length);
795
796             for (int i=0; i < actual.length; i++){
797                 assertNotNull("The EJBMetaData returned is null", actual[i]);
798                 assertEquals(expected[i].getHomeInterfaceClass(), actual[i].getHomeInterfaceClass());
799                 assertEquals(expected[i].getRemoteInterfaceClass(), actual[i].getRemoteInterfaceClass());
800             }
801         } catch (Exception JavaDoc e){
802             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
803         }
804     }
805
806
807 /*-------------------------------------------------*/
808 /* Handle */
809 /*-------------------------------------------------*/
810
811     public void test50_returnHandle() {
812         try{
813             Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
814             EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
815             assertNotNull("The EJBHome returned from JNDI is null", home);
816
817             EncBmpObject object = home.create("test_50 BmpBean");
818             assertNotNull("The EJBObject created is null", object);
819
820             Handle JavaDoc expected = object.getHandle();
821             assertNotNull("The EJBObject Handle returned is null", expected);
822             assertNotNull("The EJBObject in the Handle is null", expected.getEJBObject());
823
824             Handle JavaDoc actual = ejbObject.returnHandle(expected);
825             assertNotNull("The EJBObject Handle returned is null", actual);
826             assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject());
827
828             EJBObject JavaDoc exp = expected.getEJBObject();
829             EJBObject JavaDoc act = actual.getEJBObject();
830
831             assertTrue("The EJBObjects in the Handles are not identical", exp.isIdentical(act));
832         } catch (Exception JavaDoc e){
833             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
834         }
835     }
836
837     public void test51_returnHandle() {
838         try{
839             Handle JavaDoc actual = ejbObject.returnHandle();
840             assertNotNull("The EJBObject Handle returned is null", actual);
841             assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject());
842
843         } catch (Exception JavaDoc e){
844             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
845         }
846     }
847
848     public void test52_returnNestedHandle() {
849         try{
850             Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
851             EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
852             assertNotNull("The EJBHome returned from JNDI is null", home);
853
854             EncBmpObject object = home.create("test_52 BmpBean");
855             assertNotNull("The EJBObject created is null", object);
856
857             Handle JavaDoc expected = object.getHandle();
858             assertNotNull("The EJBObject Handle returned is null", expected);
859             assertNotNull("The EJBObject in the Handle is null", expected.getEJBObject());
860
861             ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected));
862             assertNotNull("The ObjectGraph is null", graph);
863
864             Handle JavaDoc actual = (Handle JavaDoc)graph.getObject();
865             assertNotNull("The EJBObject Handle returned is null", actual);
866             assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject());
867
868             EJBObject JavaDoc exp = expected.getEJBObject();
869             EJBObject JavaDoc act = actual.getEJBObject();
870
871             assertTrue("The EJBObjects in the Handles are not identical", exp.isIdentical(act));
872
873         } catch (Exception JavaDoc e){
874             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
875         }
876     }
877
878     public void test53_returnNestedHandle2() {
879         try{
880             ObjectGraph graph = ejbObject.returnNestedHandle();
881             assertNotNull("The ObjectGraph is null", graph);
882
883             Handle JavaDoc actual = (Handle JavaDoc)graph.getObject();
884             assertNotNull("The EJBObject Handle returned is null", actual);
885             assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject());
886         } catch (Exception JavaDoc e){
887             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
888         }
889     }
890
891     public void test54_returnHandleArray() {
892         try{
893             Object JavaDoc obj = initialContext.lookup("client/tests/entity/bmp/EncBean");
894             EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class);
895             assertNotNull("The EJBHome returned from JNDI is null", home);
896
897             EncBmpObject object = home.create("test_54 BmpBean");
898             assertNotNull("The EJBObject created is null", object);
899
900             Handle JavaDoc expected[] = new Handle JavaDoc[3];
901             for (int i=0; i < expected.length; i++){
902                 expected[i] = object.getHandle();
903                 assertNotNull("The EJBObject Handle returned is null", expected[i]);
904             }
905
906             Handle JavaDoc[] actual = (Handle JavaDoc[])ejbObject.returnHandleArray(expected);
907             assertNotNull("The Handle array returned is null", actual);
908             assertEquals(expected.length, actual.length);
909
910             for (int i=0; i < expected.length; i++){
911                 assertNotNull("The EJBObject Handle returned is null", actual[i]);
912                 assertNotNull("The EJBObject in the Handle is null", actual[i].getEJBObject());
913                 assertTrue("The EJBObjects in the Handles are not equal", expected[i].getEJBObject().isIdentical(actual[i].getEJBObject()));
914             }
915
916         } catch (Exception JavaDoc e){
917             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
918         }
919     }
920
921
922 /*-------------------------------------------------*/
923 /* Foo */
924 /*-------------------------------------------------*/
925
926     public void test55_returnObjectGraph() {
927     }
928     public void test56_returnObjectGraphArray() {
929     }
930 }
931
932
Popular Tags