Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_2287_Regression / client.cpp
blob240fd36b5a8cbaf70974b58c0e7fe4464ea256ae
1 #include "TestS.h"
2 #include "ace/Get_Opt.h"
3 // Ensure that the PI library is linked in when building statically
4 #include "tao/PI/PI.h"
5 #include "orbsvcs/FaultTolerance/FT_ClientService_Activate.h"
6 #include "Hello.h"
9 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
11 int
12 parse_args (int argc, ACE_TCHAR *argv[])
14 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
15 int c;
17 while ((c = get_opts ()) != -1)
18 switch (c)
20 case 'k':
21 ior = get_opts.opt_arg ();
22 break;
24 case '?':
25 default:
26 ACE_ERROR_RETURN ((LM_ERROR,
27 "usage: %s "
28 "-k <ior> "
29 "\n",
30 argv [0]),
31 -1);
33 // Indicates successful parsing of the command line
34 return 0;
37 int
38 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
40 CORBA::Boolean result = 0;
41 try
43 CORBA::ORB_var orb =
44 CORBA::ORB_init (argc, argv);
46 if (parse_args (argc, argv) != 0)
47 return 1;
49 CORBA::Object_var tmp =
50 orb->string_to_object(ior);
52 Test::Hello_var hello =
53 Test::Hello::_narrow(tmp.in ());
55 if (CORBA::is_nil (hello.in ()))
57 ACE_ERROR_RETURN ((LM_DEBUG,
58 "Test failed - Not regression - Unexpected Nil Test::Hello reference <%s>\n",
59 ior),
60 1);
63 // Check this isn't generating transients for any other reason
64 hello->ping ();
67 try
69 hello->throw_location_forward ();
71 ACE_DEBUG ((LM_ERROR, "REGRESSION - Test has failed !!!\n"));
72 result = 1;
74 catch (const CORBA::TRANSIENT& my_ex)
76 ACE_UNUSED_ARG (my_ex);
77 ACE_DEBUG ((LM_DEBUG, "Client catches a TRANSIENT, as expected. No problem !\n"));
80 hello->shutdown ();
82 orb->destroy ();
84 catch (const CORBA::Exception& ex)
86 ex._tao_print_exception (
87 "Test failed (Not regression) because unexpected exception caught:");
88 return 1;
91 if (result)
93 ACE_DEBUG ((LM_ERROR, "Error: REGRESSION identified!!!\n"));
95 else
97 ACE_DEBUG ((LM_DEBUG, "Test passed !!!\n"));
99 return result;