1 //============================================================================
7 // Server class to perform testing of TAO's collocation mechanism.
12 //=============================================================================
14 #include "Collocation_Tester.h"
16 Collocation_Test::Collocation_Test ()
21 Collocation_Test::shutdown ()
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",
79 Collocation_Test::parse_args (int /*argc*/,
80 ACE_TCHAR
*[] /*argv*/)
86 Collocation_Test::test_narrow ()
88 Diamond::Top_var top
=
89 Diamond::Top::_narrow (this->diamond_obj_
.in ());
91 Diamond::Left_var left
=
92 Diamond::Left::_narrow (this->diamond_obj_
.in ());
94 Diamond::Right_var right
=
95 Diamond::Right::_narrow (this->diamond_obj_
.in ());
97 Diamond::Buttom_var buttom
=
98 Diamond::Buttom::_narrow (this->diamond_obj_
.in ());
100 CORBA::String_var str
= top
->shape ();
101 ACE_DEBUG ((LM_DEBUG
, "Calling top->shape: %C\n", str
.in ()));
103 str
= left
->shape ();
104 ACE_DEBUG ((LM_DEBUG
, "Calling left->shape: %C\n", str
.in ()));
106 str
= right
->shape ();
107 ACE_DEBUG ((LM_DEBUG
, "Calling right->shape: %C\n", str
.in ()));
109 str
= buttom
->shape ();
110 ACE_DEBUG ((LM_DEBUG
, "Calling buttom->shape: %C\n", str
.in ()));
116 Collocation_Test::run ()
118 this->poa_manager_
->activate ();
120 this->test_narrow ();