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"
20 test_with_bidir_poa (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 ();
40 CORBA::PolicyList
policies (1);
44 pol
<<= BiDirPolicy::BOTH
;
46 orb
->create_policy (BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE
,
49 // Create POA as child of RootPOA with the above policies. This POA
50 // will receive request in the same connection in which it sent
52 PortableServer::POA_var child_poa
=
53 root_poa
->create_POA ("childPOA",
57 // Creation of childPOA is over. Destroy the Policy objects.
58 for (CORBA::ULong i
= 0;
59 i
< policies
.length ();
62 policies
[i
]->destroy ();
65 poa_manager
->activate ();
68 root_poa
->destroy (true, true);
75 catch (const CORBA::Exception
& ex
)
77 ex
._tao_print_exception ("Exception raised");
84 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
88 for (int i
=0; i
<10; i
++)
90 result
= test_with_bidir_poa (argc
, argv
, "poa_1", 1);
91 ACE_ASSERT (result
== 0);
93 result
= test_with_bidir_poa (argc
, argv
, "poa_2", 1);
94 ACE_ASSERT (result
== 0);
96 ACE_DEBUG ((LM_DEBUG
, "Completed OK\n"));