2 #include "ace/Log_Msg.h"
4 #include "Current_TestC.h"
5 #include "Client_Request_Interceptor.h"
6 #include "Client_ORBInitializer.h"
10 Client_Request_Interceptor::Client_Request_Interceptor (const char *orb_id
,
12 : orb_id_ (CORBA::string_dup (orb_id
))
20 Client_Request_Interceptor::interceptions ()
22 return this->request_count_
;
26 Client_Request_Interceptor::name ()
28 return CORBA::string_dup ("Client_Request_Interceptor");
32 Client_Request_Interceptor::test_transport_current (const ACE_TCHAR
* amethod
)
35 ACE_TEXT ("CRI (%P|%t) Test accessing Transport Current from %s\n"),
38 ++this->request_count_
;
42 CORBA::ORB_var orb
= CORBA::ORB_init (tmp
,
46 // Call the test function, which will throw an exception on
48 (*this->test_
) (orb
.in ());
51 ACE_TEXT ("CRI (%P|%t) Successfully tested Transport Current from %s\n"),
56 Client_Request_Interceptor::destroy ()
61 Client_Request_Interceptor::send_request (PortableInterceptor::ClientRequestInfo_ptr ri
)
64 test_transport_current (ACE_TEXT ("send_request"));
66 CORBA::Boolean
const response_expected
=
67 ri
->response_expected ();
70 if (response_expected
)
71 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT("CRI (%P|%t) Sending a two-way\n")));
73 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT("CRI (%P|%t) Sending a one-way\n")));
75 // Make the context to send the context to the target
76 IOP::ServiceContext sc
;
77 sc
.context_id
= Test::Transport::CurrentTest::ContextTag
;
79 // How long can a number really get?
82 ACE_GUARD (TAO_SYNCH_MUTEX
, monitor
, this->lock_
);
84 ACE_OS::sprintf (temp
, "%ld", this->requestID_
);
88 CORBA::ULong string_len
= ACE_OS::strlen (temp
) + 1;
89 CORBA::Octet
*buf
= CORBA::OctetSeq::allocbuf (string_len
);
90 ACE_OS::strcpy (reinterpret_cast <char *> (buf
), temp
);
92 sc
.context_data
.replace (string_len
, string_len
, buf
, 1);
94 // Add this context to the service context list.
95 ri
->add_request_service_context (sc
, 0);
99 Client_Request_Interceptor::send_poll (PortableInterceptor::ClientRequestInfo_ptr
)
101 test_transport_current (ACE_TEXT ("send_poll"));
105 Client_Request_Interceptor::receive_reply (PortableInterceptor::ClientRequestInfo_ptr
)
107 test_transport_current (ACE_TEXT ("receive_reply"));
111 Client_Request_Interceptor::receive_exception (PortableInterceptor::ClientRequestInfo_ptr
)
113 test_transport_current (ACE_TEXT ("receive_exception"));
117 Client_Request_Interceptor::receive_other (PortableInterceptor::ClientRequestInfo_ptr
)
119 test_transport_current (ACE_TEXT ("receive_other"));