1 #include "ace/SString.h"
2 #include "ace/Get_Opt.h"
3 #include "ace/OS_NS_unistd.h"
6 const ACE_TCHAR
*ior_input_file
= 0;
9 parse_args (int argc
, ACE_TCHAR
*argv
[])
11 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("o:"));
14 while ((c
= get_opts ()) != -1)
18 ior_input_file
= get_opts
.opt_arg ();
22 ACE_ERROR_RETURN ((LM_ERROR
,
29 // Indicates successful parsing of the command line
34 run_test (Simple_Server_ptr server
);
37 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
42 CORBA::ORB_init (argc
, argv
);
44 if (parse_args (argc
, argv
) == -1)
47 CORBA::Object_var objref
=
48 orb
->string_to_object (ior_input_file
);
50 if (objref
.in () == 0)
52 //FUZZ: disable check_for_NULL
53 ACE_ERROR_RETURN ((LM_ERROR
,
54 "The received objref is NULL\n"),
56 //FUZZ: enable check_for_NULL
59 Simple_Server_var server
=
60 Simple_Server::_narrow (objref
.in ());
62 if (CORBA::is_nil (server
.in ()))
64 ACE_ERROR_RETURN ((LM_ERROR
,
65 "Object reference is nil\n"),
69 run_test (server
.in ());
71 catch (const CORBA::Exception
& ex
)
73 ex
._tao_print_exception ("Caught an exception\n");
79 void run_test (Simple_Server_ptr server
)
81 for (int loop
= 0; loop
< 10; loop
++)
86 "About to make remote call\n"));
90 server
->remote_call ();
92 /*ACE_DEBUG ((LM_DEBUG,
93 "Kill the primary . . . "));
95 ACE_DEBUG ((LM_DEBUG, " hope you did\n")); */
97 "I am going to shutdown\n"));
101 catch (const CORBA::UserException
& x
)
103 x
._tao_print_exception ("Caught an ");
105 catch (const CORBA::TRANSIENT
& t
)
107 t
._tao_print_exception ("Caught Exception");
109 catch (const CORBA::COMM_FAILURE
& f
)
111 f
._tao_print_exception ("A (sort of) expected COMM_FAILURE");
112 ACE_DEBUG ((LM_DEBUG
,
113 "Automagically re-issuing request on COMM_FAILURE\n"));
115 catch (const CORBA::Exception
& ex
)
117 ex
._tao_print_exception ("Unexpected exception");