Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / Collocation / Collocation_Tester.cpp
blobad9ee246c1615c1980a9557a9964c57746e0f4a3
1 //============================================================================
2 //
3 // =FILENAME
4 // Collocation_Test.h
5 //
6 // =DESCRIPTION
7 // Server class to perform testing of TAO's collocation mechanism.
8 //
9 // =AUTHOR
10 // Nanbor Wang
12 //=============================================================================
14 #include "Collocation_Tester.h"
16 Collocation_Test::Collocation_Test ()
20 void
21 Collocation_Test::shutdown ()
23 this->root_poa_->destroy (1, 1);
24 this->orb_->destroy ();
27 int
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);
34 if (result != 0)
35 return result;
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
42 this->root_poa_ =
43 PortableServer::POA::_narrow (obj.in ());
45 // Get the POAManager of RootPOA
46 this->poa_manager_ =
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 ();
56 id =
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 ());
62 id =
63 this->root_poa_->activate_object (&this->left_servant_);
65 id =
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",
72 str.in()));
74 return 0;
78 int
79 Collocation_Test::parse_args (int /*argc*/,
80 ACE_TCHAR *[] /*argv*/)
82 return 0;
85 int
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 ()));
112 return 0;
116 Collocation_Test::run ()
118 this->poa_manager_->activate ();
120 this->test_narrow ();
122 return 0;