2 #include "ace/Get_Opt.h"
4 // Ensure that the PI library is linked in when building statically
6 #include "orbsvcs/FaultTolerance/FT_Service_Activate.h"
8 const ACE_TCHAR
*ior
= 0;
12 parse_args (int argc
, ACE_TCHAR
*argv
[])
14 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
17 while ((c
= get_opts ()) != -1)
21 ior
= get_opts
.opt_arg ();
24 ACE_ERROR_RETURN ((LM_ERROR
,
26 "-k IOR_1 -k IOR_2\n",
35 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
41 CORBA::ORB_var orb
= CORBA::ORB_init (argc
,
45 if (::parse_args (argc
, argv
) != 0)
48 // Start out with the first IOR. Interaction with the second
49 // IOR occurs during the various interceptions executed during
51 CORBA::Object_var object
=
52 orb
->string_to_object (ior
);
54 ForwardRequestTest::test_var server
=
55 ForwardRequestTest::test::_narrow (object
.in ());
57 // Before and after the LOCATION_FORWARD_PERM the marshaled
58 // object reference must differ.
60 // Create a stringified/marshaled snapshot of Object reference
61 CORBA::String_var marshaled_obj_snapshot1
=
62 orb
->object_to_string (server
.in ());
64 if (CORBA::is_nil (server
.in ()))
66 ACE_ERROR_RETURN ((LM_ERROR
,
67 "Object reference <%s> is nil\n",
72 CORBA::ULong number
= 0;
73 for (int i
= 1; i
<= 25; ++i
)
76 "CLIENT: Issuing request %d.\n",
79 number
+= server
->number ();
82 "CLIENT: Number %d .\n",
92 "(%P|%t) ERROR: Did not forward to new location\n"));
96 // One of the request triggerd a LOCATION_FORWARD_PERM, in
97 // consequence the marshaled representation of "server" should
98 // look different now, compare to snapshot1.
99 CORBA::String_var marshaled_obj_snapshot2
=
100 orb
->object_to_string (server
.in ());
102 if (ACE_OS::strcmp (marshaled_obj_snapshot1
.in (), marshaled_obj_snapshot2
.in ()) == 0)
104 // Error, before and after the marhaled object references look equal
105 ACE_ERROR ((LM_ERROR
,
106 "(%P|%t) ERROR: Marshaled Object reference should differ after LOCATION_FORWARD_PERM\n"));
112 catch (const CORBA::Exception
& ex
)
114 ex
._tao_print_exception ("Caught exception:");
119 "Group_Ref_Manip Test passed.\n"));