More tests update
[ACE_TAO.git] / TAO / tests / Bug_3853_Regression / client_interceptor.cpp
blob0c0313eee3565b69cb8bdc86f2f6a1286e80f363
1 #include "client_interceptor.h"
2 #include "HelloC.h"
3 #include "ace/Log_Msg.h"
5 extern const ACE_TCHAR *server2_ior;
6 extern CORBA::ORB_var orb;
8 const IOP::ServiceId service_id = 0xdeadbeef;
10 int isRecursive = 0;
11 extern Demo::HelloWorld_var server1_shutdownObj;
13 Echo_Client_Request_Interceptor::
14 Echo_Client_Request_Interceptor ()
15 : myname_ ("Echo_Client_Interceptor")
19 Echo_Client_Request_Interceptor::~Echo_Client_Request_Interceptor (void)
23 char *
24 Echo_Client_Request_Interceptor::name (void)
26 return CORBA::string_dup (this->myname_);
29 void
30 Echo_Client_Request_Interceptor::destroy (void)
34 void
35 Echo_Client_Request_Interceptor::send_poll (
36 PortableInterceptor::ClientRequestInfo_ptr)
38 // Do Nothing
41 void
42 Echo_Client_Request_Interceptor::send_request (
43 PortableInterceptor::ClientRequestInfo_ptr ri)
45 CORBA::String_var operation = ri->operation ();
46 if (ACE_OS::strcmp (operation.in (), "shutdown") == 0) {
47 return;
50 //send to another
51 isRecursive ++ ;
52 if (isRecursive%2 == 1 )
55 if (isRecursive == 3) {
56 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t)Echo_Client_Request_Interceptor::send_request(%d) ")
57 ACE_TEXT ("shutdown server 1 now. \n"), isRecursive));
58 server1_shutdownObj->shutdown();
61 CORBA::Object_var helloObj = orb->string_to_object(server2_ior);
63 Demo::HelloWorld_var hello = Demo::HelloWorld::_narrow(helloObj.in ());
65 if (CORBA::is_nil(hello.in ())) {
66 ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t)Echo_Client_Request_Interceptor::send_request(%d) ")
67 ACE_TEXT ("hello reference is nil.\n"), isRecursive));
69 else {
70 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t)Echo_Client_Request_Interceptor::send_request(%d) ")
71 ACE_TEXT ("call server2 HelloWorld::sayHello() \n"), isRecursive));
72 const char* pMsg = " server2 say Hello";
73 hello->sayHello(pMsg) ;
78 void
79 Echo_Client_Request_Interceptor::receive_reply (
80 PortableInterceptor::ClientRequestInfo_ptr)
84 void
85 Echo_Client_Request_Interceptor::receive_other (
86 PortableInterceptor::ClientRequestInfo_ptr)
90 void
91 Echo_Client_Request_Interceptor::receive_exception (
92 PortableInterceptor::ClientRequestInfo_ptr)