2 #include "ace/Get_Opt.h"
3 #include "ace/OS_NS_unistd.h"
5 #include "Client_ORBInitializer.h"
6 #include "tao/ORBInitializer_Registry.h"
8 const ACE_TCHAR
*ior1
= 0;
9 bool interceptor_invoked
= false;
12 parse_args (int argc
, ACE_TCHAR
*argv
[])
14 if (argc
!= 3) // foo -p IOR_1
15 ACE_ERROR_RETURN ((LM_ERROR
,
16 "Wrong number of arguments.\n"),
19 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("p:"));
22 while ((c
= get_opts ()) != -1)
26 ior1
= get_opts
.opt_arg ();
29 ACE_ERROR_RETURN ((LM_ERROR
,
40 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
46 #if TAO_HAS_INTERCEPTORS == 1
47 PortableInterceptor::ORBInitializer_ptr temp_initializer
=
48 PortableInterceptor::ORBInitializer::_nil ();
50 ACE_NEW_RETURN (temp_initializer
,
51 Client_ORBInitializer
,
52 -1); // No exceptions yet!
53 PortableInterceptor::ORBInitializer_var orb_initializer
=
56 PortableInterceptor::register_orb_initializer (orb_initializer
.in ());
57 #endif /* TAO_HAS_INTERCEPTORS == 1 */
59 CORBA::ORB_var orb
= CORBA::ORB_init (argc
,
63 if (::parse_args (argc
, argv
) != 0)
66 CORBA::Object_var object
=
67 orb
->string_to_object (ior1
);
69 RTTest::test_var server
=
70 RTTest::test::_narrow (object
.in ());
72 if (CORBA::is_nil (server
.in ()))
74 ACE_ERROR_RETURN ((LM_ERROR
,
75 "Object reference <%s> is nil.\n",
80 CORBA::Short number
= 0;
81 for (int i
= 1; i
<= 2; ++i
)
84 "CLIENT: Issuing request %d.\n",
87 number
= server
->number ();
90 "CLIENT: Request %d handled by object %d.\n",
98 catch (const CORBA::Exception
& ex
)
100 if (!interceptor_invoked
)
102 ex
._tao_print_exception ("Caught exception:");
109 "PortableInterceptor::Redirection test passed.\n"));