Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Bug_2188_Regression / client.cpp
blob172238de6b514c8f459bdce4f412866d4fcbf48f
1 #include "brokenC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR *ior = ACE_TEXT("file://broken.ior");
6 int
7 parse_args (int argc, ACE_TCHAR *argv[])
9 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
10 int c;
12 while ((c = get_opts ()) != -1)
13 switch (c)
15 case 'k':
16 ior = get_opts.opt_arg ();
17 break;
19 case '?':
20 default:
21 ACE_ERROR_RETURN ((LM_ERROR,
22 "usage: %s "
23 "-k <ior> "
24 "\n",
25 argv [0]),
26 -1);
28 // Indicates successful parsing of the command line
29 return 0;
32 int
33 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
35 ServerAdmin_var saobj;
36 CORBA::ORB_var orb;
38 try
40 orb = CORBA::ORB_init (argc, argv);
42 if (parse_args (argc, argv) != 0)
43 return 1;
45 CORBA::Object_var tmp =
46 orb->string_to_object(ior);
48 saobj = ServerAdmin::_narrow (tmp.in());
50 if (CORBA::is_nil (saobj.in ()))
52 ACE_ERROR_RETURN ((LM_DEBUG,
53 "Nil ServerAdmin reference <%s>\n",
54 ior),
55 1);
58 ArrayTest_var atobj = saobj->target();
60 CharArray_var char_array = CharArray_alloc();
61 for (int i = 0; i < 10; i++)
62 char_array.inout ()[i] = (char)('a' + i);
63 atobj->a_charArray (char_array.in ());
65 ACE_DEBUG ((LM_DEBUG, "a_charArray worked OK.\n"));
67 catch (const CORBA::Exception& ex)
69 ex._tao_print_exception ("Exception caught:");
72 saobj->shutdown();
74 orb->destroy ();
75 return 0;