2 #include "Server_ORBInitializer.h"
3 #include "tao/ORBInitializer_Registry.h"
5 #include "tao/PortableServer/PortableServer.h"
6 #include "ace/Log_Msg.h"
9 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
13 PortableInterceptor::ORBInitializer_ptr temp_initializer
=
14 PortableInterceptor::ORBInitializer::_nil ();
16 ACE_NEW_RETURN (temp_initializer
,
17 Server_ORBInitializer
,
18 -1); // No CORBA exceptions yet!
19 PortableInterceptor::ORBInitializer_var orb_initializer
=
22 PortableInterceptor::register_orb_initializer (orb_initializer
.in ());
24 CORBA::ORB_var orb
= CORBA::ORB_init (argc
,
28 // Create the test policy.
30 const CORBA::ULong val
= 40442;
34 CORBA::Policy_var
p (orb
->create_policy (Test::POLICY_TYPE
,
37 const CORBA::PolicyType ptype
=
41 if (ptype
!= Test::POLICY_TYPE
)
42 throw CORBA::INTERNAL ();
44 Test::Policy_var
policy (Test::Policy::_narrow (p
.in ()));
46 const CORBA::ULong pval
= policy
->value ();
50 throw CORBA::INTERNAL ();
52 CORBA::Object_var obj
=
53 orb
->resolve_initial_references ("RootPOA");
55 PortableServer::POA_var root_poa
=
56 PortableServer::POA::_narrow (obj
.in ());
58 if (CORBA::is_nil (root_poa
.in ()))
59 ACE_ERROR_RETURN ((LM_ERROR
,
60 "Unable to obtain RootPOA reference.\n"),
63 PortableServer::POAManager_var poa_manager
=
64 root_poa
->the_POAManager ();
66 CORBA::PolicyList
policies (1);
69 policies
[0] = policy
->copy ();
71 PortableServer::POA_var poa
=
72 root_poa
->create_POA ("Test POA",
78 poa_manager
->activate ();
80 root_poa
->destroy (true, true);
86 "PolicyFactory test succeeded.\n"));
88 catch (const CORBA::Exception
& ex
)
90 ex
._tao_print_exception ("PolicyFactory test:");