summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-09-21 16:11:24 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-09-21 16:11:24 +0000
commit61d227681b5c6e3287d9c69f4bb0488823d9dda0 (patch)
tree756077eba88c7232013c9955d26daddd4f753a31
parent5a8dc7c64c06c206a19ad7363d1c6fbc34566a3e (diff)
downloadATCD-61d227681b5c6e3287d9c69f4bb0488823d9dda0.tar.gz
ChangeLogTag: Thu Sep 21 11:01:22 2000 Jeff Parsons <parsons@cs.wustl.edu>
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/ImplRepo.dsw24
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Server.cpp243
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Service.cpp180
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Service.dsp132
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Service.h75
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/airplane_server_i.cpp2
-rwxr-xr-xTAO/orbsvcs/tests/ImplRepo/run_test.pl106
7 files changed, 755 insertions, 7 deletions
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImplRepo.dsw b/TAO/orbsvcs/ImplRepo_Service/ImplRepo.dsw
index 064c184f941..ccb2b6c9af1 100644
--- a/TAO/orbsvcs/ImplRepo_Service/ImplRepo.dsw
+++ b/TAO/orbsvcs/ImplRepo_Service/ImplRepo.dsw
@@ -15,6 +15,30 @@ Package=<4>
###############################################################################
+Project: "NT_ImplRepo_Service"=.\NT_ImplRepo_Service.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "tao_ifr"=.\tao_ifr.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "tao_imr"=.\tao_imr.dsp - Package Owner=<4>
Package=<5>
diff --git a/TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Server.cpp b/TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Server.cpp
new file mode 100644
index 00000000000..9e6ba6a37fc
--- /dev/null
+++ b/TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Server.cpp
@@ -0,0 +1,243 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ace
+//
+// = FILENAME
+// NT_ImplRepo_Server.cpp
+//
+//
+// = DESCRIPTION
+// Driver program that runs the TAO ImplRepo Service as a Windows NT
+// Service.
+//
+// = AUTHORS
+// John Tucker <jtucker@infoglide.com> and
+// Mike Vitalo <mvitalo@infoglide.com>
+// modified by
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#include "ace/OS.h"
+#include "ace/Get_Opt.h"
+
+#include "winreg.h"
+#include "NT_ImplRepo_Service.h"
+
+ACE_RCSID(ImplRepo_Service, NT_ImplRepo_Server, "$Id$")
+
+// Default for the -i (install) option.
+#define DEFAULT_SERVICE_INIT_STARTUP SERVICE_DEMAND_START
+
+class NTS_Options
+{
+ // = TITLE
+ // Keeps track of the command-line options for this program.
+public:
+ NTS_Options (void);
+ ~NTS_Options (void);
+
+ int run (int argc, char *argv[]);
+
+private:
+ void parse_args (int argc,
+ char *argv[]);
+
+ void print_usage_and_die (void);
+
+private:
+ char progname[128];
+
+ int opt_install;
+ int opt_remove;
+ int opt_start;
+ int opt_kill;
+ int opt_type;
+ int opt_debug;
+ int opt_startup;
+};
+
+typedef ACE_Singleton<NTS_Options, ACE_Mutex> NTS_OPTIONS;
+
+NTS_Options::NTS_Options (void)
+ : opt_install (0),
+ opt_remove (0),
+ opt_start (0),
+ opt_kill (0),
+ opt_type (0),
+ opt_debug (0),
+ opt_startup (0)
+{
+ ACE_OS::strcpy (progname,
+ "service");
+ ACE::init ();
+}
+
+NTS_Options::~NTS_Options (void)
+{
+ ACE::fini ();
+}
+
+void
+NTS_Options::print_usage_and_die (void)
+{
+ ACE_DEBUG ((LM_INFO,
+ "Usage: %s"
+ " -in -r -s -k -tn -d\n"
+ " -i: Install this program as an NT service, with specified startup\n"
+ " -r: Remove this program from the Service Manager\n"
+ " -s: Start the service\n"
+ " -k: Kill the service\n"
+ " -t: Set startup for an existing service\n"
+ " -d: Debug; run as a regular application\n",
+ progname,
+ 0));
+ ACE_OS::exit (1);
+}
+
+void
+NTS_Options::parse_args (int argc,
+ char *argv[])
+{
+ ACE_Get_Opt get_opt (argc, argv, "i:rskt:d");
+ int c;
+
+ while ((c = get_opt ()) != -1)
+ switch (c)
+ {
+ case 'i':
+ this->opt_install = 1;
+ this->opt_startup = ACE_OS::atoi (get_opt.optarg);
+
+ if (this->opt_startup <= 0)
+ {
+ print_usage_and_die ();
+ }
+
+ break;
+ case 'r':
+ this->opt_remove = 1;
+ break;
+ case 's':
+ this->opt_start = 1;
+ break;
+ case 'k':
+ this->opt_kill = 1;
+ break;
+ case 't':
+ this->opt_type = 1;
+ this->opt_startup = ACE_OS::atoi (get_opt.optarg);
+
+ if (this->opt_startup <= 0)
+ {
+ print_usage_and_die ();
+ }
+
+ break;
+ case 'd':
+ //opt_debug = 1;
+ break;
+ default:
+ // -i can also be given without a value - if so, it defaults
+ // to defined value.
+ if (ACE_OS::strcmp (get_opt.argv_[get_opt.optind - 1], "-i") == 0)
+ {
+ this->opt_install = 1;
+ this->opt_startup = DEFAULT_SERVICE_INIT_STARTUP;
+ }
+ else
+ {
+ this->print_usage_and_die ();
+ }
+
+ break;
+ }
+}
+
+// Define a function to handle Ctrl+C to cleanly shut this down.
+
+static BOOL __stdcall
+ConsoleHandler (DWORD ctrlType)
+{
+ SERVICE::instance ()->handle_control (SERVICE_CONTROL_STOP);
+ return TRUE;
+}
+
+ACE_NT_SERVICE_DEFINE (service,
+ TAO_NT_ImplRepo_Service,
+ "TAO NT ImplRepo Service");
+
+int
+NTS_Options::run (int argc,
+ char* argv[])
+{
+ SERVICE::instance ()->name ("TAO_NT_ImplRepo_Service",
+ "TAO NT ImplRepo Service");
+
+ this->parse_args (argc,
+ argv);
+
+ if (this->opt_install && !this->opt_remove)
+ {
+ return SERVICE::instance ()->insert (this->opt_startup);
+ }
+
+ if (this->opt_remove && !this->opt_install)
+ {
+ return SERVICE::instance ()->remove ();
+ }
+
+ if (this->opt_start && this->opt_kill)
+ {
+ print_usage_and_die ();
+ }
+
+ if (this->opt_start)
+ {
+ return SERVICE::instance ()->start_svc ();
+ }
+
+ if (this->opt_kill)
+ {
+ return SERVICE::instance ()->stop_svc ();
+ }
+
+ if (this->opt_type)
+ {
+ return SERVICE::instance ()->startup (this->opt_startup);
+ }
+
+ // If we get here, we either run the app in debug mode (-d) or are
+ // being called from the service manager to start the service.
+
+ if (this->opt_debug)
+ {
+ SetConsoleCtrlHandler (&ConsoleHandler, 1);
+ SERVICE::instance ()->svc ();
+ }
+ else
+ {
+ ACE_NT_SERVICE_RUN (service,
+ SERVICE::instance (),
+ ret);
+ if (ret == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%p\n",
+ "Couldn't start service"));
+ }
+ }
+
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ return NTS_OPTIONS::instance ()->run (argc, argv);
+}
+
diff --git a/TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Service.cpp b/TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Service.cpp
new file mode 100644
index 00000000000..f63f926e13c
--- /dev/null
+++ b/TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Service.cpp
@@ -0,0 +1,180 @@
+/* -*- C++ -*- */
+// $Id$
+
+#include "ImplRepo_i.h"
+#include "NT_ImplRepo_Service.h"
+
+ACE_RCSID(ImplRepo_Service, NT_ImplRepo_Service, "$Id$")
+
+#define REGISTRY_KEY_ROOT HKEY_LOCAL_MACHINE
+#define TAO_REGISTRY_SUBKEY "SOFTWARE\\ACE\\TAO"
+#define TAO_IMPLREPO_SERVICE_OPTS_NAME "TaoImplRepoServiceOptions"
+
+TAO_NT_ImplRepo_Service::TAO_NT_ImplRepo_Service (void)
+ : argc_ (0),
+ argc_save_ (0),
+ argv_ (0),
+ argv_save_ (0)
+{
+}
+
+TAO_NT_ImplRepo_Service::~TAO_NT_ImplRepo_Service (void)
+{
+ if (argv_save_)
+ {
+ for (int i = 0; i < this->argc_save_; i++)
+ {
+ ACE_OS::free (this->argv_save_[i]);
+ }
+
+ ACE_OS::free (argv_save_);
+ }
+}
+
+void
+TAO_NT_ImplRepo_Service::handle_control (DWORD control_code)
+{
+ if (control_code == SERVICE_CONTROL_SHUTDOWN
+ || control_code == SERVICE_CONTROL_STOP)
+ {
+ report_status (SERVICE_STOP_PENDING);
+ TAO_ORB_Core_instance ()->reactor ()->end_reactor_event_loop ();
+ TAO_ORB_Core_instance ()->orb ()->shutdown (1);
+ report_status (SERVICE_STOPPED);
+ }
+ else
+ {
+ ACE_NT_Service::handle_control (control_code);
+ }
+}
+
+int
+TAO_NT_ImplRepo_Service::handle_exception (ACE_HANDLE)
+{
+ return 0;
+}
+
+int
+TAO_NT_ImplRepo_Service::init (int argc,
+ ACE_TCHAR *argv[])
+{
+ HKEY hkey = 0;
+ BYTE buf[ACE_DEFAULT_ARGV_BUFSIZ];
+
+ *buf = '\0';
+
+ // This solution is very kludgy. It looks in the NT Registry under
+ // \\HKEY_LOCAL_MACHINE\SOFTWARE\ACE\TAO for the value of
+ // "TaoImplRepoServiceOptions" for any ImplRepo Service options such as
+ // "-ORBEndpoint".
+
+ // Get ImplRepo Service options from the NT Registry.
+
+ RegOpenKeyEx (REGISTRY_KEY_ROOT,
+ TAO_REGISTRY_SUBKEY,
+ 0,
+ KEY_READ|KEY_WRITE,
+ &hkey);
+
+ DWORD type;
+ DWORD bufSize = sizeof (buf);
+
+ RegQueryValueEx (hkey,
+ TAO_IMPLREPO_SERVICE_OPTS_NAME,
+ NULL,
+ &type,
+ buf,
+ &bufSize);
+
+ RegCloseKey (hkey);
+
+ // Add options to the args list (if any).
+
+ if (ACE_OS::strlen ((char *) buf) > 0)
+ {
+ // Allocate the internal args list to be one bigger than the
+ // args list passed into the function. We use a 'save' list in
+ // case we use a 'destructive' args list processor - this way we
+ // maintain the correct argv and argc for memory freeing
+ // operations in the destructor.
+ argv_save_ = (char **) malloc (sizeof (char *) *(argc + 1));
+
+ // Copy the values into the internal args buffer.
+ for (int i = 0; i < argc; i++)
+ {
+ this->argv_save_[i] = ACE_OS::strdup (argv[i]);
+ }
+
+ // Add the configured option to the argument list.
+ this->argv_save_[argc] = ACE_OS::strdup ((char *) buf);
+
+ // Set the arg counter.
+ this->argc_save_ = argc + 1;
+ this->argc_ = this->argc_save_;
+ this->argv_ = this->argv_save_;
+ }
+ else
+ {
+ this->argc_ = argc;
+ this->argv_ = argv;
+ }
+
+ return 0;
+}
+
+int
+TAO_NT_ImplRepo_Service::svc (void)
+{
+ ImplRepo_i server;
+
+ int status = 0;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ status = server.init (argc_,
+ argv_,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (status == -1)
+ {
+ return -1;
+ }
+ else
+ {
+ report_status (SERVICE_RUNNING);
+ server.run (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ status = server.fini (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ if (status == -1)
+ {
+ return -1;
+ }
+ }
+ }
+ ACE_CATCH (CORBA::SystemException, sysex)
+ {
+ ACE_PRINT_EXCEPTION (sysex,
+ "TAO NT ImplRepo Service");
+ return -1;
+ }
+ ACE_CATCH (CORBA::UserException, userex)
+ {
+ ACE_PRINT_EXCEPTION (userex,
+ "TAO NT ImplRepo Service");
+ return -1;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "TAO NT ImplRepo Service");
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
diff --git a/TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Service.dsp b/TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Service.dsp
new file mode 100644
index 00000000000..6f491df0b26
--- /dev/null
+++ b/TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Service.dsp
@@ -0,0 +1,132 @@
+# Microsoft Developer Studio Project File - Name="NT_ImplRepo_Service" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=NT_ImplRepo_Service - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "NT_ImplRepo_Service.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "NT_ImplRepo_Service.mak" CFG="NT_ImplRepo_Service - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "NT_ImplRepo_Service - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "NT_ImplRepo_Service - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "NT_ImplRepo_Service - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\.." /I "..\..\.." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 TAO.lib TAO_Svc_Utils.lib TAO_IORTable.lib TAO_PortableServer.lib TAO.lib ace.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\orbsvcs" /libpath:"..\..\tao\IORTable" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao" /libpath:"..\..\..\ace"
+
+!ELSEIF "$(CFG)" == "NT_ImplRepo_Service - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I ".." /I "..\.." /I "..\..\.." /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 TAO_Svc_Utilsd.lib TAO_IORTabled.lib TAO_PortableServerd.lib TAOd.lib aced.lib user32.lib advapi32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\tao\PortableServer" /libpath:"..\orbsvcs" /libpath:"..\..\tao\IORTable" /libpath:"..\..\tao" /libpath:"..\..\..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "NT_ImplRepo_Service - Win32 Release"
+# Name "NT_ImplRepo_Service - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\ImplRepo_i.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NT_ImplRepo_Server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\NT_ImplRepo_Service.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Options.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Repository.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\ImplRepo_i.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\NT_ImplRepo_Service.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Options.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Repository.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Service.h b/TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Service.h
new file mode 100644
index 00000000000..eb5fbb76540
--- /dev/null
+++ b/TAO/orbsvcs/ImplRepo_Service/NT_ImplRepo_Service.h
@@ -0,0 +1,75 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ace
+//
+// = FILENAME
+// NT_Naming_NT_ImplRepo_ServiceService.h
+//
+//
+// = DESCRIPTION
+// Run the TAO Implementation Repository as a Windows NT Service.
+//
+// = AUTHORS
+// John Tucker <jtucker@infoglide.com> and
+// Mike Vitalo <mvitalo@infoglide.com>
+// modified by
+// Jeff Parsons <parsons@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef TAO_NT_IMPLREPO_SERVICE_H
+#define TAO_NT_IMPLREPO_SERVICE_H
+
+#include "ace/OS.h"
+#include "ace/NT_Service.h"
+#include "ace/Singleton.h"
+#include "ace/Synch.h"
+
+class TAO_NT_ImplRepo_Service : public ACE_NT_Service
+{
+ // = TITLE
+ // Run the TAO Implementation Repository as a Windows NT Service.
+public:
+ typedef ACE_Recursive_Thread_Mutex MUTEX;
+
+ // Initialization and termination hooks.
+ TAO_NT_ImplRepo_Service (void);
+ virtual ~TAO_NT_ImplRepo_Service (void);
+
+ virtual void handle_control (DWORD control_code);
+ // We override <handle_control> because it handles stop requests
+ // privately.
+
+ virtual int handle_exception (ACE_HANDLE h);
+ // We override <handle_exception> so a 'stop' control code can pop
+ // the reactor off of its wait.
+
+ virtual int svc (void);
+ // This is a virtual method inherited from ACE_NT_Service.
+
+ virtual int init (int argc,
+ ACE_TCHAR *argv[]);
+ // Initialize the objects argc_ and argv_ attributes values.
+
+private:
+ // = Keep track of the "command-line" arguments.
+ int argc_;
+ int argc_save_;
+ // Argument count.
+
+ char **argv_;
+ char **argv_save_;
+ // Argument list.
+
+ friend class ACE_Singleton<TAO_NT_ImplRepo_Service, MUTEX>;
+};
+
+typedef ACE_Singleton<TAO_NT_ImplRepo_Service, ACE_Mutex> SERVICE;
+
+#endif /* TAO_NT_IMPLREPO_SERVICE_H */
+
+
diff --git a/TAO/orbsvcs/tests/ImplRepo/airplane_server_i.cpp b/TAO/orbsvcs/tests/ImplRepo/airplane_server_i.cpp
index 27a48a2b39a..06843f45bf0 100644
--- a/TAO/orbsvcs/tests/ImplRepo/airplane_server_i.cpp
+++ b/TAO/orbsvcs/tests/ImplRepo/airplane_server_i.cpp
@@ -182,7 +182,7 @@ Airplane_Server_i::init (int argc, char** argv, CORBA::Environment &ACE_TRY_ENV)
}
ACE_CATCHANY
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Airplane_i::init");
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Airplane_Server_i::init");
ACE_RE_THROW;
}
ACE_ENDTRY;
diff --git a/TAO/orbsvcs/tests/ImplRepo/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/run_test.pl
index d389bee8cf2..325e0c992c4 100755
--- a/TAO/orbsvcs/tests/ImplRepo/run_test.pl
+++ b/TAO/orbsvcs/tests/ImplRepo/run_test.pl
@@ -9,6 +9,7 @@ use lib "../../../../bin";
require ACEutils;
use Cwd;
+use Sys::Hostname;
$cwd = getcwd();
$airplane_ior = "$cwd$DIR_SEPARATOR" . "airplane.ior";
@@ -17,11 +18,21 @@ $implrepo_ior = "$cwd$DIR_SEPARATOR" . "implrepo.ior";
$refstyle = " -ORBobjrefstyle URL";
+$backing_store = "imr_backing_store";
+
+$protocol = "iiop";
+$host = hostname();
+$port = 12345;
+$endpoint = "-ORBEndpoint" . "$protocol" . "://" . "$host" . ":" . $port;
+
ACE::checkForTarget($cwd);
$implrepo_server = $EXEPREFIX."..".$DIR_SEPARATOR."..".$DIR_SEPARATOR."ImplRepo_Service".
$DIR_SEPARATOR."ImplRepo_Service".$EXE_EXT;
+$nt_implrepo_server = $EXEPREFIX."..".$DIR_SEPARATOR."..".$DIR_SEPARATOR."ImplRepo_Service".
+ $DIR_SEPARATOR."NT_ImplRepo_Service".$EXE_EXT;
+
if ($^O eq "MSWin32")
{
$tao_imr = "tao_imr".$EXE_EXT;
@@ -29,7 +40,7 @@ if ($^O eq "MSWin32")
else
{
$tao_imr = $EXEPREFIX."..".$DIR_SEPARATOR."..".$DIR_SEPARATOR."ImplRepo_Service".
- $DIR_SEPARATOR."tao_imr".$EXE_EXT;
+ $DIR_SEPARATOR."tao_imr".$EXE_EXT;
}
$airplane_server = $EXEPREFIX."airplane_server".$EXE_EXT." ";
@@ -37,6 +48,11 @@ $airplane_client = $EXEPREFIX."airplane_client".$EXE_EXT." ";
$nestea_server = $EXEPREFIX."nestea_server".$EXE_EXT." ";
$nestea_client = $EXEPREFIX."nestea_client".$EXE_EXT." ";
+$airplane_path = $ENV{ACE_ROOT}.$DIR_SEPARATOR."TAO/orbsvcs".$DIR_SEPARATOR."tests".
+ $DIR_SEPARATOR."ImplRepo".$DIR_SEPARATOR."airplane_server";
+$working_directory = $ENV{ACE_ROOT}.$DIR_SEPARATOR."TAO/orbsvcs".$DIR_SEPARATOR.
+ "tests".$DIR_SEPARATOR."ImplRepo";
+
# Make sure the files are gone, so we can wait on them.
unlink $airplane_ior;
unlink $nestea_ior;
@@ -56,27 +72,53 @@ sub airplane_test
$SV->Kill (); $SV->Wait ();
}
+sub nt_service_ir_test
+{
+ system ($nt_implrepo_server." -i");
+
+ system ($nt_implrepo_server." -s");
+
+ system ($tao_imr." add airplane_server -c \"$airplane_path -ORBUseIMR 1\" -w $working_directory");
+
+ $SV = Process::Create ($airplane_server,
+ "-o $airplane_ior -ORBUseIMR 1");
+
+ ACE::waitforfile ($airplane_ior);
+
+ system($airplane_client." -k file://$airplane_ior");
+
+ system($tao_imr." shutdown airplane_server");
+
+ system($airplane_client." -k file://$airplane_ior");
+
+ system($tao_imr." shutdown airplane_server");
+
+ system ($nt_implrepo_server." -k");
+
+ system ($nt_implrepo_server." -r");
+}
+
sub airplane_ir_test
{
$IR = Process::Create ($implrepo_server,
- "-o $implrepo_ior -d 1 $refstyle");
+ "-o $implrepo_ior");
ACE::waitforfile ($implrepo_ior);
- system ($tao_imr." -ORBInitRef ImplRepoService=file://$implrepo_ior add airplane_server -c \"$airplane_server -ORBUseIMR 1 $refstyle -ORBInitRef ImplRepoService=file://$implrepo_ior\"");
+ system ($tao_imr." add airplane_server -c \"$airplane_server -ORBUseIMR 1 -o $airplane_ior\"");
$SV = Process::Create ($airplane_server,
- "-o $airplane_ior -ORBUseIMR 1 $refstyle -ORBInitRef ImplRepoService=file://$implrepo_ior");
+ "-ORBUseIMR 1 -o $airplane_ior");
ACE::waitforfile ($airplane_ior);
system($airplane_client." -k file://$airplane_ior");
- system($tao_imr." -ORBInitRef ImplRepoService=file://$implrepo_ior shutdown airplane_server");
+ system($tao_imr." shutdown airplane_server");
system($airplane_client." -k file://$airplane_ior");
- system($tao_imr." -ORBInitRef ImplRepoService=file://$implrepo_ior shutdown airplane_server");
+ system($tao_imr." shutdown airplane_server");
$IR->Kill (); $IR->Wait ();
}
@@ -113,6 +155,48 @@ sub nestea_ir_test
$IR->Kill (); $IR->Wait ();
}
+sub persistent_ir_test
+{
+ unlink $backing_store;
+
+ $IR = Process::Create ($implrepo_server," $endpoint -o $implrepo_ior -p $backing_store -d 0");
+
+ ACE::waitforfile ($implrepo_ior);
+
+ system ($tao_imr." -ORBInitRef ImplRepoService=file://$implrepo_ior add airplane_server -c \"$airplane_server -ORBUseIMR 1 $refstyle -ORBInitRef ImplRepoService=file://$implrepo_ior\"");
+
+ $SV = Process::Create ($airplane_server,
+ "-o $airplane_ior -ORBUseIMR 1 $refstyle -ORBInitRef ImplRepoService=file://$implrepo_ior");
+
+ ACE::waitforfile ($airplane_ior);
+
+ system($airplane_client." -k file://$airplane_ior");
+
+ system($tao_imr." -ORBInitRef ImplRepoService=file://$implrepo_ior shutdown airplane_server");
+
+ system($airplane_client." -k file://$airplane_ior");
+
+ system($tao_imr." -ORBInitRef ImplRepoService=file://$implrepo_ior shutdown airplane_server");
+
+ print "\nShutting down Implementation Repository\n\n";
+
+ $IR->Kill (); $IR->Wait ();
+
+ print "Restarting Implementation Repository.\n";
+
+ $IR_NEW = Process::Create ($implrepo_server," $endpoint -p $backing_store -d 0");
+
+ ACE::waitforfile ($implrepo_ior);
+
+ system($airplane_client." -k file://$airplane_ior");
+
+ system($tao_imr." -ORBInitRef ImplRepoService=file://$implrepo_ior shutdown airplane_server");
+
+ $IR_NEW->Kill (); $IR_NEW->Wait ();
+
+ unlink $backing_store;
+}
+
sub both_ir_test
{
$IR = Process::Create ($implrepo_server, "-o $implrepo_ior -d 0 $refstyle");
@@ -181,6 +265,11 @@ for ($i = 0; $i <= $#ARGV; $i++)
airplane_ir_test ();
exit;
}
+ if ($ARGV[$i] eq "nt_service_ir")
+ {
+ nt_service_ir_test ();
+ exit;
+ }
if ($ARGV[$i] eq "nestea")
{
nestea_test ();
@@ -196,6 +285,11 @@ for ($i = 0; $i <= $#ARGV; $i++)
both_ir_test ();
exit;
}
+ if ($ARGV[$i] eq "persistent_ir")
+ {
+ persistent_ir_test ();
+ exit;
+ }
print "run_test: Unknown Option: ".$ARGV[$i]."\n";
}
}