summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Bug_1393_Regression/client.cpp
blob: 54cc2944398b0e88974aee852b4da252dc43d742 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "tao/IFR_Client/IFR_BasicC.h"
#include "tao/ORB.h"
#include "ace/OS_NS_string.h"
#include "ace/Log_Msg.h"

int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  try
    {
      CORBA::ORB_var orb_ = CORBA::ORB_init (argc, argv);

      CORBA::Object_var object =
        orb_->resolve_initial_references ("InterfaceRepository");

      CORBA::Repository_var repo_ = CORBA::Repository::_narrow (object.in ());


      CORBA::ContainedSeq_var interfaces =
                  repo_->contents (CORBA::dk_Interface,    // Any type of contained object.
                                   1);                     // Exclude parents of interfaces.

      CORBA::ULong length = interfaces->length ();

      if (length != 1)
      {
        ACE_DEBUG ((LM_DEBUG, "CLIENT (%P): Incorrect number of elements in IFR - length is %d\n", length));
        return -1;
      }

      CORBA::ULong first_one = 0;

      CORBA::InterfaceDef_var the_interface =
            CORBA::InterfaceDef::_narrow (interfaces[first_one]);

      CORBA::String_var name = the_interface->name();

      if (ACE_OS::strcmp (name.in(), "int"))
      {
        ACE_DEBUG ((LM_DEBUG, "CLIENT (%P): Interface name has been munged - it is now %C\n",
                      name.in()));
        return -1;
      }


    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Exception ...");
      return -1;
    }
  return 0;
}