Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_3215_Regression / client.cpp
bloba54dca9e813e8c40ea19bdb0b0253545a0a56520
1 // Ensure that the PI library is linked in when building statically
2 #include "tao/PI/PI.h"
3 #include "TestS.h"
4 #include "ace/Get_Opt.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);
47 if (parse_args (argc, argv) != 0)
48 return 1;
50 CORBA::Object_var tmp =
51 orb->string_to_object(ior);
54 Test::Hello_var hello =
55 Test::Hello::_narrow(tmp.in ());
58 if (CORBA::is_nil (hello.in ()))
60 ACE_ERROR_RETURN ((LM_DEBUG,
61 "Test failed - Not regression - Unexpected Nil Test::Hello reference <%s>\n",
62 ior),
63 1);
66 // Check this isn't generating transients for any other reason
67 hello->ping ();
69 try
71 hello->throw_location_forward ();
74 ACE_DEBUG ((LM_ERROR, "REGRESSION - Test has failed !!!\n"));
75 result = 1;
77 catch (const CORBA::TRANSIENT& my_ex)
79 ACE_UNUSED_ARG (my_ex);
80 ACE_DEBUG ((LM_DEBUG, "Client catches a TRANSIENT, as expected. No problem !\n"));
84 hello->shutdown ();
87 orb->destroy ();
89 catch (const CORBA::Exception& ex)
91 ex._tao_print_exception (
92 "Test failed (Not regression) because unexpected exception caught:");
93 return 1;
97 if (result)
99 ACE_DEBUG ((LM_ERROR, "Error: REGRESSION identified!!!\n"));
101 else
103 ACE_DEBUG ((LM_DEBUG, "Test passed !!!\n"));
105 return result;