diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2007-01-24 12:45:58 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2007-01-24 12:45:58 +0000 |
commit | ce20f260f6367ab9935c109ef68989ecf41ec0a3 (patch) | |
tree | 33d1c5def43d58d5552fde556c6785a723d270eb /TAO | |
parent | 490681dc4c8781c5a4d814da129ece4a7207b322 (diff) | |
download | ATCD-ce20f260f6367ab9935c109ef68989ecf41ec0a3.tar.gz |
Wed Jan 24 12:25:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/tests/Any/Recursive/Hello.cpp | 9 | ||||
-rw-r--r-- | TAO/tests/Any/Recursive/Hello.h | 5 | ||||
-rw-r--r-- | TAO/tests/Any/Recursive/Test.idl | 33 | ||||
-rw-r--r-- | TAO/tests/Any/Recursive/client.cpp | 73 | ||||
-rw-r--r-- | TAO/tests/Any/Recursive/server.cpp | 20 |
5 files changed, 93 insertions, 47 deletions
diff --git a/TAO/tests/Any/Recursive/Hello.cpp b/TAO/tests/Any/Recursive/Hello.cpp index 4ad14983990..b023cf9d179 100644 --- a/TAO/tests/Any/Recursive/Hello.cpp +++ b/TAO/tests/Any/Recursive/Hello.cpp @@ -14,8 +14,7 @@ Hello::Hello (CORBA::ORB_ptr orb) } CORBA::Any * -Hello::get_any (CORBA::Any const & the_any - ACE_ENV_ARG_DECL) +Hello::get_any (CORBA::Any const & the_any) ACE_THROW_SPEC ((CORBA::SystemException)) { CORBA::Any * retval = 0; @@ -23,16 +22,14 @@ Hello::get_any (CORBA::Any const & the_any ACE_NEW_THROW_EX (retval, CORBA::Any (the_any), CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (retval); return retval; } void -Hello::shutdown (ACE_ENV_SINGLE_ARG_DECL) +Hello::shutdown (void) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->orb_->shutdown (0 - ACE_ENV_ARG_PARAMETER); + this->orb_->shutdown (0); } diff --git a/TAO/tests/Any/Recursive/Hello.h b/TAO/tests/Any/Recursive/Hello.h index 948d883b625..07a967ea5e9 100644 --- a/TAO/tests/Any/Recursive/Hello.h +++ b/TAO/tests/Any/Recursive/Hello.h @@ -27,11 +27,10 @@ public: Hello (CORBA::ORB_ptr orb); // Return the any provide as an "in" argument. - virtual CORBA::Any * get_any (CORBA::Any const & the_any - ACE_ENV_ARG_DECL) + virtual CORBA::Any * get_any (CORBA::Any const & the_any) ACE_THROW_SPEC ((CORBA::SystemException)); - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) + virtual void shutdown (void) ACE_THROW_SPEC ((CORBA::SystemException)); private: diff --git a/TAO/tests/Any/Recursive/Test.idl b/TAO/tests/Any/Recursive/Test.idl index d1d5e447c36..a633c1d83b8 100644 --- a/TAO/tests/Any/Recursive/Test.idl +++ b/TAO/tests/Any/Recursive/Test.idl @@ -2,6 +2,8 @@ // $Id$ // +#include "tao/OctetSeq.pidl" + /// Put the interfaces in a module, to avoid global namespace pollution module Test { @@ -18,6 +20,18 @@ module Test RecursiveStructSeq recursive_structs_second; }; + struct NestedRecursiveStruct; + typedef sequence<NestedRecursiveStruct> NestedRecursiveStructSeq; + + struct NestedRecursiveStruct + { + struct InnerStruct + { + NestedRecursiveStructSeq recursive_structs; + } ins; + long i; + }; + // -------------------------- union RecursiveUnion; @@ -100,6 +114,25 @@ module Test // -------------------------- + enum PositionEnum { unknownpos }; + + struct Position { + PositionEnum type; + }; + typedef CORBA::OctetSeq OctetSeq; + + enum ValueSort { + POSITION_TYPE, + OCTET_SEQ_TYPE + }; + + union NonRecursiveUnionWithEnum switch (ValueSort) { + case POSITION_TYPE: + Position position_val; + case OCTET_SEQ_TYPE: + OctetSeq octet_seq_val; + }; + /// Simple test interface. interface Hello { diff --git a/TAO/tests/Any/Recursive/client.cpp b/TAO/tests/Any/Recursive/client.cpp index 6bb78f5ed62..1f0ca96671d 100644 --- a/TAO/tests/Any/Recursive/client.cpp +++ b/TAO/tests/Any/Recursive/client.cpp @@ -65,6 +65,22 @@ dump<Test::RecursiveStruct> (Test::RecursiveStruct * data) template<> void +dump<Test::NestedRecursiveStruct> (Test::NestedRecursiveStruct * data) +{ + ACE_DEBUG ((LM_DEBUG, + "Test::NestedRecursiveStruct\n" + "%d\n" + "%u\n" + "%d\n" + "%d\n", + data->i, + data->ins.recursive_structs.length (), + data->ins.recursive_structs[0].i, + data->ins.recursive_structs[1].i)); +} + +template<> +void dump<Test::RecursiveUnion> (Test::RecursiveUnion * data) { ACE_DEBUG ((LM_DEBUG, "Test::RecursiveUnion\n")); @@ -105,7 +121,6 @@ perform_invocation (Test::Hello_ptr hello, CORBA::Any_var my_any = hello->get_any (the_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK; T * my_foo = 0; if (!(my_any.in () >>= my_foo)) @@ -120,7 +135,6 @@ perform_invocation (Test::Hello_ptr hello, CORBA::Boolean const equal_tc = the_tc->equal (my_tc.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; if (!equal_tc) ACE_THROW (Test::Recursive_Type_In_Any_Test_Failed ()); @@ -128,7 +142,6 @@ perform_invocation (Test::Hello_ptr hello, CORBA::Boolean const equiv_tc = the_tc->equivalent (my_tc.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; if (!equiv_tc) ACE_THROW (Test::Recursive_Type_In_Any_Test_Failed ()); @@ -156,7 +169,29 @@ recursive_struct_test (CORBA::ORB_ptr /* orb */, ::perform_invocation<Test::RecursiveStruct> (hello, the_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK; +} + +void +nested_recursive_struct_test (CORBA::ORB_ptr /* orb */, + Test::Hello_ptr hello + ACE_ENV_ARG_DECL) +{ + ACE_DEBUG ((LM_INFO, + "Executing nested recursive struct test\n")); + + Test::NestedRecursiveStruct foo; + + foo.ins.recursive_structs.length (2); + foo.ins.recursive_structs[0].i = 37; + foo.ins.recursive_structs[1].i = 11034; + foo.i = 12; + + CORBA::Any the_any; + the_any <<= foo; + + ::perform_invocation<Test::NestedRecursiveStruct> (hello, + the_any + ACE_ENV_ARG_PARAMETER); } void @@ -179,7 +214,6 @@ recursive_union_test (CORBA::ORB_ptr /* orb */, ::perform_invocation<Test::EnumUnion> (hello, the_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK; // Non-recursive member case. foo.i (test_long); @@ -189,7 +223,6 @@ recursive_union_test (CORBA::ORB_ptr /* orb */, ::perform_invocation<Test::RecursiveUnion> (hello, the_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK; // Recursive member case. Test::RecursiveUnionSeq seq; @@ -204,7 +237,6 @@ recursive_union_test (CORBA::ORB_ptr /* orb */, ::perform_invocation<Test::RecursiveUnion> (hello, the_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK; // Recursive member case with no default member Test::RecursiveUnionSeqNoDefault seqnodefault; @@ -220,7 +252,6 @@ recursive_union_test (CORBA::ORB_ptr /* orb */, ::perform_invocation<Test::RecursiveUnionNoDefault> (hello, the_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK; // Recursive member case with enum . Test::VSortRecursiveUnionSeq vsortseq; @@ -236,7 +267,14 @@ recursive_union_test (CORBA::ORB_ptr /* orb */, ::perform_invocation<Test::VSortRecursiveUnion> (hello, the_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + + // Non-recursive member case with enum . + Test::NonRecursiveUnionWithEnum val; + the_any <<= val; + + ::perform_invocation<Test::NonRecursiveUnionWithEnum> (hello, + the_any + ACE_ENV_ARG_PARAMETER); } @@ -287,13 +325,11 @@ recursive_struct_typecodefactory_test (CORBA::ORB_ptr orb, CORBA::TypeCode_var recursive_tc = orb->create_recursive_tc ("IDL:Test/RecursiveStruct:1.0" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; CORBA::TypeCode_var seq_tc = orb->create_sequence_tc (0, recursive_tc.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; CORBA::StructMemberSeq members (3); members.length (3); @@ -309,18 +345,15 @@ recursive_struct_typecodefactory_test (CORBA::ORB_ptr orb, "RecursiveStruct", members ACE_ENV_ARG_PARAMETER); - ACE_CHECK; // Reset the underlying TypeCode to the one we just created with the // TypeCodeFactory. the_any.type (struct_tc.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; ::perform_invocation<Test::RecursiveStruct> (hello, the_any ACE_ENV_ARG_PARAMETER); - ACE_CHECK; } void @@ -392,7 +425,6 @@ struct Caller : public std::unary_function<T, void> f (orb.in (), hello.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; } ACE_CATCHANY { @@ -402,7 +434,6 @@ struct Caller : public std::unary_function<T, void> success = false; } ACE_ENDTRY; - ACE_CHECK; } CORBA::ORB_var orb; @@ -417,18 +448,15 @@ main (int argc, char *argv[]) { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; if (parse_args (argc, argv) != 0) return 1; CORBA::Object_var tmp = orb->string_to_object(ior ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; Test::Hello_var hello = Test::Hello::_narrow(tmp.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; if (CORBA::is_nil (hello.in ())) { @@ -445,6 +473,7 @@ main (int argc, char *argv[]) static test_func const tests[] = { recursive_struct_test + , nested_recursive_struct_test , recursive_union_test , indirectly_recursive_valuetype_test , directly_recursive_valuetype_test @@ -468,11 +497,9 @@ main (int argc, char *argv[]) if (!c.success) ACE_TRY_THROW (Test::Recursive_Type_In_Any_Test_Failed ()); - hello->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + hello->shutdown (); - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + orb->destroy (); } ACE_CATCHANY { diff --git a/TAO/tests/Any/Recursive/server.cpp b/TAO/tests/Any/Recursive/server.cpp index 177aad4d1d8..245c288e5c8 100644 --- a/TAO/tests/Any/Recursive/server.cpp +++ b/TAO/tests/Any/Recursive/server.cpp @@ -43,15 +43,12 @@ main (int argc, char *argv[]) { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; if (CORBA::is_nil (root_poa.in ())) ACE_ERROR_RETURN ((LM_ERROR, @@ -59,8 +56,7 @@ main (int argc, char *argv[]) 1); PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + root_poa->the_POAManager (); if (parse_args (argc, argv) != 0) return 1; @@ -72,12 +68,10 @@ main (int argc, char *argv[]) PortableServer::ServantBase_var owner_transfer(hello_impl); Test::Hello_var hello = - hello_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + hello_impl->_this (); CORBA::String_var ior = orb->object_to_string (hello.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; // Output the IOR to the <ior_output_file> FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); @@ -89,19 +83,15 @@ main (int argc, char *argv[]) ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + poa_manager->activate (); - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + orb->run (); ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + orb->destroy (); } ACE_CATCHANY { |