summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Mesnier <mesnier_p@ociweb.com>2006-07-03 01:07:26 +0000
committerPhil Mesnier <mesnier_p@ociweb.com>2006-07-03 01:07:26 +0000
commita9e2187f52e4a9ed830549aa827eebfd18d6c6cf (patch)
treeb625be9a2e82f5dea2a1e1d7a11050e7e59ee8d9
parent8a9cb6a565cbdfab2dc9b340916d9e761474fc53 (diff)
downloadATCD-a9e2187f52e4a9ed830549aa827eebfd18d6c6cf.tar.gz
ChangeLog tag: Mon Jul 3 00:54:37 UTC 2006 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r--TAO/ChangeLog43
-rw-r--r--TAO/tao/AnyTypeCode/skip.cpp40
-rw-r--r--TAO/tao/Valuetype/Valuetype_Adapter_Impl.cpp27
-rw-r--r--TAO/tao/Valuetype/Valuetype_Adapter_Impl.h6
-rw-r--r--TAO/tao/Valuetype_Adapter.h6
-rw-r--r--TAO/tests/OBV/Any/Any.idl6
-rw-r--r--TAO/tests/OBV/Any/AnyS_impl.cpp14
-rw-r--r--TAO/tests/OBV/Any/AnyS_impl.h3
-rw-r--r--TAO/tests/OBV/Any/OBV_Any.mpc2
-rw-r--r--TAO/tests/OBV/Any/client.cpp47
-rw-r--r--TAO/tests/OBV/Truncatable/Extra.idl19
-rw-r--r--TAO/tests/OBV/Truncatable/OBV_Truncatable.mpc3
-rw-r--r--TAO/tests/OBV/Truncatable/Truncatable.idl12
-rw-r--r--TAO/tests/OBV/Truncatable/TruncatableS_impl.cpp105
-rw-r--r--TAO/tests/OBV/Truncatable/TruncatableS_impl.h9
-rw-r--r--TAO/tests/OBV/Truncatable/client.cpp94
16 files changed, 389 insertions, 47 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index a7a6f662f2f..cf9bd88ca95 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,44 @@
+Mon Jul 3 00:54:37 UTC 2006 Phil Mesnier <mesnier_p@ociweb.com>
+
+ * tao/AnyTypeCode/skip.cpp:
+ * tao/Valuetype/Valuetype_Adapter_Impl.h:
+ * tao/Valuetype/Valuetype_Adapter_Impl.cpp:
+ * tao/Valuetype_Adapter.h:
+ Reworked the new interfaces added to the valuetype adapter to be
+ a little more logical, and added one for detecting chunking.
+ Skipping the chunks turns out to be really easy, the chunk start
+ is the length in bytes to skip. Skip that length, then get the
+ chunk end tag, which is the negated length. If the chunk start
+ value is negative, that indicates the end of a nesting level, so
+ this process is repeated until a nesting level of -1 is reached,
+ indicating the end of the value.
+
+ This change enables truncatable values to be encapsulated in
+ anys.
+
+ * tao/Valuetype/ValueBase.cpp:
+ Reformatted a long comment
+
+ * tests/OBV/Any/Any.idl:
+ * tests/OBV/Any/AnyS_impl.h:
+ * tests/OBV/Any/AnyS_impl.cpp:
+ * tests/OBV/Any/OBV_Any.mpc:
+ * tests/OBV/Any/client.cpp:
+ * tests/OBV/Truncatable/Extra.idl:
+ * tests/OBV/Truncatable/OBV_Truncatable.mpc:
+ * tests/OBV/Truncatable/Truncatable.idl:
+ * tests/OBV/Truncatable/TruncatableS_impl.h:
+ * tests/OBV/Truncatable/TruncatableS_impl.cpp:
+ * tests/OBV/Truncatable/client.cpp:
+
+ Adding the change for encapsulating truncatables gave rise to a
+ new bug, 2576. This bug illustrates that TAO does not properly
+ extract a valuetype to a base value pointer, even though the
+ base value type is carried as part of the Any's typeID
+ information. So as not to increase the number of failures on the
+ scoreboard at this time the test code illustrating this bug is
+ guarded by a #if defined (TAO_TEST_BUG_2576).
+
Sat Jul 1 19:16:11 UTC 2006 Phil Mesnier <mesnier_p@ociweb.com>
* NEWS:
@@ -20,6 +61,8 @@ Sat Jul 1 15:32:43 UTC 2006 Phil Mesnier <mesnier_p@ociweb.com>
valuetype marshaling which is not the default case since it
breaks backwards compatibility.
+ This resolves bug 2575.
+
* tao/TAO_Server_Request.h:
Fixed a typo in a comment.
diff --git a/TAO/tao/AnyTypeCode/skip.cpp b/TAO/tao/AnyTypeCode/skip.cpp
index 86a7d6c3d3f..f8c486bc6a2 100644
--- a/TAO/tao/AnyTypeCode/skip.cpp
+++ b/TAO/tao/AnyTypeCode/skip.cpp
@@ -984,21 +984,47 @@ TAO_Marshal_Value::skip (CORBA::TypeCode_ptr tc,
// We are done.
return retval;
}
- else if (value_tag & adapter->type_info_single ())
+ else if (adapter->is_type_info_single(value_tag))
{
- // @@@ this isn't really correct, the test will return true
- // if the value_tag ends with 02 for a single value or 06
- // for a value list. In the latter case, we need to skip an
- // array of strings.
-
// Skip a single repository id which is of type string.
stream->skip_string ();
}
- else if (value_tag != adapter->type_info_implied ())
+ else if (adapter->is_type_info_list(value_tag))
+ {
+ CORBA::Long num_types;
+ if (!stream->read_long (num_types))
+ {
+ return TAO::TRAVERSE_STOP;
+ }
+ while (num_types > 0)
+ {
+ stream->skip_string();
+ num_types--;
+ }
+ }
+ else if (!adapter->is_type_info_implied (value_tag))
{
//@@ boris: VT CDR
return TAO::TRAVERSE_STOP;
}
+
+ if (adapter->is_value_chunked (value_tag))
+ {
+ CORBA::Long chunk_tag = 0;
+ while (chunk_tag != -1)
+ {
+ if (!stream->read_long (chunk_tag))
+ return TAO::TRAVERSE_STOP;
+
+ if (chunk_tag > 0)
+ {
+ if (!stream->skip_bytes(chunk_tag))
+ return TAO::TRAVERSE_STOP;
+ }
+ }
+ return TAO::TRAVERSE_CONTINUE;
+ }
+
}
// Handle our base valuetype if any.
diff --git a/TAO/tao/Valuetype/Valuetype_Adapter_Impl.cpp b/TAO/tao/Valuetype/Valuetype_Adapter_Impl.cpp
index feb3c35f783..b0a61220626 100644
--- a/TAO/tao/Valuetype/Valuetype_Adapter_Impl.cpp
+++ b/TAO/tao/Valuetype/Valuetype_Adapter_Impl.cpp
@@ -48,12 +48,29 @@ TAO_Valuetype_Adapter_Impl::type_info_single (void) const
return TAO_OBV_GIOP_Flags::Type_info_single;
}
-CORBA::Long
-TAO_Valuetype_Adapter_Impl::type_info_implied (void) const
+CORBA::Boolean
+TAO_Valuetype_Adapter_Impl::is_type_info_implied (CORBA::Long vt) const
+{
+ return vt == TAO_OBV_GIOP_Flags::Value_tag_base;
+}
+
+CORBA::Boolean
+TAO_Valuetype_Adapter_Impl::is_type_info_single (CORBA::Long vt) const
+{
+ return ((vt | TAO_OBV_GIOP_Flags::Type_info_single) == vt) &&
+ ((vt | TAO_OBV_GIOP_Flags::Type_info_list) != vt);
+}
+
+CORBA::Boolean
+TAO_Valuetype_Adapter_Impl::is_type_info_list (CORBA::Long vt) const
+{
+ return (vt | TAO_OBV_GIOP_Flags::Type_info_list) == vt;
+}
+
+CORBA::Boolean
+TAO_Valuetype_Adapter_Impl::is_value_chunked (CORBA::Long vt) const
{
- return
- TAO_OBV_GIOP_Flags::Value_tag_base |
- TAO_OBV_GIOP_Flags::Type_info_none;
+ return (vt | TAO_OBV_GIOP_Flags::Chunking_tag_sigbits) == vt;
}
int
diff --git a/TAO/tao/Valuetype/Valuetype_Adapter_Impl.h b/TAO/tao/Valuetype/Valuetype_Adapter_Impl.h
index 933308e42c9..e24f2a5a70f 100644
--- a/TAO/tao/Valuetype/Valuetype_Adapter_Impl.h
+++ b/TAO/tao/Valuetype/Valuetype_Adapter_Impl.h
@@ -57,7 +57,11 @@ public:
);
virtual CORBA::Long type_info_single (void) const;
- virtual CORBA::Long type_info_implied (void) const;
+
+ virtual CORBA::Boolean is_type_info_implied (CORBA::Long) const;
+ virtual CORBA::Boolean is_type_info_single (CORBA::Long) const;
+ virtual CORBA::Boolean is_type_info_list (CORBA::Long) const;
+ virtual CORBA::Boolean is_value_chunked (CORBA::Long) const;
virtual int vf_map_rebind (const char *,
CORBA::ValueFactory &);
diff --git a/TAO/tao/Valuetype_Adapter.h b/TAO/tao/Valuetype_Adapter.h
index f967a77e423..1e2b608329a 100644
--- a/TAO/tao/Valuetype_Adapter.h
+++ b/TAO/tao/Valuetype_Adapter.h
@@ -68,7 +68,11 @@ public:
) = 0;
virtual CORBA::Long type_info_single (void) const = 0;
- virtual CORBA::Long type_info_implied (void) const = 0;
+
+ virtual CORBA::Boolean is_type_info_implied (CORBA::Long) const = 0;
+ virtual CORBA::Boolean is_type_info_single (CORBA::Long) const = 0;
+ virtual CORBA::Boolean is_type_info_list (CORBA::Long) const = 0;
+ virtual CORBA::Boolean is_value_chunked (CORBA::Long) const = 0;
virtual int vf_map_rebind (const char *,
CORBA::ValueFactory &) = 0;
diff --git a/TAO/tests/OBV/Any/Any.idl b/TAO/tests/OBV/Any/Any.idl
index 05716789fcb..23038e8e90a 100644
--- a/TAO/tests/OBV/Any/Any.idl
+++ b/TAO/tests/OBV/Any/Any.idl
@@ -18,7 +18,7 @@ module OBV_AnyTest
};
valuetype VB : VA
- {
+ {
};
//
@@ -28,7 +28,9 @@ module OBV_AnyTest
{
// Returns VA or VB inserted into any
any get_something (in boolean need_vb);
-
+
+ VB get_vb ();
+
// Shutdown the romote ORB
oneway void shutdown ();
};
diff --git a/TAO/tests/OBV/Any/AnyS_impl.cpp b/TAO/tests/OBV/Any/AnyS_impl.cpp
index aae537cf474..851de09a37c 100644
--- a/TAO/tests/OBV/Any/AnyS_impl.cpp
+++ b/TAO/tests/OBV/Any/AnyS_impl.cpp
@@ -47,6 +47,20 @@ Test_impl::get_something (
return ret_val._retn();
}
+OBV_AnyTest::VB *
+Test_impl::get_vb(
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ const CORBA::ULong magic = 3145;
+
+ OBV_AnyTest::VB_var vb;
+ ACE_NEW_RETURN (vb.inout (), OBV_OBV_AnyTest::VB, 0);
+
+ vb->id (magic);
+ return vb._retn();
+}
+
void
Test_impl::shutdown (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
diff --git a/TAO/tests/OBV/Any/AnyS_impl.h b/TAO/tests/OBV/Any/AnyS_impl.h
index d33df851ddc..d7ba0a3f399 100644
--- a/TAO/tests/OBV/Any/AnyS_impl.h
+++ b/TAO/tests/OBV/Any/AnyS_impl.h
@@ -36,6 +36,9 @@ public:
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
+ virtual OBV_AnyTest::VB * get_vb (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
ACE_THROW_SPEC ((CORBA::SystemException));
diff --git a/TAO/tests/OBV/Any/OBV_Any.mpc b/TAO/tests/OBV/Any/OBV_Any.mpc
index d49a9b37b23..955d02be791 100644
--- a/TAO/tests/OBV/Any/OBV_Any.mpc
+++ b/TAO/tests/OBV/Any/OBV_Any.mpc
@@ -11,8 +11,8 @@ project(*Server): taoexe, portableserver, valuetype {
project(*Client): taoexe, valuetype {
after += *Server
Source_Files {
+// buildflags += TAO_TEST_BUG_2576
AnyC.cpp
client.cpp
}
}
-
diff --git a/TAO/tests/OBV/Any/client.cpp b/TAO/tests/OBV/Any/client.cpp
index 9f03f474b9e..188250651b2 100644
--- a/TAO/tests/OBV/Any/client.cpp
+++ b/TAO/tests/OBV/Any/client.cpp
@@ -126,6 +126,22 @@ main (int argc, char *argv[])
1);
}
+#if defined (TAO_TEST_BUG_2576)
+ // It should be possible to extract to a base type
+ OBV_AnyTest::VB_var vb1;
+ ACE_NEW_RETURN (vb1.inout (), OBV_OBV_AnyTest::VB, 1);
+ vb1->id (magic);
+
+ a1 <<= vb1.in ();
+
+ if (!(a1 >>= dst) || dst->id() != magic)
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "(%P|%t) client - base extraction test failed.\n"),
+ 1);
+ }
+#endif /* TAO_TEST_BUG_2576 */
+
// Now do remote test
// STEP 1.
@@ -137,7 +153,7 @@ main (int argc, char *argv[])
if (!(result.inout () >>= dst) || dst->id () != magic)
{
ACE_ERROR_RETURN ((LM_DEBUG,
- "(%P|%t) client - test failed.\n"),
+ "(%P|%t) client - test 1 failed.\n"),
1);
}
@@ -151,9 +167,36 @@ main (int argc, char *argv[])
if (!(result.inout () >>= dst_vb) || dst_vb->id () != magic)
{
ACE_ERROR_RETURN ((LM_DEBUG,
- "(%P|%t) client - test failed.\n"),
+ "(%P|%t) client - test 2 failed.\n"),
+ 1);
+ }
+
+ // STEP 3. A sanity check demonstrating base-type pointer to
+ // derived type allowed.
+ OBV_AnyTest::VA* dst_va = test->get_vb();
+ if (dst_va->id () != magic)
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "(%P|%t) client - test 3 failed.\n"),
+ 1);
+ }
+
+#if defined (TAO_TEST_BUG_2576)
+ // STEP 4. get a VB, but extract to a VA*.
+ OBV_AnyTest::VA* dst_va = test->get_vb();
+
+ result = test->get_something (
+ 1
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (!(result.inout () >>= dst_va) || dst_va->id () != magic)
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "(%P|%t) client - test 4 failed.\n"),
1);
}
+#endif /* TAO_TEST_BUG_2576 */
test->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
diff --git a/TAO/tests/OBV/Truncatable/Extra.idl b/TAO/tests/OBV/Truncatable/Extra.idl
new file mode 100644
index 00000000000..453b85a92b2
--- /dev/null
+++ b/TAO/tests/OBV/Truncatable/Extra.idl
@@ -0,0 +1,19 @@
+// $Id$
+
+//
+// This file contains extra valuetypes which are unknown by the test
+// server. We should be able to pass these values and have the server
+// truncate them to the most derived known type.
+
+#include "Truncatable.idl"
+
+module OBV_TruncatableTest
+{
+ //
+ // Base valuetype.
+ //
+ valuetype Extra1 : truncatable TValue1
+ {
+ public unsigned long edata1;
+ };
+};
diff --git a/TAO/tests/OBV/Truncatable/OBV_Truncatable.mpc b/TAO/tests/OBV/Truncatable/OBV_Truncatable.mpc
index 629bd43296d..977d42cd9ab 100644
--- a/TAO/tests/OBV/Truncatable/OBV_Truncatable.mpc
+++ b/TAO/tests/OBV/Truncatable/OBV_Truncatable.mpc
@@ -11,8 +11,9 @@ project(*Server): taoexe, portableserver, valuetype {
project(*Client): taoexe, valuetype {
after += *Server
Source_Files {
+// buildflags += -DTAO_TEST_BUG_2576
+ ExtraC.cpp
TruncatableC.cpp
client.cpp
}
}
-
diff --git a/TAO/tests/OBV/Truncatable/Truncatable.idl b/TAO/tests/OBV/Truncatable/Truncatable.idl
index 46c894f4619..b86e094c470 100644
--- a/TAO/tests/OBV/Truncatable/Truncatable.idl
+++ b/TAO/tests/OBV/Truncatable/Truncatable.idl
@@ -14,7 +14,7 @@ module OBV_TruncatableTest
{
public unsigned long basic_data;
};
-
+
//
// Valuetype with one-level truncatable inheritence.
//
@@ -32,7 +32,7 @@ module OBV_TruncatableTest
};
//
- // Valuetype with multi-level inheritence, but not all truncatable.
+ // Valuetype with multi-level inheritence, but not all truncatable.
//
valuetype TValue3 : TValue1
{
@@ -41,7 +41,7 @@ module OBV_TruncatableTest
//
// An valuetype nested in a valuetype.
- //
+ //
valuetype NestedValue
{
public long data;
@@ -84,14 +84,16 @@ module OBV_TruncatableTest
void op1 (in string id, in BaseValue iv, out BaseValue ov, inout string desc);
void op2 (in TValue1 iv, in string id, out TValue1 ov, inout string desc);
void op3 (in string id, in TValue4 iv, out TValue4 ov, inout string desc);
- BaseValue op4 (in string id,
+ BaseValue op4 (in string id,
in TValue1 iv1,
in short x,
in TValue4 iv2,
in TValue4 iv3,
in TValue1 iv4,
inout string desc);
-
+
+ void op5 (in any val, in string id, out TValue1 ov, inout string desc);
+
// Shutdown the romote ORB
oneway void shutdown ();
diff --git a/TAO/tests/OBV/Truncatable/TruncatableS_impl.cpp b/TAO/tests/OBV/Truncatable/TruncatableS_impl.cpp
index 2316be3f75f..7352ad73d17 100644
--- a/TAO/tests/OBV/Truncatable/TruncatableS_impl.cpp
+++ b/TAO/tests/OBV/Truncatable/TruncatableS_impl.cpp
@@ -23,10 +23,13 @@ Test_impl::op1 (
))
{
if (TAO_debug_level > 0)
- ACE_DEBUG((LM_DEBUG, "(%P|%t)Test_impl::op1 id=%s basic_data=%u desc=%s \n",
- id, iv->basic_data (), desc));
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT("(%P|%t)Test_impl::op1")
+ ACE_TEXT(" id=%s basic_data=%u desc=%s \n"),
+ id, iv->basic_data (), desc));
- char *tmp = CORBA::string_alloc (ACE_OS::strlen (id) + ACE_OS::strlen (desc) + 2);
+ char *tmp =
+ CORBA::string_alloc (ACE_OS::strlen (id) + ACE_OS::strlen (desc) + 2);
ACE_OS::sprintf (tmp, "%s: %s", id, desc);
CORBA::string_free (desc);
desc = tmp;
@@ -49,9 +52,12 @@ Test_impl::op2 (
))
{
if (TAO_debug_level > 0)
- ACE_DEBUG((LM_DEBUG, "(%P|%t)Test_impl::op2 id=%s basic_data=%u data1=%u desc=%s \n",
- id, iv->basic_data (), iv->data1 (), desc));
- char *tmp = CORBA::string_alloc (ACE_OS::strlen (id) + ACE_OS::strlen (desc) + 2);
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT("(%P|%t)Test_impl::op2")
+ ACE_TEXT(" id=%s basic_data=%u data1=%u desc=%s \n"),
+ id, iv->basic_data (), iv->data1 (), desc));
+ char *tmp =
+ CORBA::string_alloc (ACE_OS::strlen (id) + ACE_OS::strlen (desc) + 2);
ACE_OS::sprintf (tmp, "%s: %s", id, desc);
CORBA::string_free (desc);
desc = tmp;
@@ -75,20 +81,25 @@ ACE_THROW_SPEC ((
))
{
if (TAO_debug_level > 0)
- ACE_DEBUG((LM_DEBUG, "(%P|%t)Test_impl::op3 id=%s basic_data=%u data=%u data4=%u desc=%s \n",
- id, iv->basic_data (), iv->nv4()->data (), iv->data4 (), desc));
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT("(%P|%t)Test_impl::op3")
+ ACE_TEXT(" id=%s basic_data=%u data=%u data4=%u desc=%s \n"),
+ id, iv->basic_data (), iv->nv4()->data (), iv->data4 (), desc));
- char *tmp = CORBA::string_alloc (ACE_OS::strlen (id) + ACE_OS::strlen (desc) + 2);
+ char *tmp =
+ CORBA::string_alloc (ACE_OS::strlen (id) + ACE_OS::strlen (desc) + 2);
ACE_OS::sprintf (tmp, "%s: %s", id, desc);
CORBA::string_free (desc);
desc = tmp;
ov = new ::OBV_OBV_TruncatableTest::TValue4();
- ::OBV_OBV_TruncatableTest::NestedValue* nv = new ::OBV_OBV_TruncatableTest::NestedValue();
+ ::OBV_OBV_TruncatableTest::NestedValue* nv =
+ new ::OBV_OBV_TruncatableTest::NestedValue();
nv->data (iv->nv4()->data ());
ov->basic_data (iv->basic_data());
ov->nv4 (nv);
ov->data4 (iv->data4());
+ CORBA::remove_ref(nv);
}
@@ -109,23 +120,38 @@ ACE_THROW_SPEC ((
{
if (TAO_debug_level > 0)
{
- ACE_DEBUG((LM_DEBUG, "(%P|%t)Test_impl::op4 id=%s basic_data=%u data1=%u desc=%s \n",
- id, iv1->basic_data (), iv1->data1 (), desc));
- ACE_DEBUG((LM_DEBUG, "(%P|%t)Test_impl::op4 id=%s basic_data=%u data=%u data4=%u desc=%s \n",
- id, iv2->basic_data (), iv2->nv4()->data (), iv2->data4 (), desc));
- ACE_DEBUG((LM_DEBUG, "(%P|%t)Test_impl::op4 id=%s basic_data=%u data=%u data4=%u desc=%s \n",
- id, iv3->basic_data (), iv3->nv4()->data (), iv3->data4 (), desc));
- ACE_DEBUG((LM_DEBUG, "(%P|%t)Test_impl::op4 id=%s basic_data=%u data1=%u desc=%s \n",
- id, iv4->basic_data (), iv4->data1 (), desc));
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT("(%P|%t)Test_impl::op4")
+ ACE_TEXT(" id=%s basic_data=%u data1=%u desc=%s \n"),
+ id, iv1->basic_data (), iv1->data1 (), desc));
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT("(%P|%t)Test_impl::op4")
+ ACE_TEXT(" id=%s basic_data=%u data=%u data4=%u desc=%s \n"),
+ id, iv2->basic_data (), iv2->nv4()->data (),
+ iv2->data4 (), desc));
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT("(%P|%t)Test_impl::op4")
+ ACE_TEXT(" id=%s basic_data=%u data=%u data4=%u desc=%s \n"),
+ id, iv3->basic_data (), iv3->nv4()->data (),
+ iv3->data4 (), desc));
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT("(%P|%t)Test_impl::op4")
+ ACE_TEXT(" id=%s basic_data=%u data1=%u desc=%s \n"),
+ id, iv4->basic_data (), iv4->data1 (), desc));
}
- char *tmp = CORBA::string_alloc (ACE_OS::strlen (id) + ACE_OS::strlen (desc) + 2);
+ char *tmp =
+ CORBA::string_alloc (ACE_OS::strlen (id) + ACE_OS::strlen (desc) + 2);
ACE_OS::sprintf (tmp, "%s: %s", id, desc);
CORBA::string_free (desc);
desc = tmp;
- ::OBV_TruncatableTest::BaseValue * ov = new ::OBV_OBV_TruncatableTest::BaseValue();
- CORBA::ULong total = x * (iv1->basic_data () + iv2->basic_data () + iv3->basic_data () + iv4->basic_data ());
+ ::OBV_TruncatableTest::BaseValue * ov =
+ new ::OBV_OBV_TruncatableTest::BaseValue();
+
+ CORBA::ULong total =
+ x * (iv1->basic_data () + iv2->basic_data () +
+ iv3->basic_data () + iv4->basic_data ());
ov->basic_data (total);
return ov;
@@ -133,6 +159,43 @@ ACE_THROW_SPEC ((
void
+Test_impl::op5 (const CORBA::Any& val,
+ const char * id,
+ ::OBV_TruncatableTest::TValue1_out ov,
+ char *& desc
+ ACE_ENV_ARG_DECL )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ ))
+{
+ ov = new ::OBV_OBV_TruncatableTest::TValue1();
+ ::OBV_TruncatableTest::TValue1 *iv = 0;
+ if (!(val >>= iv))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%P|%t)Test_impl::op5 extract failed\n")));
+ ov->basic_data (101);
+ ov->data1 (10101);
+ }
+ else
+ {
+ if (TAO_debug_level > 0)
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT("(%P|%t)Test_impl::op5")
+ ACE_TEXT(" id=%s basic_data=%u data1=%u desc=%s \n"),
+ id, iv->basic_data (), iv->data1 (), desc));
+ char *tmp =
+ CORBA::string_alloc (ACE_OS::strlen (id) + ACE_OS::strlen (desc) + 2);
+ ACE_OS::sprintf (tmp, "%s: %s", id, desc);
+ CORBA::string_free (desc);
+ desc = tmp;
+
+ ov->basic_data (iv->basic_data());
+ ov->data1 (iv->data1());
+ }
+}
+
+void
Test_impl::shutdown (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
diff --git a/TAO/tests/OBV/Truncatable/TruncatableS_impl.h b/TAO/tests/OBV/Truncatable/TruncatableS_impl.h
index de45a9717e3..9ae2aa573af 100644
--- a/TAO/tests/OBV/Truncatable/TruncatableS_impl.h
+++ b/TAO/tests/OBV/Truncatable/TruncatableS_impl.h
@@ -78,6 +78,15 @@ public:
::CORBA::SystemException
));
+ virtual void op5 (const CORBA::Any& val,
+ const char * id,
+ ::OBV_TruncatableTest::TValue1_out ov,
+ char *& desc
+ ACE_ENV_ARG_DECL )
+ ACE_THROW_SPEC ((
+ ::CORBA::SystemException
+ ));
+
virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException));
diff --git a/TAO/tests/OBV/Truncatable/client.cpp b/TAO/tests/OBV/Truncatable/client.cpp
index 61dd3dfe50f..07e25701e5d 100644
--- a/TAO/tests/OBV/Truncatable/client.cpp
+++ b/TAO/tests/OBV/Truncatable/client.cpp
@@ -1,6 +1,7 @@
// $Id$
#include "TruncatableC.h"
+#include "ExtraC.h"
#include "ace/Get_Opt.h"
ACE_RCSID(Truncatable, client, "$Id$")
@@ -17,7 +18,7 @@ int verbose = 0;
{ \
fail++; \
if (!verbose) \
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%P|%t) - Failure at line %l\n"))); \
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%P|%t) client - Failure at line %l\n"))); \
} \
}
@@ -423,6 +424,97 @@ main (int argc, char *argv[])
ACE_TEXT ("passed") : ACE_TEXT ("failed")));
}
+ {
+ OBV_OBV_TruncatableTest::Extra1 v1;
+ v1.basic_data (9);
+ v1.data1 (99);
+ v1.edata1 (1234);
+
+ OBV_TruncatableTest::TValue1_var ov1;
+
+ desc = CORBA::string_dup ("A<-tB, truncate unknown B to A");
+ if (verbose)
+ ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 9: %s: "),
+ ACE_TEXT_CHAR_TO_TCHAR(desc.in())));
+ pretest = fail;
+
+ test->op2 (&v1, "case9", ov1.out (), desc.inout ()
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_TRY_CHECK;
+
+ VERIFY (! ACE_OS::strcmp (desc.in (),
+ "case9: A<-tB, truncate unknown B to A"));
+ VERIFY (v1.basic_data () == ov1->basic_data ()
+ && v1.data1() == ov1->data1());
+ if (verbose)
+ ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"),
+ (pretest == fail) ?
+ ACE_TEXT ("passed") : ACE_TEXT ("failed")));
+ }
+
+
+ {
+ OBV_OBV_TruncatableTest::TValue1 v1;
+ v1.basic_data (9);
+ v1.data1 (99);
+
+ OBV_TruncatableTest::TValue1_var ov1;
+ CORBA::Any a;
+ a <<= &v1;
+ desc = CORBA::string_dup ("A<-tB, known truncatable via Any");
+ if (verbose)
+ ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 10: %s: "),
+ ACE_TEXT_CHAR_TO_TCHAR(desc.in())));
+ pretest = fail;
+
+ test->op5 (a, "case10", ov1.out (), desc.inout ()
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_TRY_CHECK;
+
+ VERIFY (! ACE_OS::strcmp (desc.in (),
+ "case10: A<-tB, known truncatable via Any"));
+ VERIFY (v1.basic_data () == ov1->basic_data ()
+ && v1.data1() == ov1->data1());
+ if (verbose)
+ ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"),
+ (pretest == fail) ?
+ ACE_TEXT ("passed") : ACE_TEXT ("failed")));
+ }
+
+#if defined (TAO_TEST_BUG_2576)
+ {
+ OBV_OBV_TruncatableTest::Extra1 v1;
+ v1.basic_data (9);
+ v1.data1 (99);
+ v1.edata1 (1234);
+
+ OBV_TruncatableTest::TValue1_var ov1;
+ CORBA::Any a;
+ a <<= &v1;
+ desc = CORBA::string_dup ("A<-tB, unknown truncatable via Any");
+ if (verbose)
+ ACE_DEBUG ((LM_DEBUG,ACE_TEXT("Case 11: %s: "),
+ ACE_TEXT_CHAR_TO_TCHAR(desc.in())));
+ pretest = fail;
+
+ test->op5 (a, "case11", ov1.out (), desc.inout ()
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_TRY_CHECK;
+
+ VERIFY (! ACE_OS::strcmp (desc.in (),
+ "case11: A<-tB, unknown truncatable via Any"));
+ VERIFY (v1.basic_data () == ov1->basic_data ()
+ && v1.data1() == ov1->data1());
+ if (verbose)
+ ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("%s\n"),
+ (pretest == fail) ?
+ ACE_TEXT ("passed") : ACE_TEXT ("failed")));
+ }
+#endif /* TAO_TEST_BUG_2576 */
+
ACE_DEBUG ((LM_DEBUG, "(%P|%t) client - shutdown orb \n"));