3 #include "ace/Get_Opt.h"
6 const ACE_TCHAR
*ior
= ACE_TEXT("file://gateway.ior");
9 int test_user_exception
= 0;
10 int test_system_exception
= 0;
13 parse_args (int argc
, ACE_TCHAR
*argv
[])
15 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("xusk:i:"));
18 while ((c
= get_opts ()) != -1)
26 test_user_exception
= 1;
30 test_system_exception
= 1;
34 ior
= get_opts
.opt_arg ();
38 niterations
= ACE_OS::atoi (get_opts
.opt_arg ());
43 ACE_ERROR_RETURN ((LM_ERROR
,
55 // Indicates successful parsing of the command line
60 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
65 CORBA::ORB_init (argc
, argv
);
67 if (parse_args (argc
, argv
) != 0)
72 CORBA::Object_var object
=
73 orb
->string_to_object (ior
);
75 Simple_Server_var server
=
76 Simple_Server::_narrow (object
.in ());
78 if (CORBA::is_nil (server
.in ()))
80 ACE_ERROR_RETURN ((LM_ERROR
,
81 "Object reference <%s> is nil.\n",
86 Structure the_in_structure
;
87 the_in_structure
.seq
.length (10);
89 if (test_user_exception
== 1)
91 server
->raise_user_exception ();
93 else if (test_system_exception
== 1)
95 server
->raise_system_exception ();
99 for (int i
= 0; i
!= niterations
; ++i
)
101 CORBA::Long
const tv
= i
+ 100;
102 server
->test_val(tv
);
103 CORBA::Long
const rtv
= server
->test_val ();
105 if (TAO_debug_level
> 0)
107 ACE_DEBUG ((LM_DEBUG
,
108 "DSI_Simpler_Server ==== Expected result = %d for %d\n",
114 ACE_ERROR ((LM_ERROR
,
115 "(%P|%t) ERROR: unexpected result = %d for %d\n",
119 the_in_structure
.i
= i
;
120 CORBA::String_var name
= CORBA::string_dup ("the name");
122 Structure_var the_out_structure
;
124 CORBA::Long
const r
=
125 server
->test_method (i
,
127 the_out_structure
.out (),
130 if (TAO_debug_level
> 0)
132 ACE_DEBUG ((LM_DEBUG
,
133 "DSI_Simpler_Server ====\n"
139 the_out_structure
->i
,
140 the_out_structure
->seq
.length (),
146 ACE_ERROR ((LM_ERROR
,
147 "(%P|%t) ERROR: unexpected result = %d for %d",
158 catch (const test_exception
& ex
)
160 if (test_user_exception
== 1)
161 ACE_DEBUG ((LM_DEBUG
,
162 "Client: caught expected user exception: %C\n",
165 ex
._tao_print_exception ("Client: exception caught - ");
167 ACE_DEBUG ((LM_DEBUG
,
172 ex
.error_message
.in (),
173 ex
.status_message
.in ()));
175 return test_user_exception
== 1 ? 0 : 1;
177 catch (const CORBA::NO_PERMISSION
& ex
)
179 if (test_system_exception
== 1)
180 ACE_DEBUG ((LM_DEBUG
,
181 "Client: caught expected system exception: %C\n",
184 ex
._tao_print_exception ("Client: exception caught - ");
186 return test_system_exception
== 1 ? 0 : 1;
188 catch (const CORBA::Exception
& ex
)
190 ex
._tao_print_exception ("Client: exception caught - ");