Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Portable_Interceptors / ORB_Shutdown / client.cpp
blob03a91660e71e3f946eaf32db0debe79352d6b1e5
1 // -*- C++ -*-
2 #include "ace/Get_Opt.h"
3 #include "testC.h"
5 const ACE_TCHAR *ior = 0;
7 int
8 parse_args (int argc, ACE_TCHAR *argv[])
10 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
11 int c;
13 while ((c = get_opts ()) != -1)
14 switch (c)
16 case 'k':
18 if (ior == 0)
19 ior = get_opts.opt_arg ();
21 break;
22 default:
23 ACE_ERROR_RETURN ((LM_ERROR,
24 "Usage: %s "
25 "-k IOR\n",
26 argv[0]),
27 -1);
30 return 0;
33 int
34 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
36 try
38 CORBA::ORB_var orb = CORBA::ORB_init (argc,
39 argv,
40 "Client ORB");
42 if (::parse_args (argc, argv) != 0)
43 return -1;
45 CORBA::Object_var object =
46 orb->string_to_object (ior);
48 test_var server = test::_narrow (object.in ());
50 if (CORBA::is_nil (server.in ()))
52 ACE_ERROR_RETURN ((LM_ERROR,
53 "Object reference <%s> is nil.\n",
54 ior),
55 1);
58 server->hello ();
60 server->shutdown ();
62 orb->destroy ();
64 catch (const CORBA::Exception& ex)
66 ex._tao_print_exception ("Caught exception:");
67 return -1;
70 ACE_DEBUG ((LM_INFO,
71 "PortableInterceptor ORB::shutdown() test passed.\n"));
73 return 0;