2 #include "ace/Get_Opt.h"
4 // Ensure that the PI library is linked in when building statically
6 #include "orbsvcs/FaultTolerance/FT_ClientService_Activate.h"
8 CORBA::ORB_var orb
= CORBA::ORB::_nil ();
11 parse_args (int argc
, ACE_TCHAR
*argv
[])
13 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT(""));
16 while ((c
= get_opts ()) != -1)
21 ACE_ERROR_RETURN ((LM_ERROR
,
27 // Indicates successful parsing of the command line
31 // Returns false if calling is_equivalent in both directions on the two supplied
32 // IORs does not produce expected result.
34 check_is_equivalent (const char* ior1
, const char * ior2
, CORBA::Boolean expected_result
)
36 CORBA::Boolean result
= 1;
39 CORBA::Object_var object1
=
40 orb
->string_to_object(ior1
);
42 CORBA::Object_var object2
=
43 orb
->string_to_object (ior2
);
45 const char* expected_result_string
= (expected_result
? "true" : "false");
47 if ((object1
->_is_equivalent (object2
.in ())) != expected_result
)
49 ACE_DEBUG ((LM_ERROR
, "Error: Result of <%s>->_is_equivalent (<%s>) is not %s when it should be...\n",
50 ior1
, ior2
, expected_result_string
));
54 if ((object2
->_is_equivalent (object1
.in ())) != expected_result
)
56 ACE_DEBUG ((LM_ERROR
, "Error: Result of <%s>->_is_equivalent (<%s>) is not %s when it should be...\n",
57 ior2
, ior1
, expected_result_string
));
61 catch (const CORBA::Exception
& ex
)
63 ACE_DEBUG ((LM_ERROR
, "Vastly unexpected exception comparing %s and %s:\n", ior1
, ior2
));
64 ex
._tao_print_exception ("Exception:");
71 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
73 CORBA::Boolean result
= 0;
77 CORBA::ORB_init (argc
, argv
);
79 if (parse_args (argc
, argv
) != 0)
82 // ep1 is equivalent to no other IORs - it is not an IOGR, and ep2 is a different endpoint.
83 // The next nine should all be false.
84 if (! check_is_equivalent ("file://ep1.ior", "file://ep1_d1_g1_v1.ior", 0))
86 ACE_DEBUG ((LM_ERROR
, "... it should be false because an IOR is never equivalent to an IOGR\n\n"));
90 if (! check_is_equivalent ("file://ep1.ior", "file://ep1_d1_g1_v2.ior", 0))
92 ACE_DEBUG ((LM_ERROR
, "... it should be false because an IOR is never equivalent to an IOGR\n\n"));
96 if (! check_is_equivalent ("file://ep1.ior", "file://ep1_d1_g2_v1.ior", 0))
98 ACE_DEBUG ((LM_ERROR
, "... it should be false because an IOR is never equivalent to an IOGR\n\n"));
102 if (! check_is_equivalent ("file://ep1.ior", "file://ep1_d2_g1_v1.ior", 0))
104 ACE_DEBUG ((LM_ERROR
, "... it should be false because an IOR is never equivalent to an IOGR\n\n"));
108 if (! check_is_equivalent ("file://ep1.ior", "file://ep2.ior", 0))
110 ACE_DEBUG ((LM_ERROR
, "... it should be false because these are IORs with different endpoints.\n\n"));
114 if (! check_is_equivalent ("file://ep1.ior", "file://ep2_d1_g1_v1.ior", 0))
116 ACE_DEBUG ((LM_ERROR
, "... it should be false because an IOR is never equivalent to an IOGR\n\n"));
120 if (! check_is_equivalent ("file://ep1.ior", "file://ep2_d1_g1_v2.ior", 0))
122 ACE_DEBUG ((LM_ERROR
, "... it should be false because an IOR is never equivalent to an IOGR\n\n"));
126 if (! check_is_equivalent ("file://ep1.ior", "file://ep1_d1_g2_v1.ior", 0))
128 ACE_DEBUG ((LM_ERROR
, "... it should be false because an IOR is never equivalent to an IOGR\n\n"));
132 if (! check_is_equivalent ("file://ep1.ior", "file://ep1_d2_g1_v1.ior", 0))
134 ACE_DEBUG ((LM_ERROR
, "... it should be false because an IOR is never equivalent to an IOGR\n\n"));
138 if (! check_is_equivalent ("file://ep1_d1_g1_v1.ior", "file://ep1_d1_g1_v2.ior", 1))
140 ACE_DEBUG ((LM_ERROR
, "... it should be true because both are IOGRs and the domain and group ids match.\n\n"));
144 if (! check_is_equivalent ("file://ep1_d1_g1_v1.ior", "file://ep1_d1_g2_v1.ior", 0))
146 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
150 if (! check_is_equivalent ("file://ep1_d1_g1_v1.ior", "file://ep1_d2_g1_v1.ior", 0))
152 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
156 if (! check_is_equivalent ("file://ep1_d1_g1_v1.ior", "file://ep2.ior", 0))
158 ACE_DEBUG ((LM_ERROR
, "... it should be false because an IOR is never equivalent to an IOGR\n\n"));
162 if (! check_is_equivalent ("file://ep1_d1_g1_v1.ior", "file://ep2_d1_g1_v1.ior", 1))
164 ACE_DEBUG ((LM_ERROR
, "... it should be true because both are IOGRs and the domain and group ids match.\n\n"));
168 if (! check_is_equivalent ("file://ep1_d1_g1_v1.ior", "file://ep2_d1_g1_v2.ior", 1))
170 ACE_DEBUG ((LM_ERROR
, "... it should be true because both are IOGRs and the domain and group ids match.\n\n"));
174 if (! check_is_equivalent ("file://ep1_d1_g1_v1.ior", "file://ep2_d1_g2_v1.ior", 0))
176 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
180 if (! check_is_equivalent ("file://ep1_d1_g1_v1.ior", "file://ep2_d2_g1_v1.ior", 0))
182 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
186 if (! check_is_equivalent ("file://ep1_d1_g1_v2.ior", "file://ep1_d1_g2_v1.ior", 0))
188 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
192 if (! check_is_equivalent ("file://ep1_d1_g1_v2.ior", "file://ep1_d2_g1_v1.ior", 0))
194 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
198 if (! check_is_equivalent ("file://ep1_d1_g1_v2.ior", "file://ep2.ior", 0))
200 ACE_DEBUG ((LM_ERROR
, "... it should be false because an IOR is never equivalent to an IOGR\n\n"));
204 if (! check_is_equivalent ("file://ep1_d1_g1_v2.ior", "file://ep2_d1_g1_v1.ior", 1))
206 ACE_DEBUG ((LM_ERROR
, "... it should be true because both are IOGRs and the domain and group ids match.\n\n"));
210 if (! check_is_equivalent ("file://ep1_d1_g1_v2.ior", "file://ep2_d1_g1_v2.ior", 1))
212 ACE_DEBUG ((LM_ERROR
, "... it should be true because both are IOGRs and the domain and group ids match.\n\n"));
216 if (! check_is_equivalent ("file://ep1_d1_g1_v2.ior", "file://ep2_d1_g2_v1.ior", 0))
218 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
222 if (! check_is_equivalent ("file://ep1_d1_g1_v2.ior", "file://ep2_d2_g1_v1.ior", 0))
224 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
228 if (! check_is_equivalent ("file://ep1_d1_g2_v1.ior", "file://ep1_d2_g1_v1.ior", 0))
230 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
234 if (! check_is_equivalent ("file://ep1_d1_g2_v1.ior", "file://ep2.ior", 0))
236 ACE_DEBUG ((LM_ERROR
, "... it should be false because an IOR is never equivalent to an IOGR\n\n"));
240 if (! check_is_equivalent ("file://ep1_d1_g2_v1.ior", "file://ep2_d1_g1_v1.ior", 0))
242 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
246 if (! check_is_equivalent ("file://ep1_d1_g2_v1.ior", "file://ep2_d1_g1_v2.ior", 0))
248 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
252 if (! check_is_equivalent ("file://ep1_d1_g2_v1.ior", "file://ep2_d1_g2_v1.ior", 1))
254 ACE_DEBUG ((LM_ERROR
, "... it should be true because both are IOGRs and the domain and group ids match.\n\n"));
258 if (! check_is_equivalent ("file://ep1_d1_g2_v1.ior", "file://ep2_d2_g1_v1.ior", 0))
260 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
264 if (! check_is_equivalent ("file://ep1_d2_g1_v1.ior", "file://ep2.ior", 0))
266 ACE_DEBUG ((LM_ERROR
, "... it should be false because an IOR is never equivalent to an IOGR\n\n"));
270 if (! check_is_equivalent ("file://ep1_d2_g1_v1.ior", "file://ep2_d1_g1_v1.ior", 0))
272 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
276 if (! check_is_equivalent ("file://ep1_d2_g1_v1.ior", "file://ep2_d1_g1_v1.ior", 0))
278 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
282 if (! check_is_equivalent ("file://ep1_d2_g1_v1.ior", "file://ep2_d1_g1_v1.ior", 0))
284 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
288 if (! check_is_equivalent ("file://ep1_d2_g1_v1.ior", "file://ep2_d1_g1_v1.ior", 0))
290 ACE_DEBUG ((LM_ERROR
, "... it should be false because both are IOGRs but the domain and group ids don't match.\n\n"));
296 catch (const CORBA::Exception
& ex
)
298 ex
._tao_print_exception ("Exception caught:");