1 #include "tao/IORManipulation/IORManip_Loader.h"
2 #include "ace/SString.h"
3 #include "ace/Get_Opt.h"
4 #include "ace/OS_NS_unistd.h"
7 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
10 const ACE_TCHAR
*name
= ACE_TEXT("file://amba.ior");
13 parse_args (int argc
, ACE_TCHAR
*argv
[])
15 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("xk:m:"));
18 while ((c
= get_opts ()) != -1)
26 ior
= get_opts
.opt_arg ();
30 name
= get_opts
.opt_arg ();
35 ACE_ERROR_RETURN ((LM_ERROR
,
43 // Indicates successful parsing of the command line
48 run_test (Simple_Server_ptr server
);
51 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
56 CORBA::ORB_init (argc
, argv
);
58 if (parse_args (argc
, argv
) != 0)
62 CORBA::Object_var object_primary
=
63 orb
->string_to_object (ior
);
66 CORBA::Object_var object_secondary
=
67 orb
->string_to_object (name
);
69 // Get an object reference for the ORBs IORManipultion object!
70 CORBA::Object_ptr IORM
=
71 orb
->resolve_initial_references (TAO_OBJID_IORMANIPULATION
,
74 TAO_IOP::TAO_IOR_Manipulation_ptr iorm
=
75 TAO_IOP::TAO_IOR_Manipulation::_narrow (IORM
);
77 TAO_IOP::TAO_IOR_Manipulation::IORList
iors (2);
79 iors
[0] = object_primary
;
80 iors
[1] = object_secondary
;
82 CORBA::Object_var merged
= iorm
->merge_iors (iors
);
85 Simple_Server_var server
=
86 Simple_Server::_narrow (merged
.in ());
88 if (CORBA::is_nil (server
.in ()))
90 ACE_ERROR_RETURN ((LM_ERROR
,
91 "Object reference <%s> is nil.\n",
96 run_test (server
.in ());
98 catch (const CORBA::Exception
& ex
)
100 ex
._tao_print_exception ("Caught an exception\n");
106 void run_test (Simple_Server_ptr server
)
108 for (int loop
= 0; loop
< 10; loop
++)
112 // Make a remote call
114 server
->remote_call ();
116 ACE_UNUSED_ARG (ret
);
120 catch (const CORBA::TRANSIENT
& t
)
122 if (t
.completed () != CORBA::COMPLETED_NO
)
124 t
._tao_print_exception ("Unexpected kind of TRANSIENT");
128 ACE_DEBUG ((LM_DEBUG
,
129 "The completed status %d\n", t
.completed ()));
130 ACE_DEBUG ((LM_DEBUG
,
131 "Automagically re-issuing request on TRANSIENT\n"));
135 catch (const CORBA::COMM_FAILURE
& f
)
137 f
._tao_print_exception ("A (sort of) expected COMM_FAILURE");
138 ACE_DEBUG ((LM_DEBUG
,
139 "Automagically re-issuing request on COMM_FAILURE\n"));
141 catch (const CORBA::Exception
& ex
)
143 ex
._tao_print_exception ("Unexpected exception");