Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / POA / Current / Current.cpp
blobf17155b7a59a9322193d0402b3bb066bac846690
2 //=============================================================================
3 /**
4 * @file Current.cpp
6 * This program tests if accessing the POA current before the
7 * RootPOA can cause any problems.
9 * @author Irfan Pyarali
11 //=============================================================================
14 #include "tao/ORB.h"
15 #include "tao/PortableServer/PortableServer.h"
17 #include "ace/Log_Msg.h"
19 int
20 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
23 try
25 // Initialize the ORB first.
26 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
28 CORBA::Object_var object;
30 object = orb->resolve_initial_references ("POACurrent");
32 PortableServer::Current_var current =
33 PortableServer::Current::_narrow (object.in ());
35 object = orb->resolve_initial_references ("RootPOA");
37 PortableServer::POA_var root_poa =
38 PortableServer::POA::_narrow (object.in ());
40 orb->destroy ();
42 ACE_DEBUG ((LM_DEBUG,
43 "%s successful\n",
44 argv[0]));
46 catch (const CORBA::Exception& ex)
48 ex._tao_print_exception ("Exception caught");
49 return -1;
52 return 0;