summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2005-05-27 07:38:26 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2005-05-27 07:38:26 +0000
commita81470d7fd9d7ba241735804375b0e00b61211c2 (patch)
treefb0ec573b4d6775f4af526bad5cb9c48e38e15ac
parent83dbf000ae8a532a1b28336834ef84f6770cf7ed (diff)
downloadATCD-a81470d7fd9d7ba241735804375b0e00b61211c2.tar.gz
ChangeLogTag:Fri May 27 00:36:32 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
-rw-r--r--TAO/ChangeLog15
-rw-r--r--TAO/tests/Any/Recursive/Hello.cpp38
-rw-r--r--TAO/tests/Any/Recursive/Hello.h54
-rw-r--r--TAO/tests/Any/Recursive/README19
-rw-r--r--TAO/tests/Any/Recursive/RecursiveHello.mpc23
-rw-r--r--TAO/tests/Any/Recursive/Test.idl62
-rw-r--r--TAO/tests/Any/Recursive/client.cpp376
-rwxr-xr-xTAO/tests/Any/Recursive/run_test.pl51
-rw-r--r--TAO/tests/Any/Recursive/server.cpp115
9 files changed, 753 insertions, 0 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 958e0b6c8e9..12577cf88dd 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,18 @@
+Fri May 27 00:36:32 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
+
+ * tests/Any/Recursive/Hello.cpp:
+ * tests/Any/Recursive/Hello.h:
+ * tests/Any/Recursive/README:
+ * tests/Any/Recursive/RecursiveHello.mpc:
+ * tests/Any/Recursive/Test.idl:
+ * tests/Any/Recursive/client.cpp:
+ * tests/Any/Recursive/run_test.pl:
+ * tests/Any/Recursive/server.cpp:
+
+ New test that verifies properly functioning recursive type Any
+ insertion and extraction support. It also indirectly verifies
+ that recursive TypeCode support is working.
+
Thu May 26 16:09:50 2005 Justin Michel <michel_j@ociweb.com>
* orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp:
diff --git a/TAO/tests/Any/Recursive/Hello.cpp b/TAO/tests/Any/Recursive/Hello.cpp
new file mode 100644
index 00000000000..4ad14983990
--- /dev/null
+++ b/TAO/tests/Any/Recursive/Hello.cpp
@@ -0,0 +1,38 @@
+// $Id$
+
+#include "Hello.h"
+
+
+ACE_RCSID (Recursive,
+ Hello,
+ "$Id$")
+
+
+Hello::Hello (CORBA::ORB_ptr orb)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+{
+}
+
+CORBA::Any *
+Hello::get_any (CORBA::Any const & the_any
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ CORBA::Any * retval = 0;
+
+ 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)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->orb_->shutdown (0
+ ACE_ENV_ARG_PARAMETER);
+}
diff --git a/TAO/tests/Any/Recursive/Hello.h b/TAO/tests/Any/Recursive/Hello.h
new file mode 100644
index 00000000000..0bff33b9322
--- /dev/null
+++ b/TAO/tests/Any/Recursive/Hello.h
@@ -0,0 +1,54 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Hello.h
+ *
+ * $Id$
+ *
+ * Header file for recursive type Any insertion and extraction test.
+ *
+ * @author Ossama Othman
+ */
+//=============================================================================
+
+
+#ifndef HELLO_H
+#define HELLO_H
+
+#include "TestS.h"
+
+#if defined (_MSC_VER)
+# pragma warning(push)
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+class Hello
+ : public virtual POA_Test::Hello
+ , public virtual PortableServer::RefCountServantBase
+{
+public:
+
+ /// Constructor
+ 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)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+
+ /// The ORB which will be shutdown by Hello::shutdown().
+ CORBA::ORB_var orb_;
+
+};
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#endif /* HELLO_H */
diff --git a/TAO/tests/Any/Recursive/README b/TAO/tests/Any/Recursive/README
new file mode 100644
index 00000000000..374abe6ed40
--- /dev/null
+++ b/TAO/tests/Any/Recursive/README
@@ -0,0 +1,19 @@
+# $Id$
+
+/**
+
+@page Recursive Any Test README File
+
+This test determines whether insertion and extraction of recursive
+types into and from a CORBA::Any, respectively, works. Properly
+functioning insertion and exctraction of recursive types depends on
+working recursive TypeCode support, which is indirectly tested by this
+test as well.
+
+To run the test use the run_test.pl script:
+
+$ ./run_test.pl
+
+the script returns 0 if the test was successful.
+
+*/
diff --git a/TAO/tests/Any/Recursive/RecursiveHello.mpc b/TAO/tests/Any/Recursive/RecursiveHello.mpc
new file mode 100644
index 00000000000..45b716eb3d8
--- /dev/null
+++ b/TAO/tests/Any/Recursive/RecursiveHello.mpc
@@ -0,0 +1,23 @@
+// -*- MPC -*-
+//
+// $Id$
+
+project(*Server): taoserver, valuetype {
+ idlflags += -GA
+
+ Source_Files {
+ Hello.cpp
+ server.cpp
+ }
+}
+
+project(*Client): taoclient, valuetype, typecodefactory, ifr_client {
+ idlflags += -GA
+
+ Source_Files {
+ TestC.cpp
+ TestA.cpp
+ client.cpp
+ }
+}
+
diff --git a/TAO/tests/Any/Recursive/Test.idl b/TAO/tests/Any/Recursive/Test.idl
new file mode 100644
index 00000000000..7972104f927
--- /dev/null
+++ b/TAO/tests/Any/Recursive/Test.idl
@@ -0,0 +1,62 @@
+//
+// $Id$
+//
+
+/// Put the interfaces in a module, to avoid global namespace pollution
+module Test
+{
+ exception Recursive_Type_In_Any_Test_Failed {};
+
+ struct RecursiveStruct;
+ typedef sequence<RecursiveStruct> RecursiveStructSeq;
+
+ struct RecursiveStruct
+ {
+ RecursiveStructSeq recursive_structs;
+ long i;
+ };
+
+ // --------------------------
+
+ union RecursiveUnion;
+ typedef sequence<RecursiveUnion> RecursiveUnionSeq;
+
+ union RecursiveUnion switch (short)
+ {
+ case 0:
+ RecursiveUnionSeq recursive_unions;
+ default:
+ long i;
+ };
+
+ // --------------------------
+
+ valuetype IndirectlyRecursiveValuetype;
+ typedef sequence<IndirectlyRecursiveValuetype>
+ IndirectlyRecursiveValuetypeSeq;
+
+ valuetype IndirectlyRecursiveValuetype
+ {
+ public IndirectlyRecursiveValuetypeSeq recursive_valuetypes;
+ };
+
+ // --------------------------
+
+ valuetype DirectlyRecursiveValuetype
+ {
+ public DirectlyRecursiveValuetype recursive_valuetype;
+ };
+
+ // --------------------------
+
+ /// Simple test interface.
+ interface Hello
+ {
+ /// Return the any provided as the "in" argument.
+ any get_any (in any the_any);
+
+ /// Shutdown the server ORB.
+ oneway void shutdown ();
+ };
+
+};
diff --git a/TAO/tests/Any/Recursive/client.cpp b/TAO/tests/Any/Recursive/client.cpp
new file mode 100644
index 00000000000..b12ffd731a3
--- /dev/null
+++ b/TAO/tests/Any/Recursive/client.cpp
@@ -0,0 +1,376 @@
+// $Id$
+
+#include "TestC.h"
+#include "tao/IFR_Client/IFR_BaseC.h"
+
+#include "ace/Get_Opt.h"
+
+#include <algorithm>
+#include <functional>
+
+
+ACE_RCSID (Recursive,
+ client,
+ "$Id$")
+
+
+const char * ior = "file://test.ior";
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "k:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ case 'h':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+
+ // Successful command line parsing.
+ return 0;
+}
+
+template<typename T> void dump (T *); // Forward declaration.
+
+template<>
+void
+dump<Test::RecursiveStruct> (Test::RecursiveStruct * data)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "%d\n"
+ "%u\n"
+ "%d\n"
+ "%d\n",
+ data->i,
+ data->recursive_structs.length (),
+ data->recursive_structs[0].i,
+ data->recursive_structs[1].i));
+}
+
+template<typename T>
+void
+perform_invocation (Test::Hello_ptr hello,
+ CORBA::Any const & the_any
+ ACE_ENV_ARG_DECL)
+{
+ // Execute more than once to help verify that mutable recursive
+ // TypeCode state is managed correctly.
+ for (unsigned int n = 0; n < 2; ++n)
+ {
+ 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))
+ ACE_THROW (CORBA::INV_OBJREF ());
+
+// ACE_DEBUG ((LM_DEBUG, "Data dump:\n"));
+// dump<T> (my_foo);
+
+ CORBA::TypeCode_var the_tc = the_any.type ();
+ CORBA::TypeCode_var my_tc = my_any->type ();
+
+ CORBA::Boolean const equal_tc =
+ the_tc->equal (my_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (equal_tc);
+
+ CORBA::Boolean const equiv_tc =
+ the_tc->equivalent (my_tc.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+
+ ACE_ASSERT (equiv_tc);
+ }
+}
+
+void
+recursive_struct_test (CORBA::ORB_ptr /* orb */,
+ Test::Hello_ptr hello
+ ACE_ENV_ARG_DECL)
+{
+ ACE_DEBUG ((LM_INFO,
+ "Executing recursive struct test\n"));
+
+ Test::RecursiveStruct foo;
+
+ foo.recursive_structs.length (2);
+ foo.recursive_structs[0].i = 37;
+ foo.recursive_structs[1].i = 11034;
+ foo.i = 12;
+
+ CORBA::Any the_any;
+ the_any <<= foo;
+
+ ::perform_invocation<Test::RecursiveStruct> (hello,
+ the_any
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK;
+}
+
+void
+recursive_struct_typecodefactory_test (CORBA::ORB_ptr orb,
+ Test::Hello_ptr hello
+ ACE_ENV_ARG_DECL)
+{
+ ACE_DEBUG ((LM_INFO,
+ "Executing recursive struct via TypeCodeFactory test\n"));
+
+ Test::RecursiveStruct foo;
+
+ foo.recursive_structs.length (2);
+ foo.recursive_structs[0].i = 37;
+ foo.recursive_structs[1].i = 11034;
+ foo.i = 12;
+
+ CORBA::Any the_any;
+ the_any <<= foo;
+
+ 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 (2);
+ members.length (2);
+ members[0].name = "recursive_structs";
+ members[0].type = seq_tc;
+ members[1].name = "i";
+ members[1].type = CORBA::TypeCode::_duplicate (CORBA::_tc_long);
+
+ CORBA::TypeCode_var struct_tc =
+ orb->create_struct_tc ("IDL:Test/RecursiveStruct:1.0",
+ "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
+recursive_union_test (CORBA::ORB_ptr /* orb */,
+ Test::Hello_ptr /* hello */
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ ACE_DEBUG ((LM_INFO,
+ "Executing recursive union test\n"));
+
+ ACE_DEBUG ((LM_WARNING,
+ " Currently unimplemented.\n"));
+}
+
+void
+recursive_union_typecodefactory_test (CORBA::ORB_ptr /* orb */,
+ Test::Hello_ptr /* hello */
+ ACE_ENV_ARG_DECL_NOT_USED)
+{
+ ACE_DEBUG ((LM_INFO,
+ "Executing recursive union via TypeCodeFactory test\n"));
+
+ ACE_DEBUG ((LM_WARNING,
+ " Currently unimplemented.\n"));
+}
+
+
+void
+indirectly_recursive_valuetype_test (CORBA::ORB_ptr /* orb */,
+ Test::Hello_ptr /* hello */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_DEBUG ((LM_INFO,
+ "Executing indirectly recursive valuetype test\n"));
+
+ ACE_DEBUG ((LM_WARNING,
+ " Currently unimplemented.\n"));
+}
+
+void
+indirectly_recursive_valuetype_typecodefactory_test (CORBA::ORB_ptr /* orb */,
+ Test::Hello_ptr /* hello */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_DEBUG ((LM_INFO,
+ "Executing indirectly recursive valuetype via "
+ "TypeCodeFactory test\n"));
+
+ ACE_DEBUG ((LM_WARNING,
+ " Currently unimplemented.\n"));
+}
+
+void
+directly_recursive_valuetype_test (CORBA::ORB_ptr /* orb */,
+ Test::Hello_ptr /* hello */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_DEBUG ((LM_INFO,
+ "Executing directly recursive valuetype test\n"));
+
+ ACE_DEBUG ((LM_WARNING,
+ " Currently unimplemented.\n"));
+}
+
+void
+directly_recursive_valuetype_typecodefactory_test (CORBA::ORB_ptr /* orb */,
+ Test::Hello_ptr /* hello */
+ ACE_ENV_ARG_DECL)
+{
+ ACE_DEBUG ((LM_INFO,
+ "Executing directly recursive valuetype via "
+ "TypeCodeFactory test\n"));
+
+ ACE_DEBUG ((LM_WARNING,
+ " Currently unimplemented.\n"));
+}
+
+
+/**
+ * @struct Caller
+ *
+ * @brief Test method invocation functor.
+ *
+ * Test method invocation functor.
+ */
+template <typename T>
+struct Caller : public std::unary_function<T, void>
+{
+ /// Constructor.
+ Caller (CORBA::ORB_ptr o, Test::Hello_ptr h)
+ : orb (CORBA::ORB::_duplicate (o))
+ , hello (Test::Hello::_duplicate (h))
+ , success (true)
+ {
+ }
+
+ /// Function call operator overload.
+ void operator() (T f)
+ {
+ ACE_DECLARE_NEW_ENV;
+ ACE_TRY
+ {
+ f (orb.in (),
+ hello.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception thrown:");
+
+ success = false;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+
+ CORBA::ORB_var orb;
+ Test::Hello_var hello;
+ bool success;
+};
+
+int
+main (int argc, char *argv[])
+{
+ ACE_TRY_NEW_ENV
+ {
+ 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 ()))
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "Nil Test::Hello reference <%s>\n",
+ ior),
+ 1);
+ }
+
+ typedef void (*test_func) (CORBA::ORB_ptr,
+ Test::Hello_ptr
+ ACE_ENV_ARG_DECL);
+
+ static test_func tests[] =
+ {
+ recursive_struct_test,
+ recursive_struct_typecodefactory_test,
+ recursive_union_test,
+ recursive_union_typecodefactory_test,
+ indirectly_recursive_valuetype_test,
+ indirectly_recursive_valuetype_typecodefactory_test,
+ directly_recursive_valuetype_test,
+ directly_recursive_valuetype_typecodefactory_test
+ };
+
+ static size_t const test_count = sizeof (tests) / sizeof (test_func);
+
+ // Have some fun with the STL. :-)
+ Caller<test_func> c =
+ std::for_each (tests,
+ tests + test_count,
+ Caller<test_func> (orb.in (),
+ hello.in ()));
+
+ if (!c.success)
+ ACE_TRY_THROW (Test::Recursive_Type_In_Any_Test_Failed ());
+
+ hello->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception caught:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/tests/Any/Recursive/run_test.pl b/TAO/tests/Any/Recursive/run_test.pl
new file mode 100755
index 00000000000..a3715338fd2
--- /dev/null
+++ b/TAO/tests/Any/Recursive/run_test.pl
@@ -0,0 +1,51 @@
+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;
+
+$iorfile = PerlACE::LocalFile ("server.ior");
+unlink $iorfile;
+
+print STDERR "\n\n==== Running Recursive Type in Any test\n";
+
+if (PerlACE::is_vxworks_test()) {
+ $SV = new PerlACE::ProcessVX ("server", "-o server.ior");
+}
+else {
+ $SV = new PerlACE::Process ("server", "-o $iorfile");
+}
+$CL = new PerlACE::Process ("client", " -k file://$iorfile");
+
+$SV->Spawn ();
+
+if (PerlACE::waitforfile_timed ($iorfile,
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+$client = $CL->SpawnWaitKill (300);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
+}
+
+$server = $SV->WaitKill (10);
+
+if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ $status = 1;
+}
+
+unlink $iorfile;
+
+exit $status;
diff --git a/TAO/tests/Any/Recursive/server.cpp b/TAO/tests/Any/Recursive/server.cpp
new file mode 100644
index 00000000000..177aad4d1d8
--- /dev/null
+++ b/TAO/tests/Any/Recursive/server.cpp
@@ -0,0 +1,115 @@
+// $Id$
+
+#include "Hello.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+
+ACE_RCSID (Hello,
+ server,
+ "$Id$")
+
+const char *ior_output_file = "test.ior";
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "o:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ ACE_TRY_NEW_ENV
+ {
+ 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,
+ " (%P|%t) Panic: nil RootPOA\n"),
+ 1);
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ Hello *hello_impl;
+ ACE_NEW_RETURN (hello_impl,
+ Hello (orb.in ()),
+ 1);
+ PortableServer::ServantBase_var owner_transfer(hello_impl);
+
+ Test::Hello_var hello =
+ hello_impl->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ 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");
+ if (output_file == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open output file for writing IOR: %s",
+ ior_output_file),
+ 1);
+ ACE_OS::fprintf (output_file, "%s", ior.in ());
+ ACE_OS::fclose (output_file);
+
+ poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ orb->run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ 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;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception caught:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}