2 #include "ace/Get_Opt.h"
4 #include "Client_ORBInitializer.h"
5 #include "tao/ORBInitializer_Registry.h"
7 const ACE_TCHAR
*ior1
= 0;
8 const ACE_TCHAR
*ior2
= 0;
9 const ACE_TCHAR
*ior3
= 0;
12 parse_args (int argc
, ACE_TCHAR
*argv
[])
14 if (argc
!= 7) // foo -p IOR_1 -f IOR_2 -s IOR_3
15 ACE_ERROR_RETURN ((LM_ERROR
,
16 "Wrong number of arguments.\n"),
19 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("p:f:s:"));
22 while ((c
= get_opts ()) != -1)
26 ior1
= get_opts
.opt_arg ();
29 ior2
= get_opts
.opt_arg ();
32 ior3
= get_opts
.opt_arg ();
35 ACE_ERROR_RETURN ((LM_ERROR
,
37 "-p IOR_1 -f IOR_2 -s IOR_3\n",
46 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
52 #if TAO_HAS_INTERCEPTORS == 1
53 PortableInterceptor::ORBInitializer_ptr temp_initializer
=
54 PortableInterceptor::ORBInitializer::_nil ();
56 ACE_NEW_RETURN (temp_initializer
,
57 Client_ORBInitializer
,
58 -1); // No exceptions yet!
59 PortableInterceptor::ORBInitializer_var orb_initializer
=
62 PortableInterceptor::register_orb_initializer (orb_initializer
.in ());
63 #endif /* TAO_HAS_INTERCEPTORS == 1 */
65 CORBA::ORB_var orb
= CORBA::ORB_init (argc
,
69 if (::parse_args (argc
, argv
) != 0)
72 CORBA::Object_var object
=
73 orb
->string_to_object (ior1
);
75 RedirectionTest::test_var server
=
76 RedirectionTest::test::_narrow (object
.in ());
78 if (CORBA::is_nil (server
.in ()))
80 ACE_ERROR_RETURN ((LM_ERROR
,
81 "Object reference <%s> is nil.\n",
86 CORBA::Short number
= 0;
87 for (int i
= 1; i
<= 9; ++i
)
90 "CLIENT: Issuing request %d.\n",
93 number
= server
->number ();
96 "CLIENT: Request %d handled by object %d.\n",
105 catch (const CORBA::Exception
& ex
)
107 ex
._tao_print_exception ("Caught exception:");
113 "PortableInterceptor::Redirection test passed.\n"));