2 #include "ace/Get_Opt.h"
4 #include "Client_ORBInitializer.h"
5 #include "Client_Request_Interceptor.h"
6 #include "tao/ORBInitializer_Registry.h"
8 const ACE_TCHAR
*ior1
= 0;
11 parse_args (int argc
, ACE_TCHAR
*argv
[])
13 if (argc
!= 3) // foo -p IOR_1 -s IOR_2
14 ACE_ERROR_RETURN ((LM_ERROR
,
15 "Wrong number of arguments.\n"),
18 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("f:s:"));
21 while ((c
= get_opts ()) != -1)
25 ior1
= get_opts
.opt_arg ();
28 ACE_ERROR_RETURN ((LM_ERROR
,
39 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
45 #if TAO_HAS_INTERCEPTORS == 1
46 Client_ORBInitializer
* temp_initializer
= 0;
48 ACE_NEW_RETURN (temp_initializer
,
49 Client_ORBInitializer
,
50 -1); // No exceptions yet!
51 PortableInterceptor::ORBInitializer_var orb_initializer
=
54 PortableInterceptor::register_orb_initializer (orb_initializer
.in ());
55 #endif /* TAO_HAS_INTERCEPTORS == 1 */
57 CORBA::ORB_var orb
= CORBA::ORB_init (argc
,
61 if (::parse_args (argc
, argv
) != 0)
64 CORBA::Object_var object
=
65 orb
->string_to_object (ior1
);
67 RedirectionTest::test_var server
=
68 RedirectionTest::test::_narrow (object
.in ());
70 if (CORBA::is_nil (server
.in ()))
72 ACE_ERROR_RETURN ((LM_ERROR
,
73 "Object reference <%s> is nil.\n",
80 (void) server
->number ();
82 catch (const CORBA::TRANSIENT
&)
87 #if TAO_HAS_INTERCEPTORS == 1
88 if (temp_initializer
->client_interceptor_
->request_count () != 1)
90 ACE_ERROR_RETURN ((LM_ERROR
,
91 "Error, send request interceptor not called\n"),
95 if (temp_initializer
->client_interceptor_
->receive_exception_count () != 1)
97 ACE_ERROR_RETURN ((LM_ERROR
,
98 "Error, receive exception interceptor not called\n"),
101 #endif /* TAO_HAS_INTERCEPTORS == 1 */
105 catch (const CORBA::Exception
& ex
)
107 ex
._tao_print_exception ("Caught exception:");
113 "PortableInterceptor::Redirection test passed.\n"));