Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_2316_Regression / client.cpp
blob552fbf18e4561b4dd3e486d48215608d8814b837
1 #include "Test_impl.h"
2 #include "ace/OS_NS_stdio.h"
3 #include "ace/Get_Opt.h"
5 const ACE_TCHAR *ior = ACE_TEXT("file://server.ior");
6 const ACE_TCHAR *uipmc_ior = ACE_TEXT("corbaloc:miop:1.0@1.0-domain-1/127.0.0.1:23232");
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;
34 int
35 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
37 int result = 0;
38 try
40 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
42 if (parse_args (argc, argv) != 0)
43 return 1;
45 CORBA::Object_var poa_object =
46 orb->resolve_initial_references("RootPOA");
48 PortableServer::POA_var root_poa =
49 PortableServer::POA::_narrow (poa_object.in ());
51 PortableServer::POAManager_var poa_manager =
52 root_poa->the_POAManager ();
53 poa_manager->activate ();
55 CORBA::Object_var obj =orb->string_to_object (uipmc_ior);
57 CORBA::Object_var tmp = orb->string_to_object (ior);
58 server_var server = server::_narrow (tmp.in ());
60 try
62 server->method (obj.in());
64 ACE_DEBUG ((LM_DEBUG, "Test passed !!\n"));
66 catch (const CORBA::SystemException& marshal)
68 ACE_DEBUG ((LM_ERROR, "Test Failed - Regression. "
69 "Sending UIPMC object ref to server failed with:\n"));
70 marshal._tao_print_exception ("Exception :\n");
71 result = 1;
74 server->shutdown ();
76 catch(const CORBA::SystemException& e)
78 e._tao_print_exception ("Unexpected exception - not a regression.\n");
79 result = 1;
81 return result;