2 //=============================================================================
4 * @file bd_wstr_seq.cpp
6 * tests bounded wide string sequences
10 //=============================================================================
14 #include "bd_wstr_seq.h"
15 #include "ace/OS_NS_wchar.h"
17 // ************************************************************************
18 // Test_Bounded_WString_Sequence
19 // ************************************************************************
21 Test_Bounded_WString_Sequence::Test_Bounded_WString_Sequence ()
22 : opname_ (CORBA::string_dup ("test_bounded_wstrseq")),
23 in_ (new Param_Test::Bounded_WStrSeq
),
24 inout_ (new Param_Test::Bounded_WStrSeq
),
25 out_ (new Param_Test::Bounded_WStrSeq
),
26 ret_ (new Param_Test::Bounded_WStrSeq
)
30 Test_Bounded_WString_Sequence::~Test_Bounded_WString_Sequence ()
32 CORBA::string_free (this->opname_
);
37 Test_Bounded_WString_Sequence::opname () const
43 Test_Bounded_WString_Sequence::dii_req_invoke (CORBA::Request
*req
)
45 req
->add_in_arg ("s1") <<= this->in_
.in ();
46 req
->add_inout_arg ("s2") <<= this->inout_
.in ();
47 req
->add_out_arg ("s3") <<= this->out_
.in ();
49 req
->set_return_type (Param_Test::_tc_Bounded_WStrSeq
);
53 const Param_Test::Bounded_WStrSeq
*tmp
;
54 req
->return_value () >>= tmp
;
55 this->ret_
= new Param_Test::Bounded_WStrSeq (*tmp
);
57 CORBA::NamedValue_ptr arg2
=
58 req
->arguments ()->item (1);
59 *arg2
->value () >>= tmp
;
60 this->inout_
= new Param_Test::Bounded_WStrSeq (*tmp
);
62 CORBA::NamedValue_ptr arg3
=
63 req
->arguments ()->item (2);
64 *arg3
->value () >>= tmp
;
65 this->out_
= new Param_Test::Bounded_WStrSeq (*tmp
);
69 Test_Bounded_WString_Sequence::init_parameters (Param_Test_ptr
)
71 Generator
*gen
= GENERATOR::instance (); // value generator
73 CORBA::ULong len
= this->in_
->maximum ();
75 // set the length of the sequence
76 this->in_
->length (len
);
77 this->inout_
->length (len
);
79 // now set each individual element
80 for (CORBA::ULong i
= 0; i
< this->in_
->length (); i
++)
82 this->in_
[i
] = gen
->gen_wstring ();
85 this->inout_
[i
] = gen
->gen_wstring ();
92 Test_Bounded_WString_Sequence::reset_parameters ()
94 this->inout_
= new Param_Test::Bounded_WStrSeq
; // delete the previous ones
95 this->out_
= new Param_Test::Bounded_WStrSeq
;
96 this->ret_
= new Param_Test::Bounded_WStrSeq
;
101 Test_Bounded_WString_Sequence::run_sii_test (Param_Test_ptr objref
)
105 Param_Test::Bounded_WStrSeq_out
out (this->out_
.out ());
107 this->ret_
= objref
->test_bounded_wstrseq (this->in_
.in (),
108 this->inout_
.inout (),
113 catch (const CORBA::Exception
& ex
)
115 ex
._tao_print_exception ("Test_Bounded_WString_Sequence::run_sii_test\n");
121 Test_Bounded_WString_Sequence::check_validity ()
123 CORBA::Boolean flag
= 0;
124 if ((this->in_
->length () == this->inout_
->length ()) &&
125 (this->in_
->length () == this->out_
->length ()) &&
126 (this->in_
->length () == this->ret_
->length ()))
128 flag
= 1; // assume all are equal
129 // lengths are same. Now compare the contents
130 for (CORBA::ULong i
=0; i
< this->in_
->length () && flag
; i
++)
132 if (ACE_OS::wscmp (this->in_
[i
], this->inout_
[i
]) ||
133 ACE_OS::wscmp (this->in_
[i
], this->out_
[i
]) ||
134 ACE_OS::wscmp (this->in_
[i
], this->ret_
[i
]))
143 Test_Bounded_WString_Sequence::check_validity (CORBA::Request_ptr
)
145 return this->check_validity ();
149 Test_Bounded_WString_Sequence::print_values ()