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
,
29 CORBA::ORB_init (argc
, argv
, orb_name
);
31 CORBA::Object_var obj
=
32 orb
->resolve_initial_references ("RootPOA");
34 PortableServer::POA_var root_poa
=
35 PortableServer::POA::_narrow (obj
.in ());
37 PortableServer::POAManager_var poa_manager
=
38 root_poa
->the_POAManager ();
40 poa_manager
->activate ();
44 root_poa
->destroy (1, 1);
52 catch (const CORBA::Exception
& ex
)
54 ex
._tao_print_exception ("Exception raised");
61 test_with_funky_poa_manager (int argc
,
66 int funky_poa_manager
)
72 CORBA::ORB_init (argc
, argv
, orb_name
);
74 CORBA::Object_var obj
=
75 orb
->resolve_initial_references ("RootPOA");
77 PortableServer::POA_var root_poa
=
78 PortableServer::POA::_narrow (obj
.in ());
80 if (funky_poa_manager
)
82 PortableServer::POAManager_var poa_manager
=
83 root_poa
->the_POAManager ();
85 poa_manager
->activate ();
90 root_poa
->destroy (1, 1);
98 catch (const CORBA::Exception
& ex
)
100 ex
._tao_print_exception ("Exception raised");
107 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
111 result
= test_with_regular_poa_manager (argc
, argv
,
112 "destroy_nothing_with_poa_manager",
114 ACE_ASSERT (result
== 0);
116 result
= test_with_regular_poa_manager (argc
, argv
,
117 "destroy_poa_with_poa_manager",
119 ACE_ASSERT (result
== 0);
121 result
= test_with_regular_poa_manager (argc
, argv
,
122 "destroy_orb_with_poa_manager",
124 ACE_ASSERT (result
== 0);
126 result
= test_with_regular_poa_manager (argc
, argv
,
127 "destroy_poa_and_orb_with_poa_manager",
129 ACE_ASSERT (result
== 0);
131 result
= test_with_funky_poa_manager (argc
, argv
,
132 "destroy_nothing_without_poa_manager",
134 ACE_ASSERT (result
== 0);
136 result
= test_with_funky_poa_manager (argc
, argv
,
137 "destroy_poa_without_poa_manager",
139 ACE_ASSERT (result
== 0);
141 result
= test_with_funky_poa_manager (argc
, argv
,
142 "destroy_orb_without_poa_manager",
144 ACE_ASSERT (result
== 0);
146 result
= test_with_funky_poa_manager (argc
, argv
,
147 "destroy_poa_and_orb_without_poa_manager",
149 ACE_ASSERT (result
== 0);
151 result
= test_with_funky_poa_manager (argc
, argv
,
152 "destroy_nothing_with_funky_poa_manager",
154 ACE_ASSERT (result
== 0);
156 result
= test_with_funky_poa_manager (argc
, argv
,
157 "destroy_poa_with_funky_poa_manager",
159 ACE_ASSERT (result
== 0);
161 result
= test_with_funky_poa_manager (argc
, argv
,
162 "destroy_orb_with_funky_poa_manager",
164 ACE_ASSERT (result
== 0);
166 result
= test_with_funky_poa_manager (argc
, argv
,
167 "destroy_poa_and_orb_with_funky_poa_manager",
169 ACE_ASSERT (result
== 0);