2 #include "tao/TransportCurrent/TCC.h"
4 #include "Current_Test_Impl.h"
6 Current_Test_Impl::Current_Test_Impl (CORBA::ORB_ptr orb
,
7 PortableServer::POA_ptr poa
,
8 int do_collocated_calls
)
9 : orb_ (CORBA::ORB::_duplicate (orb
))
10 , poa_ (PortableServer::POA::_duplicate (poa
))
11 , do_collocated_calls_ (do_collocated_calls
)
15 Current_Test_Impl::~Current_Test_Impl (void)
20 Current_Test_Impl::self_test (void)
26 Current_Test_Impl::test_transport_current (void)
28 if (TAO_debug_level
> 2)
31 ACE_TEXT ("(%P|%t) server - Testing access to Transport Current ...\n")));
34 CORBA::Object_var tcobject
=
35 orb_
->resolve_initial_references ("TAO::Transport::Current");
37 TAO::Transport::Current_var tc
=
38 TAO::Transport::Current::_narrow (tcobject
.in ());
40 if (TAO_debug_level
>= 1)
42 ::CORBA::Long id
= tc
->id ();
44 ::TAO::CounterT bs
= tc
->bytes_sent ();
46 ::TAO::CounterT br
= tc
->bytes_received ();
48 ::TAO::CounterT rs
= tc
->messages_sent ();
50 ::TAO::CounterT rr
= tc
->messages_received ();
53 ACE_TEXT ("Current_Test_Impl (%P|%t) Transport [%q] - Sent/Received [bytes=%q/%q, messages=%q/%q]\n"),
61 if (TAO_debug_level
> 2)
64 ACE_TEXT ("(%P|%t) server - Successfully accessed Transport Current\n")));
69 Current_Test_Impl::invoked_by_client (void)
73 this->invoked_by_client_i ();
75 catch (const TAO::Transport::NoContext
&)
78 ACE_TEXT ("(%P|%t) server - Caught a Transport::NoContext exception\n")));
80 catch (const CORBA::SystemException
&)
83 ACE_TEXT ("(%P|%t) server - Caught a CORBA::SystemException exception\n")));
88 Current_Test_Impl::invoked_by_client_i (void)
90 if (TAO_debug_level
> 2) {
92 ACE_TEXT ("(%P|%t) server - Testing inside an upcall\n")));
95 this->test_transport_current ();
97 if (this->do_collocated_calls_
)
99 CORBA::Object_var selfobject
=
100 poa_
->servant_to_reference (this);
102 Test::Transport::CurrentTest_var self
=
103 Test::Transport::CurrentTest::_narrow (selfobject
.in ());
105 if (TAO_debug_level
>= 1)
107 ACE_DEBUG ((LM_DEBUG
,
108 ACE_TEXT ("(%P|%t) server - Testing a collocated call\n")));
110 self
->invoked_during_upcall ();
114 if (TAO_debug_level
>= 1)
116 ACE_DEBUG ((LM_DEBUG
,
117 ACE_TEXT ("(%P|%t) server - Skipping the collocated call test\n")));
123 Current_Test_Impl::invoked_during_upcall (void)
125 if (TAO_debug_level
> 2) {
126 ACE_DEBUG ((LM_DEBUG
,
127 ACE_TEXT ("(%P|%t) server - Test method invoked ")
128 ACE_TEXT ("by the server during upcall.\n")));
134 Current_Test_Impl::shutdown (void)
136 if (TAO_debug_level
> 2) {
137 ACE_DEBUG ((LM_DEBUG
,
138 ACE_TEXT ("(%P|%t) server - shutting down.\n")));
141 this->orb_
->shutdown (0);