1 //============================================================================
7 // Server class to perform testing of TAO's collocation mechanism.
12 //=============================================================================
14 #include "Collocation_Tester.h"
16 Collocation_Test::Collocation_Test (void)
21 Collocation_Test::shutdown (void)
23 this->root_poa_
->destroy (1, 1);
24 this->orb_
->destroy ();
28 Collocation_Test::init (int argc
, ACE_TCHAR
*argv
[])
30 // Initialize the ORB.
31 this->orb_
= CORBA::ORB_init (argc
, argv
);
33 int result
= this->parse_args (argc
, argv
);
37 // Get an Object reference to RootPOA.
38 CORBA::Object_var obj
=
39 this->orb_
->resolve_initial_references ("RootPOA");
41 // Narrow the Object reference to a POA reference
43 PortableServer::POA::_narrow (obj
.in ());
45 // Get the POAManager of RootPOA
47 this->root_poa_
->the_POAManager ();
49 // Activate the diamond servant and its base classes under RootPOA.
50 PortableServer::ObjectId_var id
=
51 this->root_poa_
->activate_object (&this->top_servant_
);
53 // // We only care about the most derived class here.
54 // this->diamond_obj_ = this->diamond_servant_._this ();
57 this->root_poa_
->activate_object (&this->diamond_servant_
);
59 // We only care about the most derived class here.
60 this->diamond_obj_
= this->root_poa_
->id_to_reference (id
.in ());
63 this->root_poa_
->activate_object (&this->left_servant_
);
66 this->root_poa_
->activate_object (&this->right_servant_
);
68 CORBA::String_var str
=
69 this->orb_
->object_to_string (this->diamond_obj_
.in ());
71 ACE_DEBUG ((LM_DEBUG
, "Diamond Servant activated:\n %C\n",
80 Collocation_Test::parse_args (int /*argc*/,
81 ACE_TCHAR
*[] /*argv*/)
87 Collocation_Test::test_narrow (void)
89 Diamond::Top_var top
=
90 Diamond::Top::_narrow (this->diamond_obj_
.in ());
92 Diamond::Left_var left
=
93 Diamond::Left::_narrow (this->diamond_obj_
.in ());
95 Diamond::Right_var right
=
96 Diamond::Right::_narrow (this->diamond_obj_
.in ());
98 Diamond::Buttom_var buttom
=
99 Diamond::Buttom::_narrow (this->diamond_obj_
.in ());
101 CORBA::String_var str
= top
->shape ();
102 ACE_DEBUG ((LM_DEBUG
, "Calling top->shape: %C\n", str
.in ()));
104 str
= left
->shape ();
105 ACE_DEBUG ((LM_DEBUG
, "Calling left->shape: %C\n", str
.in ()));
107 str
= right
->shape ();
108 ACE_DEBUG ((LM_DEBUG
, "Calling right->shape: %C\n", str
.in ()));
110 str
= buttom
->shape ();
111 ACE_DEBUG ((LM_DEBUG
, "Calling buttom->shape: %C\n", str
.in ()));
117 Collocation_Test::run (void)
119 this->poa_manager_
->activate ();
121 this->test_narrow ();