Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / ImplRepo / MT_stress / client.cpp
blob5ee351c8207e71b3c6fa298bf44efffd7fe817c4
1 // This is a simple test of an ImR using the corba interfaces
2 // Start with -orbinitref Test=...
4 #include "testC.h"
5 #include "orbsvcs/CosNamingC.h"
6 #include "ace/Log_Msg.h"
7 #include "ace/Get_Opt.h"
9 ACE_CString server = "TestObject_0";
11 int parse_args (int argc, ACE_TCHAR* argv[])
13 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("s:m:"));
14 int c;
16 while ((c = get_opts ()) != -1)
18 switch (c)
20 case 's':
21 server = ACE_TEXT_ALWAYS_CHAR(get_opts.opt_arg ());
22 break;
23 default:
24 ACE_ERROR_RETURN ((LM_ERROR,
25 "usage: %s"
26 " [-s <servername>]"
27 "\n",
28 argv[0]),1);
32 return 0;
35 int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
37 try
39 CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
40 if (parse_args (argc, argv) != 0)
41 return -1;
43 CORBA::Object_var nsobj = orb->resolve_initial_references ("NameService");
44 CosNaming::NamingContext_var nc =
45 CosNaming::NamingContext::_narrow (nsobj.in ());
46 CosNaming::Name name(1);
47 name.length (1);
48 name[0].id = CORBA::string_dup (server.c_str ());
50 try
52 nsobj = nc->resolve (name);
54 catch (CosNaming::NamingContext::NotFound &)
56 return 1;
59 test_var test = test::_narrow(nsobj.in());
60 ACE_ASSERT(! is_nil(test.in()));
62 CORBA::Long n = test->get();
63 CORBA::Long m = test->get();
64 if (m == n + 1)
65 return 0;
66 return 1;
68 catch (const CORBA::Exception& ex)
70 ex._tao_print_exception ("client:");
72 return -1;