summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhangw <zhangw@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-02-21 23:59:05 +0000
committerzhangw <zhangw@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-02-21 23:59:05 +0000
commit1c2fe363afd295930496434008718e63880492c4 (patch)
tree7e9b5f3bd9d86bc9f9b31fda426b5778bf3dc763
parent98aa2a31107f9a4333e64102ae498e68b5440074 (diff)
downloadATCD-1c2fe363afd295930496434008718e63880492c4.tar.gz
Wed Feb 21 23:55:27 UTC 2007 Wallace Zhang <zhang_w@ociweb.com>
* tests/DSI_AMI_Gateway: * tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc: * tests/DSI_AMI_Gateway/Makefile.am: * tests/DSI_AMI_Gateway/client.cpp: * tests/DSI_AMI_Gateway/gateway.cpp: * tests/DSI_AMI_Gateway/run_exception_test.pl: * tests/DSI_AMI_Gateway/run_test.pl: * tests/DSI_AMI_Gateway/server.cpp: * tests/DSI_AMI_Gateway/test.idl: * tests/DSI_AMI_Gateway/test_dsi.h: * tests/DSI_AMI_Gateway/test_dsi.inl: * tests/DSI_AMI_Gateway/test_dsi.cpp: * tests/DSI_AMI_Gateway/test_i.h: * tests/DSI_AMI_Gateway/test_i.inl: * tests/DSI_AMI_Gateway/test_i.cpp:
-rw-r--r--TAO/ChangeLog.oci_rt973421
-rw-r--r--TAO/tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc51
-rw-r--r--TAO/tests/DSI_AMI_Gateway/Makefile.am160
-rw-r--r--TAO/tests/DSI_AMI_Gateway/client.cpp189
-rw-r--r--TAO/tests/DSI_AMI_Gateway/gateway.cpp132
-rwxr-xr-xTAO/tests/DSI_AMI_Gateway/run_exception_test.pl73
-rwxr-xr-xTAO/tests/DSI_AMI_Gateway/run_test.pl69
-rw-r--r--TAO/tests/DSI_AMI_Gateway/server.cpp112
-rw-r--r--TAO/tests/DSI_AMI_Gateway/test.idl34
-rw-r--r--TAO/tests/DSI_AMI_Gateway/test_dsi.cpp104
-rw-r--r--TAO/tests/DSI_AMI_Gateway/test_dsi.h68
-rw-r--r--TAO/tests/DSI_AMI_Gateway/test_dsi.inl12
-rw-r--r--TAO/tests/DSI_AMI_Gateway/test_i.cpp81
-rw-r--r--TAO/tests/DSI_AMI_Gateway/test_i.h66
-rw-r--r--TAO/tests/DSI_AMI_Gateway/test_i.inl8
15 files changed, 1180 insertions, 0 deletions
diff --git a/TAO/ChangeLog.oci_rt9734 b/TAO/ChangeLog.oci_rt9734
index 23d70d94cba..46d3fea97b5 100644
--- a/TAO/ChangeLog.oci_rt9734
+++ b/TAO/ChangeLog.oci_rt9734
@@ -1,3 +1,24 @@
+Wed Feb 21 23:55:27 UTC 2007 Wallace Zhang <zhang_w@ociweb.com>
+
+ * tests/DSI_AMI_Gateway:
+
+ * tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc:
+ * tests/DSI_AMI_Gateway/Makefile.am:
+ * tests/DSI_AMI_Gateway/client.cpp:
+ * tests/DSI_AMI_Gateway/gateway.cpp:
+ * tests/DSI_AMI_Gateway/run_exception_test.pl:
+ * tests/DSI_AMI_Gateway/run_test.pl:
+ * tests/DSI_AMI_Gateway/server.cpp:
+ * tests/DSI_AMI_Gateway/test.idl:
+ * tests/DSI_AMI_Gateway/test_dsi.h:
+ * tests/DSI_AMI_Gateway/test_dsi.inl:
+ * tests/DSI_AMI_Gateway/test_dsi.cpp:
+ * tests/DSI_AMI_Gateway/test_i.h:
+ * tests/DSI_AMI_Gateway/test_i.inl:
+ * tests/DSI_AMI_Gateway/test_i.cpp:
+
+ Added a new test.
+
Fri Feb 16 00:00:49 UTC 2007 Wallace Zhang <zhang_w@ociweb.com>
* orbsvcs/orbsvcs/AsynchProxyTools:
diff --git a/TAO/tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc b/TAO/tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc
new file mode 100644
index 00000000000..7703b170041
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/DSI_AMI_Gateway.mpc
@@ -0,0 +1,51 @@
+// -*- MPC -*-
+// $Id$
+
+project(*idl): taoidldefaults {
+ IDL_Files {
+ test.idl
+ }
+ custom_only = 1
+}
+
+project(*Server): taoserver, messaging, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro, dynamicinterface {
+ after += *idl
+ Source_Files {
+ test_i.cpp
+ server.cpp
+ }
+ Source_Files {
+ testC.cpp
+ testS.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*Client): taoclient, messaging, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro, dynamicinterface {
+ after += *idl
+ after += *Server
+ Source_Files {
+ client.cpp
+ }
+ Source_Files {
+ testC.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*Gateway): taoexe, portableserver, messaging, avoids_minimum_corba, avoids_corba_e_compact, avoids_corba_e_micro, dynamicinterface {
+ after += *idl
+ after += *Client
+ Source_Files {
+ test_dsi.cpp
+ gateway.cpp
+ }
+ Source_Files {
+ testC.cpp
+ testS.cpp
+ }
+ IDL_Files {
+ }
+}
diff --git a/TAO/tests/DSI_AMI_Gateway/Makefile.am b/TAO/tests/DSI_AMI_Gateway/Makefile.am
new file mode 100644
index 00000000000..a1bdefdaada
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/Makefile.am
@@ -0,0 +1,160 @@
+## 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 = -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.DSI_Gateway_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.DSI_Gateway_Server.am
+
+if BUILD_CORBA_MESSAGING
+if BUILD_EXCEPTIONS
+
+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.inl
+
+server_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.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_EXCEPTIONS
+endif BUILD_CORBA_MESSAGING
+
+## Makefile.DSI_Gateway_Client.am
+
+if BUILD_CORBA_MESSAGING
+if BUILD_EXCEPTIONS
+
+noinst_PROGRAMS += client
+
+client_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR)
+
+client_SOURCES = \
+ client.cpp \
+ testC.cpp \
+ test_dsi.h \
+ test_dsi.inl \
+ test_i.h \
+ test_i.inl
+
+client_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(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_EXCEPTIONS
+endif BUILD_CORBA_MESSAGING
+
+## Makefile.DSI_Gateway_Gateway.am
+
+if BUILD_CORBA_MESSAGING
+if BUILD_EXCEPTIONS
+
+noinst_PROGRAMS += gateway
+
+gateway_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(TAO_ROOT) \
+ -I$(TAO_BUILDDIR)
+
+gateway_SOURCES = \
+ gateway.cpp \
+ testC.cpp \
+ testS.cpp \
+ test_dsi.cpp \
+ test_dsi.h \
+ test_dsi.inl
+
+gateway_LDADD = \
+ $(TAO_BUILDDIR)/tao/libTAO_DynamicInterface.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Messaging.la \
+ $(TAO_BUILDDIR)/tao/libTAO_PI.la \
+ $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
+ $(TAO_BUILDDIR)/tao/libTAO_Valuetype.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_EXCEPTIONS
+endif BUILD_CORBA_MESSAGING
+
+## 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/tests/DSI_AMI_Gateway/client.cpp b/TAO/tests/DSI_AMI_Gateway/client.cpp
new file mode 100644
index 00000000000..c0d5e122d0e
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/client.cpp
@@ -0,0 +1,189 @@
+// $Id$
+
+#include "testC.h"
+#include "tao/debug.h"
+#include "ace/Get_Opt.h"
+#include "ace/Task.h"
+
+ACE_RCSID(DSI_Gateway, client, "$Id$")
+
+const char *ior = "file://gateway.ior";
+int niterations = 5;
+int do_shutdown = 0;
+int test_user_exception = 0;
+int test_system_exception = 0;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "xusk:i:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'x':
+ do_shutdown = 1;
+ break;
+
+ case 'u':
+ test_user_exception = 1;
+ break;
+
+ case 's':
+ test_system_exception = 1;
+ break;
+
+ case 'k':
+ ior = 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 "
+ "-x "
+ "-u "
+ "-s "
+ "-k <ior> "
+ "-i <niterations> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ try
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "");
+
+ if (parse_args (argc, argv) != 0)
+ {
+ return 1;
+ }
+
+ CORBA::Object_var object =
+ orb->string_to_object (ior);
+
+ Simple_Server_var server =
+ Simple_Server::_narrow (object.in ());
+
+ if (CORBA::is_nil (server.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Object reference <%s> is nil\n",
+ ior),
+ 1);
+ }
+
+ Structure the_in_structure;
+ the_in_structure.seq.length (10);
+
+ if (test_user_exception == 1)
+ {
+ server->raise_user_exception ();
+ }
+ else if (test_system_exception == 1)
+ {
+ server->raise_system_exception ();
+ }
+ else
+ {
+ for (int i = 0; i != niterations; ++i)
+ {
+ CORBA::Long const tv = i + 100;
+ server->test_val(tv);
+ CORBA::Long const rtv = server->test_val ();
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "DSI_Simpler_Server ==== Expected result = %d for %d\n",
+ rtv, tv));
+ }
+
+ if (rtv != tv)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) ERROR: unexpected result = %d for %d\n",
+ rtv, tv));
+ }
+
+ the_in_structure.i = i;
+ CORBA::String_var name = CORBA::string_dup ("the name");
+
+ Structure_var the_out_structure;
+
+ CORBA::Long const r =
+ server->test_method (i,
+ the_in_structure,
+ the_out_structure.out (),
+ name.inout ());
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "DSI_Simpler_Server ====\n"
+ " x = %d\n"
+ " i = %d\n"
+ " length = %d\n"
+ " name = <%s>\n",
+ r,
+ the_out_structure->i,
+ the_out_structure->seq.length (),
+ name.in ()));
+ }
+
+ if (r != i)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) ERROR: unexpected result = %d for %d",
+ r, i));
+ }
+ }
+ }
+
+ if (do_shutdown)
+ {
+ server->shutdown ();
+ }
+ }
+ catch (const test_exception& ex)
+ {
+ ex._tao_print_exception ("Client: exception caught - ");
+
+ ACE_DEBUG ((LM_DEBUG,
+ "error code: %d\n"
+ "error info: %s\n"
+ "status: %s\n",
+ ex.error_code,
+ ex.error_message.in (),
+ ex.status_message.in ()));
+
+ return 0;
+ }
+ catch (const CORBA::NO_PERMISSION& ex)
+ {
+ ex._tao_print_exception ("Client: exception caught - ");
+
+ return 0;
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Client: exception caught - ");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/TAO/tests/DSI_AMI_Gateway/gateway.cpp b/TAO/tests/DSI_AMI_Gateway/gateway.cpp
new file mode 100644
index 00000000000..0da6e8dda4d
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/gateway.cpp
@@ -0,0 +1,132 @@
+// $Id$
+
+#include "test_dsi.h"
+#include "ace/Get_Opt.h"
+#include "ace/Task.h"
+
+ACE_RCSID(DSI_Gateway, server, "$Id$")
+
+const char *ior = "file://test.ior";
+int niterations = 5;
+int do_shutdown = 0;
+const char *ior_output_file = "gateway.ior";
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "xk:i:o:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'x':
+ do_shutdown = 1;
+ break;
+
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+
+ case 'i':
+ niterations = ACE_OS::atoi (get_opts.opt_arg ());
+ break;
+
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-x "
+ "-k <ior> "
+ "-i <niterations> "
+ "-o <iorfile> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ try
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "");
+
+ CORBA::Object_var poa_object =
+ orb->resolve_initial_references("RootPOA");
+
+ 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 ());
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager ();
+
+ poa_manager->activate ();
+
+ if (parse_args (argc, argv) != 0)
+ {
+ return 1;
+ }
+
+ CORBA::Object_var object =
+ orb->string_to_object (ior);
+
+ DSI_Simple_Server server_impl (orb.in (),
+ object.in (),
+ root_poa.in ());
+ PortableServer::ObjectId_var oid =
+ root_poa->activate_object (&server_impl);
+
+ CORBA::Object_var server =
+ root_poa->id_to_reference (oid.in ());
+
+ CORBA::String_var ior =
+ orb->object_to_string (server.in ());
+
+ 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);
+ }
+
+ orb->run ();
+
+ ACE_DEBUG ((LM_DEBUG, "event loop finished\n"));
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Gateway: exception caught - ");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/TAO/tests/DSI_AMI_Gateway/run_exception_test.pl b/TAO/tests/DSI_AMI_Gateway/run_exception_test.pl
new file mode 100755
index 00000000000..d8ab49c6440
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/run_exception_test.pl
@@ -0,0 +1,73 @@
+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;
+
+$svfile = PerlACE::LocalFile ("server.ior");
+$gwfile = PerlACE::LocalFile ("gateway.ior");
+
+unlink $svfile;
+unlink $gwfile;
+
+$status = 0;
+
+$SV = new PerlACE::Process ("server", "-o $svfile");
+$GW = new PerlACE::Process ("gateway", "-k file://$svfile -o $gwfile");
+$CL = new PerlACE::Process ("client", "-k file://$gwfile -u");
+
+$SV->Spawn ();
+
+if (PerlACE::waitforfile_timed ($svfile, 5) == -1) {
+ print STDERR "ERROR: cannot find file <$svfile>\n";
+ $SV->Kill ();
+ exit 1;
+}
+
+$GW->Spawn ();
+
+if (PerlACE::waitforfile_timed ($gwfile, 5) == -1) {
+ print STDERR "ERROR: cannot find file <$gwfile>\n";
+ $SV->Kill ();
+ $GW->Kill ();
+ exit 1;
+}
+
+$client = $CL->SpawnWaitKill (60);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
+}
+
+$CL = new PerlACE::Process ("client", "-k file://$gwfile -s");
+
+$client = $CL->SpawnWaitKill (60);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
+}
+
+$server = $SV->Kill ();
+
+if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ $status = 1;
+}
+
+$gateway = $GW->Kill ();
+
+if ($gateway != 0) {
+ print STDERR "ERROR: gateway returned $gateway\n";
+ $status = 1;
+}
+
+unlink $svfile;
+unlink $gwfile;
+
+exit $status;
diff --git a/TAO/tests/DSI_AMI_Gateway/run_test.pl b/TAO/tests/DSI_AMI_Gateway/run_test.pl
new file mode 100755
index 00000000000..33654bcadf1
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/run_test.pl
@@ -0,0 +1,69 @@
+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;
+
+$svfile = PerlACE::LocalFile ("server.ior");
+$gwfile = PerlACE::LocalFile ("gateway.ior");
+
+unlink $svfile;
+unlink $gwfile;
+
+$status = 0;
+
+if (PerlACE::is_vxworks_test()) {
+ $SV = new PerlACE::ProcessVX ("server", "-o server.ior");
+}
+else {
+ $SV = new PerlACE::Process ("server", "-o $svfile");
+}
+$GW = new PerlACE::Process ("gateway", "-k file://$svfile -o $gwfile");
+$CL = new PerlACE::Process ("client", "-k file://$gwfile -x -i 100");
+
+$SV->Spawn ();
+
+if (PerlACE::waitforfile_timed ($svfile, 10) == -1) {
+ print STDERR "ERROR: cannot find file <$svfile>\n";
+ $SV->Kill ();
+ exit 1;
+}
+
+$GW->Spawn ();
+
+if (PerlACE::waitforfile_timed ($gwfile, 10) == -1) {
+ print STDERR "ERROR: cannot find file <$gwfile>\n";
+ $SV->Kill ();
+ $GW->Kill ();
+ exit 1;
+}
+
+$client = $CL->SpawnWaitKill (60);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
+}
+
+$server = $SV->WaitKill (5);
+
+if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ $status = 1;
+}
+
+$gateway = $GW->WaitKill (5);
+
+if ($gateway != 0) {
+ print STDERR "ERROR: gateway returned $gateway\n";
+ $status = 1;
+}
+
+unlink $svfile;
+unlink $gwfile;
+
+exit $status;
diff --git a/TAO/tests/DSI_AMI_Gateway/server.cpp b/TAO/tests/DSI_AMI_Gateway/server.cpp
new file mode 100644
index 00000000000..3ee312a38ce
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/server.cpp
@@ -0,0 +1,112 @@
+// $Id$
+
+#include "test_i.h"
+#include "ace/Get_Opt.h"
+#include "ace/Task.h"
+
+ACE_RCSID(DSI_Gateway, server, "$Id$")
+
+const char *ior_output_file = "server.ior";
+
+int nthreads = 4;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "o:n:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+
+ case 'n':
+ nthreads = ACE_OS::atoi (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[])
+{
+ try
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "");
+
+ CORBA::Object_var poa_object =
+ orb->resolve_initial_references("RootPOA");
+
+ 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 ());
+
+ PortableServer::POAManager_var poa_manager =
+ root_poa->the_POAManager ();
+
+ if (parse_args (argc, argv) != 0)
+ {
+ return 1;
+ }
+
+ Simple_Server_i server_impl (orb.in ());
+
+ Simple_Server_var server =
+ server_impl._this ();
+
+ CORBA::String_var ior =
+ orb->object_to_string (server.in ());
+
+ 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 ();
+
+ orb->run ();
+
+ ACE_DEBUG ((LM_DEBUG, "event loop finished\n"));
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Server: exception caught - ");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/TAO/tests/DSI_AMI_Gateway/test.idl b/TAO/tests/DSI_AMI_Gateway/test.idl
new file mode 100644
index 00000000000..29cdc6f4d15
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/test.idl
@@ -0,0 +1,34 @@
+//
+// $Id$
+//
+
+typedef sequence<long> DSI_LongSeq;
+
+struct Structure
+{
+ short i;
+ sequence<long> seq;
+};
+
+exception test_exception
+{
+ short error_code;
+ string error_message;
+ string status_message;
+};
+
+interface Simple_Server
+{
+ attribute long test_val;
+
+ long test_method (in long x,
+ in Structure the_in_structure,
+ out Structure the_out_structure,
+ inout string name);
+
+ void raise_user_exception () raises (test_exception);
+
+ void raise_system_exception ();
+
+ oneway void shutdown ();
+};
diff --git a/TAO/tests/DSI_AMI_Gateway/test_dsi.cpp b/TAO/tests/DSI_AMI_Gateway/test_dsi.cpp
new file mode 100644
index 00000000000..09110580f28
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/test_dsi.cpp
@@ -0,0 +1,104 @@
+// $Id$
+
+#include "test_dsi.h"
+#include "tao/DynamicInterface/Request.h"
+#include "tao/DynamicInterface/Unknown_User_Exception.h"
+#include "tao/TAO_Server_Request.h"
+#include "tao/Transport.h"
+
+#if !defined(__ACE_INLINE__)
+#include "test_dsi.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(DSI_Gateway, test_dsi, "$Id$")
+
+void
+DSI_Simple_Server::invoke (CORBA::ServerRequest_ptr request)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ //marshal_demarshal_=true;
+ if(marshal_demarshal_)
+ {
+ CORBA::NVList_ptr list;
+ this->orb_->create_list (0, list);
+
+ request->arguments (list);
+
+ CORBA::Request_var target_request;
+
+ this->target_->_create_request (0, // ctx
+ request->operation (),
+ list,
+ 0, // result
+ 0, // exception_list,
+ 0, // context_list,
+ target_request.inout (),
+ 0);
+
+ target_request->_tao_lazy_evaluation (1);
+
+ // Outgoing request must have the same byte order as the incoming one.
+ target_request->_tao_byte_order (request->_tao_incoming_byte_order ());
+
+ try
+ {
+ // Updates the byte order state, if necessary.
+ target_request->invoke ();
+ }
+ catch (const CORBA::UNKNOWN& ex)
+ {
+ ACE_UNUSED_ARG (ex);
+
+ // Outgoing reply must have the same byte order as the incoming one.
+ request->_tao_reply_byte_order (target_request->_tao_byte_order ());
+
+ request->gateway_exception_reply (target_request->raw_user_exception ());
+
+ return;
+ }
+
+ // Outgoing reply must have the same byte order as the incoming one.
+ request->_tao_reply_byte_order (target_request->_tao_byte_order ());
+
+ }
+ else
+ {
+ // forward the request without marshalling and demarshalling.
+ TAO_ServerRequest & tao_server_request = request->_tao_server_request ();
+ TAO_Transport* request_ptr = tao_server_request.transport ();
+ TAO_Stub *stubobj = target_ ->_stubobj ();
+
+ // the following code is doing the copy but with memory leak
+ TAO_OutputCDR outcdr (tao_server_request.incoming ()->start ()->duplicate ());
+ outcdr.write_octet_array_mb(tao_server_request.incoming ()->start ());
+
+ ACE_DEBUG((LM_DEBUG,"the length of incoming cdr = %d\n"
+ "the length of outgoing cdr = %d\n"
+ "the length of my outcdr = %d\n",
+ tao_server_request.incoming()->length(),
+ tao_server_request.outgoing()->length(),
+ outcdr.length ()));
+ request_ptr->send_message ( outcdr,
+ stubobj,
+ TAO_Transport::TAO_ONEWAY_REQUEST);
+
+ }
+ if (ACE_OS::strcmp ("shutdown", request->operation ()) == 0)
+ {
+ this->orb_->shutdown (0);
+ }
+}
+
+CORBA::RepositoryId
+DSI_Simple_Server::_primary_interface (const PortableServer::ObjectId &,
+ PortableServer::POA_ptr)
+ ACE_THROW_SPEC (())
+{
+ return CORBA::string_dup ("IDL:Simple_Server:1.0");
+}
+
+PortableServer::POA_ptr
+DSI_Simple_Server::_default_POA (void)
+{
+ return PortableServer::POA::_duplicate (this->poa_.in ());
+}
diff --git a/TAO/tests/DSI_AMI_Gateway/test_dsi.h b/TAO/tests/DSI_AMI_Gateway/test_dsi.h
new file mode 100644
index 00000000000..9b995ecd092
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/test_dsi.h
@@ -0,0 +1,68 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/DSI_Gateway
+//
+// = FILENAME
+// test_i.h
+//
+// = AUTHOR
+// Carlos O'Ryan
+//
+// ============================================================================
+
+#ifndef TAO_DSI_GATEWAY_TEST_DSI_H
+#define TAO_DSI_GATEWAY_TEST_DSI_H
+
+#include "tao/DynamicInterface/Server_Request.h"
+#include "tao/DynamicInterface/Dynamic_Implementation.h"
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/ORB.h"
+
+class DSI_Simple_Server : public TAO_DynamicImplementation
+{
+ // = TITLE
+ // DSI Simpler Server implementation
+ //
+ // = DESCRIPTION
+ // Implements the DSI/DII gateway.
+ //
+public:
+ DSI_Simple_Server (CORBA::ORB_ptr orb,
+ CORBA::Object_ptr target,
+ PortableServer::POA_ptr poa);
+ // ctor
+
+ // = The DynamicImplementation methods.
+ virtual void invoke (CORBA::ServerRequest_ptr request)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual CORBA::RepositoryId _primary_interface (
+ const PortableServer::ObjectId &oid,
+ PortableServer::POA_ptr poa
+ )
+ ACE_THROW_SPEC (());
+
+ virtual PortableServer::POA_ptr _default_POA (
+ );
+
+private:
+ CORBA::ORB_var orb_;
+ // The ORB
+
+ CORBA::Object_var target_;
+ // Target object, forward requests to it...
+
+ PortableServer::POA_var poa_;
+ // The POA
+
+ bool marshal_demarshal_;
+};
+
+#if defined(__ACE_INLINE__)
+#include "test_dsi.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_DSI_GATEWAY_TEST_I_H */
diff --git a/TAO/tests/DSI_AMI_Gateway/test_dsi.inl b/TAO/tests/DSI_AMI_Gateway/test_dsi.inl
new file mode 100644
index 00000000000..26ab9b53ad3
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/test_dsi.inl
@@ -0,0 +1,12 @@
+// $Id$
+
+ACE_INLINE
+DSI_Simple_Server::DSI_Simple_Server (CORBA::ORB_ptr orb,
+ CORBA::Object_ptr target,//Simple_Server_ptr target,
+ PortableServer::POA_ptr poa)
+ : orb_ (CORBA::ORB::_duplicate (orb)),
+ target_ (CORBA::Object::_duplicate (target)),//Simple_Server::_duplicate (target)),
+ poa_ (PortableServer::POA::_duplicate (poa)),
+ marshal_demarshal_(false)
+{
+}
diff --git a/TAO/tests/DSI_AMI_Gateway/test_i.cpp b/TAO/tests/DSI_AMI_Gateway/test_i.cpp
new file mode 100644
index 00000000000..c9eeeefa7e4
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/test_i.cpp
@@ -0,0 +1,81 @@
+// $Id$
+
+#include "test_i.h"
+#include "tao/debug.h"
+
+#if !defined(__ACE_INLINE__)
+#include "test_i.inl"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(DSI_Gateway, test_i, "$Id$")
+
+CORBA::Long
+Simple_Server_i::test_method (CORBA::Long x,
+ const Structure& the_in_structure,
+ Structure_out the_out_structure,
+ char *&name)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ Structure *tmp = 0;
+ ACE_NEW_RETURN (tmp, Structure (the_in_structure), -1);
+ the_out_structure = tmp;
+
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Simpler_Server_i ====\n"
+ " x = %d\n"
+ " i = %d\n"
+ " length = %d\n"
+ " name = <%s>\n",
+ x,
+ the_in_structure.i,
+ the_in_structure.seq.length (),
+ name));
+ }
+
+ return x;
+}
+
+void
+Simple_Server_i::raise_user_exception (void)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ test_exception))
+{
+ throw test_exception (33, "reactor meltdown", "kaput");
+}
+
+void
+Simple_Server_i::raise_system_exception (void)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ throw CORBA::NO_PERMISSION ();
+}
+
+void
+Simple_Server_i::shutdown (void)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ this->orb_->shutdown (0);
+}
+
+CORBA::Long
+Simple_Server_i::test_val (void)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ return vlong_;
+}
+
+void
+Simple_Server_i::test_val (CORBA::Long tv)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "Simpler_Server_i ====test_val: %d\n", tv
+ ));
+ }
+ vlong_ = tv;
+}
+
diff --git a/TAO/tests/DSI_AMI_Gateway/test_i.h b/TAO/tests/DSI_AMI_Gateway/test_i.h
new file mode 100644
index 00000000000..9ec76830813
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/test_i.h
@@ -0,0 +1,66 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/tests/DSI_Gateway
+//
+// = FILENAME
+// test_i.h
+//
+// = AUTHOR
+// Carlos O'Ryan
+//
+// ============================================================================
+
+#ifndef TAO_DSI_GATEWAY_TEST_I_H
+#define TAO_DSI_GATEWAY_TEST_I_H
+
+#include "testS.h"
+
+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);
+ // ctor
+
+ // = The Simple_Server methods.
+ CORBA::Long test_method (CORBA::Long x,
+ const Structure& the_in_structure,
+ Structure_out the_out_structure,
+ char *&name)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ CORBA::Long test_val (void)
+ ACE_THROW_SPEC (( CORBA::SystemException));
+
+ void test_val (CORBA::Long test_val)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void raise_user_exception (void)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ test_exception));
+
+ void raise_system_exception (void)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ void shutdown (void)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+private:
+ // The ORB
+ CORBA::ORB_var orb_;
+ CORBA::Long vlong_;
+};
+
+#if defined(__ACE_INLINE__)
+#include "test_i.inl"
+#endif /* __ACE_INLINE__ */
+
+#endif /* TAO_DSI_GATEWAY_TEST_I_H */
diff --git a/TAO/tests/DSI_AMI_Gateway/test_i.inl b/TAO/tests/DSI_AMI_Gateway/test_i.inl
new file mode 100644
index 00000000000..bd51e3a42bd
--- /dev/null
+++ b/TAO/tests/DSI_AMI_Gateway/test_i.inl
@@ -0,0 +1,8 @@
+// $Id$
+
+ACE_INLINE
+Simple_Server_i::Simple_Server_i (CORBA::ORB_ptr orb)
+ : orb_ (CORBA::ORB::_duplicate (orb)),
+ vlong_ (0)
+{
+}