1 #include "ace/Get_Opt.h"
4 #include "tao/ORB_Core.h"
5 #include "tao/Resource_Factory.h"
7 ACE_TCHAR
const *orb1_args
=
8 ACE_TEXT ("AAA -ORBGestalt LOCAL -ORBSvcConf MY_TEST_ORB_1.conf");
9 ACE_TCHAR
const *orb2_args
=
11 int expected_value
= 0;
14 parse_args (int argc
, ACE_TCHAR
*argv
[])
16 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT ("a:b:e:"));
19 while ((c
= get_opts ()) != -1)
23 orb1_args
= get_opts
.opt_arg ();
26 orb2_args
= get_opts
.opt_arg ();
29 expected_value
= ACE_OS::atoi (get_opts
.opt_arg ());
33 ACE_ERROR_RETURN ((LM_ERROR
,
34 ACE_TEXT ("usage: %s")
35 ACE_TEXT (" -a <orb1_args>")
36 ACE_TEXT (" -b <orb2_args>")
37 ACE_TEXT (" -e <expected value of ORBConnectionCacheMax>")
42 // Indicates successful parsing of the command line
47 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
51 if (parse_args (argc
, argv
) != 0)
56 ACE_ARGV
orb1_argv (orb1_args
);
57 int orb1_argc
= orb1_argv
.argc ();
59 ACE_ARGV
orb2_argv (orb2_args
);
60 int orb2_argc
= orb2_argv
.argc ();
63 "Initialize ORB instances...\n"));
66 CORBA::ORB_init (orb1_argc
, orb1_argv
.argv (), "AAA");
69 CORBA::ORB_init (orb2_argc
, orb2_argv
.argv (), "BBB");
72 "After ORB_init...\n"));
74 TAO_Resource_Factory
*trf1
= orb1
->orb_core ()->resource_factory ();
78 ACE_ERROR_RETURN ((LM_ERROR
,
79 ACE_TEXT ("ERROR: Can not resolve ")
80 ACE_TEXT ("Resource Factory for orb1.\n")),
84 TAO_Resource_Factory
*trf2
= orb2
->orb_core ()->resource_factory ();
88 ACE_ERROR_RETURN ((LM_ERROR
,
89 ACE_TEXT ("ERROR: Can not resolve ")
90 ACE_TEXT ("Resource Factory for orb2.\n")),
94 if (trf1
->cache_maximum () == trf2
->cache_maximum () ||
95 (0 != expected_value
&& trf1
->cache_maximum () != expected_value
))
97 ACE_ERROR_RETURN ((LM_ERROR
,
98 ACE_TEXT ("ERROR: '-ORBConnectionCacheMax' is ")
99 ACE_TEXT ("applied globally while it's expected ")
100 ACE_TEXT ("to apply to the first ORB only.\n")),
107 ACE_DEBUG ((LM_DEBUG
,
108 ACE_TEXT ("'-ORBConnectionCacheMax' is applied to the first ")
109 ACE_TEXT ("ORB only as expected.\n")));
111 catch (const CORBA::Exception
& ex
)
113 ex
._tao_print_exception ("Caught Exception in main:\n");