summaryrefslogtreecommitdiff
path: root/TAO/tests/Param_Test
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-09-13 13:10:51 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-09-13 13:10:51 +0000
commit928bbbfc8b4d9608e156335e0bdfd6052a56a9e6 (patch)
tree093bec53dad89150ecfe180637b72c2fc7abe04b /TAO/tests/Param_Test
parent33c228f513f8fcbfac259a7a9a95f0296639fadb (diff)
downloadATCD-928bbbfc8b4d9608e156335e0bdfd6052a56a9e6.tar.gz
Support for sequences of arrays and a param test to check the
functionality.
Diffstat (limited to 'TAO/tests/Param_Test')
-rw-r--r--TAO/tests/Param_Test/Makefile2
-rw-r--r--TAO/tests/Param_Test/bd_array_seq.cpp278
-rw-r--r--TAO/tests/Param_Test/bd_array_seq.h95
-rw-r--r--TAO/tests/Param_Test/bd_struct_seq.cpp18
-rw-r--r--TAO/tests/Param_Test/client.dsp16
-rw-r--r--TAO/tests/Param_Test/driver.cpp39
-rw-r--r--TAO/tests/Param_Test/options.cpp4
-rw-r--r--TAO/tests/Param_Test/options.h2
-rw-r--r--TAO/tests/Param_Test/param_test.idl11
-rw-r--r--TAO/tests/Param_Test/param_test_i.cpp43
-rw-r--r--TAO/tests/Param_Test/param_test_i.h12
-rwxr-xr-xTAO/tests/Param_Test/run_test.pl1
-rw-r--r--TAO/tests/Param_Test/tests.h2
-rw-r--r--TAO/tests/Param_Test/tmplinst.cpp4
-rw-r--r--TAO/tests/Param_Test/ub_array_seq.cpp288
-rw-r--r--TAO/tests/Param_Test/ub_array_seq.h96
-rw-r--r--TAO/tests/Param_Test/ub_struct_seq.cpp6
17 files changed, 896 insertions, 21 deletions
diff --git a/TAO/tests/Param_Test/Makefile b/TAO/tests/Param_Test/Makefile
index 3920cc10b7e..c76eea45bc3 100644
--- a/TAO/tests/Param_Test/Makefile
+++ b/TAO/tests/Param_Test/Makefile
@@ -39,6 +39,7 @@ CLI_FILES = param_testCli \
bd_string \
bd_wstring \
bd_struct_seq \
+ bd_array_seq \
fixed_array \
fixed_struct \
nested_struct \
@@ -56,6 +57,7 @@ CLI_FILES = param_testCli \
ub_string \
ub_wstring \
ub_struct_seq \
+ ub_array_seq \
var_array \
var_struct \
recursive_struct \
diff --git a/TAO/tests/Param_Test/bd_array_seq.cpp b/TAO/tests/Param_Test/bd_array_seq.cpp
new file mode 100644
index 00000000000..30e24e31626
--- /dev/null
+++ b/TAO/tests/Param_Test/bd_array_seq.cpp
@@ -0,0 +1,278 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Param_Test
+//
+// = FILENAME
+// bd_array_seq.cpp
+//
+// = DESCRIPTION
+// tests bounded array sequences
+//
+// = AUTHORS
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "helper.h"
+#include "bd_array_seq.h"
+
+const CORBA::ULong MAX_ARRAYSEQ_LEN = 1;
+
+// ************************************************************************
+// Test_Bounded_Array_Sequence
+// ************************************************************************
+
+Test_Bounded_Array_Sequence::Test_Bounded_Array_Sequence (void)
+ : opname_ (CORBA::string_dup ("test_bounded_array_sequence")),
+ inout_ (new Param_Test::Bounded_ArraySeq),
+ out_ (new Param_Test::Bounded_ArraySeq),
+ ret_ (new Param_Test::Bounded_ArraySeq)
+{
+}
+
+Test_Bounded_Array_Sequence::~Test_Bounded_Array_Sequence (void)
+{
+ CORBA::string_free (this->opname_);
+ this->opname_ = 0;
+ // the other data members will be freed as they are "_var"s and objects
+ // (rather than pointers to objects)
+}
+
+const char *
+Test_Bounded_Array_Sequence::opname (void) const
+{
+ return this->opname_;
+}
+
+void
+Test_Bounded_Array_Sequence::dii_req_invoke (CORBA::Request *req,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ req->invoke (ACE_TRY_ENV);
+}
+
+int
+Test_Bounded_Array_Sequence::init_parameters (Param_Test_ptr,
+ CORBA::Environment &)
+{
+ Generator *gen = GENERATOR::instance (); // value generator
+
+ // set the length of the sequence
+ this->in_.length (MAX_ARRAYSEQ_LEN);
+
+ // now set each individual element
+ Param_Test::Fixed_Array tmp;
+
+ for (CORBA::ULong i = 0; i < this->in_.length (); i++)
+ {
+ // Generate some arbitrary array to be filled into the ith
+ // location in the sequence.
+ for (CORBA::ULong j = 0; j < Param_Test::DIM1; j++)
+ {
+ tmp[j] = gen->gen_long ();
+ }
+
+ Param_Test::Fixed_Array_copy (this->in_[i], tmp);
+ }
+
+ return 0;
+}
+
+int
+Test_Bounded_Array_Sequence::reset_parameters (void)
+{
+ // Delete the previous ones.
+ this->inout_ = new Param_Test::Bounded_ArraySeq;
+ this->out_ = new Param_Test::Bounded_ArraySeq;
+ this->ret_ = new Param_Test::Bounded_ArraySeq;
+ return 0;
+}
+
+int
+Test_Bounded_Array_Sequence::run_sii_test (Param_Test_ptr objref,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_TRY
+ {
+ Param_Test::Bounded_ArraySeq_out out (this->out_.out ());
+
+ this->ret_ =
+ objref->test_bounded_array_sequence (this->in_,
+ this->inout_.inout (),
+ out,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ return 0;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Test_Bounded_Array_Sequence::run_sii_test\n");
+
+ }
+ ACE_ENDTRY;
+ return -1;
+}
+
+int
+Test_Bounded_Array_Sequence::add_args (CORBA::NVList_ptr param_list,
+ CORBA::NVList_ptr retval,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_TRY
+ {
+ CORBA::Any in_arg (Param_Test::_tc_Bounded_ArraySeq,
+ &this->in_,
+ 0);
+
+ CORBA::Any inout_arg (Param_Test::_tc_Bounded_ArraySeq,
+ &this->inout_.inout (),
+ 0);
+
+ CORBA::Any out_arg (Param_Test::_tc_Bounded_ArraySeq,
+ &this->out_.inout (),
+ 0);
+
+ // add parameters
+ param_list->add_value ("s1",
+ in_arg,
+ CORBA::ARG_IN,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ param_list->add_value ("s2",
+ inout_arg,
+ CORBA::ARG_INOUT,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ param_list->add_value ("s3",
+ out_arg,
+ CORBA::ARG_OUT,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // add return value type
+ CORBA::NamedValue *item = retval->item (0,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ item->value ()->replace (Param_Test::_tc_Bounded_ArraySeq,
+ &this->ret_.inout (),
+ 0, // does not own
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ return 0;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Test_Bounded_Array_Sequence::add_args\n");
+
+ }
+ ACE_ENDTRY;
+ return -1;
+}
+
+CORBA::Boolean
+Test_Bounded_Array_Sequence::check_validity (void)
+{
+ if (this->compare (this->in_, this->inout_.in ()) &&
+ this->compare (this->in_, this->out_.in ()) &&
+ this->compare (this->in_, this->ret_.in ()))
+ return 1;
+ else
+ return 0;
+}
+
+CORBA::Boolean
+Test_Bounded_Array_Sequence::check_validity (CORBA::Request_ptr)
+{
+ return this->check_validity ();
+}
+
+void
+Test_Bounded_Array_Sequence::print_values (void)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n"
+ "IN sequence\n"));
+ this->print_sequence (this->in_);
+ ACE_DEBUG ((LM_DEBUG,
+ "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n"
+ "INOUT sequence\n"));
+ this->print_sequence (this->inout_.in ());
+ ACE_DEBUG ((LM_DEBUG,
+ "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n"
+ "OUT sequence\n"));
+ this->print_sequence (this->out_.in ());
+ ACE_DEBUG ((LM_DEBUG,
+ "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n"
+ "RET sequence\n"));
+ this->print_sequence (this->ret_.in ());
+}
+
+CORBA::Boolean
+Test_Bounded_Array_Sequence::compare (const Param_Test::Bounded_ArraySeq &s1,
+ const Param_Test::Bounded_ArraySeq &s2)
+{
+ if (s1.maximum () != s2.maximum ())
+ {
+ return 0;
+ }
+
+ if (s1.length () != s2.length ())
+ {
+ return 0;
+ }
+
+ for (CORBA::ULong i = 0; i < s1.length (); i++)
+ {
+ const Param_Test::Fixed_Array& vs1 = s1[i];
+ const Param_Test::Fixed_Array& vs2 = s2[i];
+
+ for (CORBA::ULong j = 0; j < Param_Test::DIM1; j++)
+ {
+ if (vs1[j] != vs2[j])
+ {
+ return 0;
+ }
+ }
+ }
+
+ return 1; // success
+}
+
+void
+Test_Bounded_Array_Sequence::print_sequence (const Param_Test::Bounded_ArraySeq &s)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "maximum = %d\n"
+ "length = %d\n",
+ s.maximum (),
+ s.length ()));
+ ACE_DEBUG ((LM_DEBUG, "Elements -\n"));
+
+ for (CORBA::ULong i=0; i < s.length (); i++)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Element #%d --\n",
+ i));
+
+ const Param_Test::Fixed_Array& vs = s[i];
+
+ for (CORBA::ULong j = 0; j < Param_Test::DIM1; j++)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Element%d[%d] = %d\n",
+ i,
+ j,
+ vs[j]));
+ }
+ }
+}
diff --git a/TAO/tests/Param_Test/bd_array_seq.h b/TAO/tests/Param_Test/bd_array_seq.h
new file mode 100644
index 00000000000..03db2e81c8a
--- /dev/null
+++ b/TAO/tests/Param_Test/bd_array_seq.h
@@ -0,0 +1,95 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Param_Test
+//
+// = FILENAME
+// bd_array_seq.h
+//
+// = DESCRIPTION
+// Tests bounded array sequence
+//
+// = AUTHORS
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef PARAM_TEST_BOUNDED_ARRAY_SEQUENCE_H
+#define PARAM_TEST_BOUNDED_ARRAY_SEQUENCE_H
+
+#include "param_testCli.h"
+
+// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
+// test bounded sequence of arrays
+// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
+
+class Test_Bounded_Array_Sequence
+{
+public:
+ Test_Bounded_Array_Sequence (void);
+ // ctor
+
+ ~Test_Bounded_Array_Sequence (void);
+ // dtor
+
+ int run_sii_test (Param_Test_ptr objref,
+ CORBA::Environment &env);
+ // run the SII test
+
+ int add_args (CORBA::NVList_ptr nvlist,
+ CORBA::NVList_ptr retval,
+ CORBA::Environment &env);
+ // add args to NVList for DII
+
+ const char *opname (void) const;
+ // return operation name
+
+ int init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env);
+ // set values for parameters
+
+ int reset_parameters (void);
+ // reset values for CORBA
+
+ CORBA::Boolean check_validity (void);
+ // check if results are valid
+
+ CORBA::Boolean check_validity (CORBA::Request_ptr req);
+ // check if results are valid. This is used for DII results
+
+ void print_values (void);
+ // print all the values
+
+ void dii_req_invoke (CORBA::Request *,
+ CORBA::Environment &);
+ // invoke DII request with appropriate exception handling.
+
+protected:
+ CORBA::Boolean compare (const Param_Test::Bounded_ArraySeq &s1,
+ const Param_Test::Bounded_ArraySeq &s2);
+ // compare
+
+ void print_sequence (const Param_Test::Bounded_ArraySeq &s);
+ // print individual sequence
+
+private:
+ char *opname_;
+ // operation name
+
+ Param_Test::Bounded_ArraySeq in_;
+ // in parameter
+
+ // these need memory management
+ Param_Test::Bounded_ArraySeq_var inout_;
+ // inout parameter
+
+ Param_Test::Bounded_ArraySeq_var out_;
+ // out parameter
+
+ Param_Test::Bounded_ArraySeq_var ret_;
+ // return value
+};
+
+#endif /* PARAM_TEST_BOUNDED_ARRAY_SEQUENCE_H */
diff --git a/TAO/tests/Param_Test/bd_struct_seq.cpp b/TAO/tests/Param_Test/bd_struct_seq.cpp
index 11bbb0654ee..b2252973f3c 100644
--- a/TAO/tests/Param_Test/bd_struct_seq.cpp
+++ b/TAO/tests/Param_Test/bd_struct_seq.cpp
@@ -57,20 +57,17 @@ Test_Bounded_Struct_Sequence::dii_req_invoke (CORBA::Request *req,
}
int
-Test_Bounded_Struct_Sequence::init_parameters (Param_Test_ptr /*objref*/,
- CORBA::Environment &/*env*/)
+Test_Bounded_Struct_Sequence::init_parameters (Param_Test_ptr /* objref */,
+ CORBA::Environment & /* env */)
{
Generator *gen = GENERATOR::instance (); // value generator
- //ACE_UNUSED_ARG (objref);
- //ACE_UNUSED_ARG (env);
-
// set the length of the sequence
this->in_.length (MAX_STRUCTSEQ_LEN);
// now set each individual element
for (CORBA::ULong i = 0; i < this->in_.length (); i++)
{
- // generate some arbitrary string to be filled into the ith location in
+ // generate some arbitrary struct to be filled into the ith location in
// the sequence
this->in_[i] = gen->gen_fixed_struct ();
}
@@ -105,7 +102,7 @@ Test_Bounded_Struct_Sequence::run_sii_test (Param_Test_ptr objref,
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Test_Bounded_String_Sequence::run_sii_test\n");
+ "Test_Bounded_Struct_Sequence::run_sii_test\n");
}
ACE_ENDTRY;
@@ -128,7 +125,7 @@ Test_Bounded_Struct_Sequence::add_args (CORBA::NVList_ptr param_list,
0);
CORBA::Any out_arg (Param_Test::_tc_Bounded_StructSeq,
- &this->out_.inout (), // .out () causes crash
+ &this->out_.inout (),
0);
// add parameters
@@ -156,7 +153,7 @@ Test_Bounded_Struct_Sequence::add_args (CORBA::NVList_ptr param_list,
ACE_TRY_CHECK;
item->value ()->replace (Param_Test::_tc_Bounded_StructSeq,
- &this->ret_.inout (), // see above
+ &this->ret_.inout (),
0, // does not own
ACE_TRY_ENV);
ACE_TRY_CHECK;
@@ -185,9 +182,8 @@ Test_Bounded_Struct_Sequence::check_validity (void)
}
CORBA::Boolean
-Test_Bounded_Struct_Sequence::check_validity (CORBA::Request_ptr /*req*/)
+Test_Bounded_Struct_Sequence::check_validity (CORBA::Request_ptr)
{
- //ACE_UNUSED_ARG (req);
return this->check_validity ();
}
diff --git a/TAO/tests/Param_Test/client.dsp b/TAO/tests/Param_Test/client.dsp
index 5fb3cc154b7..aebf83ad52b 100644
--- a/TAO/tests/Param_Test/client.dsp
+++ b/TAO/tests/Param_Test/client.dsp
@@ -91,6 +91,10 @@ SOURCE=.\any.cpp
# End Source File
# Begin Source File
+SOURCE=.\bd_array_seq.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\bd_long_seq.cpp
# End Source File
# Begin Source File
@@ -195,6 +199,10 @@ SOURCE=.\ub_any_seq.cpp
# End Source File
# Begin Source File
+SOURCE=.\ub_array_seq.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ub_long_seq.cpp
# End Source File
# Begin Source File
@@ -247,6 +255,10 @@ SOURCE=.\any.h
# End Source File
# Begin Source File
+SOURCE=.\bd_array_seq.h
+# End Source File
+# Begin Source File
+
SOURCE=.\bd_long_seq.h
# End Source File
# Begin Source File
@@ -351,6 +363,10 @@ SOURCE=.\ub_any_seq.h
# End Source File
# Begin Source File
+SOURCE=.\ub_array_seq.h
+# End Source File
+# Begin Source File
+
SOURCE=.\ub_long_seq.h
# End Source File
# Begin Source File
diff --git a/TAO/tests/Param_Test/driver.cpp b/TAO/tests/Param_Test/driver.cpp
index 555afbc4dc6..d5d8af6213f 100644
--- a/TAO/tests/Param_Test/driver.cpp
+++ b/TAO/tests/Param_Test/driver.cpp
@@ -298,7 +298,6 @@ Driver::run (void)
delete client;
}
break;
-
case Options::TEST_RECURSIVE_STRUCT:
{
Param_Test_Client<Test_Recursive_Struct> *client = new
@@ -312,7 +311,6 @@ Driver::run (void)
delete client;
}
break;
-
case Options::TEST_OBJREF_STRUCT:
{
Param_Test_Client<Test_Objref_Struct> *client = new
@@ -326,7 +324,6 @@ Driver::run (void)
delete client;
}
break;
-
case Options::TEST_UB_STRUCT_SEQUENCE:
{
Param_Test_Client<Test_Struct_Sequence> *client = new
@@ -356,7 +353,7 @@ Driver::run (void)
{
Param_Test_Client<Test_Bounded_Struct_Sequence> *client = new
Param_Test_Client<Test_Bounded_Struct_Sequence> (this->orb_.in (),
- this->objref_.in(),
+ this->objref_.in (),
new Test_Bounded_Struct_Sequence);
if (opt->invoke_type () == Options::SII)
retstatus = client->run_sii_test ();
@@ -365,11 +362,37 @@ Driver::run (void)
delete client;
}
break;
+ case Options::TEST_UB_ARRAY_SEQUENCE:
+ {
+ Param_Test_Client<Test_Array_Sequence> *client = new
+ Param_Test_Client<Test_Array_Sequence> (this->orb_.in (),
+ this->objref_.in (),
+ new Test_Array_Sequence);
+ if (opt->invoke_type () == Options::SII)
+ retstatus = client->run_sii_test ();
+ else
+ retstatus = client->run_dii_test ();
+ delete client;
+ }
+ break;
+ case Options::TEST_BD_ARRAY_SEQUENCE:
+ {
+ Param_Test_Client<Test_Bounded_Array_Sequence> *client = new
+ Param_Test_Client<Test_Bounded_Array_Sequence> (this->orb_.in (),
+ this->objref_.in (),
+ new Test_Bounded_Array_Sequence);
+ if (opt->invoke_type () == Options::SII)
+ retstatus = client->run_sii_test ();
+ else
+ retstatus = client->run_dii_test ();
+ delete client;
+ }
+ break;
case Options::TEST_OBJREF:
{
Param_Test_Client<Test_ObjRef> *client = new
Param_Test_Client<Test_ObjRef> (this->orb_.in (),
- this->objref_.in(),
+ this->objref_.in (),
new Test_ObjRef);
if (opt->invoke_type () == Options::SII)
retstatus = client->run_sii_test ();
@@ -508,7 +531,6 @@ Driver::run (void)
delete client;
}
break;
-
case Options::TEST_EXCEPTION:
{
Param_Test_Client<Test_Exception> *client = new
@@ -522,7 +544,6 @@ Driver::run (void)
delete client;
}
break;
-
case Options::TEST_BIG_UNION:
{
Param_Test_Client<Test_Big_Union> *client = new
@@ -607,6 +628,8 @@ template class Param_Test_Client<Test_Objref_Struct>;
template class Param_Test_Client<Test_Struct_Sequence>;
template class Param_Test_Client<Test_Unbounded_Struct_Sequence>;
template class Param_Test_Client<Test_Bounded_Struct_Sequence>;
+template class Param_Test_Client<Test_Array_Sequence>;
+template class Param_Test_Client<Test_Bounded_Array_Sequence>;
template class Param_Test_Client<Test_ObjRef>;
template class Param_Test_Client<Test_ObjRef_Sequence>;
template class Param_Test_Client<Test_TypeCode>;
@@ -645,6 +668,8 @@ template class Param_Test_Client<Test_Multdim_Array>;
#pragma instantiate Param_Test_Client<Test_Struct_Sequence>
#pragma instantiate Param_Test_Client<Test_Unbounded_Struct_Sequence>
#pragma instantiate Param_Test_Client<Test_Bounded_Struct_Sequence>
+#pragma instantiate Param_Test_Client<Test_Array_Sequence>
+#pragma instantiate Param_Test_Client<Test_Bounded_Array_Sequence>
#pragma instantiate Param_Test_Client<Test_ObjRef>
#pragma instantiate Param_Test_Client<Test_ObjRef_Sequence>
#pragma instantiate Param_Test_Client<Test_TypeCode>
diff --git a/TAO/tests/Param_Test/options.cpp b/TAO/tests/Param_Test/options.cpp
index 59a117c549e..e9c876d1ad0 100644
--- a/TAO/tests/Param_Test/options.cpp
+++ b/TAO/tests/Param_Test/options.cpp
@@ -121,6 +121,10 @@ Options::parse_args (int argc, char **argv)
this->test_type_ = Options::TEST_UB_STRUCT_SEQUENCE;
else if (!ACE_OS::strcmp (get_opts.optarg, "bd_struct_seq"))
this->test_type_ = Options::TEST_BD_STRUCT_SEQUENCE;
+ else if (!ACE_OS::strcmp (get_opts.optarg, "ub_array_seq"))
+ this->test_type_ = Options::TEST_UB_ARRAY_SEQUENCE;
+ else if (!ACE_OS::strcmp (get_opts.optarg, "bd_array_seq"))
+ this->test_type_ = Options::TEST_BD_ARRAY_SEQUENCE;
else if (!ACE_OS::strcmp (get_opts.optarg, "objref"))
this->test_type_ = Options::TEST_OBJREF;
else if (!ACE_OS::strcmp (get_opts.optarg, "typecode"))
diff --git a/TAO/tests/Param_Test/options.h b/TAO/tests/Param_Test/options.h
index 0128a9fe0ed..0afdafef89c 100644
--- a/TAO/tests/Param_Test/options.h
+++ b/TAO/tests/Param_Test/options.h
@@ -51,6 +51,8 @@ public:
TEST_OBJREF_STRUCT,
TEST_UB_STRUCT_SEQUENCE,
TEST_BD_STRUCT_SEQUENCE,
+ TEST_UB_ARRAY_SEQUENCE,
+ TEST_BD_ARRAY_SEQUENCE,
TEST_OBJREF,
TEST_TYPECODE,
TEST_ANY,
diff --git a/TAO/tests/Param_Test/param_test.idl b/TAO/tests/Param_Test/param_test.idl
index 1ff5a5feaa3..8564ce7f775 100644
--- a/TAO/tests/Param_Test/param_test.idl
+++ b/TAO/tests/Param_Test/param_test.idl
@@ -169,6 +169,7 @@ interface Param_Test
inout Bounded_Coffee_Mix s2,
out Bounded_Coffee_Mix s3);
+
typedef sequence<any> AnySeq;
AnySeq test_anyseq (in AnySeq s1,
inout AnySeq s2,
@@ -247,6 +248,16 @@ interface Param_Test
inout Var_Array v2,
out Var_Array v3);
+ // Bounded and unbounced sequences of arrays.
+ typedef sequence<Fixed_Array> ArraySeq;
+ ArraySeq test_array_sequence (in ArraySeq s1,
+ inout ArraySeq s2,
+ out ArraySeq s3);
+
+ typedef sequence<Fixed_Array, 32> Bounded_ArraySeq;
+ Bounded_ArraySeq test_bounded_array_sequence (in Bounded_ArraySeq s1,
+ inout Bounded_ArraySeq s2,
+ out Bounded_ArraySeq s3);
// Just to test report a problem
exception Ooops {
diff --git a/TAO/tests/Param_Test/param_test_i.cpp b/TAO/tests/Param_Test/param_test_i.cpp
index c9d8d8d19c2..015a18c2d98 100644
--- a/TAO/tests/Param_Test/param_test_i.cpp
+++ b/TAO/tests/Param_Test/param_test_i.cpp
@@ -388,6 +388,7 @@ Param_Test_i::test_struct_sequence (const Param_Test::StructSeq &s1,
return ret;
}
+// test for bounded struct sequences
Param_Test::Bounded_StructSeq *
Param_Test_i::test_bounded_struct_sequence (const Param_Test::Bounded_StructSeq & s1,
Param_Test::Bounded_StructSeq & s2,
@@ -439,6 +440,48 @@ Param_Test_i::test_unbounded_struct_sequence (const Param_Test::PathSpec & s1,
}
+// test for array sequences
+Param_Test::ArraySeq *
+Param_Test_i::test_array_sequence (const Param_Test::ArraySeq &s1,
+ Param_Test::ArraySeq &s2,
+ Param_Test::ArraySeq_out s3,
+ CORBA::Environment &)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // we copy the "in" sequences into all the inout, out and return sequences.
+
+ Param_Test::ArraySeq
+ *ret = new Param_Test::ArraySeq,
+
+ *out = new Param_Test::ArraySeq;
+
+ // now copy all elements of s1 into the others using the assignment operator
+ s2 = s1;
+ *out = s1;
+ *ret = s1;
+ s3 = out;
+ return ret;
+}
+
+// test for bounded array sequences
+Param_Test::Bounded_ArraySeq *
+Param_Test_i::test_bounded_array_sequence (const Param_Test::Bounded_ArraySeq & s1,
+ Param_Test::Bounded_ArraySeq & s2,
+ Param_Test::Bounded_ArraySeq_out s3,
+ CORBA::Environment &)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ Param_Test::Bounded_ArraySeq
+ *ret = new Param_Test::Bounded_ArraySeq,
+ *out = new Param_Test::Bounded_ArraySeq;
+
+ s2 = s1;
+ *out = s1;
+ *ret = s1;
+ s3 = out;
+ return ret;
+}
+
Param_Test::Coffee_Mix *
Param_Test_i::test_coffe_mix (const Param_Test::Coffee_Mix & s1,
Param_Test::Coffee_Mix & s2,
diff --git a/TAO/tests/Param_Test/param_test_i.h b/TAO/tests/Param_Test/param_test_i.h
index a94d7cc18a7..272bce69dbb 100644
--- a/TAO/tests/Param_Test/param_test_i.h
+++ b/TAO/tests/Param_Test/param_test_i.h
@@ -177,6 +177,18 @@ public:
Param_Test::Bounded_StructSeq_out s3,
CORBA::Environment &env)
ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual Param_Test::ArraySeq * test_array_sequence (
+ const Param_Test::ArraySeq & s1,
+ Param_Test::ArraySeq & s2,
+ Param_Test::ArraySeq_out s3,
+ CORBA::Environment &env)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual Param_Test::Bounded_ArraySeq * test_bounded_array_sequence (
+ const Param_Test::Bounded_ArraySeq & s1,
+ Param_Test::Bounded_ArraySeq & s2,
+ Param_Test::Bounded_ArraySeq_out s3,
+ CORBA::Environment &env)
+ ACE_THROW_SPEC ((CORBA::SystemException));
virtual Param_Test::Coffee_Mix * test_coffe_mix (
const Param_Test::Coffee_Mix & s1,
Param_Test::Coffee_Mix & s2,
diff --git a/TAO/tests/Param_Test/run_test.pl b/TAO/tests/Param_Test/run_test.pl
index bc8ee9b1f36..c1d57444cba 100755
--- a/TAO/tests/Param_Test/run_test.pl
+++ b/TAO/tests/Param_Test/run_test.pl
@@ -61,6 +61,7 @@ sub run_test
"ub_strseq", "bd_strseq", "ub_wstrseq", "bd_wstrseq",
"var_struct", "nested_struct", "recursive_struct",
"ub_struct_seq", "bd_struct_seq",
+ "ub_array_seq", "bd_array_seq",
"any", "objref", "objref_sequence", "objref_struct",
"any_sequence",
"ub_short_sequence", "ub_long_sequence",
diff --git a/TAO/tests/Param_Test/tests.h b/TAO/tests/Param_Test/tests.h
index feb3b7daea0..6c873bea043 100644
--- a/TAO/tests/Param_Test/tests.h
+++ b/TAO/tests/Param_Test/tests.h
@@ -27,6 +27,7 @@
#include "bd_string.h"
#include "bd_wstring.h"
#include "bd_struct_seq.h"
+#include "bd_array_seq.h"
#include "fixed_array.h"
#include "fixed_struct.h"
#include "nested_struct.h"
@@ -45,6 +46,7 @@
#include "ub_string.h"
#include "ub_wstring.h"
#include "ub_struct_seq.h"
+#include "ub_array_seq.h"
#include "var_array.h"
#include "var_struct.h"
#include "except.h"
diff --git a/TAO/tests/Param_Test/tmplinst.cpp b/TAO/tests/Param_Test/tmplinst.cpp
index 67b5b0696a4..2ec48dfdc56 100644
--- a/TAO/tests/Param_Test/tmplinst.cpp
+++ b/TAO/tests/Param_Test/tmplinst.cpp
@@ -17,6 +17,8 @@ template class TAO_Unbounded_Sequence<Param_Test::Fixed_Struct>;
template class TAO_Bounded_Sequence<Param_Test::Fixed_Struct,32>;
template class TAO_Unbounded_Object_Sequence<Coffee,Coffee_var>;
template class TAO_Bounded_Object_Sequence<Coffee,Coffee_var,32>;
+template class TAO_Unbounded_Array_Sequence<Param_Test::Fixed_Array>;
+template class TAO_Bounded_Array_Sequence<Param_Test::Fixed_Array,32>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate TAO_Unbounded_Sequence<CORBA::Any>
#pragma instantiate TAO_Bounded_Sequence<CORBA::Long,32>
@@ -27,4 +29,6 @@ template class TAO_Bounded_Object_Sequence<Coffee,Coffee_var,32>;
#pragma instantiate TAO_Bounded_Sequence<Param_Test::Fixed_Struct,32>
#pragma instantiate TAO_Unbounded_Object_Sequence<Coffee,Coffee_var>
#pragma instantiate TAO_Bounded_Object_Sequence<Coffee,Coffee_var,32>
+#pragma instantiate TAO_Unbounded_Array_Sequence<Param_Test::Fixed_Array>
+#pragma instantiate TAO_Bounded_Array_Sequence<Param_Test::Fixed_Array,32>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/tests/Param_Test/ub_array_seq.cpp b/TAO/tests/Param_Test/ub_array_seq.cpp
new file mode 100644
index 00000000000..82296fc1fd9
--- /dev/null
+++ b/TAO/tests/Param_Test/ub_array_seq.cpp
@@ -0,0 +1,288 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Param_Test
+//
+// = FILENAME
+// ub_array_seq.cpp
+//
+// = DESCRIPTION
+// tests unbounded array sequences
+//
+// = AUTHORS
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "helper.h"
+#include "ub_array_seq.h"
+
+// ************************************************************************
+// Test_Array_Sequence
+// ************************************************************************
+
+Test_Array_Sequence::Test_Array_Sequence (void)
+ : opname_ (CORBA::string_dup ("test_array_sequence")),
+ inout_ (new Param_Test::ArraySeq),
+ out_ (new Param_Test::ArraySeq),
+ ret_ (new Param_Test::ArraySeq)
+{
+}
+
+Test_Array_Sequence::~Test_Array_Sequence (void)
+{
+ CORBA::string_free (this->opname_);
+ this->opname_ = 0;
+ // the other data members will be freed as they are "_var"s and objects
+ // (rather than pointers to objects)
+}
+
+const char *
+Test_Array_Sequence::opname (void) const
+{
+ return this->opname_;
+}
+
+void
+Test_Array_Sequence::dii_req_invoke (CORBA::Request *req,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ req->invoke (ACE_TRY_ENV);
+}
+
+int
+Test_Array_Sequence::init_parameters (Param_Test_ptr ,
+ CORBA::Environment &)
+{
+ Generator *gen = GENERATOR::instance (); // value generator
+
+ // get some sequence length (not more than 10)
+ CORBA::ULong len = (CORBA::ULong) (gen->gen_long () % 10) + 1;
+
+ // set the length of the in sequence
+ this->in_.length (len);
+ // different from in_.
+ this->inout_->length (1);
+
+ // now set each individual element
+ Param_Test::Fixed_Array tmp;
+
+ for (CORBA::ULong j = 0; j < Param_Test::DIM1; j++)
+ {
+ tmp[j] = gen->gen_long ();
+ }
+
+ Param_Test::Fixed_Array_copy (this->inout_[0], tmp);
+
+ for (CORBA::ULong i = 0; i < this->in_.length (); i++)
+ {
+ // Generate some arbitrary array to be filled into the ith
+ // location in the sequence.
+ for (CORBA::ULong j = 0; j < Param_Test::DIM1; j++)
+ {
+ tmp[j] = gen->gen_long ();
+ }
+
+ Param_Test::Fixed_Array_copy (this->in_[i], tmp);
+ }
+
+ return 0;
+}
+
+int
+Test_Array_Sequence::reset_parameters (void)
+{
+ // Delete the previous ones.
+ this->inout_ = new Param_Test::ArraySeq;
+ this->out_ = new Param_Test::ArraySeq;
+ this->ret_ = new Param_Test::ArraySeq;
+ return 0;
+}
+
+int
+Test_Array_Sequence::run_sii_test (Param_Test_ptr objref,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_TRY
+ {
+ Param_Test::ArraySeq_out out (this->out_.out ());
+
+ this->ret_ = objref->test_array_sequence (this->in_,
+ this->inout_.inout (),
+ out,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ return 0;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Test_Array_Sequence::run_sii_test\n");
+
+ }
+ ACE_ENDTRY;
+ return -1;
+}
+
+int
+Test_Array_Sequence::add_args (CORBA::NVList_ptr param_list,
+ CORBA::NVList_ptr retval,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_TRY
+ {
+ CORBA::Any in_arg (Param_Test::_tc_ArraySeq,
+ &this->in_,
+ 0);
+
+ CORBA::Any inout_arg (Param_Test::_tc_ArraySeq,
+ &this->inout_.inout (),
+ 0);
+
+ CORBA::Any out_arg (Param_Test::_tc_ArraySeq,
+ &this->out_.inout (),
+ 0);
+
+ // add parameters
+ param_list->add_value ("s1",
+ in_arg,
+ CORBA::ARG_IN,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ param_list->add_value ("s2",
+ inout_arg,
+ CORBA::ARG_INOUT,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ param_list->add_value ("s3",
+ out_arg,
+ CORBA::ARG_OUT,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ CORBA::NamedValue *item = retval->item (0,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ item->value ()->replace (Param_Test::_tc_ArraySeq,
+ &this->ret_.inout (),
+ 0, // does not own
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ return 0;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Test_Array_Sequence::add_args\n");
+
+ }
+ ACE_ENDTRY;
+ return -1;
+}
+
+CORBA::Boolean
+Test_Array_Sequence::check_validity (void)
+{
+ if (this->compare (this->in_, this->inout_.in ()) &&
+ this->compare (this->in_, this->out_.in ()) &&
+ this->compare (this->in_, this->ret_.in ()))
+ return 1;
+ else
+ return 0;
+}
+
+CORBA::Boolean
+Test_Array_Sequence::check_validity (CORBA::Request_ptr )
+{
+ return this->check_validity ();
+}
+
+void
+Test_Array_Sequence::print_values (void)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n"
+ "IN array\n"));
+ this->print_sequence (this->in_);
+ ACE_DEBUG ((LM_DEBUG,
+ "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n"
+ "INOUT array\n"));
+ this->print_sequence (this->inout_.in ());
+ ACE_DEBUG ((LM_DEBUG,
+ "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n"
+ "OUT array\n"));
+ this->print_sequence (this->out_.in ());
+ ACE_DEBUG ((LM_DEBUG,
+ "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n"
+ "RET array\n"));
+ this->print_sequence (this->ret_.in ());
+}
+
+CORBA::Boolean
+Test_Array_Sequence::compare (const Param_Test::ArraySeq &s1,
+ const Param_Test::ArraySeq &s2)
+{
+ if (s1.maximum () != s2.maximum ())
+ {
+ return 0;
+ }
+
+ if (s1.length () != s2.length ())
+ {
+ return 0;
+ }
+
+ for (CORBA::ULong i = 0; i < s1.length (); i++)
+ {
+ const Param_Test::Fixed_Array& vs1 = s1[i];
+ const Param_Test::Fixed_Array& vs2 = s2[i];
+
+ for (CORBA::ULong j = 0; j < Param_Test::DIM1; j++)
+ {
+ if (vs1[j] != vs2[j])
+ {
+ return 0;
+ }
+ }
+ }
+
+ return 1; // success
+}
+
+void
+Test_Array_Sequence::print_sequence (const Param_Test::ArraySeq &s)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "maximum = %d\n"
+ "length = %d\n",
+ s.maximum (),
+ s.length ()));
+ ACE_DEBUG ((LM_DEBUG, "Elements -\n"));
+
+ for (CORBA::ULong i=0; i < s.length (); i++)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Element #%d --\n",
+ i));
+
+ const Param_Test::Fixed_Array& vs = s[i];
+
+ for (CORBA::ULong j = 0; j < Param_Test::DIM1; j++)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Element%d[%d] = %d\n",
+ i,
+ j,
+ vs[j]));
+ }
+ }
+}
+
+
diff --git a/TAO/tests/Param_Test/ub_array_seq.h b/TAO/tests/Param_Test/ub_array_seq.h
new file mode 100644
index 00000000000..1d8b0457136
--- /dev/null
+++ b/TAO/tests/Param_Test/ub_array_seq.h
@@ -0,0 +1,96 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/Param_Test
+//
+// = FILENAME
+// ub_array_seq.h
+//
+// = DESCRIPTION
+// Tests unbounded array sequence
+//
+// = AUTHORS
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef PARAM_TEST_UNBOUNED_ARRAY_SEQUENCE_H
+#define PARAM_TEST_UNBOUNED_ARRAY_SEQUENCE_H
+
+#include "param_testCli.h"
+
+// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
+// test sequence of arrays
+// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
+
+class Test_Array_Sequence
+{
+public:
+ Test_Array_Sequence (void);
+ // ctor
+
+ ~Test_Array_Sequence (void);
+ // dtor
+
+ int run_sii_test (Param_Test_ptr objref,
+ CORBA::Environment &env);
+ // run the SII test
+
+ int add_args (CORBA::NVList_ptr nvlist,
+ CORBA::NVList_ptr retval,
+ CORBA::Environment &env);
+ // add args to NVList for DII
+
+ const char *opname (void) const;
+ // return operation name
+
+ int init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env);
+ // set values for parameters
+
+ int reset_parameters (void);
+ // reset values for CORBA
+
+ CORBA::Boolean check_validity (void);
+ // check if results are valid
+
+ CORBA::Boolean check_validity (CORBA::Request_ptr req);
+ // check if results are valid. This is used for DII results
+
+ void print_values (void);
+ // print all the values
+
+ void dii_req_invoke (CORBA::Request *,
+ CORBA::Environment &);
+ // invoke DII request with appropriate exception handling.
+
+protected:
+ CORBA::Boolean compare (const Param_Test::ArraySeq &s1,
+ const Param_Test::ArraySeq &s2);
+ // compare
+
+ void print_sequence (const Param_Test::ArraySeq &s);
+ // print individual sequence
+
+private:
+ char *opname_;
+ // operation name
+
+ Param_Test::ArraySeq in_;
+ // in parameter
+
+ // these need memory management
+ Param_Test::ArraySeq_var inout_;
+ // inout parameter
+
+ Param_Test::ArraySeq_var out_;
+ // out parameter
+
+ Param_Test::ArraySeq_var ret_;
+ // return value
+};
+
+
+#endif /* PARAM_TEST_UNBOUNED_ARRAY_SEQUENCE_H */
diff --git a/TAO/tests/Param_Test/ub_struct_seq.cpp b/TAO/tests/Param_Test/ub_struct_seq.cpp
index 77ef82ea22c..6c25e5863a6 100644
--- a/TAO/tests/Param_Test/ub_struct_seq.cpp
+++ b/TAO/tests/Param_Test/ub_struct_seq.cpp
@@ -55,7 +55,7 @@ Test_Struct_Sequence::dii_req_invoke (CORBA::Request *req,
}
int
-Test_Struct_Sequence::init_parameters (Param_Test_ptr ,
+Test_Struct_Sequence::init_parameters (Param_Test_ptr,
CORBA::Environment &)
{
Generator *gen = GENERATOR::instance (); // value generator
@@ -69,7 +69,7 @@ Test_Struct_Sequence::init_parameters (Param_Test_ptr ,
// now set each individual element
for (CORBA::ULong i = 0; i < this->in_.length (); i++)
{
- // generate some arbitrary string to be filled into the ith location in
+ // generate some arbitrary struct to be filled into the ith location in
// the sequence
this->in_[i] = gen->gen_fixed_struct ();
this->inout_[i] = gen->gen_fixed_struct ();
@@ -128,7 +128,7 @@ Test_Struct_Sequence::add_args (CORBA::NVList_ptr param_list,
0);
CORBA::Any out_arg (Param_Test::_tc_StructSeq,
- &this->out_.inout (), // .out () causes crash
+ &this->out_.inout (),
0);
// add parameters