Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_1393_Regression / client.cpp
blob54cc2944398b0e88974aee852b4da252dc43d742
1 #include "tao/IFR_Client/IFR_BasicC.h"
2 #include "tao/ORB.h"
3 #include "ace/OS_NS_string.h"
4 #include "ace/Log_Msg.h"
6 int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
8 try
10 CORBA::ORB_var orb_ = CORBA::ORB_init (argc, argv);
12 CORBA::Object_var object =
13 orb_->resolve_initial_references ("InterfaceRepository");
15 CORBA::Repository_var repo_ = CORBA::Repository::_narrow (object.in ());
18 CORBA::ContainedSeq_var interfaces =
19 repo_->contents (CORBA::dk_Interface, // Any type of contained object.
20 1); // Exclude parents of interfaces.
22 CORBA::ULong length = interfaces->length ();
24 if (length != 1)
26 ACE_DEBUG ((LM_DEBUG, "CLIENT (%P): Incorrect number of elements in IFR - length is %d\n", length));
27 return -1;
30 CORBA::ULong first_one = 0;
32 CORBA::InterfaceDef_var the_interface =
33 CORBA::InterfaceDef::_narrow (interfaces[first_one]);
35 CORBA::String_var name = the_interface->name();
37 if (ACE_OS::strcmp (name.in(), "int"))
39 ACE_DEBUG ((LM_DEBUG, "CLIENT (%P): Interface name has been munged - it is now %C\n",
40 name.in()));
41 return -1;
46 catch (const CORBA::Exception& ex)
48 ex._tao_print_exception ("Exception ...");
49 return -1;
51 return 0;