Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_1395_Regression / Test_i.cpp
blob638a1f4fdaf56af9247f064d5409d7d218e2c50a
1 #include "Test_i.h"
3 // In case this is a static build we have to force
4 // the ImR_Client to be linked.
5 #include "tao/ImR_Client/ImR_Client.h"
7 Test_i::Test_i (CORBA::ORB_ptr orb) :
8 orb_ (CORBA::ORB::_duplicate(orb)),
9 policies_ (1)
11 try
13 CORBA::Object_var obj =
14 orb_->resolve_initial_references ("RootPOA");
15 this->root_poa_ =
16 PortableServer::POA::_narrow (obj.in ());
17 policies_.length(1);
18 policies_[0] =
19 root_poa_->create_lifespan_policy (PortableServer::PERSISTENT);
20 this->poa_mgr_ =
21 this->root_poa_->the_POAManager ();
23 catch (const CORBA::Exception& ex)
25 ex._tao_print_exception ("Caught exception");
27 ACE_ASSERT (0); // Force termination!
31 Test_i::~Test_i (void)
33 this->policies_[0]->destroy ();
36 int
37 Test_i::try_and_create_POA (void)
39 try
41 PortableServer::POA_var persistent_poa =
42 root_poa_->create_POA ("MyPoa",
43 poa_mgr_.in (),
44 this->policies_);
46 catch (const CORBA::TRANSIENT&)
48 // A transient exception exception may be expected,
49 // so we won't print out the word exception but we
50 // will let the user know that a transient exception occurred
51 ACE_DEBUG ((LM_DEBUG,
52 "CORBA::TRANSIENT in Test_i::try_and_create_POA\n"));
53 return 1;
55 catch (const CORBA::Exception& ex)
57 ex._tao_print_exception ("try_and_create_POA Exception ...");
58 return 1;
61 return 0;
64 void
65 Test_i::shutdown (void)
67 orb_->shutdown (0);