2 //=============================================================================
6 * Modified ORB destruction test.
8 * @author Andrew Schnable <Andrew.Schnable@veritas.com> Iliyan Jeliazkov <jeliazkov_i@ociweb.com>
10 //=============================================================================
13 #include "tao/corba.h"
14 #include "tao/PortableServer/PortableServer.h"
15 #include "tao/AnyTypeCode/Any.h"
16 #include "tao/BiDir_GIOP/BiDirGIOP.h"
21 test_with_bidir_poa (int argc
,
30 CORBA::ORB_init (argc
, argv
, orb_name
);
32 CORBA::Object_var obj
=
33 orb
->resolve_initial_references ("RootPOA");
35 PortableServer::POA_var root_poa
=
36 PortableServer::POA::_narrow (obj
.in ());
38 PortableServer::POAManager_var poa_manager
=
39 root_poa
->the_POAManager ();
42 CORBA::PolicyList
policies (1);
46 pol
<<= BiDirPolicy::BOTH
;
48 orb
->create_policy (BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE
,
51 // Create POA as child of RootPOA with the above policies. This POA
52 // will receive request in the same connection in which it sent
54 PortableServer::POA_var child_poa
=
55 root_poa
->create_POA ("childPOA",
59 // Creation of childPOA is over. Destroy the Policy objects.
60 for (CORBA::ULong i
= 0;
61 i
< policies
.length ();
64 policies
[i
]->destroy ();
67 poa_manager
->activate ();
70 root_poa
->destroy (1, 1);
77 catch (const CORBA::Exception
& ex
)
79 ex
._tao_print_exception ("Exception raised");
86 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
90 for (int i
=0; i
<10; i
++)
92 result
= test_with_bidir_poa (argc
, argv
, "poa_1", 1);
93 ACE_ASSERT (result
== 0);
95 result
= test_with_bidir_poa (argc
, argv
, "poa_2", 1);
96 ACE_ASSERT (result
== 0);
98 ACE_DEBUG ((LM_DEBUG
, "Completed OK\n"));