2 #include "tao/TransportCurrent/TC_IIOPC.h"
3 #include "tao/TransportCurrent/TCC.h"
5 #include "Current_Test_Impl.h"
7 Current_Test_Impl::Current_Test_Impl (CORBA::ORB_ptr orb
,
8 PortableServer::POA_ptr poa
,
9 int do_collocated_calls
)
10 : orb_ (CORBA::ORB::_duplicate (orb
))
11 , poa_ (PortableServer::POA::_duplicate (poa
))
12 , do_collocated_calls_ (do_collocated_calls
)
16 Current_Test_Impl::~Current_Test_Impl ()
21 Current_Test_Impl::self_test ()
27 Current_Test_Impl::test_transport_current ()
29 if (TAO_debug_level
> 2) {
31 ACE_TEXT ("(%P|%t) server - Testing access to IIOP Transport Current ...\n")));
34 CORBA::Object_var tcobject
=
35 this->orb_
->resolve_initial_references ("TAO::Transport::IIOP::Current");
37 TAO::Transport::IIOP::Current_var tc
=
38 TAO::Transport::IIOP::Current::_narrow (tcobject
.in ());
40 if (CORBA::is_nil (tc
.in()))
43 ACE_TEXT ("Unable to narrow down to TAO::Transport::IIOP::Current\n")));
44 throw CORBA::INTERNAL ();
47 CORBA::String_var
rhost (tc
->remote_host ());
48 CORBA::String_var
lhost (tc
->local_host ());
50 ACE_TEXT ("(%P|%t) server - [%s:%d] -> [%s:%d]\n"),
51 rhost
.in (), tc
->remote_port (),
52 lhost
.in (), tc
->local_port ()));
54 if (TAO_debug_level
> 2) {
56 ACE_TEXT ("(%P|%t) server - Successfully accessed IIOP Transport Current\n")));
62 Current_Test_Impl::invoked_by_client ()
64 if (TAO_debug_level
>= 1) {
66 ACE_TEXT ("(%P|%t) server - Test method invoked by client.\n")));
69 this->test_transport_current ();
71 if (this->do_collocated_calls_
)
73 CORBA::Object_var selfobject
=
74 poa_
->servant_to_reference (this);
76 Test::Transport::CurrentTest_var self
=
77 Test::Transport::CurrentTest::_narrow (selfobject
.in ());
79 if (TAO_debug_level
>= 1) {
81 ACE_TEXT ("(%P|%t) server - Making a collocated invocation to invoked_during_upcall().\n")));
83 self
->invoked_during_upcall ();
87 if (TAO_debug_level
>= 1)
90 ACE_TEXT ("(%P|%t) server - skipping collocated calls\n")));
98 Current_Test_Impl::invoked_during_upcall ()
100 if (TAO_debug_level
> 2) {
101 ACE_DEBUG ((LM_DEBUG
,
102 ACE_TEXT ("(%P|%t) server - Test method invoked ")
103 ACE_TEXT ("by the server during upcall.\n")));
108 Current_Test_Impl::shutdown ()
110 if (TAO_debug_level
> 2) {
111 ACE_DEBUG ((LM_DEBUG
,
112 ACE_TEXT ("(%P|%t) server - shutting down.\n")));
115 this->orb_
->shutdown (false);