2 #include "tao/Profile_Transport_Resolver.h"
3 #include "tao/Transport.h"
5 #include "ace/Get_Opt.h"
7 const ACE_TCHAR
*ior
= ACE_TEXT ("file://test.ior");
10 parse_args (int argc
, ACE_TCHAR
*argv
[])
12 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
15 while ((c
= get_opts ()) != -1)
19 ior
= get_opts
.opt_arg ();
24 ACE_ERROR_RETURN ((LM_ERROR
,
31 // Indicates successful parsing of the command line
35 // This function does what TAO does in order to get a transport.
37 first_request_flag (CORBA::Object_ptr obj
)
39 TAO_Stub
*const stub
= obj
->_stubobj ();
42 ACE_ERROR_RETURN ((LM_DEBUG
,
43 "CORBA::Object has stub = 0\n"),
47 TAO::Profile_Transport_Resolver
resolver (obj
, stub
, true);
51 TAO_Transport
*transport
= resolver
.transport ();
54 ACE_ERROR_RETURN ((LM_DEBUG
,
59 return transport
->first_request ();
63 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
67 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
69 if (parse_args (argc
, argv
) != 0)
72 CORBA::Object_var tmp
= orb
->string_to_object (ior
);
74 // No remote calls, first request flag is on.
75 if (!first_request_flag (tmp
.in ()))
78 "Test FAILED at the beginning (why?)\n"));
81 // This call must issue LocateRequest message.
82 CORBA::PolicyList_var pl
;
83 tmp
->_validate_connection (pl
.out ());
85 // There was a LocateRequest call, first request flag
87 if (!first_request_flag (tmp
.in ()))
90 "Test FAILED after LocateRequest (bug#3676 is not fixed)!!\n"));
93 Test::Hello_var hello
= Test::Hello::_narrow (tmp
.in ());
95 if (CORBA::is_nil (hello
.in ()))
97 ACE_ERROR_RETURN ((LM_DEBUG
,
98 "Nil Test::Hello reference <%s>\n",
103 CORBA::String_var the_string
= hello
->get_string ();
105 // Either _narrow or get_string issued a remote call,
106 // first request flag is off.
107 if (first_request_flag (tmp
.in ()))
109 ACE_ERROR ((LM_ERROR
,
110 "Test FAILED after normal request (why?)\n"));
117 catch (const CORBA::Exception
& ex
)
119 ex
._tao_print_exception ("Exception caught:");