2 //=============================================================================
4 * @file ub_wstr_seq.cpp
6 * tests unbounded wide string sequences
10 //=============================================================================
14 #include "ub_wstr_seq.h"
15 #include "ace/OS_NS_wchar.h"
17 // ************************************************************************
18 // Test_WString_Sequence
19 // ************************************************************************
21 Test_WString_Sequence::Test_WString_Sequence ()
22 : opname_ (CORBA::string_dup ("test_wstrseq")),
23 in_ (new CORBA::WStringSeq
),
24 inout_ (new CORBA::WStringSeq
),
25 out_ (new CORBA::WStringSeq
),
26 ret_ (new CORBA::WStringSeq
)
30 Test_WString_Sequence::~Test_WString_Sequence ()
32 CORBA::string_free (this->opname_
);
37 Test_WString_Sequence::opname () const
43 Test_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 (CORBA::_tc_WStringSeq
);
53 const CORBA::WStringSeq
*tmp
= 0;
54 req
->return_value () >>= tmp
;
55 this->ret_
= new CORBA::WStringSeq (*tmp
);
57 CORBA::NamedValue_ptr o2
=
58 req
->arguments ()->item (1);
59 *o2
->value () >>= tmp
;
60 this->inout_
= new CORBA::WStringSeq (*tmp
);
62 CORBA::NamedValue_ptr o3
=
63 req
->arguments ()->item (2);
64 *o3
->value () >>= tmp
;
65 this->out_
= new CORBA::WStringSeq (*tmp
);
69 Test_WString_Sequence::init_parameters (Param_Test_ptr
)
71 Generator
*gen
= GENERATOR::instance (); // value generator
75 // set the length of the sequences
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 ();
83 this->inout_
[i
] = gen
->gen_wstring ();
90 Test_WString_Sequence::reset_parameters ()
92 this->inout_
= new CORBA::WStringSeq
; // delete the previous ones
93 this->out_
= new CORBA::WStringSeq
;
94 this->ret_
= new CORBA::WStringSeq
;
99 Test_WString_Sequence::run_sii_test (Param_Test_ptr objref
)
103 CORBA::WStringSeq_out
out (this->out_
.out ());
105 this->ret_
= objref
->test_wstrseq (this->in_
.in (),
106 this->inout_
.inout (),
111 catch (const CORBA::Exception
& ex
)
113 ex
._tao_print_exception ("Test_WString_Sequence::run_sii_test\n");
119 Test_WString_Sequence::check_validity ()
121 CORBA::Boolean flag
= 0;
122 if ((this->in_
->length () == this->inout_
->length ()) &&
123 (this->in_
->length () == this->out_
->length ()) &&
124 (this->in_
->length () == this->ret_
->length ()))
126 flag
= 1; // assume all are equal
127 // lengths are same. Now compare the contents
128 for (CORBA::ULong i
=0; i
< this->in_
->length () && flag
; i
++)
130 if (ACE_OS::wscmp (this->in_
[i
], this->inout_
[i
]) ||
131 ACE_OS::wscmp (this->in_
[i
], this->out_
[i
]) ||
132 ACE_OS::wscmp (this->in_
[i
], this->ret_
[i
]))
141 Test_WString_Sequence::check_validity (CORBA::Request_ptr
)
143 return this->check_validity ();
147 Test_WString_Sequence::print_values ()