KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > test > orb > LongLongSeq


1 package org.jacorb.test.orb;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2001 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */

22
23 import junit.framework.*;
24 import junit.extensions.*;
25 import java.io.*;
26 import org.omg.CORBA.*;
27 import org.jacorb.test.common.*;
28 import org.jacorb.util.*;
29 import org.jacorb.test.*;
30 import org.jacorb.test.LongLongSeqServerPackage.*;
31
32 public class LongLongSeq extends ClientServerTestCase
33 {
34     private LongLongSeqServer server;
35
36     private static void test( long[] arg )
37     {
38         assertEquals( arg[0], Long.MIN_VALUE );
39         assertEquals( arg[1], Long.MIN_VALUE );
40     }
41
42     public LongLongSeq(String JavaDoc name, ClientServerSetup setup)
43     {
44         super(name, setup);
45     }
46
47     public void setUp() throws Exception JavaDoc
48     {
49         server = LongLongSeqServerHelper.narrow( setup.getServerObject() );
50     }
51
52     public static Test suite()
53     {
54         TestSuite suite = new TestSuite
55             ( "Client/server longlongseq tests" );
56         ClientServerSetup setup = new ClientServerSetup
57             ( suite, "org.jacorb.test.orb.LongLongSeqServerImpl" );
58
59         suite.addTest( new LongLongSeq( "test_longlong", setup ) );
60
61         return setup;
62     }
63
64     public void test_longlong()
65     {
66         long[] l = new long[]{ Long.MIN_VALUE, Long.MIN_VALUE };
67
68         SeqLongLongHolder h_out = new SeqLongLongHolder();
69         SeqLongLongHolder h_inout = new SeqLongLongHolder();
70
71         h_inout.value = l;
72
73         try
74         {
75             for( int i = 0; i < 1000; i++ )
76             {
77                 test( server.test1( l, h_out, h_inout ));
78                 test( h_out.value );
79                 test( h_inout.value );
80
81                 test( server.test2( l, h_out ));
82                 test( h_out.value );
83
84                 server.test3( h_inout );
85                 test( h_inout.value );
86             }
87         }
88         catch( Exception JavaDoc e )
89         {
90             fail( "unexpected exception: " + e );
91         }
92     }
93 }
94
Popular Tags