1 // This is a simple test of an ImR using the corba interfaces
2 // Start with -orbinitref Test=...
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:"));
16 while ((c
= get_opts ()) != -1)
21 server
= ACE_TEXT_ALWAYS_CHAR(get_opts
.opt_arg ());
24 ACE_ERROR_RETURN ((LM_ERROR
,
35 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
39 CORBA::ORB_var orb
= CORBA::ORB_init(argc
, argv
);
40 if (parse_args (argc
, argv
) != 0)
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);
48 name
[0].id
= CORBA::string_dup (server
.c_str ());
52 nsobj
= nc
->resolve (name
);
54 catch (CosNaming::NamingContext::NotFound
&)
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();
68 catch (const CORBA::Exception
& ex
)
70 ex
._tao_print_exception ("client:");