1 // This include is needed for static builds to initialize DII_Arguments_Converter
3 //#include "tao/DynamicInterface/DII_Arguments_Converter_Impl.h"
5 #include "Server_Task.h"
6 #include "Client_Task.h"
7 #include "ace/Get_Opt.h"
8 #include "ace/Argv_Type_Converter.h"
9 #include "ace/SString.h"
10 #include "ace/Manual_Event.h"
12 const ACE_TCHAR
*output
= ACE_TEXT("server.ior");
13 const ACE_TCHAR
*input
= ACE_TEXT("file://server.ior");
14 const ACE_TCHAR
*simple_test_output
= ACE_TEXT("simple_test.ior");
15 const ACE_TCHAR
*simple_test_input
= ACE_TEXT("file://simple_test.ior");
16 // static int named_orbs = 0;
17 ACE_CString server_orb
;
18 ACE_CString client_orb
;
20 CORBA::Boolean debug
= 0;
23 parse_args (int argc
, ACE_TCHAR
*argv
[])
25 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:o:nd"));
28 while ((c
= get_opts ()) != -1)
32 output
= get_opts
.opt_arg ();
35 input
= get_opts
.opt_arg ();
39 server_orb
.set ("server_orb");
40 client_orb
.set ("client_orb");
47 // This is a hack but that is okay!
50 // Indicates successful parsing of the command line
55 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
63 ACE_Argv_Type_Converter
satc (argc
, argv
);
65 CORBA::ORB_init (satc
.get_argc (),
66 satc
.get_TCHAR_argv (),
70 Server_Task
server_task (output
,
74 ACE_Thread_Manager::instance ());
76 if (server_task
.activate (THR_NEW_LWP
| THR_JOINABLE
,
80 ACE_ERROR ((LM_ERROR
, "Error activating server task\n"));
83 // Wait for the server thread to do some processing
86 ACE_Argv_Type_Converter
catc (argc
, argv
);
88 CORBA::ORB_init (catc
.get_argc (),
89 catc
.get_TCHAR_argv (),
92 Client_Task
client_task (input
,
95 ACE_Thread_Manager::instance ());
97 if (client_task
.activate (THR_NEW_LWP
| THR_JOINABLE
,
101 ACE_ERROR ((LM_ERROR
, "Error activating client task\n"));
104 // Wait for the client and server to finish
105 ACE_Thread_Manager::instance ()->wait ();
107 // Now that all threads have completed we can destroy the ORB
109 if (server_orb
!= client_orb
)
114 CORBA::ULong errors
= client_task
.error_count () + server_task
.error_count ();
117 ACE_DEBUG((LM_DEBUG
, "(%P|%t) test passed\n"));
121 ACE_DEBUG((LM_DEBUG
, "(%P|%t) test failed - error_count=%u\n", errors
));
125 catch (const CORBA::Exception
&)
127 // Ignore exceptions..