4 #include "CSD_PT_TestInf_Export.h"
5 #include "TestInf/TestAppExceptionC.h"
6 #include "tao/PortableServer/PortableServer.h"
8 #include "ace/Log_Msg.h"
13 typedef typename
T::_ptr_type T_ptr
;
14 typedef typename
T::_var_type T_var
;
16 static T_ptr
string_to_ref(CORBA::ORB_ptr orb
,
19 CORBA::Object_var obj
= orb
->string_to_object(ior
);
21 if (CORBA::is_nil(obj
.in()))
24 "(%P|%t) Failed to convert IOR string to obj ref.\n"));
25 throw TestAppException();
28 T_var t_obj
= T::_narrow(obj
.in());
30 if (CORBA::is_nil(t_obj
.in()))
33 "(%P|%t) Failed to narrow obj ref to T interface.\n"));
34 throw TestAppException();
40 static T_ptr
resolve_initial_ref(CORBA::ORB_ptr orb
,
44 = orb
->resolve_initial_references(name
);
46 if (CORBA::is_nil(obj
.in()))
49 "(%P|%t) Failed to resolve initial ref for '%s'.\n",
51 throw TestAppException();
54 T_var t_obj
= T::_narrow(obj
.in());
57 if (CORBA::is_nil(t_obj
.in()))
60 "(%P|%t) Failed to narrow resolved initial ref '%s'.\n",
62 throw TestAppException();
69 struct CSD_PT_TestInf_Export AppHelper
71 static void ref_to_file(CORBA::ORB_ptr orb
,
72 CORBA::Object_ptr obj
,
73 const ACE_TCHAR
* filename
);
75 static PortableServer::POA_ptr create_poa
77 PortableServer::POA_ptr root_poa
,
78 PortableServer::POAManager_ptr mgr
,
79 CORBA::PolicyList
& policies
);
81 static CORBA::Object_ptr
activate_servant(PortableServer::POA_ptr poa
,
82 PortableServer::Servant servant
);
84 // This helper method is used because there is a chance that the
85 // initial CORBA request made to the target ORB will fail during
86 // connection establishment with a TRANSIENT CORBA SystemException.
87 // This occurs for some platforms (ie, windows) when several clients
88 // make their initial CORBA request to the same ORB at the same time,
89 // causing the ORB to attempt to handle several connection establishments
90 // at one time. Apparently, under certain conditions, it will throw the
91 // TRANSIENT exception to tell the client application to "try again later".
92 // The analogy is making a phone call. Sometimes you get a busy tone.
93 // This means "try again later".
94 // This helper function will retry until the connection establishment
95 // works - or until it decides that enough is enough.
96 static bool validate_connection (CORBA::Object_ptr obj
);