Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / Optimized_Connection / oc_client.cpp
blobcb8915cd7d00ce79f778f95030e9f6084e8055b6
1 #include "TestC.h"
2 #include "ace/Get_Opt.h"
4 #include "tao/Strategies/advanced_resource.h"
5 #include "tao/Strategies/OC_Endpoint_Selector_Loader.h"
7 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
9 int
10 parse_args (int argc, ACE_TCHAR *argv[])
12 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
13 int c;
15 while ((c = get_opts ()) != -1)
16 switch (c)
18 case 'k':
19 ior = get_opts.opt_arg ();
20 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 try
40 CORBA::ORB_var orb =
41 CORBA::ORB_init (argc, argv);
43 if (parse_args (argc, argv) != 0)
44 return 1;
46 CORBA::Object_var tmp =
47 orb->string_to_object(ior);
49 Test::Hello_var hello =
50 Test::Hello::_narrow(tmp.in ());
52 if (CORBA::is_nil (hello.in ()))
54 ACE_ERROR_RETURN ((LM_DEBUG,
55 "Nil Test::Hello reference <%s>\n",
56 ior),
57 1);
60 CORBA::String_var the_string = hello->get_string ();
62 ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned <%C>\n",
63 the_string.in ()));
65 hello->shutdown ();
67 orb->destroy ();
69 catch (const CORBA::TRANSIENT& )
71 ACE_DEBUG ((LM_DEBUG, "(%P|%t) Expected CORBA::TRANSIENT caught\n"));
73 catch (const CORBA::Exception& ex)
75 ex._tao_print_exception ("Exception caught:");
76 return 1;
79 return 0;