ACE+TAO-6_5_17
[ACE_TAO.git] / TAO / tests / Collocated_ThruP_Sp / Client_Task.cpp
blob8199914c81faceac526f01f0f76632e1e9cec690
2 #include "Client_Task.h"
3 #include "TestC.h"
5 Client_Task::Client_Task (const ACE_TCHAR *ior,
6 CORBA::ORB_ptr corb,
7 ACE_Thread_Manager *thr_mgr)
8 : ACE_Task_Base (thr_mgr)
9 , input_ (ior)
10 , corb_ (CORBA::ORB::_duplicate (corb))
15 int
16 Client_Task::svc (void)
18 CORBA::Boolean exception = false;
19 try
21 CORBA::Object_var tmp =
22 this->corb_->string_to_object (input_);
24 Test::Hello_var hello =
25 Test::Hello::_narrow(tmp.in ());
27 if (CORBA::is_nil (hello.in ()))
29 ACE_ERROR_RETURN ((LM_DEBUG,
30 "Nil Test::Hello reference <%s>\n",
31 input_),
32 1);
34 try
36 CORBA::String_var the_string =
37 hello->get_string ();
39 ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
40 the_string.in ()));
42 hello->shutdown ();
44 catch (const CORBA::INTERNAL&)
46 exception = true;
47 ACE_DEBUG ((LM_DEBUG, "OK: Client_Task Expected exception received\n"));
48 corb_->destroy ();
49 return 0;
52 catch (const CORBA::Exception& ex)
54 ex._tao_print_exception ("Exception caught:");
55 return 1;
57 if (!exception)
59 ACE_ERROR ((LM_ERROR, "(ERROR: Client_Task::svc Expected exception not received\n"));
61 return 0;