summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/HTIOP
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/tests/HTIOP')
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/HTIOP_AMI.mpc50
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/Makefile.am165
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/README39
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/Test_Output.cpp230
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/ami_test.idl40
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/ami_test_i.cpp86
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/ami_test_i.h60
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/client.cpp339
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/exclusive.conf9
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/muxed.conf9
-rwxr-xr-xTAO/orbsvcs/tests/HTIOP/AMI/run_test.pl60
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/server.conf8
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/server.cpp144
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/simple_client.cpp320
-rw-r--r--TAO/orbsvcs/tests/HTIOP/AMI/svc.conf6
-rw-r--r--TAO/orbsvcs/tests/HTIOP/BiDirectional/HTIOP_BiDirectional.mpc35
-rw-r--r--TAO/orbsvcs/tests/HTIOP/BiDirectional/Makefile.am114
-rw-r--r--TAO/orbsvcs/tests/HTIOP/BiDirectional/Test_Output.cpp230
-rw-r--r--TAO/orbsvcs/tests/HTIOP/BiDirectional/client.cpp168
-rw-r--r--TAO/orbsvcs/tests/HTIOP/BiDirectional/inside.conf7
-rw-r--r--TAO/orbsvcs/tests/HTIOP/BiDirectional/outside.conf7
-rwxr-xr-xTAO/orbsvcs/tests/HTIOP/BiDirectional/run_test.pl45
-rw-r--r--TAO/orbsvcs/tests/HTIOP/BiDirectional/server.cpp177
-rw-r--r--TAO/orbsvcs/tests/HTIOP/BiDirectional/test.idl27
-rw-r--r--TAO/orbsvcs/tests/HTIOP/BiDirectional/test_i.cpp94
-rw-r--r--TAO/orbsvcs/tests/HTIOP/BiDirectional/test_i.h92
-rw-r--r--TAO/orbsvcs/tests/HTIOP/BiDirectional/test_i.i17
-rw-r--r--TAO/orbsvcs/tests/HTIOP/HT_Config.conf4
-rw-r--r--TAO/orbsvcs/tests/HTIOP/Hello/HTIOP_Hello.mpc45
-rw-r--r--TAO/orbsvcs/tests/HTIOP/Hello/Hello.cpp27
-rw-r--r--TAO/orbsvcs/tests/HTIOP/Hello/Hello.h42
-rw-r--r--TAO/orbsvcs/tests/HTIOP/Hello/Makefile.am105
-rw-r--r--TAO/orbsvcs/tests/HTIOP/Hello/README22
-rw-r--r--TAO/orbsvcs/tests/HTIOP/Hello/Test.idl20
-rw-r--r--TAO/orbsvcs/tests/HTIOP/Hello/Test_Output.cpp230
-rw-r--r--TAO/orbsvcs/tests/HTIOP/Hello/client.cpp94
-rw-r--r--TAO/orbsvcs/tests/HTIOP/Hello/outside.conf8
-rwxr-xr-xTAO/orbsvcs/tests/HTIOP/Hello/run_test.pl91
-rw-r--r--TAO/orbsvcs/tests/HTIOP/Hello/server.cpp167
-rw-r--r--TAO/orbsvcs/tests/HTIOP/Hello/svc.conf7
-rw-r--r--TAO/orbsvcs/tests/HTIOP/Makefile.am15
-rw-r--r--TAO/orbsvcs/tests/HTIOP/test_config.h319
42 files changed, 3774 insertions, 0 deletions
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/HTIOP_AMI.mpc b/TAO/orbsvcs/tests/HTIOP/AMI/HTIOP_AMI.mpc
new file mode 100644
index 00000000000..4dde0b749eb
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/HTIOP_AMI.mpc
@@ -0,0 +1,50 @@
+// -*- MPC -*-
+//
+// $Id$
+
+project(*idl): taoidldefaults, ami {
+ IDL_Files {
+ ami_test.idl
+ }
+ custom_only = 1
+}
+
+project(*Server): messaging, taoexe, portableserver, ami {
+ after += *idl
+ macros += TEST_OUTPUT_HAS_DLL=0
+ Source_Files {
+ Test_Output.cpp
+ ami_test_i.cpp
+ ami_testS.cpp
+ ami_testC.cpp
+ server.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*Client): messaging, taoexe, portableserver, ami {
+ after += *idl
+ macros += TEST_OUTPUT_HAS_DLL=0
+ Source_Files {
+ Test_Output.cpp
+ client.cpp
+ ami_testS.cpp
+ ami_testC.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*Simple Client): messaging, taoexe, portableserver, ami {
+ after += *idl
+ macros += TEST_OUTPUT_HAS_DLL=0
+ Source_Files {
+ Test_Output.cpp
+ simple_client.cpp
+ ami_testS.cpp
+ ami_testC.cpp
+ }
+ IDL_Files {
+ }
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/Makefile.am b/TAO/orbsvcs/tests/HTIOP/AMI/Makefile.am
new file mode 100644
index 00000000000..8e47b662087
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/Makefile.am
@@ -0,0 +1,165 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ../bin/mwc.pl -type automake -noreldefs TAO.mwc
+
+ACE_BUILDDIR = $(top_builddir)/..
+ACE_ROOT = $(top_srcdir)/..
+TAO_BUILDDIR = $(top_builddir)
+TAO_IDL = ACE_ROOT=$(ACE_ROOT) TAO_ROOT=$(TAO_ROOT) $(TAO_BUILDDIR)/TAO_IDL/tao_idl
+TAO_IDL_DEP = $(TAO_BUILDDIR)/TAO_IDL/tao_idl
+TAO_IDLFLAGS = -Ge 1 -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(srcdir) -g $(ACE_BUILDDIR)/apps/gperf/src/gperf
+TAO_ROOT = $(top_srcdir)
+
+noinst_PROGRAMS =
+
+## Makefile.HTIOP_AMI_Idl.am
+
+if BUILD_AMI
+if BUILD_CORBA_MESSAGING
+
+BUILT_SOURCES = \
+ ami_testC.cpp \
+ ami_testC.h \
+ ami_testC.inl \
+ ami_testS.cpp \
+ ami_testS.h \
+ ami_testS.inl
+
+CLEANFILES = \
+ ami_test-stamp \
+ ami_testC.cpp \
+ ami_testC.h \
+ ami_testC.inl \
+ ami_testS.cpp \
+ ami_testS.h \
+ ami_testS.inl
+
+ami_testC.cpp ami_testC.h ami_testC.inl ami_testS.cpp ami_testS.h ami_testS.inl: ami_test-stamp
+
+ami_test-stamp: $(srcdir)/ami_test.idl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -GC $(srcdir)/ami_test.idl
+ @touch $@
+
+
+noinst_HEADERS = \
+ ami_test.idl
+
+endif BUILD_CORBA_MESSAGING
+endif BUILD_AMI
+
+## Makefile.HTIOP_AMI_Client.am
+
+if BUILD_AMI
+if BUILD_CORBA_MESSAGING
+
+noinst_PROGRAMS += client
+
+client_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTEST_OUTPUT_HAS_DLL=0
+
+client_SOURCES = \
+ Test_Output.cpp \
+ ami_testC.cpp \
+ ami_testS.cpp \
+ client.cpp \
+ ami_test_i.h
+
+client_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif BUILD_CORBA_MESSAGING
+endif BUILD_AMI
+
+## Makefile.HTIOP_AMI_Server.am
+
+if BUILD_AMI
+if BUILD_CORBA_MESSAGING
+
+noinst_PROGRAMS += server
+
+server_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTEST_OUTPUT_HAS_DLL=0
+
+server_SOURCES = \
+ Test_Output.cpp \
+ ami_testC.cpp \
+ ami_testS.cpp \
+ ami_test_i.cpp \
+ server.cpp \
+ ami_test_i.h
+
+server_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif BUILD_CORBA_MESSAGING
+endif BUILD_AMI
+
+## Makefile.HTIOP_AMI_Simple_Client.am
+
+if BUILD_AMI
+if BUILD_CORBA_MESSAGING
+
+noinst_PROGRAMS += simple_client
+
+simple_client_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTEST_OUTPUT_HAS_DLL=0
+
+simple_client_SOURCES = \
+ Test_Output.cpp \
+ ami_testC.cpp \
+ ami_testS.cpp \
+ simple_client.cpp \
+ ami_test_i.h
+
+simple_client_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif BUILD_CORBA_MESSAGING
+endif BUILD_AMI
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/README b/TAO/orbsvcs/tests/HTIOP/AMI/README
new file mode 100644
index 00000000000..04117a71d7d
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/README
@@ -0,0 +1,39 @@
+# $Id$
+
+Description:
+This is a simple test for AMI callback model.
+
+Note:
+Use TAO_HAS_CORBA_MESSAGING
+and TAO_HAS_AMI_CALLBACK
+to compile TAO. This enables the AMI code in it.
+
+Use -GC on the TAO IDL compiler to generate code for AMI callbacks.
+
+Usage:
+=====
+$ server -o ior
+$ simple_client -ORBSvcConf muxed.conf -k file://ior -i 10
+
+simple-client:
+=============
+
+$ simple_client -k file://test_ior [-i <niterations] [-x] [-d] \
+ -ORBSvcConf {muxed.conf,
+ exclusive.conf}
+
+-d Enable debug messages.
+-i Number of iterations.
+-k IOR.
+-x Call shutdown method.
+
+Issues <i> number of asynchronous requests. Then it issues a
+synchronous request, which collects the replies.
+
+If you choose Muxed Transport configuration, then the synchronous
+request will collect all the asynchronous replies also, since the
+replies will arrive in order. In the Exclusive Transport, however,
+the synchronous request might not collect all the AMI replies.
+Instead, it might return as soon as its reply arrives.
+
+
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/Test_Output.cpp b/TAO/orbsvcs/tests/HTIOP/AMI/Test_Output.cpp
new file mode 100644
index 00000000000..8ab1d029463
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/Test_Output.cpp
@@ -0,0 +1,230 @@
+// -*- C++ -*-
+
+// ============================================================================
+/**
+ * @file Test_Output.cpp
+ *
+ * $Id$
+ *
+ * This file factors out common macros and other utilities used by the
+ * ACE automated regression tests.
+ *
+ * @author Prashant Jain <pjain@cs.wustl.edu>
+ * @author Tim Harrison <harrison@cs.wustl.edu>
+ * @author David Levine <levine@cs.wustl.edu>
+ * @author Don Hinton <dhinton@dresystems.com>
+ */
+// ============================================================================
+
+#include "tests/test_config.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_sys_stat.h"
+#include "ace/Guard_T.h"
+#include "ace/Object_Manager.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+#include "ace/Framework_Component.h"
+#include "ace/Log_Msg.h"
+#include "ace/ACE.h"
+
+#if defined (VXWORKS)
+# include "ace/OS_NS_unistd.h"
+# include "ace/OS_NS_fcntl.h"
+#endif /* VXWORKS */
+
+ACE_Test_Output *ACE_Test_Output::instance_ = 0;
+
+ACE_Test_Output::ACE_Test_Output (void)
+ : output_file_ (0)
+{
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+ this->output_file_ = new OFSTREAM;
+#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+}
+
+ACE_Test_Output::~ACE_Test_Output (void)
+{
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) && !defined (ACE_PSOS)
+ ACE_LOG_MSG->msg_ostream (&cerr);
+#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY && ! ACE_PSOS */
+
+ ACE_LOG_MSG->clr_flags (ACE_Log_Msg::OSTREAM);
+ ACE_LOG_MSG->set_flags (ACE_Log_Msg::STDERR);
+
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) && !defined (ACE_HAS_PHARLAP)
+ delete this->output_file_;
+#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+}
+
+OFSTREAM *
+ACE_Test_Output::output_file (void)
+{
+ return this->output_file_;
+}
+
+int
+ACE_Test_Output::set_output (const ACE_TCHAR *filename, int append)
+{
+#if defined (ACE_HAS_PHARLAP)
+ // For PharLap, just send it all to the host console for now - redirect
+ // to a file there for saving/analysis.
+ EtsSelectConsole(ETS_CO_HOST);
+ ACE_LOG_MSG->msg_ostream (&cout);
+
+#else
+ ACE_TCHAR temp[MAXPATHLEN];
+ // Ignore the error value since the directory may already exist.
+ const ACE_TCHAR *test_dir;
+
+#if !defined (ACE_HAS_WINCE)
+# if defined (ACE_WIN32) || !defined (ACE_USES_WCHAR)
+ test_dir = ACE_OS::getenv (ACE_TEXT ("ACE_TEST_DIR"));
+# else
+ ACE_TCHAR tempenv[MAXPATHLEN];
+ char *test_dir_n = ACE_OS::getenv ("ACE_TEST_DIR");
+ if (test_dir_n == 0)
+ test_dir = 0;
+ else
+ {
+ ACE_OS::strcpy (tempenv, ACE_TEXT_CHAR_TO_TCHAR (test_dir_n));
+ test_dir = tempenv;
+ }
+# endif /* ACE_WIN32 || !ACE_USES_WCHAR */
+
+ if (test_dir == 0)
+#endif /* ACE_HAS_WINCE */
+ test_dir = ACE_TEXT ("");
+
+ // This could be done with ACE_OS::sprintf() but it requires different
+ // format strings for wide-char POSIX vs. narrow-char POSIX and Windows.
+ // Easier to keep straight like this.
+ ACE_OS_String::strcpy (temp, test_dir);
+ ACE_OS_String::strcat (temp, ACE_LOG_DIRECTORY);
+ ACE_OS_String::strcat
+ (temp, ACE::basename (filename, ACE_DIRECTORY_SEPARATOR_CHAR));
+ ACE_OS_String::strcat (temp, ACE_LOG_FILE_EXT_NAME);
+
+#if defined (VXWORKS)
+ // This is the only way I could figure out to avoid a console
+ // warning about opening an existing file (w/o O_CREAT), or
+ // attempting to unlink a non-existant one.
+ ACE_HANDLE fd = ACE_OS::open (temp,
+ O_WRONLY|O_CREAT,
+ S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
+ if (fd != ERROR)
+ {
+ ACE_OS::close (fd);
+ ACE_OS::unlink (temp);
+ }
+# else /* ! VXWORKS */
+ // This doesn't seem to work on VxWorks if the directory doesn't
+ // exist: it creates a plain file instead of a directory. If the
+ // directory does exist, it causes a wierd console error message
+ // about "cat: input error on standard input: Is a directory". So,
+ // VxWorks users must create the directory manually.
+# if defined (ACE_HAS_WINCE)
+ ACE_OS::mkdir (ACE_LOG_DIRECTORY_FOR_MKDIR);
+# else
+ ACE_OS::mkdir (ACE_LOG_DIRECTORY);
+# endif // ACE_HAS_WINCE
+# endif /* ! VXWORKS */
+
+# if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+ this->output_file_->open (ACE_TEXT_ALWAYS_CHAR (temp),
+ ios::out | (append ? ios::app : ios::trunc));
+ if (this->output_file_->bad ())
+ return -1;
+#else /* when ACE_LACKS_IOSTREAM_TOTALLY */
+ ACE_TCHAR *fmode = 0;
+ if (append)
+ fmode = ACE_TEXT ("a");
+ else
+ fmode = ACE_TEXT ("w");
+ this->output_file_ = ACE_OS::fopen (temp, fmode);
+# endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+
+ ACE_LOG_MSG->msg_ostream (this->output_file ());
+#endif /* ACE_HAS_PHARLAP */
+
+ ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER );
+ ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
+
+ return 0;
+}
+
+void
+ACE_Test_Output::close (void)
+{
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+ this->output_file_->flush ();
+ this->output_file_->close ();
+#else
+ ACE_OS::fflush (this->output_file_);
+ ACE_OS::fclose (this->output_file_);
+#endif /* !ACE_LACKS_IOSTREAM_TOTALLY */
+}
+
+ACE_Test_Output*
+ACE_Test_Output::instance ()
+{
+ if (ACE_Test_Output::instance_ == 0)
+ {
+ // Perform Double-Checked Locking Optimization.
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
+ *ACE_Static_Object_Lock::instance (), 0));
+
+ if (ACE_Test_Output::instance_ == 0)
+ {
+ ACE_NEW_RETURN (ACE_Test_Output::instance_,
+ ACE_Test_Output,
+ 0);
+ ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Test_Output, ACE_Test_Output::instance_)
+ }
+ }
+ return ACE_Test_Output::instance_;
+}
+
+const ACE_TCHAR *
+ACE_Test_Output::dll_name (void)
+{
+ return ACE_TEXT ("Test_Output");
+}
+
+const ACE_TCHAR *
+ACE_Test_Output::name (void)
+{
+ return ACE_TEXT ("ACE_Test_Output");
+}
+
+void
+ACE_Test_Output::close_singleton (void)
+{
+ delete ACE_Test_Output::instance_;
+ ACE_Test_Output::instance_ = 0;
+}
+
+void
+randomize (int array[], size_t size)
+{
+ size_t i;
+
+ for (i = 0; i < size; i++)
+ array [i] = static_cast<int> (i);
+
+ // See with a fixed number so that we can produce "repeatable"
+ // random numbers.
+ ACE_OS::srand (0);
+
+ // Generate an array of random numbers from 0 .. size - 1.
+
+ for (i = 0; i < size; i++)
+ {
+ size_t index = ACE_OS::rand() % size--;
+ int temp = array [index];
+ array [index] = array [size];
+ array [size] = temp;
+ }
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/ami_test.idl b/TAO/orbsvcs/tests/HTIOP/AMI/ami_test.idl
new file mode 100644
index 00000000000..df28b53177a
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/ami_test.idl
@@ -0,0 +1,40 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/AMI
+//
+// = FILENAME
+// ami_test.idl
+//
+// = DESCRIPTION
+// IDL description of the AMI Test interface
+//
+// = AUTHOR
+// Alexander Babu Arulanthu <alex@cs.wustl.edu>,
+// Michael Kircher <Michael.Kircher@mchp.siemens.de>
+//
+// ============================================================================
+
+
+module A
+ {
+ exception DidTheRightThing {
+ long id;
+ string whatDidTheRightThing;
+ };
+
+ interface AMI_Test
+ {
+ long foo (out long out_l,
+ in long in_l,
+ in string in_str)
+ raises (DidTheRightThing);
+
+ attribute long yadda;
+
+ oneway void shutdown ();
+ };
+
+ };
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/ami_test_i.cpp b/TAO/orbsvcs/tests/HTIOP/AMI/ami_test_i.cpp
new file mode 100644
index 00000000000..4586a4d67a1
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/ami_test_i.cpp
@@ -0,0 +1,86 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/AMI
+//
+// = FILENAME
+// ami_test_i.cpp
+//
+// = DESCRIPTION
+// Implementation of the AMI Test interface.
+//
+// = AUTHOR
+// Alexander Babu Arulanthu <alex@cs.wustl.edu>,
+// Michael Kircher <Michael.Kircher@mchp.siemens.de>
+//
+// ============================================================================
+
+#include "ami_test_i.h"
+#include "tao/debug.h"
+
+ACE_RCSID(AMI, ami_test_i, "$Id$")
+
+AMI_Test_i::AMI_Test_i (CORBA::ORB_ptr orb)
+ : orb_ (CORBA::ORB::_duplicate (orb)),
+ number_ ((CORBA::Long) 931232),
+ yadda_ ((CORBA::Long) 140474)
+{
+}
+
+CORBA::Long
+AMI_Test_i::foo (CORBA::Long_out out_l,
+ CORBA::Long in_l,
+ const char* in_str
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ A::DidTheRightThing))
+{
+ out_l = 931233;
+
+ //if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "%N:%l:(%P:%t):AMI_Test_i::foo: %d %s\n",
+ in_l,
+ in_str));
+
+ if (in_l == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Throwing Exception: A::DidTheRightThing\n"));
+ ACE_THROW_RETURN (A::DidTheRightThing(), 0);
+ }
+
+ return 931234;
+}
+
+
+
+void
+AMI_Test_i::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->orb_->shutdown (0);
+}
+
+
+CORBA::Long
+AMI_Test_i::yadda (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "%N:%l:(%P:%t):AMI_Test_i::(get_)yadda\n"));
+ return yadda_;
+}
+
+
+void
+AMI_Test_i::yadda (CORBA::Long yadda
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "%N:%l:(%P:%t):AMI_Test_i::(set_)yadda\n"));
+ yadda_ = yadda;
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/ami_test_i.h b/TAO/orbsvcs/tests/HTIOP/AMI/ami_test_i.h
new file mode 100644
index 00000000000..161d329e7ff
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/ami_test_i.h
@@ -0,0 +1,60 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/AMI
+//
+// = FILENAME
+// ami_test_i.h
+//
+// = AUTHOR
+// Michael Kircher <Michael.Kircher@mchp.siemens.de>
+//
+// ============================================================================
+
+#ifndef TAO_AMI_TEST_I_H
+#define TAO_AMI_TEST_I_H
+
+#include "ami_testS.h"
+
+class AMI_Test_i : public POA_A::AMI_Test
+{
+ // = TITLE
+ // AMI Test implementation
+ //
+ // = DESCRIPTION
+ // Implements the AMI_Test interface in test.idl
+ //
+public:
+ AMI_Test_i (CORBA::ORB_ptr orb);
+ // ctor
+
+ // The AMI_Test methods.
+ CORBA::Long foo (CORBA::Long_out out_l,
+ CORBA::Long in_l,
+ const char* in_str
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ A::DidTheRightThing));
+
+ void shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Long yadda (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void yadda (CORBA::Long yadda
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ CORBA::ORB_var orb_;
+
+ CORBA::Long number_;
+
+ CORBA::Long yadda_;
+};
+
+
+#endif /* TAO_AMI_TEST_I_H */
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/client.cpp b/TAO/orbsvcs/tests/HTIOP/AMI/client.cpp
new file mode 100644
index 00000000000..efc9e973701
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/client.cpp
@@ -0,0 +1,339 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/AMI
+//
+// = FILENAME
+// server.cpp
+//
+// = DESCRIPTION
+// A client which uses the AMI callback model.
+//
+// = AUTHOR
+// Alexander Babu Arulanthu <alex@cs.wustl.edu>,
+// Michael Kircher <Michael.Kircher@mchp.siemens.de>
+//
+// ============================================================================
+
+#include "tests/test_config.h"
+#include "ace/OS_NS_sys_socket.h"
+#include "ace/Get_Opt.h"
+#include "ace/Task.h"
+#include "ami_testC.h"
+#include "ami_testS.h"
+
+ACE_RCSID(AMI, client, "$Id$")
+
+const char *ior = "file://test.ior";
+int nthreads = 5;
+int niterations = 5;
+int debug = 0;
+int number_of_replies = 0;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "dk:n:i:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'd':
+ debug = 1;
+ break;
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+ case 'n':
+ nthreads = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+ case 'i':
+ niterations = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-d "
+ "-k <ior> "
+ "-n <nthreads> "
+ "-i <niterations> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+class Client : public ACE_Task_Base
+{
+ // = TITLE
+ // Run the client thread
+ //
+ // = DESCRIPTION
+ // Use the ACE_Task_Base class to run the client threads.
+ //
+public:
+ Client (A::AMI_Test_ptr server, int niterations);
+ // ctor
+
+ virtual int svc (void);
+ // The thread entry point.
+
+ // private:
+ A::AMI_Test_var ami_test_var_;
+ // Var for the AMI_Test object.
+
+ int niterations_;
+ // The number of iterations on each client thread.
+
+ A::AMI_AMI_TestHandler_var the_handler_var_;
+ // Var for AMI_AMI_Test_ReplyHandler object.
+};
+
+class Handler : public POA_A::AMI_AMI_TestHandler
+{
+public:
+ Handler (void) {};
+
+ void foo (CORBA::Long result,
+ CORBA::Long out_l
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ if (debug)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P | %t) : Callback method called: result <%d>, out_arg <%d>\n",
+ result,
+ out_l));
+ }
+
+ number_of_replies--;
+ };
+
+ void foo_excep (::Messaging::ExceptionHolder * excep_holder
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Callback method <foo_excep> called: \n"));
+ ACE_TRY
+ {
+ excep_holder->raise_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Caught exception:");
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ };
+
+ void get_yadda (CORBA::Long result
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Callback method <get_yadda> called: result <%d>\n",
+ result));
+ };
+
+ void get_yadda_excep (::Messaging::ExceptionHolder *
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Callback method <get_yadda_excep> called: \n"));
+ };
+
+ void set_yadda (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Callback method <set_yadda> called: \n"));
+ };
+
+ void set_yadda_excep (::Messaging::ExceptionHolder *
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Callback method <set_yadda_excep> called: \n"));
+ };
+ ~Handler (void) {};
+};
+
+// ReplyHandler.
+Handler handler;
+
+int
+main (int argc, char *argv[])
+{
+ ACE_START_TEST (ACE_TEXT ("HTIOP_AMI_client"));
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ ACE_OS::socket_init ();
+
+ CORBA::Object_var object =
+ orb->string_to_object (ior ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ A::AMI_Test_var server =
+ A::AMI_Test::_narrow (object.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (server.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Object reference <%s> is nil\n",
+ ior),
+ 1);
+ }
+
+ // Activate POA to handle the call back.
+
+ CORBA::Object_var poa_object =
+ orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (poa_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"),
+ 1);
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Let the client perform the test in a separate thread
+
+ Client client (server.in (), niterations);
+ if (client.activate (THR_NEW_LWP | THR_JOINABLE,
+ nthreads) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot activate client threads\n"),
+ 1);
+
+ // Main thread collects replies. It needs to collect
+ // <nthreads*niterations> replies.
+ number_of_replies = nthreads * niterations;
+
+ if (debug)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) : Entering perform_work loop to receive <%d> replies\n",
+ number_of_replies));
+ }
+
+ // ORB loop.
+
+ while (number_of_replies > 0)
+ {
+ CORBA::Boolean pending =
+ orb->work_pending(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (pending)
+ {
+ orb->perform_work(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+
+ if (debug)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) : Exited perform_work loop Received <%d> replies\n",
+ (nthreads*niterations) - number_of_replies));
+ }
+
+
+ client.thr_mgr ()->wait ();
+
+ ACE_DEBUG ((LM_DEBUG, "threads finished\n"));
+
+ //client.ami_test_var_->shutdown ();
+
+ root_poa->destroy (1, // ethernalize objects
+ 0 // wait for completion
+ 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,
+ "Caught exception:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ ACE_END_TEST;
+ return 0;
+}
+
+// ****************************************************************
+
+Client::Client (A::AMI_Test_ptr server,
+ int niterations)
+ : ami_test_var_ (A::AMI_Test::_duplicate (server)),
+ niterations_ (niterations)
+{
+ the_handler_var_ = handler._this (/* ACE_ENV_SINGLE_ARG_PARAMETER */);
+}
+
+int
+Client::svc (void)
+{
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::Long number = 931232;
+
+ for (int i = 0; i < this->niterations_; ++i)
+ {
+ ami_test_var_->sendc_foo (the_handler_var_.in (),
+ number,
+ "Let's talk AMI."
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ if (debug)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P | %t):<%d> Asynchronous methods issued\n",
+ niterations));
+ }
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "MT_Client: exception raised");
+ }
+ ACE_ENDTRY;
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/exclusive.conf b/TAO/orbsvcs/tests/HTIOP/AMI/exclusive.conf
new file mode 100644
index 00000000000..37d1ecd17d9
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/exclusive.conf
@@ -0,0 +1,9 @@
+
+dynamic HTIOP_Factory Service_Object *
+ TAO_HTIOP:_make_TAO_HTIOP_Protocol_Factory ()
+ "-inside 1"
+
+static Client_Strategy_Factory
+ "-ORBTransportMuxStrategy EXCLUSIVE -ORBProfileLock null -ORBclientconnectionhandler ST"
+
+static Resource_Factory "-ORBProtocolFactory HTIOP_Factory"
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/muxed.conf b/TAO/orbsvcs/tests/HTIOP/AMI/muxed.conf
new file mode 100644
index 00000000000..99322cdc625
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/muxed.conf
@@ -0,0 +1,9 @@
+
+dynamic HTIOP_Factory Service_Object *
+ TAO_HTIOP:_make_TAO_HTIOP_Protocol_Factory ()
+ "-inside 1"
+
+static Client_Strategy_Factory
+ "-ORBTransportMuxStrategy MUXED -ORBProfileLock null -ORBClientConnectionHandler ST"
+
+static Resource_Factory "-ORBProtocolFactory HTIOP_Factory"
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/run_test.pl b/TAO/orbsvcs/tests/HTIOP/AMI/run_test.pl
new file mode 100755
index 00000000000..1eb776eba79
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/run_test.pl
@@ -0,0 +1,60 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::Run_Test;
+use Sys::Hostname;
+
+$client_conf = PerlACE::LocalFile ("muxed$PerlACE::svcconf_ext");
+
+$debug_level = '0';
+$iterations = '1';
+$host = hostname();
+
+foreach $i (@ARGV) {
+ if ($i eq '-mux') {
+ $client_conf = PerlACE::LocalFile ("muxed$PerlACE::svcconf_ext");
+ }
+ elsif ($i eq '-debug') {
+ $debug_level = '10';
+ }
+ elsif ($i eq '-exclusive') {
+ $client_conf = PerlACE::LocalFile ("exclusive$PerlACE::svcconf_ext");
+ }
+}
+
+$iorfile = PerlACE::LocalFile ("server.ior");
+
+unlink $iorfile;
+
+$SV = new PerlACE::Process ("server",
+ "-ORBEndpoint htiop://$host:8088 -ORBdebuglevel $debug_level -d -o $iorfile");
+
+$SV->Spawn ();
+
+if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+$CL = new PerlACE::Process ("simple_client",
+ "-ORBsvcconf $client_conf "
+ . "-ORBdebuglevel $debug_level"
+ . " -k file://$iorfile "
+ . " -i $iterations -x -d");
+
+$client = $CL->SpawnWaitKill (60);
+$server = $SV->WaitKill (5);
+
+unlink $iorfile;
+
+if ($server != 0 || $client != 0) {
+ exit 1;
+}
+
+exit 0;
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/server.conf b/TAO/orbsvcs/tests/HTIOP/AMI/server.conf
new file mode 100644
index 00000000000..dada9646a63
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/server.conf
@@ -0,0 +1,8 @@
+# $Id$
+#
+
+dynamic HTIOP_Factory Service_Object *
+ TAO_HTIOP:_make_TAO_HTIOP_Protocol_Factory () ""
+
+#static Server_Strategy_Factory "-ORBconcurrency thread-per-connection"
+static Resource_Factory "-ORBProtocolFactory HTIOP_Factory"
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/server.cpp b/TAO/orbsvcs/tests/HTIOP/AMI/server.cpp
new file mode 100644
index 00000000000..ee6a7282b5f
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/server.cpp
@@ -0,0 +1,144 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/AMI
+//
+// = FILENAME
+// server.cpp
+//
+// = DESCRIPTION
+// Implementation of the server.
+//
+// = AUTHOR
+// Alexander Babu Arulanthu <alex@cs.wustl.edu>,
+// Michael Kircher <Michael.Kircher@mchp.siemens.de>
+//
+// ============================================================================
+
+#include "ami_test_i.h"
+
+#include "tests/test_config.h"
+
+#include "tao/debug.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_sys_socket.h"
+
+ACE_RCSID(AMI, server, "$Id$")
+
+const char *ior_output_file = 0;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "o:d");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+ case 'd':
+ TAO_debug_level++;
+ 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_START_TEST (ACE_TEXT ("HTIOP_AMI_server"));
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ 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;
+
+ if (CORBA::is_nil (poa_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"),
+ 1);
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ 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;
+
+ ACE_OS::socket_init ();
+
+ AMI_Test_i ami_test_i (orb.in ());
+
+ A::AMI_Test_var ami_test_var =
+ ami_test_i._this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::String_var ior =
+ orb->object_to_string (ami_test_var.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ()));
+
+ // If the ior_output_file exists, output the ior to it
+ if (ior_output_file != 0)
+ {
+ 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;
+
+ root_poa->destroy (1, // ethernalize objects
+ 0 // wait for completion
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "event loop finished\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Caught exception:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ ACE_END_TEST;
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/simple_client.cpp b/TAO/orbsvcs/tests/HTIOP/AMI/simple_client.cpp
new file mode 100644
index 00000000000..442d7a9356f
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/simple_client.cpp
@@ -0,0 +1,320 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/AMI
+//
+// = FILENAME
+// simple_client.cpp
+//
+// = DESCRIPTION
+// A very simple client which uses the AMI callback model.
+//
+// = AUTHOR
+// Alexander Babu Arulanthu <alex@cs.wustl.edu>,
+// Michael Kircher <Michael.Kircher@mchp.siemens.de>
+//
+// ============================================================================
+
+#include "tests/test_config.h"
+
+#include "ace/OS_NS_sys_socket.h"
+#include "ace/Get_Opt.h"
+#include "ace/Task.h"
+
+#include "ami_testC.h"
+#include "ami_testS.h"
+
+ACE_RCSID(AMI, simple_client, "$Id$")
+
+const char *ior = "file://test.ior";
+int niterations = 5;
+int shutdown_flag = 0;
+int debug = 0;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "dk:i:x");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'd':
+ debug = 1;
+ break;
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+ case 'i':
+ niterations = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+ case 'x':
+ shutdown_flag = 1;
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "-i <niterations> "
+ "-x "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+class Handler : public POA_A::AMI_AMI_TestHandler
+{
+public:
+ Handler (void) {};
+ // Constructor.
+
+ ~Handler (void) {};
+ // Destructor.
+
+ void foo (CORBA::Long ami_return_val,
+ CORBA::Long out_l
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ if (debug)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Callback method <foo> called: result <%d>, out_arg <%d>\n",
+ ami_return_val,
+ out_l));
+ }
+ };
+
+ void foo_excep (::Messaging::ExceptionHolder * excep_holder
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+
+ ACE_DEBUG ((LM_DEBUG,
+ "Callback method <foo_excep> called: \n"
+ "Testing proper exception handling ...\n"));
+ ACE_TRY
+ {
+ excep_holder->raise_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCH (A::DidTheRightThing, ex)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "... exception received successfully\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "... caught the wrong exception -> ERROR\n"));
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ };
+
+
+ void get_yadda (CORBA::Long result
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Callback method <get_yadda> called: result <%d>\n",
+ result));
+ };
+
+ void get_yadda_excep (::Messaging::ExceptionHolder *
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Callback method <get_yadda_excep> called: \n"));
+ };
+
+ void set_yadda (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Callback method <set_yadda> called: \n"));
+ };
+
+ void set_yadda_excep (::Messaging::ExceptionHolder *
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Callback method <set_yadda_excep> called: \n"));
+ };
+
+};
+
+int
+main (int argc, char *argv[])
+{
+ ACE_START_TEST (ACE_TEXT ("HTIOP_AMI_simple_client"));
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::Object_var object_var =
+ orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ PortableServer::POA_var poa_var =
+ PortableServer::POA::_narrow (object_var.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ PortableServer::POAManager_var poa_manager_var =
+ poa_var->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ poa_manager_var->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ // We reuse the object_var smart pointer!
+ object_var = orb->string_to_object (ior ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ A::AMI_Test_var ami_test_var =
+ A::AMI_Test::_narrow (object_var.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (ami_test_var.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Object reference <%s> is nil\n",
+ ior),
+ 1);
+ }
+
+ ACE_OS::socket_init ();
+
+ // Instantiate the ReplyHandler and register that with the POA.
+ Handler handler;
+ A::AMI_AMI_TestHandler_var the_handler_var =
+ handler._this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Try out sending asynchronous messages without a reply handler
+ // registered. Things fail if we get an exception.
+
+ ami_test_var->sendc_foo (A::AMI_AMI_TestHandler::_nil (),
+ 0,
+ ""
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+
+ // Trigger the DidTheRightThing exception on the server side
+ // by sending 0 to it.
+ ACE_DEBUG ((LM_DEBUG,
+ "Sending asynch message\n"));
+
+ ami_test_var->sendc_foo (the_handler_var.in (),
+ 0,
+ "Let's talk AMI."
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::Long l = 931247;
+
+ for (ssize_t ni = 0; ni < niterations; ni++)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Sending asynch message: %d\n",
+ ni));
+
+ ami_test_var->sendc_foo (the_handler_var.in (),
+ l,
+ "Let's talk AMI."
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ // Begin test of attributes
+ ami_test_var->sendc_get_yadda (the_handler_var.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ami_test_var->sendc_set_yadda (the_handler_var.in (),
+ 4711
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ami_test_var->sendc_get_yadda (the_handler_var.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // End test of attributes
+
+ if (debug)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "<%d> Asynchronous methods issued\n",
+ niterations));
+ }
+
+ if (debug)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Issuing a synchronous method to collect the AMI replies\n"));
+ }
+
+ //while (orb->work_pending())
+ // orb->perform_work ();
+
+
+ CORBA::Long number = ami_test_var->foo (l,
+ l,
+ "Let's talk SMI."
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (debug)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Received the following number: %d\n",
+ number));
+ }
+
+ if (shutdown_flag)
+ {
+ ACE_DEBUG ((LM_DEBUG, "invoking shutdown\n"));
+ ami_test_var->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ poa_var->destroy (1, // ethernalize objects
+ 0 // wait for completion
+ 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,
+ "Caught exception:");
+ return 1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ ACE_END_TEST;
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/AMI/svc.conf b/TAO/orbsvcs/tests/HTIOP/AMI/svc.conf
new file mode 100644
index 00000000000..9657f158c19
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/AMI/svc.conf
@@ -0,0 +1,6 @@
+# $Id$
+
+dynamic HTIOP_Factory Service_Object *
+ TAO_HTIOP:_make_TAO_HTIOP_Protocol_Factory () ""
+
+static Resource_Factory "-ORBProtocolFactory HTIOP_Factory"
diff --git a/TAO/orbsvcs/tests/HTIOP/BiDirectional/HTIOP_BiDirectional.mpc b/TAO/orbsvcs/tests/HTIOP/BiDirectional/HTIOP_BiDirectional.mpc
new file mode 100644
index 00000000000..981b180e88a
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/BiDirectional/HTIOP_BiDirectional.mpc
@@ -0,0 +1,35 @@
+// -*- MPC -*-
+//
+// $Id$
+
+project(*idl): taoidldefaults {
+ IDL_Files {
+ test.idl
+ }
+
+ custom_only = 1
+}
+
+project(*Server): taoexe, portableserver, bidir_giop {
+ after += *idl
+ Source_Files {
+ testC.cpp
+ testS.cpp
+ test_i.cpp
+ server.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*Client): taoexe, portableserver, minimum_corba, bidir_giop {
+ after += *idl
+ Source_Files {
+ testC.cpp
+ testS.cpp
+ test_i.cpp
+ client.cpp
+ }
+ IDL_Files {
+ }
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/BiDirectional/Makefile.am b/TAO/orbsvcs/tests/HTIOP/BiDirectional/Makefile.am
new file mode 100644
index 00000000000..825e33eaade
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/BiDirectional/Makefile.am
@@ -0,0 +1,114 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ../bin/mwc.pl -type automake -noreldefs TAO.mwc
+
+ACE_BUILDDIR = $(top_builddir)/..
+ACE_ROOT = $(top_srcdir)/..
+TAO_BUILDDIR = $(top_builddir)
+TAO_IDL = ACE_ROOT=$(ACE_ROOT) TAO_ROOT=$(TAO_ROOT) $(TAO_BUILDDIR)/TAO_IDL/tao_idl
+TAO_IDL_DEP = $(TAO_BUILDDIR)/TAO_IDL/tao_idl
+TAO_IDLFLAGS = -Ge 1 -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(srcdir) -g $(ACE_BUILDDIR)/apps/gperf/src/gperf
+TAO_ROOT = $(top_srcdir)
+
+noinst_PROGRAMS =
+
+## Makefile.HTIOP_BiDirectional_Idl.am
+
+BUILT_SOURCES = \
+ testC.cpp \
+ testC.h \
+ testC.inl \
+ testS.cpp \
+ testS.h \
+ testS.inl
+
+CLEANFILES = \
+ test-stamp \
+ testC.cpp \
+ testC.h \
+ testC.inl \
+ testS.cpp \
+ testS.h \
+ testS.inl
+
+testC.cpp testC.h testC.inl testS.cpp testS.h testS.inl: test-stamp
+
+test-stamp: $(srcdir)/test.idl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Sa -St $(srcdir)/test.idl
+ @touch $@
+
+
+noinst_HEADERS = \
+ test.idl
+
+## Makefile.HTIOP_BiDirectional_Client.am
+
+if !BUILD_MINIMUM_CORBA
+
+noinst_PROGRAMS += client
+
+client_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR)
+
+client_SOURCES = \
+ client.cpp \
+ testC.cpp \
+ testS.cpp \
+ test_i.cpp \
+ test_i.h \
+ test_i.i
+
+client_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO_BiDirGIOP.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_MINIMUM_CORBA
+
+## Makefile.HTIOP_BiDirectional_Server.am
+
+noinst_PROGRAMS += server
+
+server_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR)
+
+server_SOURCES = \
+ server.cpp \
+ testC.cpp \
+ testS.cpp \
+ test_i.cpp \
+ test_i.h \
+ test_i.i
+
+server_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO_BiDirGIOP.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/TAO/orbsvcs/tests/HTIOP/BiDirectional/Test_Output.cpp b/TAO/orbsvcs/tests/HTIOP/BiDirectional/Test_Output.cpp
new file mode 100644
index 00000000000..8ab1d029463
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/BiDirectional/Test_Output.cpp
@@ -0,0 +1,230 @@
+// -*- C++ -*-
+
+// ============================================================================
+/**
+ * @file Test_Output.cpp
+ *
+ * $Id$
+ *
+ * This file factors out common macros and other utilities used by the
+ * ACE automated regression tests.
+ *
+ * @author Prashant Jain <pjain@cs.wustl.edu>
+ * @author Tim Harrison <harrison@cs.wustl.edu>
+ * @author David Levine <levine@cs.wustl.edu>
+ * @author Don Hinton <dhinton@dresystems.com>
+ */
+// ============================================================================
+
+#include "tests/test_config.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_sys_stat.h"
+#include "ace/Guard_T.h"
+#include "ace/Object_Manager.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+#include "ace/Framework_Component.h"
+#include "ace/Log_Msg.h"
+#include "ace/ACE.h"
+
+#if defined (VXWORKS)
+# include "ace/OS_NS_unistd.h"
+# include "ace/OS_NS_fcntl.h"
+#endif /* VXWORKS */
+
+ACE_Test_Output *ACE_Test_Output::instance_ = 0;
+
+ACE_Test_Output::ACE_Test_Output (void)
+ : output_file_ (0)
+{
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+ this->output_file_ = new OFSTREAM;
+#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+}
+
+ACE_Test_Output::~ACE_Test_Output (void)
+{
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) && !defined (ACE_PSOS)
+ ACE_LOG_MSG->msg_ostream (&cerr);
+#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY && ! ACE_PSOS */
+
+ ACE_LOG_MSG->clr_flags (ACE_Log_Msg::OSTREAM);
+ ACE_LOG_MSG->set_flags (ACE_Log_Msg::STDERR);
+
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) && !defined (ACE_HAS_PHARLAP)
+ delete this->output_file_;
+#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+}
+
+OFSTREAM *
+ACE_Test_Output::output_file (void)
+{
+ return this->output_file_;
+}
+
+int
+ACE_Test_Output::set_output (const ACE_TCHAR *filename, int append)
+{
+#if defined (ACE_HAS_PHARLAP)
+ // For PharLap, just send it all to the host console for now - redirect
+ // to a file there for saving/analysis.
+ EtsSelectConsole(ETS_CO_HOST);
+ ACE_LOG_MSG->msg_ostream (&cout);
+
+#else
+ ACE_TCHAR temp[MAXPATHLEN];
+ // Ignore the error value since the directory may already exist.
+ const ACE_TCHAR *test_dir;
+
+#if !defined (ACE_HAS_WINCE)
+# if defined (ACE_WIN32) || !defined (ACE_USES_WCHAR)
+ test_dir = ACE_OS::getenv (ACE_TEXT ("ACE_TEST_DIR"));
+# else
+ ACE_TCHAR tempenv[MAXPATHLEN];
+ char *test_dir_n = ACE_OS::getenv ("ACE_TEST_DIR");
+ if (test_dir_n == 0)
+ test_dir = 0;
+ else
+ {
+ ACE_OS::strcpy (tempenv, ACE_TEXT_CHAR_TO_TCHAR (test_dir_n));
+ test_dir = tempenv;
+ }
+# endif /* ACE_WIN32 || !ACE_USES_WCHAR */
+
+ if (test_dir == 0)
+#endif /* ACE_HAS_WINCE */
+ test_dir = ACE_TEXT ("");
+
+ // This could be done with ACE_OS::sprintf() but it requires different
+ // format strings for wide-char POSIX vs. narrow-char POSIX and Windows.
+ // Easier to keep straight like this.
+ ACE_OS_String::strcpy (temp, test_dir);
+ ACE_OS_String::strcat (temp, ACE_LOG_DIRECTORY);
+ ACE_OS_String::strcat
+ (temp, ACE::basename (filename, ACE_DIRECTORY_SEPARATOR_CHAR));
+ ACE_OS_String::strcat (temp, ACE_LOG_FILE_EXT_NAME);
+
+#if defined (VXWORKS)
+ // This is the only way I could figure out to avoid a console
+ // warning about opening an existing file (w/o O_CREAT), or
+ // attempting to unlink a non-existant one.
+ ACE_HANDLE fd = ACE_OS::open (temp,
+ O_WRONLY|O_CREAT,
+ S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
+ if (fd != ERROR)
+ {
+ ACE_OS::close (fd);
+ ACE_OS::unlink (temp);
+ }
+# else /* ! VXWORKS */
+ // This doesn't seem to work on VxWorks if the directory doesn't
+ // exist: it creates a plain file instead of a directory. If the
+ // directory does exist, it causes a wierd console error message
+ // about "cat: input error on standard input: Is a directory". So,
+ // VxWorks users must create the directory manually.
+# if defined (ACE_HAS_WINCE)
+ ACE_OS::mkdir (ACE_LOG_DIRECTORY_FOR_MKDIR);
+# else
+ ACE_OS::mkdir (ACE_LOG_DIRECTORY);
+# endif // ACE_HAS_WINCE
+# endif /* ! VXWORKS */
+
+# if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+ this->output_file_->open (ACE_TEXT_ALWAYS_CHAR (temp),
+ ios::out | (append ? ios::app : ios::trunc));
+ if (this->output_file_->bad ())
+ return -1;
+#else /* when ACE_LACKS_IOSTREAM_TOTALLY */
+ ACE_TCHAR *fmode = 0;
+ if (append)
+ fmode = ACE_TEXT ("a");
+ else
+ fmode = ACE_TEXT ("w");
+ this->output_file_ = ACE_OS::fopen (temp, fmode);
+# endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+
+ ACE_LOG_MSG->msg_ostream (this->output_file ());
+#endif /* ACE_HAS_PHARLAP */
+
+ ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER );
+ ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
+
+ return 0;
+}
+
+void
+ACE_Test_Output::close (void)
+{
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+ this->output_file_->flush ();
+ this->output_file_->close ();
+#else
+ ACE_OS::fflush (this->output_file_);
+ ACE_OS::fclose (this->output_file_);
+#endif /* !ACE_LACKS_IOSTREAM_TOTALLY */
+}
+
+ACE_Test_Output*
+ACE_Test_Output::instance ()
+{
+ if (ACE_Test_Output::instance_ == 0)
+ {
+ // Perform Double-Checked Locking Optimization.
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
+ *ACE_Static_Object_Lock::instance (), 0));
+
+ if (ACE_Test_Output::instance_ == 0)
+ {
+ ACE_NEW_RETURN (ACE_Test_Output::instance_,
+ ACE_Test_Output,
+ 0);
+ ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Test_Output, ACE_Test_Output::instance_)
+ }
+ }
+ return ACE_Test_Output::instance_;
+}
+
+const ACE_TCHAR *
+ACE_Test_Output::dll_name (void)
+{
+ return ACE_TEXT ("Test_Output");
+}
+
+const ACE_TCHAR *
+ACE_Test_Output::name (void)
+{
+ return ACE_TEXT ("ACE_Test_Output");
+}
+
+void
+ACE_Test_Output::close_singleton (void)
+{
+ delete ACE_Test_Output::instance_;
+ ACE_Test_Output::instance_ = 0;
+}
+
+void
+randomize (int array[], size_t size)
+{
+ size_t i;
+
+ for (i = 0; i < size; i++)
+ array [i] = static_cast<int> (i);
+
+ // See with a fixed number so that we can produce "repeatable"
+ // random numbers.
+ ACE_OS::srand (0);
+
+ // Generate an array of random numbers from 0 .. size - 1.
+
+ for (i = 0; i < size; i++)
+ {
+ size_t index = ACE_OS::rand() % size--;
+ int temp = array [index];
+ array [index] = array [size];
+ array [size] = temp;
+ }
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/BiDirectional/client.cpp b/TAO/orbsvcs/tests/HTIOP/BiDirectional/client.cpp
new file mode 100644
index 00000000000..a9a6dac7d63
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/BiDirectional/client.cpp
@@ -0,0 +1,168 @@
+// $Id$
+
+#include "ace/Get_Opt.h"
+#include "test_i.h"
+#include "tao/BiDir_GIOP/BiDirGIOP.h"
+#include "tao/AnyTypeCode/Any.h"
+
+ACE_RCSID(BiDirectional, client, "$Id$")
+
+const char *ior = "file://test.ior";
+
+void do_nothing (void)
+{
+}
+
+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 '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ CORBA::ORB_var orb = CORBA::ORB::_nil();
+ PortableServer::POA_var root_poa = PortableServer::POA::_nil();
+ Callback_i *servant = 0;
+
+ ACE_TRY_NEW_ENV
+ {
+ 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;
+
+ if (CORBA::is_nil (poa_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"),
+ 1);
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Policies for the childPOA to be created.
+ CORBA::PolicyList policies (1);
+ policies.length (1);
+
+ CORBA::Any pol;
+ pol <<= BiDirPolicy::BOTH;
+ policies[0] =
+ orb->create_policy (BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE,
+ pol
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Create POA as child of RootPOA with the above policies. This POA
+ // will receive request in the same connection in which it sent
+ // the request
+ PortableServer::POA_var child_poa =
+ root_poa->create_POA ("childPOA",
+ poa_manager.in (),
+ policies
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Creation of childPOA is over. Destroy the Policy objects.
+ for (CORBA::ULong i = 0;
+ i < policies.length ();
+ ++i)
+ {
+ policies[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var object =
+ orb->string_to_object (ior ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ Simple_Server_var server =
+ Simple_Server::_narrow (object.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (server.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Object reference <%s> is nil\n",
+ ior),
+ 1);
+ }
+
+
+ servant = new Callback_i (orb.in ());
+
+ Callback_var callback =
+ servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Send the calback object to the server
+ server->callback_object (callback.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // A method to kickstart callbacks from the server
+ CORBA::Long r =
+ server->test_method (1 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (r != 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) unexpected result = %d ",
+ r));
+ }
+
+ orb->run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Caught exception:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ if (!CORBA::is_nil(root_poa.in()))
+ root_poa->destroy (1,1);
+ delete servant;
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/BiDirectional/inside.conf b/TAO/orbsvcs/tests/HTIOP/BiDirectional/inside.conf
new file mode 100644
index 00000000000..db8240efb56
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/BiDirectional/inside.conf
@@ -0,0 +1,7 @@
+# $Id$
+
+dynamic HTIOP_Factory Service_Object *
+ TAO_HTIOP:_make_TAO_HTIOP_Protocol_Factory () "-inside 1"
+# "-config ../HT_Config.conf -env_persist inside.mmf"
+
+static Resource_Factory "-ORBProtocolFactory HTIOP_Factory"
diff --git a/TAO/orbsvcs/tests/HTIOP/BiDirectional/outside.conf b/TAO/orbsvcs/tests/HTIOP/BiDirectional/outside.conf
new file mode 100644
index 00000000000..48cf6669bb2
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/BiDirectional/outside.conf
@@ -0,0 +1,7 @@
+# $Id$
+
+dynamic HTIOP_Factory Service_Object *
+ TAO_HTIOP:_make_TAO_HTIOP_Protocol_Factory ()
+ "-env_persist outside.mmf"
+
+static Resource_Factory "-ORBProtocolFactory HTIOP_Factory"
diff --git a/TAO/orbsvcs/tests/HTIOP/BiDirectional/run_test.pl b/TAO/orbsvcs/tests/HTIOP/BiDirectional/run_test.pl
new file mode 100755
index 00000000000..b14d507cb97
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/BiDirectional/run_test.pl
@@ -0,0 +1,45 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::Run_Test;
+use Sys::Hostname;
+
+$status = 0;
+$iorfile = PerlACE::LocalFile ("test.ior");
+$host = hostname();
+
+unlink $iorfile;
+
+$SV = new PerlACE::Process ("server", "-orbendpoint htiop://$host:8088 -orbsvcconf outside.conf -o $iorfile -i 100");
+$CL = new PerlACE::Process ("client", "-orbsvcconf inside.conf -k file://$iorfile");
+
+$SV->Spawn ();
+
+if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill ();
+ exit 1;
+}
+
+$client = $CL->SpawnWaitKill (20);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
+}
+
+$server = $SV->WaitKill (20);
+
+if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ $status = 1;
+}
+
+unlink $iorfile;
+
+exit $status;
diff --git a/TAO/orbsvcs/tests/HTIOP/BiDirectional/server.cpp b/TAO/orbsvcs/tests/HTIOP/BiDirectional/server.cpp
new file mode 100644
index 00000000000..acd21da590e
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/BiDirectional/server.cpp
@@ -0,0 +1,177 @@
+// $Id$
+
+#include "ace/OS_NS_stdio.h"
+#include "ace/Get_Opt.h"
+#include "test_i.h"
+#include "tao/BiDir_GIOP/BiDirGIOP.h"
+#include "tao/AnyTypeCode/Any.h"
+
+ACE_RCSID(BiDirectional, server, "$Id$")
+
+const char *ior_output_file = 0;
+int no_iterations = 10;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "o:i:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+ case 'i':
+ no_iterations = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "-i <no_iterations>"
+ "\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;
+
+ if (CORBA::is_nil (poa_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize the POA.\n"),
+ 1);
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Policies for the childPOA to be created.
+ CORBA::PolicyList policies (1);
+ policies.length (1);
+
+ CORBA::Any pol;
+ pol <<= BiDirPolicy::BOTH;
+ policies[0] =
+ orb->create_policy (BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE,
+ pol
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Create POA as child of RootPOA with the above policies. This POA
+ // will receive request in the same connection in which it sent
+ // the request
+ PortableServer::POA_var child_poa =
+ root_poa->create_POA ("childPOA",
+ poa_manager.in (),
+ policies
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Creation of childPOA is over. Destroy the Policy objects.
+ for (CORBA::ULong i = 0;
+ i < policies.length ();
+ ++i)
+ {
+ policies[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+
+ poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ Simple_Server_i *server_impl = new Simple_Server_i (orb.in (),
+ no_iterations);
+
+ PortableServer::ObjectId_var id =
+ PortableServer::string_to_ObjectId ("simple_server");
+
+ child_poa->activate_object_with_id (id.in (),
+ server_impl
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ server_impl->_remove_ref(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::Object_var obj =
+ child_poa->id_to_reference (id.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::String_var ior =
+ orb->object_to_string (obj.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Activated as <%s>\n", ior.in ()));
+
+ // If the ior_output_file exists, output the ior to it
+ if (ior_output_file != 0)
+ {
+ 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);
+ }
+
+ int retval = 0;
+ while (retval == 0)
+ {
+ // Just process one upcall. We know that we would get the
+ // clients IOR in that call.
+ CORBA::Boolean pending =
+ orb->work_pending(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (pending)
+ {
+ orb->perform_work(ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ // Now that hopefully we have the clients IOR, just start
+ // making remote calls to the client.
+ retval = server_impl->call_client (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_DEBUG ((LM_DEBUG, "event loop finished\n"));
+
+ root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Caught exception:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/BiDirectional/test.idl b/TAO/orbsvcs/tests/HTIOP/BiDirectional/test.idl
new file mode 100644
index 00000000000..47ede657b9a
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/BiDirectional/test.idl
@@ -0,0 +1,27 @@
+//
+// $Id$
+//
+
+interface Callback
+{
+ oneway void shutdown ();
+ // A safe way to shutdown the client, using either clean shutdowns
+ // or "catastrophic failures".
+
+ void callback_method ();
+ // A simple remote call
+
+};
+
+interface Simple_Server
+{
+ long test_method (in boolean do_callback);
+ // Just call a method on the server,
+
+ void callback_object (in Callback cb);
+ // send the callback object to the server
+
+ oneway void shutdown ();
+ // A safe way to shutdown the server, it is a oneway function so we
+ // will never get a COMM_FAILURE error
+};
diff --git a/TAO/orbsvcs/tests/HTIOP/BiDirectional/test_i.cpp b/TAO/orbsvcs/tests/HTIOP/BiDirectional/test_i.cpp
new file mode 100644
index 00000000000..60146973192
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/BiDirectional/test_i.cpp
@@ -0,0 +1,94 @@
+// $Id$
+
+#include "test_i.h"
+
+#include "tao/ORB_Core.h"
+#include "tao/debug.h"
+#include "tao/Transport_Cache_Manager.h"
+#include "tao/Thread_Lane_Resources.h"
+
+#if !defined(__ACE_INLINE__)
+#include "test_i.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(BiDirectional, test_i, "$Id$")
+
+void
+Callback_i::shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_DEBUG ((LM_DEBUG, "Performing clean shutdown\n"));
+ this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER);
+}
+
+void
+Callback_i::callback_method (ACE_ENV_SINGLE_ARG_DECL_NOT_USED /*ACE_ENV_SINGLE_ARG_PARAMETER*/)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG, "Callback method called \n"));
+}
+
+
+// ****************************************************************
+
+CORBA::Long
+Simple_Server_i::test_method (CORBA::Boolean do_callback
+ ACE_ENV_ARG_DECL_NOT_USED )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (do_callback)
+ {
+ this->flag_ = 1;
+ }
+
+ return 0;
+}
+
+void
+Simple_Server_i::callback_object (Callback_ptr callback
+ ACE_ENV_ARG_DECL_NOT_USED )
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Store the callback object
+ this->callback_ = Callback::_duplicate (callback);
+}
+
+int
+Simple_Server_i::call_client (ACE_ENV_SINGLE_ARG_DECL)
+{
+ if (this->flag_)
+ {
+ ACE_DEBUG ((LM_DEBUG,"calling client\n"));
+
+ for (int times = 0; times < this->no_iterations_; ++times)
+ {
+ this->callback_->callback_method (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+
+ if (this->orb_->orb_core ()->lane_resources ().transport_cache ().current_size () > 1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) The cache has grown, aborting ..\n"));
+
+ ACE_OS::abort ();
+ }
+ }
+
+ this->callback_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (0);
+ this->flag_ = 0;
+
+ return 1;
+ }
+
+ return 0;
+}
+
+
+void
+Simple_Server_i::shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER);
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/BiDirectional/test_i.h b/TAO/orbsvcs/tests/HTIOP/BiDirectional/test_i.h
new file mode 100644
index 00000000000..d66809ff118
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/BiDirectional/test_i.h
@@ -0,0 +1,92 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/BiDirectional
+//
+// = FILENAME
+// test_i.h
+//
+// = AUTHOR
+// Balachandran Natarajan <bala@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef TAO_BIDIRECTIONAL_TEST_I_H
+#define TAO_BIDIRECTIONAL_TEST_I_H
+
+#include "testS.h"
+
+class Callback_i : public POA_Callback
+{
+ // = TITLE
+ // A callback object to the "client"
+ //
+ // = DESCRIPTION
+ // To test that the server can call the client on the same
+ // connection that was established by the client
+ //
+public:
+ Callback_i (CORBA::ORB_ptr orb);
+ // ctor
+
+ void shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // Safe way to shutdown
+
+ void callback_method (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+ // The callback method
+
+private:
+ CORBA::ORB_var orb_;
+ // The orb
+
+};
+
+class Simple_Server_i : public POA_Simple_Server
+{
+ // = TITLE
+ // Simpler Server implementation
+ //
+ // = DESCRIPTION
+ // Implements the Simple_Server interface in test.idl
+ //
+public:
+ Simple_Server_i (CORBA::ORB_ptr orb, int no_iterations);
+ // ctor
+
+ // = The Simple_Server methods.
+ CORBA::Long test_method (CORBA::Boolean do_callback
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void callback_object (Callback_ptr callback
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ int call_client (ACE_ENV_SINGLE_ARG_DECL_NOT_USED);
+
+private:
+ CORBA::ORB_var orb_;
+ // The ORB
+
+ int flag_;
+ // Flag to indicate, whether we are ready for a remote call.
+
+ Callback_var callback_;
+ // Callback Object
+
+ int no_iterations_;
+ // Number of times the callback needs to be called
+};
+
+#if defined(__ACE_INLINE__)
+#include "test_i.i"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_BIDIRECTIONAL_TEST_I_H */
diff --git a/TAO/orbsvcs/tests/HTIOP/BiDirectional/test_i.i b/TAO/orbsvcs/tests/HTIOP/BiDirectional/test_i.i
new file mode 100644
index 00000000000..799be9fdcbe
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/BiDirectional/test_i.i
@@ -0,0 +1,17 @@
+// $Id$
+
+ACE_INLINE
+Callback_i::Callback_i (CORBA::ORB_ptr orb)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+{
+}
+
+ACE_INLINE
+Simple_Server_i::Simple_Server_i (CORBA::ORB_ptr orb,
+ int no_iterations)
+ : orb_ (CORBA::ORB::_duplicate (orb)),
+ flag_ (0),
+ callback_ (0),
+ no_iterations_ (no_iterations)
+{
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/HT_Config.conf b/TAO/orbsvcs/tests/HTIOP/HT_Config.conf
new file mode 100644
index 00000000000..49dfd238ec3
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/HT_Config.conf
@@ -0,0 +1,4 @@
+[htbp]
+proxy_port=3128
+proxy_host=rtai.ociweb.com
+htid_url=http://rtai.ociweb.com/cgi-bin/HTIOP_ID_Generator.cgi
diff --git a/TAO/orbsvcs/tests/HTIOP/Hello/HTIOP_Hello.mpc b/TAO/orbsvcs/tests/HTIOP/Hello/HTIOP_Hello.mpc
new file mode 100644
index 00000000000..a6fec141c7e
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Hello/HTIOP_Hello.mpc
@@ -0,0 +1,45 @@
+// -*- MPC -*-
+//
+// $Id$
+
+project(*idl): taoidldefaults {
+ idlflags += -Sa -St
+
+ IDL_Files {
+ Test.idl
+ }
+
+ custom_only = 1
+}
+
+project(*Server): taoserver, naming, iortable {
+ after += *idl
+ macros += TEST_OUTPUT_HAS_DLL=0
+ Source_Files {
+ Test_Output.cpp
+ TestS.cpp
+ TestC.cpp
+ Hello.cpp
+ server.cpp
+ }
+ Header_Files {
+ ../test_config.h
+ }
+ IDL_Files {
+ }
+}
+
+project(*Client): taoclient {
+ after += *idl
+ macros += TEST_OUTPUT_HAS_DLL=0
+ Source_Files {
+ Test_Output.cpp
+ TestC.cpp
+ client.cpp
+ }
+ Header_Files {
+ ../test_config.h
+ }
+ IDL_Files {
+ }
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/Hello/Hello.cpp b/TAO/orbsvcs/tests/HTIOP/Hello/Hello.cpp
new file mode 100644
index 00000000000..b6f13134438
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Hello/Hello.cpp
@@ -0,0 +1,27 @@
+//
+// $Id$
+//
+#include "Hello.h"
+
+ACE_RCSID(Hello, Hello, "$Id$")
+
+Hello::Hello (CORBA::ORB_ptr orb)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+{
+}
+
+char *
+Hello::get_string (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_DEBUG ((LM_DEBUG, "in get_string\n"));
+ return CORBA::string_dup ("Hello there!");
+}
+
+void
+Hello::shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER);
+ ACE_DEBUG ((LM_DEBUG,"in shutdown\n"));
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/Hello/Hello.h b/TAO/orbsvcs/tests/HTIOP/Hello/Hello.h
new file mode 100644
index 00000000000..68311a6634e
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Hello/Hello.h
@@ -0,0 +1,42 @@
+//
+// $Id$
+//
+
+#ifndef HELLO_H
+#define HELLO_H
+#include /**/ "ace/pre.h"
+
+#include "TestS.h"
+
+#if defined (_MSC_VER)
+# pragma warning(push)
+# pragma warning (disable:4250)
+#endif /* _MSC_VER */
+
+/// Implement the Test::Hello interface
+class Hello
+ : public virtual POA_Test::Hello
+{
+public:
+ /// Constructor
+ Hello (CORBA::ORB_ptr orb);
+
+ // = The skeleton methods
+ virtual char * get_string (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ /// Use an ORB reference to conver strings to objects and shutdown
+ /// the application.
+ CORBA::ORB_var orb_;
+};
+
+#if defined(_MSC_VER)
+# pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* HELLO_H */
diff --git a/TAO/orbsvcs/tests/HTIOP/Hello/Makefile.am b/TAO/orbsvcs/tests/HTIOP/Hello/Makefile.am
new file mode 100644
index 00000000000..18a98bc6fc4
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Hello/Makefile.am
@@ -0,0 +1,105 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ../bin/mwc.pl -type automake -noreldefs TAO.mwc
+
+ACE_BUILDDIR = $(top_builddir)/..
+ACE_ROOT = $(top_srcdir)/..
+TAO_BUILDDIR = $(top_builddir)
+TAO_IDL = ACE_ROOT=$(ACE_ROOT) TAO_ROOT=$(TAO_ROOT) $(TAO_BUILDDIR)/TAO_IDL/tao_idl
+TAO_IDL_DEP = $(TAO_BUILDDIR)/TAO_IDL/tao_idl
+TAO_IDLFLAGS = -Ge 1 -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(srcdir) -g $(ACE_BUILDDIR)/apps/gperf/src/gperf
+TAO_ROOT = $(top_srcdir)
+
+## Makefile.HTIOP_Hello_Idl.am
+
+BUILT_SOURCES = \
+ TestC.cpp \
+ TestC.h \
+ TestC.inl \
+ TestS.cpp \
+ TestS.h \
+ TestS.inl
+
+CLEANFILES = \
+ Test-stamp \
+ TestC.cpp \
+ TestC.h \
+ TestC.inl \
+ TestS.cpp \
+ TestS.h \
+ TestS.inl
+
+TestC.cpp TestC.h TestC.inl TestS.cpp TestS.h TestS.inl: Test-stamp
+
+Test-stamp: $(srcdir)/Test.idl $(TAO_IDL_DEP)
+ $(TAO_IDL) $(TAO_IDLFLAGS) -Sa -St -Sa -St $(srcdir)/Test.idl
+ @touch $@
+
+
+noinst_HEADERS = \
+ Test.idl
+
+## Makefile.HTIOP_Hello_Client.am
+
+noinst_PROGRAMS = client
+
+client_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -DTEST_OUTPUT_HAS_DLL=0
+
+client_SOURCES = \
+ TestC.cpp \
+ Test_Output.cpp \
+ client.cpp \
+ ../test_config.h
+
+client_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+## Makefile.HTIOP_Hello_Server.am
+
+noinst_PROGRAMS += server
+
+server_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR) \
+ -I$(TAO_ROOT)/orbsvcs \
+ -I$(TAO_BUILDDIR)/orbsvcs \
+ -DTEST_OUTPUT_HAS_DLL=0
+
+server_SOURCES = \
+ Hello.cpp \
+ TestC.cpp \
+ TestS.cpp \
+ Test_Output.cpp \
+ server.cpp \
+ ../test_config.h \
+ Hello.h
+
+server_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO_IORTable.la \
+ $(TAO_BUILDDIR)/orbsvcs/orbsvcs/libTAO_CosNaming.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
+ $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
+ $(TAO_BUILDDIR)/tao/libTAO.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/TAO/orbsvcs/tests/HTIOP/Hello/README b/TAO/orbsvcs/tests/HTIOP/Hello/README
new file mode 100644
index 00000000000..52221e74599
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Hello/README
@@ -0,0 +1,22 @@
+/**
+
+@page Hello Test README File
+
+Simple Test to test the functionality and usage of HTIOP protocol
+
+ Please refrain from "improving", extending or expanding this
+test, if you need to change
+
+ To run the test use the run_test.pl script:
+
+$ ./run_test.pl
+
+ the script returns 0 if the test was successful.
+
+
+This test also demonstrates how one could use HTIOP with the corbaloc
+or corbaname syntax. Note that corbaloc support requires the server register
+the object reference with the IOR table internally, the corbaname support
+requires the NamingService running.
+
+*/
diff --git a/TAO/orbsvcs/tests/HTIOP/Hello/Test.idl b/TAO/orbsvcs/tests/HTIOP/Hello/Test.idl
new file mode 100644
index 00000000000..d6002892314
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Hello/Test.idl
@@ -0,0 +1,20 @@
+//
+// $Id$
+//
+
+/// Put the interfaces in a module, to avoid global namespace pollution
+module Test
+{
+ /// A very simple interface
+ interface Hello
+ {
+ /// Return a simple string
+ string get_string ();
+
+ /// A method to shutdown the ORB
+ /**
+ * This method is used to simplify the test shutdown process
+ */
+ void shutdown ();
+ };
+};
diff --git a/TAO/orbsvcs/tests/HTIOP/Hello/Test_Output.cpp b/TAO/orbsvcs/tests/HTIOP/Hello/Test_Output.cpp
new file mode 100644
index 00000000000..8ab1d029463
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Hello/Test_Output.cpp
@@ -0,0 +1,230 @@
+// -*- C++ -*-
+
+// ============================================================================
+/**
+ * @file Test_Output.cpp
+ *
+ * $Id$
+ *
+ * This file factors out common macros and other utilities used by the
+ * ACE automated regression tests.
+ *
+ * @author Prashant Jain <pjain@cs.wustl.edu>
+ * @author Tim Harrison <harrison@cs.wustl.edu>
+ * @author David Levine <levine@cs.wustl.edu>
+ * @author Don Hinton <dhinton@dresystems.com>
+ */
+// ============================================================================
+
+#include "tests/test_config.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_sys_stat.h"
+#include "ace/Guard_T.h"
+#include "ace/Object_Manager.h"
+
+// FUZZ: disable check_for_streams_include
+#include "ace/streams.h"
+
+#include "ace/Framework_Component.h"
+#include "ace/Log_Msg.h"
+#include "ace/ACE.h"
+
+#if defined (VXWORKS)
+# include "ace/OS_NS_unistd.h"
+# include "ace/OS_NS_fcntl.h"
+#endif /* VXWORKS */
+
+ACE_Test_Output *ACE_Test_Output::instance_ = 0;
+
+ACE_Test_Output::ACE_Test_Output (void)
+ : output_file_ (0)
+{
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+ this->output_file_ = new OFSTREAM;
+#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+}
+
+ACE_Test_Output::~ACE_Test_Output (void)
+{
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) && !defined (ACE_PSOS)
+ ACE_LOG_MSG->msg_ostream (&cerr);
+#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY && ! ACE_PSOS */
+
+ ACE_LOG_MSG->clr_flags (ACE_Log_Msg::OSTREAM);
+ ACE_LOG_MSG->set_flags (ACE_Log_Msg::STDERR);
+
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) && !defined (ACE_HAS_PHARLAP)
+ delete this->output_file_;
+#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+}
+
+OFSTREAM *
+ACE_Test_Output::output_file (void)
+{
+ return this->output_file_;
+}
+
+int
+ACE_Test_Output::set_output (const ACE_TCHAR *filename, int append)
+{
+#if defined (ACE_HAS_PHARLAP)
+ // For PharLap, just send it all to the host console for now - redirect
+ // to a file there for saving/analysis.
+ EtsSelectConsole(ETS_CO_HOST);
+ ACE_LOG_MSG->msg_ostream (&cout);
+
+#else
+ ACE_TCHAR temp[MAXPATHLEN];
+ // Ignore the error value since the directory may already exist.
+ const ACE_TCHAR *test_dir;
+
+#if !defined (ACE_HAS_WINCE)
+# if defined (ACE_WIN32) || !defined (ACE_USES_WCHAR)
+ test_dir = ACE_OS::getenv (ACE_TEXT ("ACE_TEST_DIR"));
+# else
+ ACE_TCHAR tempenv[MAXPATHLEN];
+ char *test_dir_n = ACE_OS::getenv ("ACE_TEST_DIR");
+ if (test_dir_n == 0)
+ test_dir = 0;
+ else
+ {
+ ACE_OS::strcpy (tempenv, ACE_TEXT_CHAR_TO_TCHAR (test_dir_n));
+ test_dir = tempenv;
+ }
+# endif /* ACE_WIN32 || !ACE_USES_WCHAR */
+
+ if (test_dir == 0)
+#endif /* ACE_HAS_WINCE */
+ test_dir = ACE_TEXT ("");
+
+ // This could be done with ACE_OS::sprintf() but it requires different
+ // format strings for wide-char POSIX vs. narrow-char POSIX and Windows.
+ // Easier to keep straight like this.
+ ACE_OS_String::strcpy (temp, test_dir);
+ ACE_OS_String::strcat (temp, ACE_LOG_DIRECTORY);
+ ACE_OS_String::strcat
+ (temp, ACE::basename (filename, ACE_DIRECTORY_SEPARATOR_CHAR));
+ ACE_OS_String::strcat (temp, ACE_LOG_FILE_EXT_NAME);
+
+#if defined (VXWORKS)
+ // This is the only way I could figure out to avoid a console
+ // warning about opening an existing file (w/o O_CREAT), or
+ // attempting to unlink a non-existant one.
+ ACE_HANDLE fd = ACE_OS::open (temp,
+ O_WRONLY|O_CREAT,
+ S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
+ if (fd != ERROR)
+ {
+ ACE_OS::close (fd);
+ ACE_OS::unlink (temp);
+ }
+# else /* ! VXWORKS */
+ // This doesn't seem to work on VxWorks if the directory doesn't
+ // exist: it creates a plain file instead of a directory. If the
+ // directory does exist, it causes a wierd console error message
+ // about "cat: input error on standard input: Is a directory". So,
+ // VxWorks users must create the directory manually.
+# if defined (ACE_HAS_WINCE)
+ ACE_OS::mkdir (ACE_LOG_DIRECTORY_FOR_MKDIR);
+# else
+ ACE_OS::mkdir (ACE_LOG_DIRECTORY);
+# endif // ACE_HAS_WINCE
+# endif /* ! VXWORKS */
+
+# if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+ this->output_file_->open (ACE_TEXT_ALWAYS_CHAR (temp),
+ ios::out | (append ? ios::app : ios::trunc));
+ if (this->output_file_->bad ())
+ return -1;
+#else /* when ACE_LACKS_IOSTREAM_TOTALLY */
+ ACE_TCHAR *fmode = 0;
+ if (append)
+ fmode = ACE_TEXT ("a");
+ else
+ fmode = ACE_TEXT ("w");
+ this->output_file_ = ACE_OS::fopen (temp, fmode);
+# endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+
+ ACE_LOG_MSG->msg_ostream (this->output_file ());
+#endif /* ACE_HAS_PHARLAP */
+
+ ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER );
+ ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
+
+ return 0;
+}
+
+void
+ACE_Test_Output::close (void)
+{
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+ this->output_file_->flush ();
+ this->output_file_->close ();
+#else
+ ACE_OS::fflush (this->output_file_);
+ ACE_OS::fclose (this->output_file_);
+#endif /* !ACE_LACKS_IOSTREAM_TOTALLY */
+}
+
+ACE_Test_Output*
+ACE_Test_Output::instance ()
+{
+ if (ACE_Test_Output::instance_ == 0)
+ {
+ // Perform Double-Checked Locking Optimization.
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
+ *ACE_Static_Object_Lock::instance (), 0));
+
+ if (ACE_Test_Output::instance_ == 0)
+ {
+ ACE_NEW_RETURN (ACE_Test_Output::instance_,
+ ACE_Test_Output,
+ 0);
+ ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Test_Output, ACE_Test_Output::instance_)
+ }
+ }
+ return ACE_Test_Output::instance_;
+}
+
+const ACE_TCHAR *
+ACE_Test_Output::dll_name (void)
+{
+ return ACE_TEXT ("Test_Output");
+}
+
+const ACE_TCHAR *
+ACE_Test_Output::name (void)
+{
+ return ACE_TEXT ("ACE_Test_Output");
+}
+
+void
+ACE_Test_Output::close_singleton (void)
+{
+ delete ACE_Test_Output::instance_;
+ ACE_Test_Output::instance_ = 0;
+}
+
+void
+randomize (int array[], size_t size)
+{
+ size_t i;
+
+ for (i = 0; i < size; i++)
+ array [i] = static_cast<int> (i);
+
+ // See with a fixed number so that we can produce "repeatable"
+ // random numbers.
+ ACE_OS::srand (0);
+
+ // Generate an array of random numbers from 0 .. size - 1.
+
+ for (i = 0; i < size; i++)
+ {
+ size_t index = ACE_OS::rand() % size--;
+ int temp = array [index];
+ array [index] = array [size];
+ array [size] = temp;
+ }
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/Hello/client.cpp b/TAO/orbsvcs/tests/HTIOP/Hello/client.cpp
new file mode 100644
index 00000000000..e8d3ff65f68
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Hello/client.cpp
@@ -0,0 +1,94 @@
+// $Id$
+
+#include "TestC.h"
+
+#include "tests/test_config.h"
+#include <ace/Get_Opt.h>
+
+
+ACE_RCSID(Hello, 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 '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ ACE_START_TEST (ACE_TEXT ("Hello_client"));
+
+ 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);
+ }
+
+ CORBA::String_var the_string =
+ hello->get_string (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client Main - string returned <%s>\n",
+ the_string.in ()));
+
+ hello->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client Main - shutdown returned\n"));
+
+ orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception caught:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ ACE_END_TEST;
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/Hello/outside.conf b/TAO/orbsvcs/tests/HTIOP/Hello/outside.conf
new file mode 100644
index 00000000000..219a83417be
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Hello/outside.conf
@@ -0,0 +1,8 @@
+# $Id$
+
+dynamic HTIOP_Factory Service_Object *
+ TAO_HTIOP:_make_TAO_HTIOP_Protocol_Factory ()
+ "-env_persist outside.mmf"
+
+static Resource_Factory
+ "-ORBProtocolFactory IIOP_Factory -ORBProtocolFactory HTIOP_Factory"
diff --git a/TAO/orbsvcs/tests/HTIOP/Hello/run_test.pl b/TAO/orbsvcs/tests/HTIOP/Hello/run_test.pl
new file mode 100755
index 00000000000..110aff57e38
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Hello/run_test.pl
@@ -0,0 +1,91 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::Run_Test;
+use Sys::Hostname;
+
+$iorfile = PerlACE::LocalFile ("server.ior");
+$nsiorfile = PerlACE::LocalFile ("ns.ior");
+
+unlink $iorfile;
+unlink $nsiorfile;
+
+$status = 0;
+$host = hostname();
+
+$ior = "file://$iorfile";
+$server_port = 8088;
+$name_port = 8087;
+$server_config = PerlACE::LocalFile ("outside.conf");
+
+foreach $i (@ARGV) {
+ if ($i eq '-corbaloc') {
+ $ior = "corbaloc:htiop:$host:$server_port/HelloObj";
+ }
+ elsif ($i eq '-corbaname') {
+ $ior = "corbaname:htiop:$host:$name_port#HelloObj";
+ $use_ns = 1;
+ }
+}
+
+$NS =
+ new PerlACE::Process ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/Naming_Service",
+ "-ORBSvcConf $server_config "
+ . "-ORBEndpoint 'iiop://;htiop://$host:$name_port' "
+ . "-o $nsiorfile");
+
+$NS->IgnoreExeSubDir ();
+$NS->Spawn ();
+print "Waiting for Name Service to start\n";
+if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) {
+ print STDERR "ERROR: nameserver not started\n";
+ $NS->Kill (); $NS->TimedWait (1);
+ exit 1;
+}
+
+$SV =
+ new PerlACE::Process ("server",
+ "-o $iorfile "
+ . "-ORBInitRef NameService=file://$nsiorfile "
+ . "-ORBSvcConf $server_config "
+ . "-ORBEndpoint htiop://$host:$server_port");
+
+$CL = new PerlACE::Process ("client", " -k $ior");
+
+$SV->Spawn ();
+print "Waiting for server to start\n";
+if (PerlACE::waitforfile_timed ($iorfile, 5) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+print "Running Client\n";
+$client = $CL->SpawnWaitKill (300);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
+ $SV->Kill(); $SV->TimedWait (1);
+}
+else {
+ $server = $SV->WaitKill (10);
+
+ if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ $status = 1;
+ }
+}
+
+$NS->Kill ();
+$NS->TimedWait (1);
+
+unlink $nsiorfile;
+unlink $iorfile;
+
+exit $status;
diff --git a/TAO/orbsvcs/tests/HTIOP/Hello/server.cpp b/TAO/orbsvcs/tests/HTIOP/Hello/server.cpp
new file mode 100644
index 00000000000..e3ba7544ee9
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Hello/server.cpp
@@ -0,0 +1,167 @@
+// $Id$
+
+#include "Hello.h"
+
+#include "tests/test_config.h"
+
+#include "ace/Get_Opt.h"
+#include "tao/IORTable/IORTable.h"
+#include "orbsvcs/CosNamingC.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_START_TEST (ACE_TEXT ("Hello_server"));
+
+ ACE_TRY_NEW_ENV
+ {
+ ACE_DEBUG ((LM_DEBUG, "Begin of Hello_Server test\n"));
+
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ //------ Get Root POA & POA Manager references
+
+ CORBA::Object_var obj =
+ orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (obj.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;
+
+ //------- Get IOR Table reference to support CORBALOC URLs
+
+ obj =
+ orb->resolve_initial_references("IORTable" ACE_ENV_ARG_PARAMETER);
+
+ IORTable::Table_var ior_table =
+ IORTable::Table::_narrow(obj.in() ACE_ENV_ARG_PARAMETER);
+
+
+ //------- Get NameService Root Context
+
+ obj =
+ orb->resolve_initial_references("NameService" ACE_ENV_ARG_PARAMETER);
+
+ CosNaming::NamingContextExt_var root_nc =
+ CosNaming::NamingContextExt::_narrow(obj.in() ACE_ENV_ARG_PARAMETER);
+
+ //-------- Prepare Servant
+
+ 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;
+
+ //--------- Publish IOR using various means
+
+ if (!CORBA::is_nil(root_nc.in()))
+ {
+ CosNaming::Name_var objname= root_nc->to_name("HelloObj");
+ root_nc->rebind (objname.in(),hello.in());
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,"Could not initialize name service\n"));
+ }
+
+ if (!CORBA::is_nil(ior_table.in()))
+ ior_table->bind("HelloObj", ior.in() ACE_ENV_ARG_PARAMETER);
+
+ // 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;
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - Root poa destroyed\n"));
+
+ orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - orb destroyed\n"));
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "server exiting\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_END_TEST;
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception caught:");
+ return 1;
+ }
+ ACE_ENDTRY;
+
+ ACE_END_TEST;
+ return 0;
+}
diff --git a/TAO/orbsvcs/tests/HTIOP/Hello/svc.conf b/TAO/orbsvcs/tests/HTIOP/Hello/svc.conf
new file mode 100644
index 00000000000..13a0987cc86
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Hello/svc.conf
@@ -0,0 +1,7 @@
+# $Id$
+
+dynamic HTIOP_Factory Service_Object *
+ TAO_HTIOP:_make_TAO_HTIOP_Protocol_Factory ()
+ "-config ../HT_Config.conf"
+
+static Resource_Factory "-ORBProtocolFactory HTIOP_Factory"
diff --git a/TAO/orbsvcs/tests/HTIOP/Makefile.am b/TAO/orbsvcs/tests/HTIOP/Makefile.am
new file mode 100644
index 00000000000..8493fa2444c
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/Makefile.am
@@ -0,0 +1,15 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ../bin/mwc.pl -type automake -noreldefs TAO.mwc
+
+SUBDIRS = \
+ AMI \
+ BiDirectional \
+ Hello
+
diff --git a/TAO/orbsvcs/tests/HTIOP/test_config.h b/TAO/orbsvcs/tests/HTIOP/test_config.h
new file mode 100644
index 00000000000..c87f7c6ecb4
--- /dev/null
+++ b/TAO/orbsvcs/tests/HTIOP/test_config.h
@@ -0,0 +1,319 @@
+// -*- C++ -*-
+
+
+// ============================================================================
+/**
+ * @file test_config.h
+ *
+ * $Id$
+ *
+ * This file factors out common macros and other utilities used by the
+ * ACE automated regression tests.
+ *
+ * @author Prashant Jain <pjain@cs.wustl.edu>
+ * @author Tim Harrison <harrison@cs.wustl.edu>
+ * @author David Levine <levine@cs.wustl.edu>
+ */
+// ============================================================================
+
+#ifndef ACE_TEST_CONFIG_H
+#define ACE_TEST_CONFIG_H
+
+#include "ace/config-all.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#if defined (ACE_NLOGGING)
+// ACE_NLOGGING must not be set if the tests are to produce any output.
+#undef ACE_NLOGGING
+#endif /* ACE_NLOGGING */
+
+// This first #undef protects against command-line definitions.
+#undef ACE_NDEBUG
+#include "ace/OS.h"
+#include "ace/streams.h"
+#include "ace/Singleton.h"
+#include "ace/Synch.h"
+#include "ace/Log_Msg.h"
+#include "ace/ACE.h"
+
+// The second #undef protects against being reset in a config.h file.
+#undef ACE_NDEBUG
+
+#undef ACE_TEXT
+#define ACE_TEXT ACE_LIB_TEXT
+
+#if defined (ACE_HAS_WINCE)
+// Note that Pocket PC 2002 will NOT create a directory if it does not start with a leading '\'.
+// PPC 2002 only accepts '\log' as a valid directory name, while 'log\' works under WinCE 3.0.
+# define ACE_LOG_DIRECTORY_FOR_MKDIR ACE_TEXT ("\\log")
+# define ACE_LOG_DIRECTORY ACE_TEXT ("\\log\\")
+# define MAKE_PIPE_NAME(X) ACE_TEXT ("\\\\.\\pipe\\"#X)
+#elif defined (ACE_WIN32)
+# define ACE_LOG_DIRECTORY ACE_TEXT ("..\\..\\log\\")
+# define MAKE_PIPE_NAME(X) ACE_TEXT ("\\\\..\\..\\.\\pipe\\"#X)
+#else
+# define ACE_LOG_DIRECTORY ACE_TEXT ("log/")
+# define MAKE_PIPE_NAME(X) ACE_TEXT (X)
+#endif /* ACE_WIN32 */
+
+#if defined (ACE_HAS_WINCE)
+#define ACE_LOG_FILE_EXT_NAME ACE_TEXT (".txt")
+#else
+#define ACE_LOG_FILE_EXT_NAME ACE_TEXT (".log")
+#endif /* ACE_HAS_WINCE */
+
+#if defined (ACE_HAS_WINCE) || defined (ACE_HAS_PHARLAP)
+const size_t ACE_MAX_CLIENTS = 4;
+#else
+const size_t ACE_MAX_CLIENTS = 30;
+#endif /* ACE_HAS_WINCE */
+
+const size_t ACE_NS_MAX_ENTRIES = 1000;
+const size_t ACE_DEFAULT_USECS = 1000;
+const size_t ACE_MAX_TIMERS = 4;
+const size_t ACE_MAX_DELAY = 10;
+const size_t ACE_MAX_INTERVAL = 0;
+const size_t ACE_MAX_ITERATIONS = 10;
+const size_t ACE_MAX_PROCESSES = 10;
+const size_t ACE_MAX_THREADS = 4;
+
+#define ACE_START_TEST(NAME) \
+ const ACE_TCHAR *program = NAME; \
+ ACE_LOG_MSG->open (program, ACE_Log_Msg::OSTREAM | ACE_Log_Msg::VERBOSE_LITE); \
+ if (ace_file_stream::instance()->set_output (program) != 0) \
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("set_output failed")), -1); \
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Starting %s test at %D\n"), program))
+
+#define ACE_END_TEST \
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Ending %s test at %D\n"), program)); \
+ ace_file_stream::instance()->close ()
+
+#define ACE_CLOSE_TEST_LOG ace_file_stream::instance()->close ()
+
+#if !defined (ACE_WIN32)
+#define ACE_APPEND_LOG(NAME) \
+ const ACE_TCHAR *program = NAME; \
+ ACE_LOG_MSG->open (program, ACE_Log_Msg::OSTREAM | ACE_Log_Msg::VERBOSE_LITE); \
+ ace_file_stream::instance()->close (); \
+ if (ace_file_stream::instance()->set_output (program, 1) != 0) \
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("set_output failed")), -1); \
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Starting %s test at %D\n"), program));
+#else /* ACE_WIN32 */
+#define ACE_APPEND_LOG(NAME) \
+ const ACE_TCHAR *program = NAME; \
+ ACE_LOG_MSG->open (program, ACE_Log_Msg::OSTREAM | ACE_Log_Msg::VERBOSE_LITE); \
+ if (ace_file_stream::instance()->set_output (program, 1) != 0) \
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("set_output failed")), -1); \
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Starting %s test at %D\n"), program));
+#endif /* ACE_WIN32 */
+
+#define ACE_END_LOG \
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Ending %s test at %D\n\n"), program)); \
+ ACE_LOG_MSG->set_flags(ACE_Log_Msg::SILENT); \
+ ace_file_stream::instance()->close ();
+
+#if defined (VXWORKS)
+ // This is the only way I could figure out to avoid an error
+ // about attempting to unlink a non-existant file.
+#define ACE_INIT_LOG(NAME) \
+ ACE_TCHAR temp[MAXPATHLEN]; \
+ ACE_OS::sprintf (temp, ACE_TEXT ("%s%s%s"), \
+ ACE_LOG_DIRECTORY, \
+ ACE::basename (NAME, ACE_DIRECTORY_SEPARATOR_CHAR), \
+ ACE_LOG_FILE_EXT_NAME); \
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Deleting old log file %s (if any)\n\n"), temp)); \
+ int fd_init_log; \
+ if ((fd_init_log = ACE_OS::open (temp, \
+ O_WRONLY|O_CREAT, \
+ S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) != ERROR) \
+ { \
+ ACE_OS::close (fd_init_log); \
+ ACE_OS::unlink (temp); \
+ }
+
+#if defined (ghs)
+# // Rename main to ace_main for compatibility with run_tests.vxworks.
+# undef ACE_MAIN
+# define ACE_MAIN ace_main
+#endif /* ghs */
+#else /* ! VXWORKS */
+#define ACE_INIT_LOG(NAME) \
+ ACE_TCHAR temp[MAXPATHLEN]; \
+ ACE_OS::sprintf (temp, ACE_TEXT ("%s%s%s"), \
+ ACE_LOG_DIRECTORY, \
+ ACE::basename (NAME, ACE_DIRECTORY_SEPARATOR_CHAR), \
+ ACE_LOG_FILE_EXT_NAME); \
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Deleting old log file %s (if any)\n\n"), temp)); \
+ ACE_OS::unlink (temp);
+#endif /* ! VXWORKS */
+
+#if defined (ACE_LACKS_IOSTREAM_TOTALLY)
+#define OFSTREAM FILE
+#else
+#define OFSTREAM ofstream
+#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+
+class ACE_Test_Output
+{
+public:
+ ACE_Test_Output (void);
+ ~ACE_Test_Output (void);
+ int set_output (const ACE_TCHAR *filename, int append = 0);
+ OFSTREAM *output_file (void);
+ void close (void);
+
+private:
+ OFSTREAM *output_file_;
+};
+
+inline ACE_Test_Output::ACE_Test_Output (void)
+ : output_file_ (0)
+{
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+ this->output_file_ = new OFSTREAM;
+#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+}
+
+inline ACE_Test_Output::~ACE_Test_Output (void)
+{
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) && !defined (ACE_PSOS)
+ ACE_LOG_MSG->msg_ostream (&cerr);
+#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY && ! ACE_PSOS */
+
+ ACE_LOG_MSG->clr_flags (ACE_Log_Msg::OSTREAM);
+ ACE_LOG_MSG->set_flags (ACE_Log_Msg::STDERR);
+
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) && !defined (ACE_HAS_PHARLAP)
+ delete this->output_file_;
+#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
+}
+
+inline OFSTREAM *
+ACE_Test_Output::output_file (void)
+{
+ return this->output_file_;
+}
+
+inline int
+ACE_Test_Output::set_output (const ACE_TCHAR *filename, int append)
+{
+#if defined (ACE_HAS_PHARLAP)
+ // For PharLap, just send it all to the host console for now - redirect
+ // to a file there for saving/analysis.
+ EtsSelectConsole(ETS_CO_HOST);
+ ACE_LOG_MSG->msg_ostream (&cout);
+
+#else
+ ACE_TCHAR temp[MAXPATHLEN];
+ // Ignore the error value since the directory may already exist.
+ const ACE_TCHAR *test_dir;
+
+#if !defined (ACE_HAS_WINCE)
+ test_dir = ACE_OS::getenv (ACE_TEXT ("ACE_TEST_DIR"));
+
+ if (test_dir == 0)
+#endif /* ACE_HAS_WINCE */
+ test_dir = ACE_TEXT ("");
+
+ ACE_OS::sprintf (temp,
+ ACE_TEXT ("%s%s%s%s"),
+ test_dir,
+ ACE_LOG_DIRECTORY,
+ ACE::basename (filename, ACE_DIRECTORY_SEPARATOR_CHAR),
+ ACE_LOG_FILE_EXT_NAME);
+
+#if defined (VXWORKS)
+ // This is the only way I could figure out to avoid a console
+ // warning about opening an existing file (w/o O_CREAT), or
+ // attempting to unlink a non-existant one.
+ ACE_HANDLE fd = ACE_OS::open (temp,
+ O_WRONLY|O_CREAT,
+ S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
+ if (fd != ERROR)
+ {
+ ACE_OS::close (fd);
+ ACE_OS::unlink (temp);
+ }
+# else /* ! VXWORKS */
+ // This doesn't seem to work on VxWorks if the directory doesn't
+ // exist: it creates a plain file instead of a directory. If the
+ // directory does exist, it causes a wierd console error message
+ // about "cat: input error on standard input: Is a directory". So,
+ // VxWorks users must create the directory manually.
+# if defined (ACE_HAS_WINCE)
+ ACE_OS::mkdir (ACE_LOG_DIRECTORY_FOR_MKDIR);
+# else
+ ACE_OS::mkdir (ACE_LOG_DIRECTORY);
+# endif // ACE_HAS_WINCE
+# endif /* ! VXWORKS */
+
+# if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+ this->output_file_->open (ACE_TEXT_ALWAYS_CHAR (temp),
+ ios::out | (append ? ios::app : ios::trunc));
+ if (this->output_file_->bad ())
+ return -1;
+#else /* when ACE_LACKS_IOSTREAM_TOTALLY */
+ ACE_TCHAR *fmode = 0;
+ if (append)
+ fmode = ACE_TEXT ("a");
+ else
+ fmode = ACE_TEXT ("w");
+ this->output_file_ = ACE_OS::fopen (temp, fmode);
+# endif /* ACE_LACKS_IOSTREAM_TOTALLY */
+
+ ACE_LOG_MSG->msg_ostream (this->output_file ());
+#endif /* ACE_HAS_PHARLAP */
+
+ ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER );
+ ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM);
+
+ return 0;
+}
+
+inline void
+ACE_Test_Output::close (void)
+{
+#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
+ this->output_file_->flush ();
+ this->output_file_->close ();
+#else
+ ACE_OS::fflush (this->output_file_);
+ ACE_OS::fclose (this->output_file_);
+#endif /* !ACE_LACKS_IOSTREAM_TOTALLY */
+ ACE_LOG_MSG->msg_ostream (0);
+}
+
+inline void
+randomize (int array[], size_t size)
+{
+ size_t i;
+
+ for (i = 0; i < size; i++)
+ array [i] = static_cast<int> (i);
+
+ // See with a fixed number so that we can produce "repeatable"
+ // random numbers.
+ ACE_OS::srand (0);
+
+ // Generate an array of random numbers from 0 .. size - 1.
+
+ for (i = 0; i < size; i++)
+ {
+ size_t index = ACE_OS::rand() % size--;
+ int temp = array [index];
+ array [index] = array [size];
+ array [size] = temp;
+ }
+}
+
+typedef ACE_Singleton<ACE_Test_Output, ACE_Null_Mutex> ace_file_stream;
+
+#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
+template ACE_Singleton<ACE_Test_Output, ACE_Null_Mutex> *
+ ACE_Singleton<ACE_Test_Output, ACE_Null_Mutex>::singleton_;
+#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */
+
+#endif /* ACE_TEST_CONFIG_H */