4 #include "CSD_TP_Test_Export.h"
5 #include "TestAppExceptionC.h"
6 #include "tao/PortableServer/PortableServer.h"
8 #include "ace/Log_Msg.h"
14 typedef typename
T::_ptr_type T_ptr
;
15 typedef typename
T::_var_type T_var
;
17 static T_ptr
string_to_ref(CORBA::ORB_ptr orb
,
20 CORBA::Object_var obj
= orb
->string_to_object(ior
);
22 if (CORBA::is_nil(obj
.in()))
25 "(%P|%t) Failed to convert IOR string to obj ref.\n"));
26 throw TestAppException();
29 T_var t_obj
= T::_narrow(obj
.in());
31 if (CORBA::is_nil(t_obj
.in()))
34 "(%P|%t) Failed to narrow obj ref to T interface.\n"));
35 throw TestAppException();
41 static T_ptr
resolve_initial_ref(CORBA::ORB_ptr orb
,
45 = orb
->resolve_initial_references(name
);
47 if (CORBA::is_nil(obj
.in()))
50 "(%P|%t) Failed to resolve initial ref for '%s'.\n",
52 throw TestAppException();
55 T_var t_obj
= T::_narrow(obj
.in());
58 if (CORBA::is_nil(t_obj
.in()))
61 "(%P|%t) Failed to narrow resolved initial ref '%s'.\n",
63 throw TestAppException();
70 struct CSD_TP_Test_Export AppHelper
72 static void ref_to_file(CORBA::ORB_ptr orb
,
73 CORBA::Object_ptr obj
,
74 const ACE_TCHAR
* filename
);
76 static PortableServer::POA_ptr create_poa
78 PortableServer::POA_ptr root_poa
,
79 PortableServer::POAManager_ptr mgr
,
80 CORBA::PolicyList
& policies
);
82 static CORBA::Object_ptr
activate_servant(PortableServer::POA_ptr poa
,
83 PortableServer::Servant servant
);
85 // This helper method is used because there is a chance that the
86 // initial CORBA request made to the target ORB will fail during
87 // connection establishment with a TRANSIENT CORBA SystemException.
88 // This occurs for some platforms (ie, windows) when several clients
89 // make their initial CORBA request to the same ORB at the same time,
90 // causing the ORB to attempt to handle several connection establishments
91 // at one time. Apparently, under certain conditions, it will throw the
92 // TRANSIENT exception to tell the client application to "try again later".
93 // The analogy is making a phone call. Sometimes you get a busy tone.
94 // This means "try again later".
95 // This helper function will retry until the connection establishment
96 // works - or until it decides that enough is enough.
97 static bool validate_connection (CORBA::Object_ptr obj
);