diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:21 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:21 +0000 |
commit | 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (patch) | |
tree | 197c810e5f5bce17b1233a7cb8d7b50c0bcd25e2 /TAO/tests/Bug_2543_Regression | |
parent | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (diff) | |
download | ATCD-3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/tests/Bug_2543_Regression')
-rw-r--r-- | TAO/tests/Bug_2543_Regression/Bug_2543_Regression.mpc | 8 | ||||
-rw-r--r-- | TAO/tests/Bug_2543_Regression/Test.idl | 13 | ||||
-rw-r--r-- | TAO/tests/Bug_2543_Regression/bug_2543_regression.cpp | 74 | ||||
-rwxr-xr-x | TAO/tests/Bug_2543_Regression/run_test.pl | 29 |
4 files changed, 124 insertions, 0 deletions
diff --git a/TAO/tests/Bug_2543_Regression/Bug_2543_Regression.mpc b/TAO/tests/Bug_2543_Regression/Bug_2543_Regression.mpc new file mode 100644 index 00000000000..be2c40753b0 --- /dev/null +++ b/TAO/tests/Bug_2543_Regression/Bug_2543_Regression.mpc @@ -0,0 +1,8 @@ +// -*- MPC -*- +// $Id$ + +project : taoclient, anytypecode, codecfactory, valuetype { + Source_Files { + bug_2543_regression.cpp + } +} diff --git a/TAO/tests/Bug_2543_Regression/Test.idl b/TAO/tests/Bug_2543_Regression/Test.idl new file mode 100644 index 00000000000..ac8ac65cbcf --- /dev/null +++ b/TAO/tests/Bug_2543_Regression/Test.idl @@ -0,0 +1,13 @@ +// $Id$ + +valuetype Base +{ + public long l; +}; + +typedef sequence<Base> BaseSeq; + +valuetype Value : Base +{ + public string s; +}; diff --git a/TAO/tests/Bug_2543_Regression/bug_2543_regression.cpp b/TAO/tests/Bug_2543_Regression/bug_2543_regression.cpp new file mode 100644 index 00000000000..e5a057e822b --- /dev/null +++ b/TAO/tests/Bug_2543_Regression/bug_2543_regression.cpp @@ -0,0 +1,74 @@ +// $Id$ + +#include "TestC.h" +#include "tao/CodecFactory/CodecFactory.h" + +ACE_RCSID (Bug_2543_Regression, + bug_2543_regression, + "$Id$") + +int main (int argc, char* argv[]) +{ + ACE_DECLARE_NEW_CORBA_ENV; + + ACE_TRY + { + CORBA::ORB_var orb = CORBA::ORB_init(argc,argv); + + orb->register_value_factory( + Base::_tao_obv_static_repository_id(), + new Base_init); + orb->register_value_factory( + Value::_tao_obv_static_repository_id(), + new Value_init); + + CORBA::Object_var object = + orb->resolve_initial_references("CodecFactory"); + + IOP::CodecFactory_var codec_factory = + IOP::CodecFactory::_narrow(object.in ()); + IOP::Encoding e = {IOP::ENCODING_CDR_ENCAPS,1,2}; + + IOP::Codec_var codec = codec_factory->create_codec(e); + + + CORBA::Any any_o; + BaseSeq values; + values.length(1); + values[0] = new OBV_Value(1,"An instance of Value"); + any_o <<= values; + any_o.type(_tc_BaseSeq); + + CORBA::OctetSeq_var bin = codec->encode(any_o); + CORBA::Any_var any_n = codec->decode(bin.in ()); + + const BaseSeq * out = 0; + if (!(any_n.in () >>= out)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Error: extract out of any failed\n"), + 1); + } + if (ACE_OS::strcmp( (*out)[0]->_tao_obv_repository_id(), + Value::_tao_obv_static_repository_id()) != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, "Error: wrong type!\n"), 1); + } + + orb->destroy(); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Caught a CORBA exception \n"); + return 1; + } + ACE_CATCHALL + { + return 1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (1); + + return 0; +} diff --git a/TAO/tests/Bug_2543_Regression/run_test.pl b/TAO/tests/Bug_2543_Regression/run_test.pl new file mode 100755 index 00000000000..7634915c348 --- /dev/null +++ b/TAO/tests/Bug_2543_Regression/run_test.pl @@ -0,0 +1,29 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib '../../../bin'; +use PerlACE::Run_Test; + +$status = 0; + +if (PerlACE::is_vxworks_test()) { + $SV = new PerlACE::ProcessVX ("client"); +} +else { + $SV = new PerlACE::Process ("client"); +} + +$SV->Spawn (); + +$server = $SV->WaitKill (10); + +if ($server != 0) { + print STDERR "ERROR: client returned $server\n"; + $status = 1; +} + +exit $status; |