Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Bug_1330_Regression / client.cpp
blob6a9214cc9f003d2479ecb3c7e335699a0766e07a
1 #include "TestC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR *ior = ACE_TEXT("corbaloc:iiop:localhost:12345/Name\\2dwith\\2dhyphens");
5 bool shutdown_server = false;
7 int
8 parse_args (int argc, ACE_TCHAR *argv[])
10 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("sk:"));
11 int c;
13 while ((c = get_opts ()) != -1)
14 switch (c)
16 case 'k':
17 ior = get_opts.opt_arg ();
18 break;
19 case 's':
20 shutdown_server = true;
21 break;
22 case '?':
23 default:
24 ACE_ERROR_RETURN ((LM_ERROR,
25 "usage: %s "
26 "-k <ior> "
27 "\n",
28 argv [0]),
29 -1);
31 // Indicates successful parsing of the command line
32 return 0;
35 int
36 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
38 int result = 0;
39 try
41 CORBA::ORB_var orb =
42 CORBA::ORB_init (argc, argv);
44 if (parse_args (argc, argv) != 0)
45 return 1;
47 CORBA::Object_var tmp =
48 orb->string_to_object(ior);
50 Test_var server =
51 Test::_narrow(tmp.in ());
53 if (CORBA::is_nil (server.in ()))
55 ACE_ERROR_RETURN ((LM_DEBUG,
56 "Nil Test::Server reference <%s>\n",
57 ior),
58 1);
61 server->test_method();
62 result =0;
64 if (shutdown_server)
66 server->shutdown ();
69 orb->destroy ();
71 catch (const CORBA::Exception&)
73 result = 1;
76 return result;