Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Bug_1269_Regression / shutdown.cpp
blob2048cbef6ec8c2672157cc9ffeaaada9a32e3f6f
1 #include "TestC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
6 int
7 parse_args (int argc, ACE_TCHAR *argv[]);
9 int
10 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
12 try
14 CORBA::ORB_var orb =
15 CORBA::ORB_init (argc, argv);
17 if (parse_args (argc, argv) != 0)
18 return 1;
20 CORBA::Object_var tmp =
21 orb->string_to_object (ior);
23 Test::Echo_Caller_var server =
24 Test::Echo_Caller::_narrow (tmp.in ());
26 if (CORBA::is_nil (server.in ()))
28 ACE_ERROR_RETURN ((LM_DEBUG,
29 "Nil Test::Echo_Caller reference <%s>\n",
30 ior),
31 1);
34 server->shutdown ();
36 orb->destroy ();
38 catch (const CORBA::Exception& ex)
40 ex._tao_print_exception ("Exception caught:");
41 return 1;
44 return 0;
47 int
48 parse_args (int argc, ACE_TCHAR *argv[])
50 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
51 int c;
53 while ((c = get_opts ()) != -1)
54 switch (c)
56 case 'k':
57 ior = get_opts.opt_arg ();
58 break;
60 case '?':
61 default:
62 ACE_ERROR_RETURN ((LM_ERROR,
63 "usage: %s "
64 "-k <ior> "
65 "\n",
66 argv [0]),
67 -1);
69 // Indicates successful parsing of the command line
70 return 0;