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
[])
57 CORBA::ORB_init (argc
, argv
);
59 if (parse_args (argc
, argv
) != 0)
63 CORBA::Object_var object_primary
=
64 orb
->string_to_object (ior
);
67 CORBA::Object_var object_secondary
=
68 orb
->string_to_object (name
);
70 // Get an object reference for the ORBs IORManipultion object!
71 CORBA::Object_ptr IORM
=
72 orb
->resolve_initial_references (TAO_OBJID_IORMANIPULATION
,
75 TAO_IOP::TAO_IOR_Manipulation_ptr iorm
=
76 TAO_IOP::TAO_IOR_Manipulation::_narrow (IORM
);
78 TAO_IOP::TAO_IOR_Manipulation::IORList
iors (2);
80 iors
[0] = object_primary
;
81 iors
[1] = object_secondary
;
83 CORBA::Object_var merged
= iorm
->merge_iors (iors
);
86 Simple_Server_var server
=
87 Simple_Server::_narrow (merged
.in ());
89 if (CORBA::is_nil (server
.in ()))
91 ACE_ERROR_RETURN ((LM_ERROR
,
92 "Object reference <%s> is nil.\n",
97 run_test (server
.in ());
99 catch (const CORBA::Exception
& ex
)
101 ex
._tao_print_exception ("Caught an exception\n");
107 void run_test (Simple_Server_ptr server
)
109 for (int loop
= 0; loop
< 10; loop
++)
113 // Make a remote call
115 server
->remote_call ();
117 ACE_UNUSED_ARG (ret
);
121 catch (const CORBA::TRANSIENT
& t
)
123 if (t
.completed () != CORBA::COMPLETED_NO
)
125 t
._tao_print_exception ("Unexpected kind of TRANSIENT");
129 ACE_DEBUG ((LM_DEBUG
,
130 "The completed status %d\n", t
.completed ()));
131 ACE_DEBUG ((LM_DEBUG
,
132 "Automagically re-issuing request on TRANSIENT\n"));
136 catch (const CORBA::COMM_FAILURE
& f
)
138 f
._tao_print_exception ("A (sort of) expected COMM_FAILURE");
139 ACE_DEBUG ((LM_DEBUG
,
140 "Automagically re-issuing request on COMM_FAILURE\n"));
142 catch (const CORBA::Exception
& ex
)
144 ex
._tao_print_exception ("Unexpected exception");