/[classpath]/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java
ViewVC logotype

Diff of /classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.2 by gnu_andrew, Sun Jun 5 19:36:36 2005 UTC revision 1.1.2.3 by gnu_andrew, Wed Nov 2 00:43:21 2005 UTC
# Line 1  Line 1 
1    /* RequestTest.java --
2     Copyright (C) 2005 Free Software Foundation, Inc.
3    
4     This file is part of GNU Classpath.
5    
6     GNU Classpath is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2, or (at your option)
9     any later version.
10    
11     GNU Classpath is distributed in the hope that it will be useful, but
12     WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14     General Public License for more details.
15    
16     You should have received a copy of the GNU General Public License
17     along with GNU Classpath; see the file COPYING.  If not, write to the
18     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19     02110-1301 USA.
20    
21     Linking this library statically or dynamically with other modules is
22     making a combined work based on this library.  Thus, the terms and
23     conditions of the GNU General Public License cover the whole
24     combination.
25    
26     As a special exception, the copyright holders of this library give you
27     permission to link this library with independent modules to produce an
28     executable, regardless of the license terms of these independent
29     modules, and to copy and distribute the resulting executable under
30     terms of your choice, provided that you also meet, for each linked
31     independent module, the terms and conditions of the license of that
32     module.  An independent module is a module which is not derived from
33     or based on this library.  If you modify this library, you may extend
34     this exception to your version of the library, but you are not
35     obligated to do so.  If you do not wish to do so, delete this
36     exception statement from your version. */
37    
38    
39  package gnu.classpath.examples.CORBA.SimpleCommunication.communication;  package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
# Line 7  import java.io.FileReader; Line 43  import java.io.FileReader;
43  import java.io.IOException;  import java.io.IOException;
44    
45  import org.omg.CORBA.BAD_OPERATION;  import org.omg.CORBA.BAD_OPERATION;
 import org.omg.CORBA.ByteHolder;  
 import org.omg.CORBA.DoubleHolder;  
46  import org.omg.CORBA.ExceptionList;  import org.omg.CORBA.ExceptionList;
47  import org.omg.CORBA.NVList;  import org.omg.CORBA.NVList;
48  import org.omg.CORBA.ORB;  import org.omg.CORBA.ORB;
49  import org.omg.CORBA.Request;  import org.omg.CORBA.Request;
 import org.omg.CORBA.ShortHolder;  
 import org.omg.CORBA.StringHolder;  
50  import org.omg.CORBA.TCKind;  import org.omg.CORBA.TCKind;
51  import org.omg.CORBA.UnknownUserException;  import org.omg.CORBA.UnknownUserException;
52    
# Line 25  import org.omg.CORBA.UnknownUserExceptio Line 57  import org.omg.CORBA.UnknownUserExceptio
57   * where the program has been started.   * where the program has been started.
58   *   *
59   * The IOR.txt file is written by the server   * The IOR.txt file is written by the server
60   * {@link gnu.classpath.examples.CORBA.SimpleCommunication.comServer}.   * {@link gnu.classpath.examples.CORBA.SimpleCommunication.DemoServer}.
61   * The server should be reachable over Internet, unless blocked by   * The server should be reachable over Internet, unless blocked by
62   * security tools.   * security tools.
63   *   *
# Line 106  public class RequestTest Line 138  public class RequestTest
138          throw new InternalError();          throw new InternalError();
139        }        }
140      testSystemException();      testSystemException();
     testUserException();  
141      testWideNarrowStrings();      testWideNarrowStrings();
142    }    }
143    
# Line 135  public class RequestTest Line 166  public class RequestTest
166      Request r =      Request r =
167        object._create_request(null, "passSimple", orb.create_list(0), null);        object._create_request(null, "passSimple", orb.create_list(0), null);
168    
     ByteHolder a_byte = new ByteHolder((byte) 0);  
     ShortHolder a_short = new ShortHolder((short) 3);  
     StringHolder a_string = new StringHolder("[string 4]");  
   
     // This is an 'out' parameter; the value must not be passed to servant.  
     DoubleHolder a_double = new DoubleHolder(56.789);  
   
169      r.add_inout_arg().insert_octet((byte) 0);      r.add_inout_arg().insert_octet((byte) 0);
170      r.add_in_arg().insert_long(2);      r.add_in_arg().insert_long(2);
171      r.add_inout_arg().insert_short((short) 3);      r.add_inout_arg().insert_short((short) 3);
# Line 188  public class RequestTest Line 212  public class RequestTest
212      try      try
213        {        {
214          ExceptionList exList = orb.create_exception_list();          ExceptionList exList = orb.create_exception_list();
215          exList.add(ourUserExceptionHelper.type());          exList.add(WeThrowThisExceptionHelper.type());
216    
217          Request rq =          Request rq =
218            object._create_request(null, "throwException", orb.create_list(1),            object._create_request(null, "throwException", orb.create_list(1),
# Line 217  public class RequestTest Line 241  public class RequestTest
241      System.out.println("**** Test user exception:");      System.out.println("**** Test user exception:");
242    
243      ExceptionList exList = orb.create_exception_list();      ExceptionList exList = orb.create_exception_list();
244      exList.add(ourUserExceptionHelper.type());      exList.add(WeThrowThisExceptionHelper.type());
245    
246      Request rq =      Request rq =
247        object._create_request(null, "throwException", orb.create_list(1), null,        object._create_request(null, "throwException", orb.create_list(1), null,
# Line 228  public class RequestTest Line 252  public class RequestTest
252      rq.invoke();      rq.invoke();
253    
254      UnknownUserException uku = (UnknownUserException) rq.env().exception();      UnknownUserException uku = (UnknownUserException) rq.env().exception();
255      ourUserException our_exception = ourUserExceptionHelper.extract(uku.except);      WeThrowThisException our_exception = WeThrowThisExceptionHelper.extract(uku.except);
256    
257      System.out.println("  Our user exception, field " + our_exception.ourField +      System.out.println("  Our user exception, field " + our_exception.ourField +
258                         ", has been thrown on remote side."                         ", has been thrown on remote side."

Legend:
Removed from v.1.1.2.2  
changed lines
  Added in v.1.1.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26