2 #include "ace/Get_Opt.h"
3 #include "tao/PortableInterceptorC.h"
4 #include "ClientORBInitializer.h"
5 #include "tao/ORBInitializer_Registry.h"
6 #include "tao/Strategies/advanced_resource.h"
7 #include "tao/Strategies/OC_Endpoint_Selector_Loader.h"
9 const ACE_TCHAR
*ior
= ACE_TEXT ("file://test.ior");
12 parse_args (int argc
, ACE_TCHAR
*argv
[])
14 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
17 while ((c
= get_opts ()) != -1)
21 ior
= get_opts
.opt_arg ();
26 ACE_ERROR_RETURN ((LM_ERROR
,
33 // Indicates successful parsing of the command line
38 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
43 PortableInterceptor::ORBInitializer_ptr temp_orb_initializer
=
44 PortableInterceptor::ORBInitializer::_nil ();
45 PortableInterceptor::ORBInitializer_var orb_initializer
;
47 // Register the ClientRequest_Interceptor ORBInitializer.
48 ACE_NEW_RETURN (temp_orb_initializer
,
52 orb_initializer
= temp_orb_initializer
;
54 PortableInterceptor::register_orb_initializer (orb_initializer
.in ());
56 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
58 if (parse_args (argc
, argv
) != 0)
61 CORBA::Object_var tmp
=
62 orb
->string_to_object (ior
);
64 Test::Hello_var hello
=
65 Test::Hello::_narrow(tmp
.in ());
67 if (CORBA::is_nil (hello
.in ()))
69 ACE_ERROR_RETURN ((LM_DEBUG
,
70 "Nil Test::Hello reference <%s>\n",
75 ACE_DEBUG ((LM_DEBUG
, "Client about to make method call that is doomed to failure...\n"));
77 bool call_failed
= false;
80 CORBA::String_var the_string
=
83 catch (const CORBA::Exception
&)
91 "Error - the remote call succeeded which is bloody miraculous given that no server is running !!\n"));
95 if (ClientRequest_Interceptor::success_flag_
)
97 ACE_DEBUG ((LM_DEBUG
, "Success - the server was unreachable and PI receive_exception was invoked.\n"));
101 ACE_ERROR ((LM_DEBUG
,
102 "Error: regression failed - interceptor receive_exception interception point was not invoked !!\n"));
108 catch (const CORBA::Exception
& ex
)
110 ex
._tao_print_exception ("Exception caught:");