1 // *******************************************************************
3 // This test links in RTCORBA and RTPortableServer and creates two
4 // distinct RT ORB's. It then activates an object using the RT POA
5 // from each RT ORB. Prior to fixing the TAO_Policy_Validator,
6 // activating the second object would cause a segmentation fault.
7 // This was caused by the RT Policy Validator not being added correctly
8 // to the ORB Core's policy validator list.
10 // *******************************************************************
12 #include "tao/corba.h"
15 class TestMonitorable_i
: public virtual POA_Arch_Idl::Monitorable
18 TestMonitorable_i () {}
22 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
27 CORBA::ORB_init (argc
, argv
, "orb1");
29 CORBA::ORB_init (argc
, argv
, "orb2");
31 CORBA::Object_var poaObj_var
=
32 orb1
->resolve_initial_references ("RootPOA");
33 PortableServer::POA_var rootPoa
=
34 PortableServer::POA::_narrow (poaObj_var
.in ());
35 PortableServer::POAManager_var poaManager
=
36 rootPoa
->the_POAManager ();
38 CORBA::Object_var poaObj_var2
=
39 orb2
->resolve_initial_references ("RootPOA");
40 PortableServer::POA_var rootPoa2
=
41 PortableServer::POA::_narrow (poaObj_var2
.in ());
42 PortableServer::POAManager_var poaManager2
=
43 rootPoa2
->the_POAManager ();
45 poaManager2
->activate ();
46 poaManager
->activate ();
48 TestMonitorable_i
* monitorable_i
= 0;
49 ACE_NEW_RETURN (monitorable_i
, TestMonitorable_i
, 1);
50 PortableServer::ServantBase_var monitorable_var
= monitorable_i
;
52 TestMonitorable_i
* m2
= 0;
53 ACE_NEW_RETURN (m2
, TestMonitorable_i
, 1);
54 PortableServer::ServantBase_var m2_var
= m2
;
56 PortableServer::ObjectId_var monitorableId1_var
=
57 rootPoa
->activate_object (monitorable_var
.in ());
58 CORBA::Object_var obj1
=
59 rootPoa
->id_to_reference (monitorableId1_var
.in ());
60 Arch_Idl::Monitorable_var monitorable1
=
61 Arch_Idl::Monitorable::_narrow (obj1
.in ());
63 PortableServer::ObjectId_var monitorableId2_var
=
64 rootPoa2
->activate_object (m2_var
.in ());
65 CORBA::Object_var obj2
=
66 rootPoa2
->id_to_reference (monitorableId2_var
.in ());
67 Arch_Idl::Monitorable_var monitorable2
=
68 Arch_Idl::Monitorable::_narrow (obj2
.in ());
70 catch (const CORBA::Exception
& ex
)
72 ex
._tao_print_exception ("Caught exception:");