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 (void)
21 Current_Test_Impl::self_test (void)
27 Current_Test_Impl::test_transport_current (void)
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")));
63 Current_Test_Impl::invoked_by_client (void)
65 if (TAO_debug_level
>= 1) {
67 ACE_TEXT ("(%P|%t) server - Test method invoked by client.\n")));
70 this->test_transport_current ();
72 if (this->do_collocated_calls_
)
74 CORBA::Object_var selfobject
=
75 poa_
->servant_to_reference (this);
77 Test::Transport::CurrentTest_var self
=
78 Test::Transport::CurrentTest::_narrow (selfobject
.in ());
80 if (TAO_debug_level
>= 1) {
82 ACE_TEXT ("(%P|%t) server - Making a collocated invocation to invoked_during_upcall().\n")));
84 self
->invoked_during_upcall ();
88 if (TAO_debug_level
>= 1)
91 ACE_TEXT ("(%P|%t) server - skipping collocated calls\n")));
99 Current_Test_Impl::invoked_during_upcall (void)
101 if (TAO_debug_level
> 2) {
102 ACE_DEBUG ((LM_DEBUG
,
103 ACE_TEXT ("(%P|%t) server - Test method invoked ")
104 ACE_TEXT ("by the server during upcall.\n")));
109 Current_Test_Impl::shutdown (void)
111 if (TAO_debug_level
> 2) {
112 ACE_DEBUG ((LM_DEBUG
,
113 ACE_TEXT ("(%P|%t) server - shutting down.\n")));
116 this->orb_
->shutdown (0);