KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openejb > test > stateless > StatelessRmiIiopTests


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, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
33  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38  * OF THE POSSIBILITY OF SUCH DAMAGE.
39  *
40  * Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
41  *
42  * $Id: StatelessRmiIiopTests.java 1096 2004-03-26 21:41:16Z dblevins $
43  */

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