1 #include "ace/Get_Opt.h"
2 #include "Controller.h"
3 #include "Manager_Handler.h"
5 const ACE_TCHAR
*ior
= ACE_TEXT("file://test.ior");
8 parse_args (int argc
, ACE_TCHAR
*argv
[])
10 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
13 while ((c
= get_opts ()) != -1)
17 ior
= get_opts
.opt_arg ();
21 ACE_ERROR_RETURN ((LM_ERROR
,
28 // Indicates successful parsing of the command line
33 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
38 CORBA::ORB_init (argc
, argv
);
40 CORBA::Object_var object
=
41 orb
->resolve_initial_references("RootPOA");
43 if (CORBA::is_nil (object
.in ()))
44 ACE_ERROR_RETURN ((LM_ERROR
,
45 " (%P|%t) Unable to initialize the POA.\n"),
48 PortableServer::POA_var root_poa
=
49 PortableServer::POA::_narrow (object
.in ());
51 PortableServer::POAManager_var poa_manager
=
52 root_poa
->the_POAManager ();
54 if (parse_args (argc
, argv
) != 0)
57 Controller controller_impl
;
59 PortableServer::ObjectId_var id
=
60 root_poa
->activate_object (&controller_impl
);
62 CORBA::Object_var object_act
= root_poa
->id_to_reference (id
.in ());
64 Test::Controller_var controller
=
65 Test::Controller::_narrow (object_act
.in ());
67 object
= orb
->string_to_object (ior
);
69 Test::Manager_var manager
=
70 Test::Manager::_narrow (object
.in ());
72 if (CORBA::is_nil (manager
.in ()))
73 ACE_ERROR_RETURN ((LM_ERROR
,
77 Manager_Handler
handler_impl (manager
.in (),
80 id
= root_poa
->activate_object (&handler_impl
);
82 object_act
= root_poa
->id_to_reference (id
.in ());
84 Test::AMI_ManagerHandler_var handler
=
85 Test::AMI_ManagerHandler::_narrow (object_act
.in ());
87 poa_manager
->activate ();
89 const CORBA::Short worker_count
= 10;
90 manager
->sendc_start_workers (handler
.in (),
95 ACE_Time_Value
tv (30, 0);
98 controller_impl
.dump_results ();
100 manager
->shutdown ();
102 root_poa
->destroy (1, 1);
106 catch (const CORBA::Exception
& ex
)
108 ex
._tao_print_exception ("Exception caught:");