2 #include "ace/Get_Opt.h"
3 #include "ace/OS_NS_unistd.h"
5 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
9 parse_args (int argc
, ACE_TCHAR
*argv
[])
11 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:i:"));
14 while ((c
= get_opts ()) != -1)
18 ior
= get_opts
.opt_arg ();
22 iterations
= ACE_OS::atoi (get_opts
.opt_arg ());
27 ACE_ERROR_RETURN ((LM_ERROR
,
35 // Indicates successful parsing of the command line
40 single_iteration (Test::Oneway_Receiver_ptr oneway_receiver
)
44 oneway_receiver
->receive_oneway ();
45 ACE_Time_Value
tv (0, 40000);
48 catch (const CORBA::Exception
&)
56 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
61 CORBA::ORB_init (argc
, argv
);
63 if (parse_args (argc
, argv
) != 0)
66 CORBA::Object_var tmp
=
67 orb
->string_to_object(ior
);
69 Test::Oneway_Receiver_var oneway_receiver
=
70 Test::Oneway_Receiver::_narrow(tmp
.in ());
72 if (CORBA::is_nil (oneway_receiver
.in ()))
74 ACE_ERROR_RETURN ((LM_DEBUG
,
75 "Nil process reference <%s>\n",
81 int exception_count
= 0;
82 for (int i
= 0; i
!= iterations
; ++i
)
84 int result
= single_iteration (oneway_receiver
.in ());
91 ACE_DEBUG ((LM_DEBUG
, "Finished iteration %d\n", i
));
93 // Lets not waste any more time than we have to
94 if (exception_count
> 10 && normal_count
> 0)
98 if (exception_count
== 0)
99 ACE_ERROR ((LM_ERROR
, "ERROR: no exceptions detected\n"));
101 if (normal_count
== 0)
102 ACE_ERROR ((LM_ERROR
, "ERROR: no request was succesful\n"));
106 catch (const CORBA::Exception
& ex
)
108 ex
._tao_print_exception ("Exception caught:");