diff options
Diffstat (limited to 'TAO/tests/POA/RootPOA/RootPOA.cpp')
-rw-r--r-- | TAO/tests/POA/RootPOA/RootPOA.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/TAO/tests/POA/RootPOA/RootPOA.cpp b/TAO/tests/POA/RootPOA/RootPOA.cpp new file mode 100644 index 00000000000..40acaf4b170 --- /dev/null +++ b/TAO/tests/POA/RootPOA/RootPOA.cpp @@ -0,0 +1,44 @@ +#include "ace/streams.h" +#include "tao/corba.h" + +int +main (int argc, char **argv) +{ + CORBA::Environment env; + + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, 0, env); + if (env.exception () != 0) + { + env.print_exception ("CORBA::ORB_init"); + return -1; + } + + CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); + + PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in(), env); + if (env.exception () != 0) + { + env.print_exception ("PortableServer::POA::_narrow"); + return -1; + } + + CORBA::String_var poa_name = root_poa->the_name (env); + if (env.exception () != 0) + { + env.print_exception ("PortableServer::POA::_narrow"); + return -1; + } + + cout << poa_name.in () << endl; + + root_poa->destroy (CORBA::B_TRUE, + CORBA::B_TRUE, + env); + if (env.exception () != 0) + { + env.print_exception ("PortableServer::POA::destroy"); + return -1; + } + + return 0; +} |