KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > iiopperf > test > T0PassBasicTypesTestCase


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.test.iiopperf.test;
23
24
25 import javax.ejb.*;
26 import javax.naming.*;
27 import javax.rmi.PortableRemoteObject JavaDoc;
28
29 import org.jboss.test.iiopperf.interfaces.*;
30
31 import junit.framework.Test;
32 import junit.framework.TestCase;
33 import junit.framework.TestSuite;
34 import org.jboss.test.JBossTestCase;
35
36
37 /**
38  * @author Francisco.Reverbel@jboss.org
39  * @version $Revision: 37406 $
40  */

41 public class T0PassBasicTypesTestCase
42    extends JBossTestCase
43 {
44    // Constants -----------------------------------------------------
45

46    // Attributes ----------------------------------------------------
47
private java.util.Properties JavaDoc cosnamingJndiProps;
48
49    // Static --------------------------------------------------------
50

51    // Constructors --------------------------------------------------
52
public T0PassBasicTypesTestCase(String JavaDoc name)
53        throws java.io.IOException JavaDoc
54    {
55       super(name);
56       java.net.URL JavaDoc url;
57
58       url = ClassLoader.getSystemResource("cosnaming.jndi.properties");
59       cosnamingJndiProps = new java.util.Properties JavaDoc();
60       cosnamingJndiProps.load(url.openStream());
61    }
62    
63    // Package --------------------------------------------------------
64

65    InitialContext getInitialContext(java.util.Properties JavaDoc jndiProps)
66        throws Exception JavaDoc
67    {
68       return new InitialContext(jndiProps);
69    }
70
71    // Public --------------------------------------------------------
72

73    /**
74     * This tests the speed of JRMP sendReceiveNothing invocations
75     *
76     * @exception Exception
77     */

78    public void testJRMPSendReceiveNothing()
79       throws Exception JavaDoc
80    {
81       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
82             getInitialContext().lookup(SessionHome.JNDI_NAME),
83             SessionHome.class);
84       Session session = home.create();
85       int n = getIterationCount();
86       long start = System.currentTimeMillis();
87       for (int i = 0 ; i < n; i++)
88       {
89          session.sendReceiveNothing();
90       }
91       long end = System.currentTimeMillis();
92       getLog().info("JRMP sendReceiveNothing: " +
93                     ((end - start) / (double)n) + " ms/call");
94    }
95    
96    /**
97     * This tests the speed of IIOP sendReceiveNothing invocations
98     *
99     * @exception Exception
100     */

101    public void testIIOPSendReceiveNothing()
102       throws Exception JavaDoc
103    {
104       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
105             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
106             SessionHome.class);
107       Session session = home.create();
108       int n = getIterationCount();
109       long start = System.currentTimeMillis();
110       for (int i = 0 ; i < n; i++)
111       {
112          session.sendReceiveNothing();
113       }
114       long end = System.currentTimeMillis();
115       getLog().info("IIOP sendReceiveNothing: " +
116                     ((end - start) / (double)n) + " ms/call");
117    }
118    
119    /**
120     * This tests the speed of JRMP sendBoolean invocations
121     *
122     * @exception Exception
123     */

124    public void testJRMPSendBoolean()
125       throws Exception JavaDoc
126    {
127       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
128             getInitialContext().lookup(SessionHome.JNDI_NAME),
129             SessionHome.class);
130       Session session = home.create();
131       int n = getIterationCount();
132       long start = System.currentTimeMillis();
133       for (int i = 0 ; i < n; i++)
134       {
135          session.sendBoolean(true);
136       }
137       long end = System.currentTimeMillis();
138       getLog().info("JRMP sendBoolean: " +
139                     ((end - start) / (double)n) + " ms/call");
140    }
141    
142    /**
143     * This tests the speed of IIOP sendBoolean invocations
144     *
145     * @exception Exception
146     */

147    public void testIIOPSendBoolean()
148       throws Exception JavaDoc
149    {
150       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
151             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
152             SessionHome.class);
153       Session session = home.create();
154       int n = getIterationCount();
155       long start = System.currentTimeMillis();
156       for (int i = 0 ; i < n; i++)
157       {
158          session.sendBoolean(true);
159       }
160       long end = System.currentTimeMillis();
161       getLog().info("IIOP sendBoolean: " +
162                     ((end - start) / (double)n) + " ms/call");
163    }
164    
165    /**
166     * This tests the speed of JRMP receiveBoolean invocations
167     *
168     * @exception Exception
169     */

170    public void testJRMPReceiveBoolean()
171       throws Exception JavaDoc
172    {
173       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
174             getInitialContext().lookup(SessionHome.JNDI_NAME),
175             SessionHome.class);
176       Session session = home.create();
177       int n = getIterationCount();
178       long start = System.currentTimeMillis();
179       for (int i = 0 ; i < n; i++)
180       {
181          session.receiveBoolean();
182       }
183       long end = System.currentTimeMillis();
184       getLog().info("JRMP receiveBoolean: " +
185                     ((end - start) / (double)n) + " ms/call");
186    }
187    
188    /**
189     * This tests the speed of IIOP receiveBoolean invocations
190     *
191     * @exception Exception
192     */

193    public void testIIOPReceiveBoolean()
194       throws Exception JavaDoc
195    {
196       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
197             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
198             SessionHome.class);
199       Session session = home.create();
200       int n = getIterationCount();
201       long start = System.currentTimeMillis();
202       for (int i = 0 ; i < n; i++)
203       {
204          session.receiveBoolean();
205       }
206       long end = System.currentTimeMillis();
207       getLog().info("IIOP receiveBoolean: " +
208                     ((end - start) / (double)n) + " ms/call");
209    }
210    
211    /**
212     * This tests the speed of JRMP sendReceiveBoolean invocations
213     *
214     * @exception Exception
215     */

216    public void testJRMPSendReceiveBoolean()
217       throws Exception JavaDoc
218    {
219       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
220             getInitialContext().lookup(SessionHome.JNDI_NAME),
221             SessionHome.class);
222       Session session = home.create();
223       int n = getIterationCount();
224       long start = System.currentTimeMillis();
225       for (int i = 0 ; i < n; i++)
226       {
227          session.sendReceiveBoolean(true);
228       }
229       long end = System.currentTimeMillis();
230       getLog().info("JRMP sendReceiveBoolean: " +
231                     ((end - start) / (double)n) + " ms/call");
232    }
233    
234    /**
235     * This tests the speed of IIOP sendReceiveBoolean invocations
236     *
237     * @exception Exception
238     */

239    public void testIIOPSendReceiveBoolean()
240       throws Exception JavaDoc
241    {
242       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
243             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
244             SessionHome.class);
245       Session session = home.create();
246       int n = getIterationCount();
247       long start = System.currentTimeMillis();
248       for (int i = 0 ; i < n; i++)
249       {
250          session.sendReceiveBoolean(true);
251       }
252       long end = System.currentTimeMillis();
253       getLog().info("IIOP sendReceiveBoolean: " +
254                     ((end - start) / (double)n) + " ms/call");
255    }
256    
257    /**
258     * This tests the speed of JRMP sendChar invocations
259     *
260     * @exception Exception
261     */

262    public void testJRMPSendChar()
263       throws Exception JavaDoc
264    {
265       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
266             getInitialContext().lookup(SessionHome.JNDI_NAME),
267             SessionHome.class);
268       Session session = home.create();
269       int n = getIterationCount();
270       long start = System.currentTimeMillis();
271       for (int i = 0 ; i < n; i++)
272       {
273          session.sendChar(Character.MAX_VALUE);
274       }
275       long end = System.currentTimeMillis();
276       getLog().info("JRMP sendChar: " +
277                     ((end - start) / (double)n) + " ms/call");
278    }
279    
280    /**
281     * This tests the speed of IIOP sendChar invocations
282     *
283     * @exception Exception
284     */

285    public void testIIOPSendChar()
286       throws Exception JavaDoc
287    {
288       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
289             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
290             SessionHome.class);
291       Session session = home.create();
292       int n = getIterationCount();
293       long start = System.currentTimeMillis();
294       for (int i = 0 ; i < n; i++)
295       {
296          session.sendChar(Character.MAX_VALUE);
297       }
298       long end = System.currentTimeMillis();
299       getLog().info("IIOP sendChar: " +
300                     ((end - start) / (double)n) + " ms/call");
301    }
302    
303    /**
304     * This tests the speed of JRMP receiveChar invocations
305     *
306     * @exception Exception
307     */

308    public void testJRMPReceiveChar()
309       throws Exception JavaDoc
310    {
311       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
312             getInitialContext().lookup(SessionHome.JNDI_NAME),
313             SessionHome.class);
314       Session session = home.create();
315       int n = getIterationCount();
316       long start = System.currentTimeMillis();
317       for (int i = 0 ; i < n; i++)
318       {
319          session.receiveChar();
320       }
321       long end = System.currentTimeMillis();
322       getLog().info("JRMP receiveChar: " +
323                     ((end - start) / (double)n) + " ms/call");
324    }
325    
326    /**
327     * This tests the speed of IIOP receiveChar invocations
328     *
329     * @exception Exception
330     */

331    public void testIIOPReceiveChar()
332       throws Exception JavaDoc
333    {
334       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
335             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
336             SessionHome.class);
337       Session session = home.create();
338       int n = getIterationCount();
339       long start = System.currentTimeMillis();
340       for (int i = 0 ; i < n; i++)
341       {
342          session.receiveChar();
343       }
344       long end = System.currentTimeMillis();
345       getLog().info("IIOP receiveChar: " +
346                     ((end - start) / (double)n) + " ms/call");
347    }
348    
349    /**
350     * This tests the speed of JRMP sendReceiveChar invocations
351     *
352     * @exception Exception
353     */

354    public void testJRMPSendReceiveChar()
355       throws Exception JavaDoc
356    {
357       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
358             getInitialContext().lookup(SessionHome.JNDI_NAME),
359             SessionHome.class);
360       Session session = home.create();
361       int n = getIterationCount();
362       long start = System.currentTimeMillis();
363       for (int i = 0 ; i < n; i++)
364       {
365          session.sendReceiveChar(Character.MAX_VALUE);
366       }
367       long end = System.currentTimeMillis();
368       getLog().info("JRMP sendReceiveChar: " +
369                     ((end - start) / (double)n) + " ms/call");
370    }
371    
372    /**
373     * This tests the speed of IIOP sendReceiveChar invocations
374     *
375     * @exception Exception
376     */

377    public void testIIOPSendReceiveChar()
378       throws Exception JavaDoc
379    {
380       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
381             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
382             SessionHome.class);
383       Session session = home.create();
384       int n = getIterationCount();
385       long start = System.currentTimeMillis();
386       for (int i = 0 ; i < n; i++)
387       {
388          session.sendReceiveChar(Character.MAX_VALUE);
389       }
390       long end = System.currentTimeMillis();
391       getLog().info("IIOP sendReceiveChar: " +
392                     ((end - start) / (double)n) + " ms/call");
393    }
394    
395    /**
396     * This tests the speed of JRMP sendByte invocations
397     *
398     * @exception Exception
399     */

400    public void testJRMPSendByte()
401       throws Exception JavaDoc
402    {
403       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
404             getInitialContext().lookup(SessionHome.JNDI_NAME),
405             SessionHome.class);
406       Session session = home.create();
407       int n = getIterationCount();
408       long start = System.currentTimeMillis();
409       for (int i = 0 ; i < n; i++)
410       {
411          session.sendByte(Byte.MAX_VALUE);
412       }
413       long end = System.currentTimeMillis();
414       getLog().info("JRMP sendByte: " +
415                     ((end - start) / (double)n) + " ms/call");
416    }
417    
418    /**
419     * This tests the speed of IIOP sendByte invocations
420     *
421     * @exception Exception
422     */

423    public void testIIOPSendByte()
424       throws Exception JavaDoc
425    {
426       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
427             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
428             SessionHome.class);
429       Session session = home.create();
430       int n = getIterationCount();
431       long start = System.currentTimeMillis();
432       for (int i = 0 ; i < n; i++)
433       {
434          session.sendByte(Byte.MAX_VALUE);
435       }
436       long end = System.currentTimeMillis();
437       getLog().info("IIOP sendByte: " +
438                     ((end - start) / (double)n) + " ms/call");
439    }
440    
441    /**
442     * This tests the speed of JRMP receiveByte invocations
443     *
444     * @exception Exception
445     */

446    public void testJRMPReceiveByte()
447       throws Exception JavaDoc
448    {
449       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
450             getInitialContext().lookup(SessionHome.JNDI_NAME),
451             SessionHome.class);
452       Session session = home.create();
453       int n = getIterationCount();
454       long start = System.currentTimeMillis();
455       for (int i = 0 ; i < n; i++)
456       {
457          session.receiveByte();
458       }
459       long end = System.currentTimeMillis();
460       getLog().info("JRMP receiveByte: " +
461                     ((end - start) / (double)n) + " ms/call");
462    }
463    
464    /**
465     * This tests the speed of IIOP receiveByte invocations
466     *
467     * @exception Exception
468     */

469    public void testIIOPReceiveByte()
470       throws Exception JavaDoc
471    {
472       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
473             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
474             SessionHome.class);
475       Session session = home.create();
476       int n = getIterationCount();
477       long start = System.currentTimeMillis();
478       for (int i = 0 ; i < n; i++)
479       {
480          session.receiveByte();
481       }
482       long end = System.currentTimeMillis();
483       getLog().info("IIOP receiveByte: " +
484                     ((end - start) / (double)n) + " ms/call");
485    }
486    
487    /**
488     * This tests the speed of JRMP sendReceiveByte invocations
489     *
490     * @exception Exception
491     */

492    public void testJRMPSendReceiveByte()
493       throws Exception JavaDoc
494    {
495       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
496             getInitialContext().lookup(SessionHome.JNDI_NAME),
497             SessionHome.class);
498       Session session = home.create();
499       int n = getIterationCount();
500       long start = System.currentTimeMillis();
501       for (int i = 0 ; i < n; i++)
502       {
503          session.sendReceiveByte(Byte.MAX_VALUE);
504       }
505       long end = System.currentTimeMillis();
506       getLog().info("JRMP sendReceiveByte: " +
507                     ((end - start) / (double)n) + " ms/call");
508    }
509    
510    /**
511     * This tests the speed of IIOP sendReceiveByte invocations
512     *
513     * @exception Exception
514     */

515    public void testIIOPSendReceiveByte()
516       throws Exception JavaDoc
517    {
518       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
519             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
520             SessionHome.class);
521       Session session = home.create();
522       int n = getIterationCount();
523       long start = System.currentTimeMillis();
524       for (int i = 0 ; i < n; i++)
525       {
526          session.sendReceiveByte(Byte.MAX_VALUE);
527       }
528       long end = System.currentTimeMillis();
529       getLog().info("IIOP sendReceiveByte: " +
530                     ((end - start) / (double)n) + " ms/call");
531    }
532    
533    /**
534     * This tests the speed of JRMP sendChar invocations
535     *
536     * @exception Exception
537     */

538    public void testJRMPSendShort()
539       throws Exception JavaDoc
540    {
541       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
542             getInitialContext().lookup(SessionHome.JNDI_NAME),
543             SessionHome.class);
544       Session session = home.create();
545       int n = getIterationCount();
546       long start = System.currentTimeMillis();
547       for (int i = 0 ; i < n; i++)
548       {
549          session.sendShort(Short.MAX_VALUE);
550       }
551       long end = System.currentTimeMillis();
552       getLog().info("JRMP sendShort: " +
553                     ((end - start) / (double)n) + " ms/call");
554    }
555    
556    /**
557     * This tests the speed of IIOP sendShort invocations
558     *
559     * @exception Exception
560     */

561    public void testIIOPSendShort()
562       throws Exception JavaDoc
563    {
564       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
565             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
566             SessionHome.class);
567       Session session = home.create();
568       int n = getIterationCount();
569       long start = System.currentTimeMillis();
570       for (int i = 0 ; i < n; i++)
571       {
572          session.sendShort(Short.MAX_VALUE);
573       }
574       long end = System.currentTimeMillis();
575       getLog().info("IIOP sendShort: " +
576                     ((end - start) / (double)n) + " ms/call");
577    }
578    
579    /**
580     * This tests the speed of JRMP receiveShort invocations
581     *
582     * @exception Exception
583     */

584    public void testJRMPReceiveShort()
585       throws Exception JavaDoc
586    {
587       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
588             getInitialContext().lookup(SessionHome.JNDI_NAME),
589             SessionHome.class);
590       Session session = home.create();
591       int n = getIterationCount();
592       long start = System.currentTimeMillis();
593       for (int i = 0 ; i < n; i++)
594       {
595          session.receiveShort();
596       }
597       long end = System.currentTimeMillis();
598       getLog().info("JRMP receiveShort: " +
599                     ((end - start) / (double)n) + " ms/call");
600    }
601    
602    /**
603     * This tests the speed of IIOP receiveShort invocations
604     *
605     * @exception Exception
606     */

607    public void testIIOPReceiveShort()
608       throws Exception JavaDoc
609    {
610       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
611             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
612             SessionHome.class);
613       Session session = home.create();
614       int n = getIterationCount();
615       long start = System.currentTimeMillis();
616       for (int i = 0 ; i < n; i++)
617       {
618          session.receiveShort();
619       }
620       long end = System.currentTimeMillis();
621       getLog().info("IIOP receiveShort: " +
622                     ((end - start) / (double)n) + " ms/call");
623    }
624    
625    /**
626     * This tests the speed of JRMP sendReceiveShort invocations
627     *
628     * @exception Exception
629     */

630    public void testJRMPSendReceiveShort()
631       throws Exception JavaDoc
632    {
633       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
634             getInitialContext().lookup(SessionHome.JNDI_NAME),
635             SessionHome.class);
636       Session session = home.create();
637       int n = getIterationCount();
638       long start = System.currentTimeMillis();
639       for (int i = 0 ; i < n; i++)
640       {
641          session.sendReceiveShort(Short.MAX_VALUE);
642       }
643       long end = System.currentTimeMillis();
644       getLog().info("JRMP sendReceiveShort: " +
645                     ((end - start) / (double)n) + " ms/call");
646    }
647    
648    /**
649     * This tests the speed of IIOP sendReceiveShort invocations
650     *
651     * @exception Exception
652     */

653    public void testIIOPSendReceiveShort()
654       throws Exception JavaDoc
655    {
656       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
657             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
658             SessionHome.class);
659       Session session = home.create();
660       int n = getIterationCount();
661       long start = System.currentTimeMillis();
662       for (int i = 0 ; i < n; i++)
663       {
664          session.sendReceiveShort(Short.MAX_VALUE);
665       }
666       long end = System.currentTimeMillis();
667       getLog().info("IIOP sendReceiveShort: " +
668                     ((end - start) / (double)n) + " ms/call");
669    }
670    
671    /**
672     * This tests the speed of JRMP sendInt invocations
673     *
674     * @exception Exception
675     */

676    public void testJRMPSendInt()
677       throws Exception JavaDoc
678    {
679       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
680             getInitialContext().lookup(SessionHome.JNDI_NAME),
681             SessionHome.class);
682       Session session = home.create();
683       int n = getIterationCount();
684       long start = System.currentTimeMillis();
685       for (int i = 0 ; i < n; i++)
686       {
687          session.sendInt(Integer.MAX_VALUE);
688       }
689       long end = System.currentTimeMillis();
690       getLog().info("JRMP sendInt: " +
691                     ((end - start) / (double)n) + " ms/call");
692    }
693    
694    /**
695     * This tests the speed of IIOP sendInt invocations
696     *
697     * @exception Exception
698     */

699    public void testIIOPSendInt()
700       throws Exception JavaDoc
701    {
702       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
703             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
704             SessionHome.class);
705       Session session = home.create();
706       int n = getIterationCount();
707       long start = System.currentTimeMillis();
708       for (int i = 0 ; i < n; i++)
709       {
710          session.sendInt(Integer.MAX_VALUE);
711       }
712       long end = System.currentTimeMillis();
713       getLog().info("IIOP sendInt: " +
714                     ((end - start) / (double)n) + " ms/call");
715    }
716    
717    /**
718     * This tests the speed of JRMP receiveInt invocations
719     *
720     * @exception Exception
721     */

722    public void testJRMPReceiveInt()
723       throws Exception JavaDoc
724    {
725       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
726             getInitialContext().lookup(SessionHome.JNDI_NAME),
727             SessionHome.class);
728       Session session = home.create();
729       int n = getIterationCount();
730       long start = System.currentTimeMillis();
731       for (int i = 0 ; i < n; i++)
732       {
733          session.receiveInt();
734       }
735       long end = System.currentTimeMillis();
736       getLog().info("JRMP receiveInt: " +
737                     ((end - start) / (double)n) + " ms/call");
738    }
739    
740    /**
741     * This tests the speed of IIOP receiveInt invocations
742     *
743     * @exception Exception
744     */

745    public void testIIOPReceiveInt()
746       throws Exception JavaDoc
747    {
748       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
749             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
750             SessionHome.class);
751       Session session = home.create();
752       int n = getIterationCount();
753       long start = System.currentTimeMillis();
754       for (int i = 0 ; i < n; i++)
755       {
756          session.receiveInt();
757       }
758       long end = System.currentTimeMillis();
759       getLog().info("IIOP receiveInt: " +
760                     ((end - start) / (double)n) + " ms/call");
761    }
762    
763    /**
764     * This tests the speed of JRMP sendReceiveInt invocations
765     *
766     * @exception Exception
767     */

768    public void testJRMPSendReceiveInt()
769       throws Exception JavaDoc
770    {
771       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
772             getInitialContext().lookup(SessionHome.JNDI_NAME),
773             SessionHome.class);
774       Session session = home.create();
775       int n = getIterationCount();
776       long start = System.currentTimeMillis();
777       for (int i = 0 ; i < n; i++)
778       {
779          session.sendReceiveInt(Integer.MAX_VALUE);
780       }
781       long end = System.currentTimeMillis();
782       getLog().info("JRMP sendReceiveInt: " +
783                     ((end - start) / (double)n) + " ms/call");
784    }
785    
786    /**
787     * This tests the speed of IIOP sendReceiveInt invocations
788     *
789     * @exception Exception
790     */

791    public void testIIOPSendReceiveInt()
792       throws Exception JavaDoc
793    {
794       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
795             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
796             SessionHome.class);
797       Session session = home.create();
798       int n = getIterationCount();
799       long start = System.currentTimeMillis();
800       for (int i = 0 ; i < n; i++)
801       {
802          session.sendReceiveInt(Integer.MAX_VALUE);
803       }
804       long end = System.currentTimeMillis();
805       getLog().info("IIOP sendReceiveInt: " +
806                     ((end - start) / (double)n) + " ms/call");
807    }
808    
809    /**
810     * This tests the speed of JRMP sendLong invocations
811     *
812     * @exception Exception
813     */

814    public void testJRMPSendLong()
815       throws Exception JavaDoc
816    {
817       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
818             getInitialContext().lookup(SessionHome.JNDI_NAME),
819             SessionHome.class);
820       Session session = home.create();
821       int n = getIterationCount();
822       long start = System.currentTimeMillis();
823       for (int i = 0 ; i < n; i++)
824       {
825          session.sendLong(Long.MAX_VALUE);
826       }
827       long end = System.currentTimeMillis();
828       getLog().info("JRMP sendLong: " +
829                     ((end - start) / (double)n) + " ms/call");
830    }
831    
832    /**
833     * This tests the speed of IIOP sendLong invocations
834     *
835     * @exception Exception
836     */

837    public void testIIOPSendLong()
838       throws Exception JavaDoc
839    {
840       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
841             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
842             SessionHome.class);
843       Session session = home.create();
844       int n = getIterationCount();
845       long start = System.currentTimeMillis();
846       for (int i = 0 ; i < n; i++)
847       {
848          session.sendLong(Long.MAX_VALUE);
849       }
850       long end = System.currentTimeMillis();
851       getLog().info("IIOP sendLong: " +
852                     ((end - start) / (double)n) + " ms/call");
853    }
854    
855    /**
856     * This tests the speed of JRMP receiveLong invocations
857     *
858     * @exception Exception
859     */

860    public void testJRMPReceiveLong()
861       throws Exception JavaDoc
862    {
863       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
864             getInitialContext().lookup(SessionHome.JNDI_NAME),
865             SessionHome.class);
866       Session session = home.create();
867       int n = getIterationCount();
868       long start = System.currentTimeMillis();
869       for (int i = 0 ; i < n; i++)
870       {
871          session.receiveLong();
872       }
873       long end = System.currentTimeMillis();
874       getLog().info("JRMP receiveLong: " +
875                     ((end - start) / (double)n) + " ms/call");
876    }
877    
878    /**
879     * This tests the speed of IIOP receiveLong invocations
880     *
881     * @exception Exception
882     */

883    public void testIIOPReceiveLong()
884       throws Exception JavaDoc
885    {
886       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
887             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
888             SessionHome.class);
889       Session session = home.create();
890       int n = getIterationCount();
891       long start = System.currentTimeMillis();
892       for (int i = 0 ; i < n; i++)
893       {
894          session.receiveLong();
895       }
896       long end = System.currentTimeMillis();
897       getLog().info("IIOP receiveLong: " +
898                     ((end - start) / (double)n) + " ms/call");
899    }
900    
901    /**
902     * This tests the speed of JRMP sendReceiveLong invocations
903     *
904     * @exception Exception
905     */

906    public void testJRMPSendReceiveLong()
907       throws Exception JavaDoc
908    {
909       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
910             getInitialContext().lookup(SessionHome.JNDI_NAME),
911             SessionHome.class);
912       Session session = home.create();
913       int n = getIterationCount();
914       long start = System.currentTimeMillis();
915       for (int i = 0 ; i < n; i++)
916       {
917          session.sendReceiveLong(Long.MAX_VALUE);
918       }
919       long end = System.currentTimeMillis();
920       getLog().info("JRMP sendReceiveLong: " +
921                     ((end - start) / (double)n) + " ms/call");
922    }
923    
924    /**
925     * This tests the speed of IIOP sendReceiveLong invocations
926     *
927     * @exception Exception
928     */

929    public void testIIOPSendReceiveLong()
930       throws Exception JavaDoc
931    {
932       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
933             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
934             SessionHome.class);
935       Session session = home.create();
936       int n = getIterationCount();
937       long start = System.currentTimeMillis();
938       for (int i = 0 ; i < n; i++)
939       {
940          session.sendReceiveLong(Long.MAX_VALUE);
941       }
942       long end = System.currentTimeMillis();
943       getLog().info("IIOP sendReceiveLong: " +
944                     ((end - start) / (double)n) + " ms/call");
945    }
946    
947    /**
948     * This tests the speed of JRMP sendFloat invocations
949     *
950     * @exception Exception
951     */

952    public void testJRMPSendFloat()
953       throws Exception JavaDoc
954    {
955       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
956             getInitialContext().lookup(SessionHome.JNDI_NAME),
957             SessionHome.class);
958       Session session = home.create();
959       int n = getIterationCount();
960       long start = System.currentTimeMillis();
961       for (int i = 0 ; i < n; i++)
962       {
963          session.sendFloat(Float.MAX_VALUE);
964       }
965       long end = System.currentTimeMillis();
966       getLog().info("JRMP sendFloat: " +
967                     ((end - start) / (double)n) + " ms/call");
968    }
969    
970    /**
971     * This tests the speed of IIOP sendFloat invocations
972     *
973     * @exception Exception
974     */

975    public void testIIOPSendFloat()
976       throws Exception JavaDoc
977    {
978       SessionHome home = (SessionHome)PortableRemoteObject.narrow(
979             getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
980             SessionHome.class);
981       Session session = home.create();
982       int n = getIterationCount();
983       long start = System.currentTimeMillis();
984       for (int i = 0 ; i < n; i++)
985       {
986          session.sendFloat(Float.MAX_VALUE);
987       }
988       long end = System.currentTimeMillis();
989       getLog().info("IIOP sendFloat: " +
990                     ((end - start) / (double)n) + " ms/call");
991    }
992    
993    /**
994     * This tests the speed of JRMP receiveFloat invocations
995     *
996     * @exception Exception
997     */

998    public void testJRMPReceiveFloat()
999       throws Exception JavaDoc
1000   {
1001      SessionHome home = (SessionHome)PortableRemoteObject.narrow(
1002            getInitialContext().lookup(SessionHome.JNDI_NAME),
1003            SessionHome.class);
1004      Session session = home.create();
1005      int n = getIterationCount();
1006      long start = System.currentTimeMillis();
1007      for (int i = 0 ; i < n; i++)
1008      {
1009         session.receiveFloat();
1010      }
1011      long end = System.currentTimeMillis();
1012      getLog().info("JRMP receiveFloat: " +
1013                    ((end - start) / (double)n) + " ms/call");
1014   }
1015   
1016   /**
1017    * This tests the speed of IIOP receiveFloat invocations
1018    *
1019    * @exception Exception
1020    */

1021   public void testIIOPReceiveFloat()
1022      throws Exception JavaDoc
1023   {
1024      SessionHome home = (SessionHome)PortableRemoteObject.narrow(
1025            getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
1026            SessionHome.class);
1027      Session session = home.create();
1028      int n = getIterationCount();
1029      long start = System.currentTimeMillis();
1030      for (int i = 0 ; i < n; i++)
1031      {
1032         session.receiveFloat();
1033      }
1034      long end = System.currentTimeMillis();
1035      getLog().info("IIOP receiveFloat: " +
1036                    ((end - start) / (double)n) + " ms/call");
1037   }
1038   
1039   /**
1040    * This tests the speed of JRMP sendReceiveFloat invocations
1041    *
1042    * @exception Exception
1043    */

1044   public void testJRMPSendReceiveFloat()
1045      throws Exception JavaDoc
1046   {
1047      SessionHome home = (SessionHome)PortableRemoteObject.narrow(
1048            getInitialContext().lookup(SessionHome.JNDI_NAME),
1049            SessionHome.class);
1050      Session session = home.create();
1051      int n = getIterationCount();
1052      long start = System.currentTimeMillis();
1053      for (int i = 0 ; i < n; i++)
1054      {
1055         session.sendReceiveFloat(Float.MAX_VALUE);
1056      }
1057      long end = System.currentTimeMillis();
1058      getLog().info("JRMP sendReceiveFloat: " +
1059                    ((end - start) / (double)n) + " ms/call");
1060   }
1061   
1062   /**
1063    * This tests the speed of IIOP sendReceiveFloat invocations
1064    *
1065    * @exception Exception
1066    */

1067   public void testIIOPSendReceiveFloat()
1068      throws Exception JavaDoc
1069   {
1070      SessionHome home = (SessionHome)PortableRemoteObject.narrow(
1071            getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
1072            SessionHome.class);
1073      Session session = home.create();
1074      int n = getIterationCount();
1075      long start = System.currentTimeMillis();
1076      for (int i = 0 ; i < n; i++)
1077      {
1078         session.sendReceiveFloat(Float.MAX_VALUE);
1079      }
1080      long end = System.currentTimeMillis();
1081      getLog().info("IIOP sendReceiveFloat: " +
1082                    ((end - start) / (double)n) + " ms/call");
1083   }
1084   
1085   /**
1086    * This tests the speed of JRMP sendDouble invocations
1087    *
1088    * @exception Exception
1089    */

1090   public void testJRMPSendDouble()
1091      throws Exception JavaDoc
1092   {
1093      SessionHome home = (SessionHome)PortableRemoteObject.narrow(
1094            getInitialContext().lookup(SessionHome.JNDI_NAME),
1095            SessionHome.class);
1096      Session session = home.create();
1097      int n = getIterationCount();
1098      long start = System.currentTimeMillis();
1099      for (int i = 0 ; i < n; i++)
1100      {
1101         session.sendDouble(Double.MAX_VALUE);
1102      }
1103      long end = System.currentTimeMillis();
1104      getLog().info("JRMP sendDouble: " +
1105                    ((end - start) / (double)n) + " ms/call");
1106   }
1107   
1108   /**
1109    * This tests the speed of IIOP sendDouble invocations
1110    *
1111    * @exception Exception
1112    */

1113   public void testIIOPSendDouble()
1114      throws Exception JavaDoc
1115   {
1116      SessionHome home = (SessionHome)PortableRemoteObject.narrow(
1117            getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
1118            SessionHome.class);
1119      Session session = home.create();
1120      int n = getIterationCount();
1121      long start = System.currentTimeMillis();
1122      for (int i = 0 ; i < n; i++)
1123      {
1124         session.sendDouble(Double.MAX_VALUE);
1125      }
1126      long end = System.currentTimeMillis();
1127      getLog().info("IIOP sendDouble: " +
1128                    ((end - start) / (double)n) + " ms/call");
1129   }
1130   
1131   /**
1132    * This tests the speed of JRMP receiveDouble invocations
1133    *
1134    * @exception Exception
1135    */

1136   public void testJRMPReceiveDouble()
1137      throws Exception JavaDoc
1138   {
1139      SessionHome home = (SessionHome)PortableRemoteObject.narrow(
1140            getInitialContext().lookup(SessionHome.JNDI_NAME),
1141            SessionHome.class);
1142      Session session = home.create();
1143      int n = getIterationCount();
1144      long start = System.currentTimeMillis();
1145      for (int i = 0 ; i < n; i++)
1146      {
1147         session.receiveDouble();
1148      }
1149      long end = System.currentTimeMillis();
1150      getLog().info("JRMP receiveDouble: " +
1151                    ((end - start) / (double)n) + " ms/call");
1152   }
1153   
1154   /**
1155    * This tests the speed of IIOP receiveDouble invocations
1156    *
1157    * @exception Exception
1158    */

1159   public void testIIOPReceiveDouble()
1160      throws Exception JavaDoc
1161   {
1162      SessionHome home = (SessionHome)PortableRemoteObject.narrow(
1163            getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
1164            SessionHome.class);
1165      Session session = home.create();
1166      int n = getIterationCount();
1167      long start = System.currentTimeMillis();
1168      for (int i = 0 ; i < n; i++)
1169      {
1170         session.receiveDouble();
1171      }
1172      long end = System.currentTimeMillis();
1173      getLog().info("IIOP receiveDouble: " +
1174                    ((end - start) / (double)n) + " ms/call");
1175   }
1176   
1177   /**
1178    * This tests the speed of JRMP sendReceiveDouble invocations
1179    *
1180    * @exception Exception
1181    */

1182   public void testJRMPSendReceiveDouble()
1183      throws Exception JavaDoc
1184   {
1185      SessionHome home = (SessionHome)PortableRemoteObject.narrow(
1186            getInitialContext().lookup(SessionHome.JNDI_NAME),
1187            SessionHome.class);
1188      Session session = home.create();
1189      int n = getIterationCount();
1190      long start = System.currentTimeMillis();
1191      for (int i = 0 ; i < n; i++)
1192      {
1193         session.sendReceiveDouble(Double.MAX_VALUE);
1194      }
1195      long end = System.currentTimeMillis();
1196      getLog().info("JRMP sendReceiveDouble: " +
1197                    ((end - start) / (double)n) + " ms/call");
1198   }
1199   
1200   /**
1201    * This tests the speed of IIOP sendReceiveDouble invocations
1202    *
1203    * @exception Exception
1204    */

1205   public void testIIOPSendReceiveDouble()
1206      throws Exception JavaDoc
1207   {
1208      SessionHome home = (SessionHome)PortableRemoteObject.narrow(
1209            getInitialContext(cosnamingJndiProps).lookup(SessionHome.JNDI_NAME),
1210            SessionHome.class);
1211      Session session = home.create();
1212      int n = getIterationCount();
1213      long start = System.currentTimeMillis();
1214      for (int i = 0 ; i < n; i++)
1215      {
1216         session.sendReceiveDouble(Double.MAX_VALUE);
1217      }
1218      long end = System.currentTimeMillis();
1219      getLog().info("IIOP sendReceiveDouble: " +
1220                    ((end - start) / (double)n) + " ms/call");
1221   }
1222   
1223   public static Test suite() throws Exception JavaDoc
1224   {
1225      return getDeploySetup(T0PassBasicTypesTestCase.class, "iiopperf.jar");
1226   }
1227
1228}
1229
Popular Tags