Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / Bug_3198_Regression / bug_3198_regression.cpp
blob40e905106ff76c272fc66305fd4fc4a01476675b
1 #include "tao/ORB_Core.h"
2 #include "tao/SystemException.h"
3 #include "tao/PolicyC.h"
4 #include "ace/Get_Opt.h"
6 const ACE_TCHAR *ior = ACE_TEXT ("corbaloc:iiop:localhost:12345/MyObjectKey");
8 int
9 parse_args (int argc, ACE_TCHAR *argv[])
11 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
12 int c;
14 while ((c = get_opts ()) != -1)
15 switch (c)
17 case 'k':
18 ior = get_opts.opt_arg ();
19 break;
21 case '?':
22 default:
23 ACE_ERROR_RETURN ((LM_ERROR,
24 "usage: %s "
25 "-k <ior> "
26 "\n",
27 argv [0]),
28 -1);
30 // Indicates successful parsing of the command line
31 return 0;
35 int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
37 try
39 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
41 if (parse_args (argc, argv) != 0)
42 return 1;
44 CORBA::Object_var obj = orb->string_to_object (ior);
45 CORBA::PolicyList_var policies;
46 CORBA::Boolean result = obj->_validate_connection (policies.out());
47 if (result)
49 ACE_ERROR_RETURN ((LM_ERROR,
50 " (%P|%t) got true from _validate_connection\n"),
51 1);
54 catch (const CORBA::TRANSIENT&)
56 ACE_DEBUG ((LM_DEBUG, "Caught transient as expected\n"));
58 catch (const CORBA::Exception& ex)
60 ex._tao_print_exception ("Exception caught:");
61 return 1;
63 return 0;