summaryrefslogtreecommitdiff
path: root/TAO/tests/Bug_2503_Regression/test_i.cpp
blob: af9c6b79500fd091631c6a93ebdf4c29d085c26e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// $Id$

#include "test_i.h"

#include "tao/Utils/Servant_Var.h"

test_i::
test_i(CORBA::ORB_ptr orb)
{
 this->orb_ = CORBA::ORB::_duplicate (orb);
}

void test_i::
the_operation(CORBA::Long & x)
{
  x = 42;
}

char *
test_i::
create_and_activate_server()
{
  TAO::Utils::Servant_Var<test_i> impl(
      new test_i (this->orb_.in ()));

  CORBA::Object_var poa_object =
    this->orb_->resolve_initial_references("RootPOA");

  PortableServer::POA_var root_poa =
    PortableServer::POA::_narrow (poa_object.in ());

  PortableServer::ObjectId_var id =
    root_poa->activate_object (impl.in ());

  CORBA::Object_var object = root_poa->id_to_reference (id.in ());

  Test_var ref = Test::_narrow (object.in ());

  return this->orb_->object_to_string(ref.in());
}

void
test_i::shutdown (void)
{
  if (!CORBA::is_nil (this->orb_.in ()))
    this->orb_->shutdown (0);
}