summaryrefslogtreecommitdiff
path: root/TAO/tests/DII_Collocation_Tests/twoway
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2007-04-10 09:58:44 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2007-04-10 09:58:44 +0000
commit2da4ac6d029c495757ce7221b91f96fd5a4aea89 (patch)
treeae7846c772d3aa4b3faeb8d273d532b022f41bd9 /TAO/tests/DII_Collocation_Tests/twoway
parent74ac7fe3ee14d91e57fe5d8904dbd8eb3615deb1 (diff)
downloadATCD-2da4ac6d029c495757ce7221b91f96fd5a4aea89.tar.gz
Tue Apr 10 09:57:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/tests/DII_Collocation_Tests/twoway')
-rw-r--r--TAO/tests/DII_Collocation_Tests/twoway/Client_Task.cpp78
-rw-r--r--TAO/tests/DII_Collocation_Tests/twoway/Hello.cpp14
-rw-r--r--TAO/tests/DII_Collocation_Tests/twoway/Hello.h6
-rw-r--r--TAO/tests/DII_Collocation_Tests/twoway/Test.idl25
4 files changed, 106 insertions, 17 deletions
diff --git a/TAO/tests/DII_Collocation_Tests/twoway/Client_Task.cpp b/TAO/tests/DII_Collocation_Tests/twoway/Client_Task.cpp
index a6b4a921625..41c7b613c38 100644
--- a/TAO/tests/DII_Collocation_Tests/twoway/Client_Task.cpp
+++ b/TAO/tests/DII_Collocation_Tests/twoway/Client_Task.cpp
@@ -11,6 +11,7 @@
ACE_RCSID(DII_Collocation_Tests, Client_Task, "$Id$")
char TEST_STR[] = "This is a DII collocation test.";
+char NULL_STR[] = "";
CORBA::Long TEST_BASIC_VALUE = 12345;
CORBA::Char TEST_SPECIAL_VALUE = 'x';
CORBA::Short TEST_HOUR = 12;
@@ -50,7 +51,7 @@ Client_Task::svc (void)
if (CORBA::is_nil (simple_test_obj.in ()))
{
- ACE_ERROR_RETURN ((LM_DEBUG,
+ ACE_ERROR_RETURN ((LM_ERROR,
"Nil Test::Simple_Test reference <%s>\n",
simple_test_input_),
1);
@@ -58,21 +59,88 @@ Client_Task::svc (void)
Test::Simple_Test_var simple_test
= Test::Simple_Test::_narrow (simple_test_obj.in ());
-CORBA::Long l = 200;
+ CORBA::Long l = 200;
CORBA::Request_var req (obj->_request ("test_basic_arg"));
req->add_in_arg ("basic") <<= TEST_BASIC_VALUE;
req->add_out_arg ("x") <<= l;
req->invoke ();
if (req->response_received ())
{
-
+ for (CORBA::ULong count=0; count<req->arguments ()->count () ;++count)
+ {
+ CORBA::NamedValue_ptr arg = req->arguments ()->item (count);
+ if (ACE_OS::strcmp (arg->name (), "x") == 0)
+ {
+ CORBA::Long y = 0;
+ if (*(arg->value()) >>= y)
+ {
+ if (y != 10)
+ {
+ ++error_count_;
+ ACE_ERROR_RETURN ((LM_ERROR, "Invalid out value, received %d\n", y), 1);
+ }
+ }
+ else
+ {
+ ++error_count_;
+ ACE_ERROR_RETURN ((LM_ERROR, "Invalid typed value\n"), 1);
+ }
+ }
+ }
+ }
+ else
+ {
+ ++error_count_;
+ ACE_ERROR_RETURN ((LM_ERROR, "Response received not true\n"), 1);
}
req = obj->_request ("test_unbounded_string_arg");
req->add_in_arg ("ub_string") <<= TEST_STR;
req->invoke ();
+ if (req->response_received ())
+ {
+ }
+ else
+ {
+ ++error_count_;
+ ACE_ERROR_RETURN ((LM_ERROR, "Response received not true\n"), 1);
+ }
+ req = obj->_request ("test_unbounded_string_arg_out");
+
+ req->add_in_arg ("ub_string") <<= TEST_STR;
+ req->add_out_arg ("x") <<= NULL_STR;
+ req->invoke ();
+ if (req->response_received ())
+ {
+ for (CORBA::ULong count=0; count<req->arguments ()->count () ;++count)
+ {
+ CORBA::NamedValue_ptr arg = req->arguments ()->item (count);
+ if (ACE_OS::strcmp (arg->name (), "x") == 0)
+ {
+ const char * ystring = 0;
+ if (*(arg->value()) >>= ystring)
+ {
+ if (ACE_OS::strcmp(ystring, TEST_STR) != 0)
+ {
+ ++error_count_;
+ ACE_ERROR_RETURN ((LM_ERROR, "Invalid out value, received %s\n", ystring), 1);
+ }
+ }
+ else
+ {
+ ++error_count_;
+ ACE_ERROR_RETURN ((LM_ERROR, "Invalid typed value\n"), 1);
+ }
+ }
+ }
+ }
+ else
+ {
+ ++error_count_;
+ ACE_ERROR_RETURN ((LM_ERROR, "Response received not true\n"), 1);
+ }
req = obj->_request ("test_bounded_string_arg");
@@ -217,13 +285,13 @@ CORBA::Long l = 200;
}
catch (const CORBA::Exception& ex)
{
- error_count_ ++;
+ ++error_count_;
ex._tao_print_exception ("Exception caught:");
return 1;
}
catch (...)
{
- error_count_ ++;
+ ++error_count_;
ACE_ERROR ((LM_ERROR, "(%P|%t)Client_Task::svc - caught unknown exception \n"));
return 1;
}
diff --git a/TAO/tests/DII_Collocation_Tests/twoway/Hello.cpp b/TAO/tests/DII_Collocation_Tests/twoway/Hello.cpp
index 0c21c44f5b5..29862aed6d1 100644
--- a/TAO/tests/DII_Collocation_Tests/twoway/Hello.cpp
+++ b/TAO/tests/DII_Collocation_Tests/twoway/Hello.cpp
@@ -73,6 +73,20 @@ Hello::test_unbounded_string_arg(const char* message)
}
}
+void
+Hello::test_unbounded_string_arg_out(const char* message, ::CORBA::String_out out_message)
+{
+ if (debug)
+ ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t)Hello::test_unbounded_string_arg_out ")
+ ACE_TEXT("got unbounded string: %s\n"),
+ message));
+ if (ACE_OS::strncmp (message, TEST_STR, strlen (TEST_STR) != 0))
+ {
+ ERROR_COUNT ("Hello::test_unbounded_string_arg_out")
+ }
+ out_message = CORBA::string_dup (message);
+}
+
void
Hello::test_bounded_string_arg(const char* message)
diff --git a/TAO/tests/DII_Collocation_Tests/twoway/Hello.h b/TAO/tests/DII_Collocation_Tests/twoway/Hello.h
index 210748f7469..4dae7429cb1 100644
--- a/TAO/tests/DII_Collocation_Tests/twoway/Hello.h
+++ b/TAO/tests/DII_Collocation_Tests/twoway/Hello.h
@@ -48,6 +48,12 @@ public:
);
virtual
+ void test_unbounded_string_arg_out (
+ const char * message,
+ ::CORBA::String_out out_message
+ );
+
+ virtual
void test_bounded_string_arg (
const char * message
);
diff --git a/TAO/tests/DII_Collocation_Tests/twoway/Test.idl b/TAO/tests/DII_Collocation_Tests/twoway/Test.idl
index f248f37c698..8fa814b4920 100644
--- a/TAO/tests/DII_Collocation_Tests/twoway/Test.idl
+++ b/TAO/tests/DII_Collocation_Tests/twoway/Test.idl
@@ -33,6 +33,8 @@ module Test
void test_unbounded_string_arg(in string message);
+ void test_unbounded_string_arg_out(in string message, out string out_message);
+
void test_bounded_string_arg(in string<BOUNDED_STRING_SIZE> message);
void test_fixed_array_arg(in Fixed_Array message);
@@ -50,23 +52,22 @@ module Test
void test_objref_arg (in Simple_Test test);
void test_object_arg (in Object o);
-
- void test_args_1 (in Object arg1,
- in char arg2,
- in Simple_Test arg3);
- void test_args_2 (in string arg1,
- in Fixed_Array arg2,
- in TimeOfDay arg3);
+ void test_args_1 (in Object arg1,
+ in char arg2,
+ in Simple_Test arg3);
+
+ void test_args_2 (in string arg1,
+ in Fixed_Array arg2,
+ in TimeOfDay arg3);
- void test_args_3 (in string<BOUNDED_STRING_SIZE> arg1,
- in Bounded_Var_Size_Arg arg2,
+ void test_args_3 (in string<BOUNDED_STRING_SIZE> arg1,
+ in Bounded_Var_Size_Arg arg2,
in Unbounded_Var_Size_Arg arg3,
in Var_Array arg4);
-
- /// Return a simple string
+
string get_string ();
-
+
/// A method to shutdown the ORB
/**
* This method is used to simplify the test shutdown process