2 //=============================================================================
4 * @file ORB_destroy.cpp
6 * Simple ORB destruction test.
8 * @author Irfan Pyarali <irfan@cs.wustl.edu>
10 //=============================================================================
14 #include "tao/PortableServer/PortableServer.h"
16 #include "ace/Log_Msg.h"
19 test_with_regular_poa_manager (int argc
,
28 CORBA::ORB_init (argc
, argv
, orb_name
);
30 CORBA::Object_var obj
=
31 orb
->resolve_initial_references ("RootPOA");
33 PortableServer::POA_var root_poa
=
34 PortableServer::POA::_narrow (obj
.in ());
36 PortableServer::POAManager_var poa_manager
=
37 root_poa
->the_POAManager ();
39 poa_manager
->activate ();
43 root_poa
->destroy (true, true);
51 catch (const CORBA::Exception
& ex
)
53 ex
._tao_print_exception ("Exception raised");
60 test_with_funky_poa_manager (int argc
,
65 int funky_poa_manager
)
70 CORBA::ORB_init (argc
, argv
, orb_name
);
72 CORBA::Object_var obj
=
73 orb
->resolve_initial_references ("RootPOA");
75 PortableServer::POA_var root_poa
=
76 PortableServer::POA::_narrow (obj
.in ());
78 if (funky_poa_manager
)
80 PortableServer::POAManager_var poa_manager
=
81 root_poa
->the_POAManager ();
83 poa_manager
->activate ();
88 root_poa
->destroy (true, true);
96 catch (const CORBA::Exception
& ex
)
98 ex
._tao_print_exception ("Exception raised");
105 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
109 result
= test_with_regular_poa_manager (argc
, argv
,
110 "destroy_nothing_with_poa_manager",
112 ACE_ASSERT (result
== 0);
114 result
= test_with_regular_poa_manager (argc
, argv
,
115 "destroy_poa_with_poa_manager",
117 ACE_ASSERT (result
== 0);
119 result
= test_with_regular_poa_manager (argc
, argv
,
120 "destroy_orb_with_poa_manager",
122 ACE_ASSERT (result
== 0);
124 result
= test_with_regular_poa_manager (argc
, argv
,
125 "destroy_poa_and_orb_with_poa_manager",
127 ACE_ASSERT (result
== 0);
129 result
= test_with_funky_poa_manager (argc
, argv
,
130 "destroy_nothing_without_poa_manager",
132 ACE_ASSERT (result
== 0);
134 result
= test_with_funky_poa_manager (argc
, argv
,
135 "destroy_poa_without_poa_manager",
137 ACE_ASSERT (result
== 0);
139 result
= test_with_funky_poa_manager (argc
, argv
,
140 "destroy_orb_without_poa_manager",
142 ACE_ASSERT (result
== 0);
144 result
= test_with_funky_poa_manager (argc
, argv
,
145 "destroy_poa_and_orb_without_poa_manager",
147 ACE_ASSERT (result
== 0);
149 result
= test_with_funky_poa_manager (argc
, argv
,
150 "destroy_nothing_with_funky_poa_manager",
152 ACE_ASSERT (result
== 0);
154 result
= test_with_funky_poa_manager (argc
, argv
,
155 "destroy_poa_with_funky_poa_manager",
157 ACE_ASSERT (result
== 0);
159 result
= test_with_funky_poa_manager (argc
, argv
,
160 "destroy_orb_with_funky_poa_manager",
162 ACE_ASSERT (result
== 0);
164 result
= test_with_funky_poa_manager (argc
, argv
,
165 "destroy_poa_and_orb_with_funky_poa_manager",
167 ACE_ASSERT (result
== 0);