summaryrefslogtreecommitdiff
path: root/TAO/tests
diff options
context:
space:
mode:
authorgokhale <asgokhale@users.noreply.github.com>1998-01-07 18:59:50 +0000
committergokhale <asgokhale@users.noreply.github.com>1998-01-07 18:59:50 +0000
commit127ce6a0707bf77affff819010fd7292afdea1d4 (patch)
tree3cd183d49f4ce39919bf9b5db9f8bbbc2693dc15 /TAO/tests
parent325cd1e647340401e6f8f14d2acdba47c4ab7eb3 (diff)
downloadATCD-127ce6a0707bf77affff819010fd7292afdea1d4.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/tests')
-rw-r--r--TAO/tests/Param_Test/client.cpp28
-rw-r--r--TAO/tests/Param_Test/driver.cpp15
-rw-r--r--TAO/tests/Param_Test/options.cpp2
-rw-r--r--TAO/tests/Param_Test/options.h3
-rw-r--r--TAO/tests/Param_Test/param_test.idl8
-rw-r--r--TAO/tests/Param_Test/param_test_i.cpp74
-rw-r--r--TAO/tests/Param_Test/param_test_i.h45
-rw-r--r--TAO/tests/Param_Test/server.cpp2
-rw-r--r--TAO/tests/Param_Test/tests.cpp325
-rw-r--r--TAO/tests/Param_Test/tests.h87
10 files changed, 542 insertions, 47 deletions
diff --git a/TAO/tests/Param_Test/client.cpp b/TAO/tests/Param_Test/client.cpp
index 1d9fe2e6022..8bc216c11fb 100644
--- a/TAO/tests/Param_Test/client.cpp
+++ b/TAO/tests/Param_Test/client.cpp
@@ -59,7 +59,14 @@ Param_Test_Client<T>::run_sii_test (void)
this->results_.iterations (opt->loop_count ());
// initialize parameters for the test
- this->test_object_->init_parameters ();
+ if (this->test_object_->init_parameters (this->param_test_, env) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) client.cpp - run_sii_test:"
+ "init_parameters failed for opname - %s",
+ opname));
+ return -1;
+ }
// Make the calls in a loop.
for (i = 0; i < opt->loop_count (); i++)
@@ -94,6 +101,7 @@ Param_Test_Client<T>::run_sii_test (void)
ACE_DEBUG ((LM_DEBUG, "\n****** After call values *****\n"));
this->test_object_->print_values ();
}
+
if (!this->test_object_->check_validity ())
{
this->results_.error_count (this->results_.error_count () + 1);
@@ -104,7 +112,14 @@ Param_Test_Client<T>::run_sii_test (void)
continue;
}
// reset parameters for the test
- this->test_object_->reset_parameters ();
+ if (this->test_object_->reset_parameters () == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) client.cpp - run_dii_test:"
+ "init_parameters failed for opname - %s",
+ opname));
+ return -1;
+ }
}
// print statistics
@@ -130,7 +145,14 @@ Param_Test_Client<T>::run_dii_test (void)
this->results_.iterations (opt->loop_count ());
// initialize parameters for the test
- this->test_object_->init_parameters ();
+ if (this->test_object_->init_parameters (this->param_test_, env) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%N:%l) client.cpp - run_dii_test:"
+ "init_parameters failed for opname - %s",
+ opname));
+ return -1;
+ }
// Make the calls in a loop.
for (i = 0; i < opt->loop_count (); i++)
diff --git a/TAO/tests/Param_Test/driver.cpp b/TAO/tests/Param_Test/driver.cpp
index 0deeea10bfe..0e58ab1fb19 100644
--- a/TAO/tests/Param_Test/driver.cpp
+++ b/TAO/tests/Param_Test/driver.cpp
@@ -206,6 +206,19 @@ Driver::run (void)
delete client;
}
break;
+ case Options::TEST_OBJREF:
+ {
+ Param_Test_Client<Test_ObjRef> *client = new
+ Param_Test_Client<Test_ObjRef> (this->orb_ptr_,
+ this->objref_,
+ new Test_ObjRef);
+ if (opt->invoke_type () == Options::SII)
+ retstatus = client->run_sii_test ();
+ else
+ retstatus = client->run_dii_test ();
+ delete client;
+ }
+ break;
default:
break;
}
@@ -220,6 +233,7 @@ template class Param_Test_Client<Test_Fixed_Struct>;
template class Param_Test_Client<Test_String_Sequence>;
template class Param_Test_Client<Test_Var_Struct>;
template class Param_Test_Client<Test_Nested_Struct>;
+template class Param_Test_Client<Test_ObjRef>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Singleton<Driver, ACE_SYNCH_RECURSIVE_MUTEX>
#pragma instantiate Param_Test_Client<Test_Short>
@@ -228,4 +242,5 @@ template class Param_Test_Client<Test_Nested_Struct>;
#pragma instantiate Param_Test_Client<Test_String_Sequence>
#pragma instantiate Param_Test_Client<Test_Var_Struct>
#pragma instantiate Param_Test_Client<Test_Nested_Struct>
+#pragma instantiate Param_Test_Client<Test_ObjRef>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/tests/Param_Test/options.cpp b/TAO/tests/Param_Test/options.cpp
index a58d3977db0..b311b46ccf8 100644
--- a/TAO/tests/Param_Test/options.cpp
+++ b/TAO/tests/Param_Test/options.cpp
@@ -84,6 +84,8 @@ Options::parse_args (int argc, char **argv)
this->test_type_ = Options::TEST_VAR_STRUCT;
else if (!ACE_OS::strcmp (get_opts.optarg, "nested_struct"))
this->test_type_ = Options::TEST_NESTED_STRUCT;
+ else if (!ACE_OS::strcmp (get_opts.optarg, "objref"))
+ this->test_type_ = Options::TEST_OBJREF;
break;
case '?':
default:
diff --git a/TAO/tests/Param_Test/options.h b/TAO/tests/Param_Test/options.h
index f86d08966d0..47445dde079 100644
--- a/TAO/tests/Param_Test/options.h
+++ b/TAO/tests/Param_Test/options.h
@@ -33,7 +33,8 @@ public:
TEST_FIXED_STRUCT,
TEST_STRING_SEQUENCE,
TEST_VAR_STRUCT,
- TEST_NESTED_STRUCT
+ TEST_NESTED_STRUCT,
+ TEST_OBJREF
};
enum INVOKE_TYPE
diff --git a/TAO/tests/Param_Test/param_test.idl b/TAO/tests/Param_Test/param_test.idl
index c3a5fcd6b64..f94eca36b1d 100644
--- a/TAO/tests/Param_Test/param_test.idl
+++ b/TAO/tests/Param_Test/param_test.idl
@@ -19,7 +19,6 @@
//
// ============================================================================
-/*
interface Coffee
{
struct Desc
@@ -27,9 +26,8 @@ interface Coffee
string name;
};
- readonly attribute Desc description;
+ attribute Desc description; // provides us the coffee object type
};
- */
interface Param_Test
{
@@ -89,11 +87,11 @@ interface Param_Test
Nested_Struct test_nested_struct (in Nested_Struct s1,
inout Nested_Struct s2,
out Nested_Struct s3);
- /*
// object references
Coffee make_coffee (); // make a Coffee object
- Coffee test_Coffee (in Coffee o1, inout Coffee o2, out Coffee o3);
+ Coffee test_objref (in Coffee o1, inout Coffee o2, out Coffee o3);
+ /*
long test_long (in long l1,
inout long l2,
out long l3);
diff --git a/TAO/tests/Param_Test/param_test_i.cpp b/TAO/tests/Param_Test/param_test_i.cpp
index a2edd5883a0..d4ff792cd37 100644
--- a/TAO/tests/Param_Test/param_test_i.cpp
+++ b/TAO/tests/Param_Test/param_test_i.cpp
@@ -16,10 +16,48 @@
#include "tao/corba.h"
#include "param_test_i.h"
+// ********* class Coffee_i ****************
// Constructor
-Param_Test_i::Param_Test_i (const char *obj_name)
- : POA_Param_Test (obj_name)
+Coffee_i::Coffee_i (const char *name,
+ const char *obj_name)
+ : name_ (name),
+ POA_Coffee (obj_name)
+{
+}
+
+// Destructor
+
+Coffee_i::~Coffee_i (void)
+{
+}
+
+// get attribute
+Coffee::Desc *
+Coffee_i::description (CORBA::Environment & /*env*/)
+{
+ Coffee::Desc *desc = new Coffee::Desc;
+ desc->name = CORBA::string_dup (this->name_);
+ return desc;
+}
+
+// set attribute
+void
+Coffee_i::description (const Coffee::Desc &description,
+ CORBA::Environment & /*env*/)
+{
+ this->name_ = CORBA::string_dup (description.name);
+}
+
+
+// ********* class Param_Test_i ****************
+
+// Constructor
+
+Param_Test_i::Param_Test_i (const char *coffee_name,
+ const char *obj_name)
+ : obj_ (new Coffee_i (coffee_name)),
+ POA_Param_Test (obj_name)
{
}
@@ -81,6 +119,7 @@ Param_Test_i::test_strseq (const Param_Test::StrSeq &s1,
Param_Test::StrSeq_out s3,
CORBA::Environment &env)
{
+ ACE_UNUSED_ARG (env);
// we copy the "in" sequences into all the inout, out and return sequences.
Param_Test::StrSeq
@@ -102,6 +141,7 @@ Param_Test_i::test_var_struct (const Param_Test::Var_Struct &s1,
Param_Test::Var_Struct_out s3,
CORBA::Environment &env)
{
+ ACE_UNUSED_ARG (env);
// we copy the "in" sequences into all the inout, out and return sequences.
Param_Test::Var_Struct
@@ -123,6 +163,7 @@ Param_Test_i::test_nested_struct (const Param_Test::Nested_Struct &s1,
Param_Test::Nested_Struct_out s3,
CORBA::Environment &env)
{
+ ACE_UNUSED_ARG (env);
// we copy the "in" sequences into all the inout, out and return sequences.
Param_Test::Nested_Struct
@@ -136,3 +177,32 @@ Param_Test_i::test_nested_struct (const Param_Test::Nested_Struct &s1,
s3 = out;
return ret;
}
+
+// make a Coffee object
+Coffee_ptr
+Param_Test_i::make_coffee (CORBA::Environment & /*env*/)
+{
+ return Coffee::_duplicate (this->obj_.in ());
+}
+
+// test for object references
+Coffee_ptr
+Param_Test_i::test_objref (Coffee_ptr o1,
+ Coffee_ptr &o2,
+ Coffee_out o3,
+ CORBA::Environment &env)
+{
+ // o1's attribute should be same as the one we have
+ if (this->obj_->_is_equivalent (o1, env))
+ {
+ o2 = Coffee::_duplicate (this->obj_.in ());
+ o3 = Coffee::_duplicate (this->obj_.in ());
+ return Coffee::_duplicate (this->obj_.in ());
+ }
+ else
+ {
+ o2 = Coffee::_nil ();
+ o3 = Coffee::_nil ();
+ return Coffee::_nil ();
+ }
+}
diff --git a/TAO/tests/Param_Test/param_test_i.h b/TAO/tests/Param_Test/param_test_i.h
index 50c19abf7b3..584da7372ac 100644
--- a/TAO/tests/Param_Test/param_test_i.h
+++ b/TAO/tests/Param_Test/param_test_i.h
@@ -18,6 +18,33 @@
#include "param_testS.h"
+// Implementation of the Coffee interface
+class Coffee_i : public POA_Coffee
+
+{
+public:
+ Coffee_i (const char *name,
+ const char *obj_name = 0);
+ // constructor
+
+ ~Coffee_i (void);
+ // destructor
+
+ // =methods for the attribute
+
+ virtual Coffee::Desc * description (CORBA::Environment &env);
+ // get attribute
+
+ virtual void description (const Coffee::Desc &description,
+ CORBA::Environment &env);
+ // set attribute
+
+private:
+ CORBA::String_var name_;
+ // my description
+};
+
+// the implementation of the Param_test interface
class Param_Test_i : public POA_Param_Test
{
// = TITLE
@@ -25,7 +52,8 @@ class Param_Test_i : public POA_Param_Test
// = DESCRIPTION
// Implementation of the Param_Test test suite.
public:
- Param_Test_i (const char *obj_name = 0);
+ Param_Test_i (const char *coffee_name,
+ const char *obj_name = 0);
// Constructor
~Param_Test_i (void);
@@ -70,6 +98,21 @@ public:
Param_Test::Nested_Struct_out s3,
CORBA::Environment &env);
// test for nested structs
+
+ virtual Coffee_ptr
+ make_coffee (CORBA::Environment &env);
+ // make a coffee object
+
+ virtual Coffee_ptr
+ test_objref (Coffee_ptr o1,
+ Coffee_ptr &o2,
+ Coffee_out o3,
+ CORBA::Environment &env);
+ // test for object references
+
+private:
+ Coffee_var obj_;
+ // the coffee object reference we maintain
};
#endif /* PARAM_TEST_I_H */
diff --git a/TAO/tests/Param_Test/server.cpp b/TAO/tests/Param_Test/server.cpp
index 15c784abc68..c31d165eef9 100644
--- a/TAO/tests/Param_Test/server.cpp
+++ b/TAO/tests/Param_Test/server.cpp
@@ -76,7 +76,7 @@ main (int argc, char *argv[])
Param_Test_i *param_test;
// implicitly initializes with the OA
- ACE_NEW_RETURN (param_test, Param_Test_i ("param_test"), 1);
+ ACE_NEW_RETURN (param_test, Param_Test_i ("unknown", "param_test"), 1);
if (TAO_debug_level > 0)
{
diff --git a/TAO/tests/Param_Test/tests.cpp b/TAO/tests/Param_Test/tests.cpp
index 3bf683734d3..f8fd02a48db 100644
--- a/TAO/tests/Param_Test/tests.cpp
+++ b/TAO/tests/Param_Test/tests.cpp
@@ -41,21 +41,27 @@ Test_Short::opname (void) const
return this->opname_;
}
-void
-Test_Short::init_parameters (void)
+int
+Test_Short::init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env)
{
Generator *gen = GENERATOR::instance (); // value generator
+ ACE_UNUSED_ARG (objref);
+ ACE_UNUSED_ARG (env);
+
this->in_ = gen->gen_short ();
this->inout_ = 0;
+ return 0;
}
-void
+int
Test_Short::reset_parameters (void)
{
this->inout_ = 0;
this->out_ = 0;
this->ret_ = 0;
+ return 0;
}
int
@@ -158,10 +164,14 @@ Test_Unbounded_String::opname (void) const
return this->opname_;
}
-void
-Test_Unbounded_String::init_parameters (void)
+int
+Test_Unbounded_String::init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env)
{
Generator *gen = GENERATOR::instance (); // value generator
+ ACE_UNUSED_ARG (objref);
+ ACE_UNUSED_ARG (env);
+
// release any previously occupied values
CORBA::string_free (this->in_);
CORBA::string_free (this->inout_);
@@ -174,9 +184,10 @@ Test_Unbounded_String::init_parameters (void)
this->in_ = gen->gen_string ();
this->inout_ = CORBA::string_dup (this->in_);
+ return 0;
}
-void
+int
Test_Unbounded_String::reset_parameters (void)
{
// release any previously occupied values
@@ -185,6 +196,7 @@ Test_Unbounded_String::reset_parameters (void)
this->ret_ = 0;
this->inout_ = CORBA::string_dup (this->in_);
+ return 0;
}
int
@@ -284,21 +296,27 @@ Test_Fixed_Struct::opname (void) const
return this->opname_;
}
-void
-Test_Fixed_Struct::init_parameters (void)
+int
+Test_Fixed_Struct::init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env)
{
Generator *gen = GENERATOR::instance (); // value generator
+ ACE_UNUSED_ARG (objref);
+ ACE_UNUSED_ARG (env);
+
this->in_ = gen->gen_fixed_struct ();
ACE_OS::memset (&this->inout_, 0, sizeof (Param_Test::Fixed_Struct));
+ return 0;
}
-void
+int
Test_Fixed_Struct::reset_parameters (void)
{
ACE_OS::memset (&this->inout_, 0, sizeof (Param_Test::Fixed_Struct));
ACE_OS::memset (&this->out_, 0, sizeof (Param_Test::Fixed_Struct));
ACE_OS::memset (&this->ret_, 0, sizeof (Param_Test::Fixed_Struct));
+ return 0;
}
int
@@ -471,11 +489,15 @@ Test_String_Sequence::opname (void) const
return this->opname_;
}
-void
-Test_String_Sequence::init_parameters (void)
+int
+Test_String_Sequence::init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env)
{
Generator *gen = GENERATOR::instance (); // value generator
+ ACE_UNUSED_ARG (objref);
+ ACE_UNUSED_ARG (env);
+
// get some sequence length (not more than 10)
CORBA::ULong len = (CORBA::ULong) (gen->gen_long () % 10) + 1;
@@ -489,14 +511,16 @@ Test_String_Sequence::init_parameters (void)
char *str = gen->gen_string ();
this->in_[i] = str;
}
+ return 0;
}
-void
+int
Test_String_Sequence::reset_parameters (void)
{
this->inout_ = new Param_Test::StrSeq; // delete the previous one
this->out_ = 0;
this->ret_ = 0;
+ return 0;
}
int
@@ -616,11 +640,15 @@ Test_Var_Struct::opname (void) const
return this->opname_;
}
-void
-Test_Var_Struct::init_parameters (void)
+int
+Test_Var_Struct::init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env)
{
Generator *gen = GENERATOR::instance (); // value generator
+ ACE_UNUSED_ARG (objref);
+ ACE_UNUSED_ARG (env);
+
// get some sequence length (not more than 10)
CORBA::ULong len = (CORBA::ULong) (gen->gen_long () % 10) + 1;
@@ -634,14 +662,16 @@ Test_Var_Struct::init_parameters (void)
char *str = gen->gen_string ();
this->in_.seq[i] = str;
}
+ return 0;
}
-void
+int
Test_Var_Struct::reset_parameters (void)
{
this->inout_ = new Param_Test::Var_Struct; // delete the previous one
this->out_ = 0;
this->ret_ = 0;
+ return 0;
}
int
@@ -761,11 +791,15 @@ Test_Nested_Struct::opname (void) const
return this->opname_;
}
-void
-Test_Nested_Struct::init_parameters (void)
+int
+Test_Nested_Struct::init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env)
{
Generator *gen = GENERATOR::instance (); // value generator
+ ACE_UNUSED_ARG (objref);
+ ACE_UNUSED_ARG (env);
+
// get some sequence length (not more than 10)
CORBA::ULong len = (CORBA::ULong) (gen->gen_long () % 10) + 1;
@@ -779,14 +813,16 @@ Test_Nested_Struct::init_parameters (void)
char *str = gen->gen_string ();
this->in_.vs.seq[i] = str;
}
+ return 0;
}
-void
+int
Test_Nested_Struct::reset_parameters (void)
{
this->inout_ = new Param_Test::Nested_Struct; // delete the previous one
this->out_ = 0;
this->ret_ = 0;
+ return 0;
}
int
@@ -849,12 +885,13 @@ CORBA::Boolean
Test_Nested_Struct::check_validity (CORBA::Request_ptr req)
{
CORBA::Environment env;
- this->inout_ = new Param_Test::Nested_Struct (*(Param_Test::Nested_Struct *) req->arguments
- ()->item (1, env)->value ()->value ());
+ this->inout_ = new Param_Test::Nested_Struct (*(Param_Test::Nested_Struct *)
+ req->arguments ()->item
+ (1, env)->value ()->value ());
this->out_ = new Param_Test::Nested_Struct (*(Param_Test::Nested_Struct *) req->arguments
- ()->item (2, env)->value ()->value ());
+ ()->item (2, env)->value ()->value ());
this->ret_ = new Param_Test::Nested_Struct (*(Param_Test::Nested_Struct *)req->result
- ()->value ()->value ());
+ ()->value ()->value ());
return this->check_validity ();
}
@@ -880,3 +917,247 @@ Test_Nested_Struct::print_values (void)
(this->ret_->vs.seq.length ()? (char *)this->ret_->vs.seq[i]:"<nul>")));
}
}
+
+// ************************************************************************
+// Test_ObjRef
+// ************************************************************************
+
+Test_ObjRef::Test_ObjRef (void)
+ : opname_ (CORBA::string_dup ("test_objref"))
+{
+}
+
+Test_ObjRef::~Test_ObjRef (void)
+{
+ CORBA::string_free (this->opname_);
+ this->opname_ = 0;
+}
+
+const char *
+Test_ObjRef::opname (void) const
+{
+ return this->opname_;
+}
+
+static char *Coffee_Flavor [] = {
+ "Italian Roast",
+ "Irish Creme",
+ "Costa Rican",
+ "Colombian Supremo",
+ "Macademia Nut",
+ "Swiss Chocolate Mocha"
+};
+
+int
+Test_ObjRef::init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env)
+{
+ Coffee::Desc desc;
+ Generator *gen = GENERATOR::instance (); // value generator
+
+ // first get a Coffee object
+ this->in_ = objref->make_coffee (env);
+ if (env.exception ())
+ {
+ env.print_exception ("make_coffee");
+ return -1;
+ }
+
+ // get some sequence length (not more than 10)
+ CORBA::ULong index = (CORBA::ULong) (gen->gen_long () % 6);
+ desc.name = Coffee_Flavor [index];
+ // set the attribute of the object
+ this->in_->description (desc, env); // set the attribute for the in object
+ if (env.exception ())
+ {
+ env.print_exception ("set coffee attribute");
+ return -1;
+ }
+ return 0;
+}
+
+int
+Test_ObjRef::reset_parameters (void)
+{
+ CORBA::Environment env;
+ Coffee::Desc desc;
+ Generator *gen = GENERATOR::instance (); // value generator
+
+ // get some sequence length (not more than 10)
+ CORBA::ULong index = (CORBA::ULong) (gen->gen_long () % 6);
+ desc.name = Coffee_Flavor [index];
+ // set the attribute of the object
+ this->in_->description (desc, env); // set the attribute for the in object
+ if (env.exception ())
+ {
+ env.print_exception ("set coffee attribute");
+ return -1;
+ }
+
+ this->inout_ = Coffee::_nil ();
+ this->out_ = Coffee::_nil ();
+ this->ret_ = Coffee::_nil ();
+ return 0;
+}
+
+int
+Test_ObjRef::run_sii_test (Param_Test_ptr objref,
+ CORBA::Environment &env)
+{
+ Coffee_out out (this->out_.out ());
+ this->ret_ = objref->test_objref (this->in_.in (),
+ this->inout_.inout (),
+ out,
+ env);
+ return (env.exception () ? -1:0);
+}
+
+int
+Test_ObjRef::add_args (CORBA::NVList_ptr &param_list,
+ CORBA::NVList_ptr &retval,
+ CORBA::Environment &env)
+{
+ CORBA::Any in_arg (_tc_Coffee, &this->in_, 0);
+ CORBA::Any inout_arg (_tc_Coffee, &this->inout_, 0);
+ CORBA::Any out_arg (_tc_Coffee, &this->out_, 0);
+
+ // add parameters
+ (void)param_list->add_value ("o1", in_arg, CORBA::ARG_IN, env);
+ (void)param_list->add_value ("o2", inout_arg, CORBA::ARG_INOUT, env);
+ (void)param_list->add_value ("o3", out_arg, CORBA::ARG_OUT, env);
+
+ // add return value
+ (void)retval->item (0, env)->value ()->replace (_tc_Coffee,
+ &this->ret_,
+ 0, // does not own
+ env);
+ return 0;
+}
+
+CORBA::Boolean
+Test_ObjRef::check_validity (void)
+{
+ CORBA::Environment env;
+ char // attribute names
+ *in,
+ *inout,
+ *out,
+ *ret;
+
+ in = this->in_->description (env)->name;
+ if (env.exception ())
+ {
+ env.print_exception ("retrieving description");
+ return 0;
+ }
+
+ inout = this->inout_->description (env)->name;
+ if (env.exception ())
+ {
+ env.print_exception ("retrieving description");
+ return 0;
+ }
+
+ out = this->out_->description (env)->name;
+ if (env.exception ())
+ {
+ env.print_exception ("retrieving description");
+ return 0;
+ }
+
+ ret = this->ret_->description (env)->name;
+ if (env.exception ())
+ {
+ env.print_exception ("retrieving description");
+ return 0;
+ }
+
+ // now compare them
+ if (!ACE_OS::strcmp (in, inout) &&
+ !ACE_OS::strcmp (in, out) &&
+ !ACE_OS::strcmp (in, ret))
+ return 1; // success
+ else
+ return 0;
+}
+
+CORBA::Boolean
+Test_ObjRef::check_validity (CORBA::Request_ptr req)
+{
+ CORBA::Environment env;
+ this->inout_ = Coffee::_narrow ((CORBA::Object_ptr) req->arguments ()->item
+ (1, env)->value ()->value (), env);
+ if (env.exception ())
+ {
+ env.print_exception ("_narrow from DII result");
+ return 0;
+ }
+
+ this->out_ = Coffee::_narrow ((CORBA::Object_ptr) req->arguments ()->item
+ (2, env)->value ()->value (), env);
+ if (env.exception ())
+ {
+ env.print_exception ("_narrow from DII result");
+ return 0;
+ }
+
+ this->ret_ = Coffee::_narrow ((CORBA::Object_ptr)req->result ()->value
+ ()->value (), env);
+ if (env.exception ())
+ {
+ env.print_exception ("_narrow from DII result");
+ return 0;
+ }
+
+ return this->check_validity ();
+}
+
+void
+Test_ObjRef::print_values (void)
+{
+ CORBA::Environment env;
+ char // attribute names
+ *in,
+ *inout,
+ *out,
+ *ret;
+
+ in = this->in_->description (env)->name;
+ if (env.exception ())
+ {
+ env.print_exception ("retrieving description");
+ return;
+ }
+
+ inout = this->inout_->description (env)->name;
+ if (env.exception ())
+ {
+ env.print_exception ("retrieving description");
+ return;
+ }
+
+ out = this->out_->description (env)->name;
+ if (env.exception ())
+ {
+ env.print_exception ("retrieving description");
+ return;
+ }
+
+ ret = this->ret_->description (env)->name;
+ if (env.exception ())
+ {
+ env.print_exception ("retrieving description");
+ return;
+ }
+
+ ACE_DEBUG ((LM_DEBUG,
+ "\n=*=*=*=*=*=*"
+ "in = %s, "
+ "inout = %s, "
+ "out = %s, "
+ "ret = %s*=*=*=*=*=\n",
+ in,
+ inout,
+ out,
+ ret));
+}
diff --git a/TAO/tests/Param_Test/tests.h b/TAO/tests/Param_Test/tests.h
index e45e7322d7c..a87eb464215 100644
--- a/TAO/tests/Param_Test/tests.h
+++ b/TAO/tests/Param_Test/tests.h
@@ -45,10 +45,11 @@ public:
const char *opname (void) const;
// return operation name
- void init_parameters (void);
+ int init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env);
// set values for parameters
- void reset_parameters (void);
+ int reset_parameters (void);
// reset values for CORBA
CORBA::Boolean check_validity (void);
@@ -101,10 +102,11 @@ public:
const char *opname (void) const;
// return operation name
- void init_parameters (void);
+ int init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env);
// set values for parameters
- void reset_parameters (void);
+ int reset_parameters (void);
// reset values for CORBA
CORBA::Boolean check_validity (void);
@@ -158,10 +160,11 @@ public:
const char *opname (void) const;
// return operation name
- void init_parameters (void);
+ int init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env);
// set values for parameters
- void reset_parameters (void);
+ int reset_parameters (void);
// reset values for CORBA
CORBA::Boolean check_validity (void);
@@ -215,10 +218,11 @@ public:
const char *opname (void) const;
// return operation name
- void init_parameters (void);
+ int init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env);
// set values for parameters
- void reset_parameters (void);
+ int reset_parameters (void);
// reset values for CORBA
CORBA::Boolean check_validity (void);
@@ -272,10 +276,11 @@ public:
const char *opname (void) const;
// return operation name
- void init_parameters (void);
+ int init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env);
// set values for parameters
- void reset_parameters (void);
+ int reset_parameters (void);
// reset values for CORBA
CORBA::Boolean check_validity (void);
@@ -330,10 +335,11 @@ public:
const char *opname (void) const;
// return operation name
- void init_parameters (void);
+ int init_parameters (Param_Test_ptr objref,
+ CORBA::Environment &env);
// set values for parameters
- void reset_parameters (void);
+ int reset_parameters (void);
// reset values for CORBA
CORBA::Boolean check_validity (void);
@@ -363,4 +369,61 @@ private:
// return value
};
+// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
+// test objrefs
+// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
+class Test_ObjRef
+{
+public:
+ Test_ObjRef (void);
+ // ctor
+
+ ~Test_ObjRef (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
+
+private:
+ char *opname_;
+ // operation name
+
+ Coffee_var in_;
+ // in parameter
+
+ Coffee_var inout_;
+ // inout parameter
+
+ Coffee_var out_;
+ // out parameter
+
+ Coffee_var ret_;
+ // return value
+};
+
#endif /* if !defined */