2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR
*ior
= ACE_TEXT ("file://test.ior");
7 parse_args (int argc
, ACE_TCHAR
*argv
[])
9 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT ("k:"));
12 while ((c
= get_opts ()) != -1)
16 ior
= get_opts
.opt_arg ();
21 ACE_ERROR_RETURN ((LM_ERROR
,
22 "usage: %s -k <ior> \n",
26 // Indicates successful parsing of the command line
31 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
36 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
38 if (parse_args (argc
, argv
) != 0)
41 CORBA::Object_var tmp
= orb
->string_to_object(ior
);
43 Test::BoundSequences_var TestThis
=
44 Test::BoundSequences::_narrow(tmp
.in ());
46 if (CORBA::is_nil (TestThis
.in ()))
48 ACE_ERROR_RETURN ((LM_DEBUG
,
49 "Nil Test::BoundSequences reference <%s>\n",
54 ////////////////////////////////////////////
55 ::Test::BoundSequences::SequenceOf10Long Seq
;
56 ACE_DEBUG ((LM_DEBUG
, "Client - Attempting to set length(11)\n"));
61 "Client - **FAILED** Incorrectly set length to %u\n",
65 catch (const ::CORBA::BAD_PARAM
&)
67 ACE_DEBUG ((LM_DEBUG
, "Client - Correctly threw bad_param\n"));
69 catch (const ::CORBA::Exception
&ex
)
71 ex
._tao_print_exception ("Client - **FAILED** Incorrectly threw");
77 "Client - **FAILED** Incorrectly threw something else\n"));
81 ////////////////////////////////////////////
82 ACE_DEBUG ((LM_DEBUG
, "Client - Attempting to set length(10)\n"));
86 ACE_DEBUG ((LM_DEBUG
, "Client - %Correctly set length to %u\n",
87 ((10 == Seq
.length ()) ? "C" : "**** Inc"),
89 if (10 != Seq
.length ())
92 catch (const ::CORBA::Exception
&ex
)
94 ex
._tao_print_exception ("Client - **FAILED** Incorrectly threw");
100 "Client - **FAILED** Incorrectly threw something else\n"));
104 //////////////////////////////////////////
105 ACE_DEBUG ((LM_DEBUG
, "Client - Accessing [0]\n"));
108 // Just to read access Seq[0] without optimizing away
109 ACE_DEBUG ((LM_DEBUG
, "", Seq
[0]));
110 ACE_DEBUG ((LM_DEBUG
, "Client - Correctly allowed access to [0]\n"));
112 catch (const ::CORBA::Exception
&ex
)
114 ex
._tao_print_exception ("Client - **FAILED** Incorrectly threw");
119 ACE_DEBUG ((LM_DEBUG
,
120 "Client - **FAILED** Incorrectly threw something else\n"));
124 ////////////////////////////////////////////
125 ACE_DEBUG ((LM_DEBUG
, "Client - Accessing [10]\n"));
128 // Just to read access Seq[10] without optimizing away
129 ACE_DEBUG ((LM_DEBUG
, "", Seq
[10]));
130 #if defined (TAO_CHECKED_SEQUENCE_INDEXING) && (TAO_CHECKED_SEQUENCE_INDEXING == 1)
131 ACE_DEBUG ((LM_DEBUG
,
132 "Client - **** Incorrectly allowed access to [10]\n"));
135 catch (const ::CORBA::BAD_PARAM
&)
137 ACE_DEBUG ((LM_DEBUG
, "Client - Correctly threw bad_param\n"));
139 ACE_DEBUG ((LM_DEBUG
, "Client - Correctly allowed access to [10]\n"));
140 #endif // TAO_CHECKED_SEQUENCE_INDEXING
142 catch (const ::CORBA::Exception
&ex
)
144 ex
._tao_print_exception ("Client - **FAILED** Incorrectly threw");
149 ACE_DEBUG ((LM_DEBUG
,
150 "Client - **FAILED** Incorrectly threw something else\n"));
154 ////////////////////////////////////////////
155 ACE_DEBUG ((LM_DEBUG
, "Client - Sending Seq\n"));
156 ::CORBA::ULong result
;
159 result
= TestThis
->SendSequenceOf10Long (Seq
.length (), Seq
);
160 if (result
!= Seq
.length())
162 ACE_DEBUG ((LM_DEBUG
,
163 "Client - **FAILED** Sent %u longs but "
164 "server received %u longs\n",
165 Seq
.length(), result
));
169 ACE_DEBUG ((LM_DEBUG
,
170 "Client - **SUCCESS** Sent and Server got %u longs\n",
173 catch (const ::CORBA::Exception
&ex
)
175 ex
._tao_print_exception ("Client - **FAILED** Incorrectly threw");
180 ACE_DEBUG ((LM_DEBUG
,
181 "Client - **FAILED** Incorrectly threw something else\n"));
185 ////////////////////////////////////////////
186 ACE_DEBUG ((LM_DEBUG
, "Client - Shutting down Server\n"));
187 TestThis
->shutdown ();
189 ACE_DEBUG ((LM_DEBUG
, "Client - Finishing\n"));
192 catch (const CORBA::Exception
& ex
)
194 ex
._tao_print_exception ("Client - Exception caught:");