summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2001-07-30 06:22:02 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2001-07-30 06:22:02 +0000
commit46f85575f60bd65f931909a7bbaf7861e27f35be (patch)
treef5bc80eeee3b888b0f54c77880049b8aff573edd
parent35612613b3e5b1ddcdec441948d4233dc08e531a (diff)
downloadATCD-46f85575f60bd65f931909a7bbaf7861e27f35be.tar.gz
ChangeLogTag:Sun Jul 29 22:10:40 2001 Ossama Othman <ossama@uci.edu>
-rw-r--r--ChangeLog14
-rw-r--r--ChangeLogs/ChangeLog-02a14
-rw-r--r--ChangeLogs/ChangeLog-03a14
-rw-r--r--tests/Service_Config_DLL.cpp183
-rw-r--r--tests/Service_Config_DLL.dsp184
-rw-r--r--tests/Service_Config_DLL.h68
-rw-r--r--tests/Service_Config_DLL_Export.h34
-rw-r--r--tests/Service_Config_Test.conf19
-rw-r--r--tests/Service_Config_Test.cpp75
9 files changed, 572 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index 5eb8289b363..aebcee4027e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,8 +3,8 @@ Sun Jul 29 22:10:40 2001 Ossama Othman <ossama@uci.edu>
* tests/Service_Config_DLL.cpp:
* tests/Service_Config_DLL.h:
* tests/Service_Config_DLL.dsp:
+ * tests/Service_Config_DLL_Export.h:
* tests/Service_Config_Test.conf:
- * tests/Service_Config_Test_Export.h:
New files associated with the existing Service_Config_Test.
They are used when testing the reentrance/thread-safety of the
@@ -12,6 +12,18 @@ Sun Jul 29 22:10:40 2001 Ossama Othman <ossama@uci.edu>
Configurator's ability to handle nested processing of Service
Configurator directives.
+ * tests/Service_Config_Test.cpp (run_test):
+
+ Add arguments to the Service Configurator argument vector to
+ make it process the newly added `Service_Config_Test.conf'
+ file.
+
+ (main):
+
+ Make the ACE_Thread_Manager wait for all running threads before
+ exiting the test. Processing the `Service_Config_Test.conf'
+ file causes some threads to be spawned.
+
Sun Jul 29 19:19:20 2001 Ossama Othman <ossama@uci.edu>
* ace/Service_Config.cpp (process_directive, process_directives):
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index 5eb8289b363..aebcee4027e 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -3,8 +3,8 @@ Sun Jul 29 22:10:40 2001 Ossama Othman <ossama@uci.edu>
* tests/Service_Config_DLL.cpp:
* tests/Service_Config_DLL.h:
* tests/Service_Config_DLL.dsp:
+ * tests/Service_Config_DLL_Export.h:
* tests/Service_Config_Test.conf:
- * tests/Service_Config_Test_Export.h:
New files associated with the existing Service_Config_Test.
They are used when testing the reentrance/thread-safety of the
@@ -12,6 +12,18 @@ Sun Jul 29 22:10:40 2001 Ossama Othman <ossama@uci.edu>
Configurator's ability to handle nested processing of Service
Configurator directives.
+ * tests/Service_Config_Test.cpp (run_test):
+
+ Add arguments to the Service Configurator argument vector to
+ make it process the newly added `Service_Config_Test.conf'
+ file.
+
+ (main):
+
+ Make the ACE_Thread_Manager wait for all running threads before
+ exiting the test. Processing the `Service_Config_Test.conf'
+ file causes some threads to be spawned.
+
Sun Jul 29 19:19:20 2001 Ossama Othman <ossama@uci.edu>
* ace/Service_Config.cpp (process_directive, process_directives):
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 5eb8289b363..aebcee4027e 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -3,8 +3,8 @@ Sun Jul 29 22:10:40 2001 Ossama Othman <ossama@uci.edu>
* tests/Service_Config_DLL.cpp:
* tests/Service_Config_DLL.h:
* tests/Service_Config_DLL.dsp:
+ * tests/Service_Config_DLL_Export.h:
* tests/Service_Config_Test.conf:
- * tests/Service_Config_Test_Export.h:
New files associated with the existing Service_Config_Test.
They are used when testing the reentrance/thread-safety of the
@@ -12,6 +12,18 @@ Sun Jul 29 22:10:40 2001 Ossama Othman <ossama@uci.edu>
Configurator's ability to handle nested processing of Service
Configurator directives.
+ * tests/Service_Config_Test.cpp (run_test):
+
+ Add arguments to the Service Configurator argument vector to
+ make it process the newly added `Service_Config_Test.conf'
+ file.
+
+ (main):
+
+ Make the ACE_Thread_Manager wait for all running threads before
+ exiting the test. Processing the `Service_Config_Test.conf'
+ file causes some threads to be spawned.
+
Sun Jul 29 19:19:20 2001 Ossama Othman <ossama@uci.edu>
* ace/Service_Config.cpp (process_directive, process_directives):
diff --git a/tests/Service_Config_DLL.cpp b/tests/Service_Config_DLL.cpp
new file mode 100644
index 00000000000..65b2dccd9fb
--- /dev/null
+++ b/tests/Service_Config_DLL.cpp
@@ -0,0 +1,183 @@
+// -*- C++ -*-
+
+#include "Service_Config_DLL.h"
+
+ACE_RCSID (tests,
+ Service_Config_DLL,
+ "$Id$")
+
+static void *
+invoke_service_config (void *arg)
+{
+ const ACE_TCHAR *directive = ACE_reinterpret_cast (const ACE_TCHAR *,
+ arg);
+
+
+ // Process a Service Configurator directive in the current thread.
+ if (ACE_Service_Config::process_directive (directive) != 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Service_Config_DLL::svc() - ")
+ ACE_TEXT ("process_directive() failed for:\n")
+ ACE_TEXT ("\"%s\"\n"),
+ directive));
+
+ return 0;
+}
+
+Service_Config_DLL::Service_Config_DLL (void)
+{
+ ACE_OS::memset (this->directive_[0], 0, BUFSIZ * sizeof (ACE_TCHAR));
+ ACE_OS::memset (this->directive_[1], 0, BUFSIZ * sizeof (ACE_TCHAR));
+}
+
+int
+Service_Config_DLL::init (int argc, ACE_TCHAR *argv[])
+{
+ if (argc == 2)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Loading Test_Object_%s and Test_Object_%s\n"),
+ argv[0],
+ argv[1]));
+
+ ACE_OS::sprintf (this->directive_[0],
+ ACE_TEXT ("dynamic Test_Object_%s Service_Object * Service_Config_DLL:_make_Service_Config_DLL() \"Test_Object_%s\""),
+ argv[0],
+ argv[0]);
+
+ ACE_OS::sprintf (this->directive_[1],
+ ACE_TEXT ("dynamic Test_Object_%s Service_Object * Service_Config_DLL:_make_Service_Config_DLL() \"Test_Object_%s\""),
+ argv[1],
+ argv[1]);
+
+ if (ACE_Service_Config::process_directive (this->directive_[0]) != 0)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Service_Config_DLL::init() - ")
+ ACE_TEXT ("process_directive() failed for:\n")
+ ACE_TEXT ("\"%s\"\n"),
+ this->directive_[0]));
+
+#if defined (ACE_HAS_THREADS)
+
+ // Become an Active Object if more than one argument passed.
+ // Two arguments indicate two "test objects" to be dynamically
+ // loaded.
+ return this->activate ();
+
+#endif /* ACE_HAS_THREADS */
+
+ }
+ else if (argc == 1)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Service_Config_DLL::init () - %s\n"),
+ argv[0]));
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Incorrect number of arguments ")
+ ACE_TEXT ("(%d) passed to Service_Config_DLL::init ()"),
+ argc),
+ -1);
+ }
+
+ return 0;
+}
+
+int
+Service_Config_DLL::fini (void)
+{
+ return 0;
+}
+
+int
+Service_Config_DLL::svc (void)
+{
+ if (ACE_Thread_Manager::instance ()->spawn (invoke_service_config,
+ this->directive_[1]) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Unable to spawn thread to ")
+ ACE_TEXT ("invoke Service Configurator.\n")),
+ -1);
+
+ return 0;
+}
+
+// The same class (Service_Config_DLL) is used to implement each of the
+// Service Objects whose service descriptors are defined below.
+
+// -----------------------------------------------------------------
+
+ACE_STATIC_SVC_DEFINE (Test_Object_1,
+ ACE_TEXT ("Test_Object_1"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (Service_Config_DLL),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+// -----------------------------------------------------------------
+
+ACE_STATIC_SVC_DEFINE (Test_Object_2,
+ ACE_TEXT ("Test_Object_2"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (Service_Config_DLL),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+// -----------------------------------------------------------------
+
+ACE_STATIC_SVC_DEFINE (Test_Object_3,
+ ACE_TEXT ("Test_Object_3"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (Service_Config_DLL),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+// -----------------------------------------------------------------
+
+ACE_STATIC_SVC_DEFINE (Test_Object_4,
+ ACE_TEXT ("Test_Object_4"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (Service_Config_DLL),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+// -----------------------------------------------------------------
+
+ACE_STATIC_SVC_DEFINE (Test_Object_5,
+ ACE_TEXT ("Test_Object_5"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (Service_Config_DLL),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+// -----------------------------------------------------------------
+
+ACE_STATIC_SVC_DEFINE (Test_Object_6,
+ ACE_TEXT ("Test_Object_6"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (Service_Config_DLL),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+// -----------------------------------------------------------------
+
+ACE_STATIC_SVC_DEFINE (Final_Object,
+ ACE_TEXT ("Final_Object"),
+ ACE_SVC_OBJ_T,
+ &ACE_SVC_NAME (Service_Config_DLL),
+ ACE_Service_Type::DELETE_THIS
+ | ACE_Service_Type::DELETE_OBJ,
+ 0)
+
+// -----------------------------------------------------------------
+
+// Same factory is used for all service descriptors defined above.
+ACE_FACTORY_DEFINE (Service_Config_DLL, Service_Config_DLL)
diff --git a/tests/Service_Config_DLL.dsp b/tests/Service_Config_DLL.dsp
new file mode 100644
index 00000000000..4fe6dc04b72
--- /dev/null
+++ b/tests/Service_Config_DLL.dsp
@@ -0,0 +1,184 @@
+# Microsoft Developer Studio Project File - Name="Service_Config_DLL" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=Service_Config_DLL - Win32 Static Release
+!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 "Service_Config_DLL.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 "Service_Config_DLL.mak" CFG="Service_Config_DLL - Win32 Static Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Service_Config_DLL - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "Service_Config_DLL - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "Service_Config_DLL - Win32 Static Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "Service_Config_DLL - Win32 Static Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Service_Config_DLL - 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 ""
+# PROP Intermediate_Dir ".\DLL\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "Service_Config_DLL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /D "SERVICE_CONFIG_DLL_BUILD_DLL" /FD /c
+# SUBTRACT CPP /X /YX
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# 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 /dll /machine:I386
+# ADD LINK32 ACE.lib /nologo /dll /pdb:none /machine:I386 /out:"..\bin\Service_Config_DLL.dll" /libpath:"../ace"
+
+!ELSEIF "$(CFG)" == "Service_Config_DLL - 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 ".\DLL\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "Service_Config_DLL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SERVICE_CONFIG_DLL_BUILD_DLL" /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# 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 /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ACEd.lib /nologo /dll /debug /machine:I386 /out:"..\bin\Service_Config_DLLd.dll" /libpath:"../ace"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "Service_Config_DLL - Win32 Static Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Service_Config_DLL___Win32_Static_Debug"
+# PROP BASE Intermediate_Dir "Service_Config_DLL___Win32_Static_Debug"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ".\LIB\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "TEST_BUILD_DLL" /FD /c
+# SUBTRACT BASE CPP /Fr /YX
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# 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 ACEd.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\Service_Config_DLLd.dll" /libpath:"../../../ace" /libpath:"../../tao"
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 ACEsd.lib /nologo /dll /debug /machine:I386 /out:"Static_Debug\Service_Config_DLLsd.lib" /libpath:"../ace"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "Service_Config_DLL - Win32 Static Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Service_Config_DLL___Win32_Static_Release"
+# PROP BASE Intermediate_Dir "Service_Config_DLL___Win32_Static_Release"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ".\LIB\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../.." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "TEST_BUILD_DLL" /FD /c
+# SUBTRACT BASE CPP /Fr /YX
+# ADD CPP /nologo /MT /W3 /Gm /GX /Zi /Od /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /FD /c
+# SUBTRACT CPP /Fr /YX
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# 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 ACEd.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\Service_Config_DLLd.dll" /libpath:"../../../ace" /libpath:"../../tao"
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 ACEs.lib /nologo /dll /debug /machine:I386 /out:"Service_Config_DLLs.lib" /libpath:"../ace"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "Service_Config_DLL - Win32 Release"
+# Name "Service_Config_DLL - Win32 Debug"
+# Name "Service_Config_DLL - Win32 Static Debug"
+# Name "Service_Config_DLL - Win32 Static Release"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx"
+# Begin Source File
+
+SOURCE=.\Service_Config_DLL.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm"
+# Begin Source File
+
+SOURCE=.\Service_Config_DLL.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Service_Config_DLL_Export.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\test_config.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/tests/Service_Config_DLL.h b/tests/Service_Config_DLL.h
new file mode 100644
index 00000000000..bd55dea1661
--- /dev/null
+++ b/tests/Service_Config_DLL.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Service_Config_DLL.h
+ *
+ * $Id$
+ *
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
+#ifndef SERVICE_CONFIG_DLL_H
+#define SERVICE_CONFIG_DLL_H
+
+#include "ace/pre.h"
+
+#include "Service_Config_DLL_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Task.h"
+
+/**
+ * @class Service_Config_DLL
+ *
+ * @brief The Service_Config_DLL that is instantiated when the
+ * client-side test module/library is dynamically loaded.
+ *
+ * This class is the implementation used for all service instances
+ * (i.e. those declared using the ACE_FACTORY_* macros).
+ */
+class Service_Config_DLL_Export Service_Config_DLL : public ACE_Task_Base
+{
+public:
+
+ /// Constructor.
+ Service_Config_DLL (void);
+
+ /// Initializes object when dynamic linking occurs.
+ virtual int init (int argc, ACE_TCHAR *argv[]);
+
+ /// Terminates object when dynamic unlinking occurs.
+ virtual int fini (void);
+
+ /// Run by a daemon thread.
+ /**
+ * Each thread will invoke the Service Configurator via this
+ * method unless the object is the "FINAL" object.
+ */
+ virtual int svc (void);
+
+private:
+
+ /// Directives to be passed to be processed by the Service
+ /// Configurator in seperate threads.
+ ACE_TCHAR directive_[2][BUFSIZ];
+
+};
+
+
+ACE_FACTORY_DECLARE (Service_Config_DLL, Service_Config_DLL)
+
+#include "ace/post.h"
+
+#endif /* SERVICE_CONFIG_DLL_H */
diff --git a/tests/Service_Config_DLL_Export.h b/tests/Service_Config_DLL_Export.h
new file mode 100644
index 00000000000..4310cd394ce
--- /dev/null
+++ b/tests/Service_Config_DLL_Export.h
@@ -0,0 +1,34 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl
+// ------------------------------
+#ifndef SERVICE_CONFIG_DLL_EXPORT_H
+#define SERVICE_CONFIG_DLL_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if !defined (SERVICE_CONFIG_DLL_HAS_DLL)
+# define SERVICE_CONFIG_DLL_HAS_DLL 1
+#endif /* ! TEST_HAS_DLL */
+
+#if defined (SERVICE_CONFIG_DLL_HAS_DLL) && (SERVICE_CONFIG_DLL_HAS_DLL == 1)
+# if defined (SERVICE_CONFIG_DLL_BUILD_DLL)
+# define Service_Config_DLL_Export ACE_Proper_Export_Flag
+# define TEST_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TEST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* SERVICE_CONFIG_DLL_BUILD_DLL */
+# define Service_Config_DLL_Export ACE_Proper_Import_Flag
+# define TEST_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TEST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* SERVICE_CONFIG_DLL_BUILD_DLL */
+#else /* SERVICE_CONFIG_DLL_HAS_DLL == 1 */
+# define Service_Config_DLL_Export
+# define TEST_SINGLETON_DECLARATION(T)
+# define TEST_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* SERVICE_CONFIG_DLL_HAS_DLL == 1 */
+
+#endif /* SERVICE_CONFIG_DLL_EXPORT_H */
+
+// End of auto generated file.
diff --git a/tests/Service_Config_Test.conf b/tests/Service_Config_Test.conf
new file mode 100644
index 00000000000..34d51068365
--- /dev/null
+++ b/tests/Service_Config_Test.conf
@@ -0,0 +1,19 @@
+# Dynamically loading each of the Service Objects below causes a
+# number of threads to be spawned, each one invoking the Service
+# Configurator (e.g. ACE_Service_Config::process_directive(). If the
+# Service Configurator is thread safe and reentrant, then parsing of
+# this `Service_Config_Test.conf' file should run to completion
+# without error.
+#
+# Test_Object_1 will cause Test_Object_2 and Test_Object_3 to be
+# dynamically loaded. Dynamic loading of each of object will occur in
+# a separate thread.
+dynamic Test_Object_1 Service_Object * Service_Config_DLL:_make_Service_Config_DLL() "2 3"
+
+# Test_Object_4 will cause Test_Object_5 and Test_Object_6 to be
+# dynamically loaded. Dynamic loading of each of object will occur in
+# a separate thread.
+dynamic Test_Object_4 Service_Object * Service_Config_DLL:_make_Service_Config_DLL() "5 6"
+
+# Final_Object does nothing but print a completion message.
+dynamic Final_Object Service_Object * Service_Config_DLL:_make_Service_Config_DLL() "FINAL"
diff --git a/tests/Service_Config_Test.cpp b/tests/Service_Config_Test.cpp
index 7650417c110..76195ffed9c 100644
--- a/tests/Service_Config_Test.cpp
+++ b/tests/Service_Config_Test.cpp
@@ -1,43 +1,47 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// tests
-//
-// = FILENAME
-// Service_Config_Test.cpp
-//
-// = DESCRIPTION
-// This is a simple test to make sure the Service_Configurator is
-// working correctly.
-//
-// = AUTHOR
-// David Levine <levine@cs.wustl.edu>
-//
-// ============================================================================
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Service_Config_Test.cpp
+ *
+ * $Id$
+ *
+ * This is a simple test to make sure the Service_Configurator is
+ * working correctly.
+ *
+ * @author David Levine <levine@cs.wustl.edu>
+ * @author Ossama Othman <ossama@uci.edu>
+ */
+//=============================================================================
+
#include "test_config.h"
#include "ace/Object_Manager.h"
#include "ace/Service_Config.h"
+#include "ace/Thread_Manager.h"
+#include "ace/ARGV.h"
-ACE_RCSID(tests, Service_Config_Test, "$Id$")
+ACE_RCSID (tests,
+ Service_Config_Test,
+ "$Id$")
static const u_int VARIETIES = 3;
static u_int error = 0;
+/**
+ * @class Test_Singleton
+ *
+ * @brief Test the Singleton
+ *
+ * This should be a template class, with singleton instantiations.
+ * But to avoid having to deal with compilers that want template
+ * declarations in separate files, it's just a plain class. The
+ * instance argument differentiates the "singleton" instances. It
+ * also demonstrates the use of the param arg to the cleanup ()
+ * function.
+ */
class Test_Singleton
- // = TITLE
- // Test the Singleton
- //
- // = DESCRIPTION
- // This should be a template class, with singleton instantiations.
- // But to avoid having to deal with compilers that want template
- // declarations in separate files, it's just a plain class. The
- // instance argument differentiates the "singleton" instances. It
- // also demonstrates the use of the param arg to the cleanup ()
- // function.
{
public:
static Test_Singleton *instance (u_short variety);
@@ -114,11 +118,19 @@ Test_Singleton::~Test_Singleton (void)
static void
run_test (int argc, ACE_TCHAR *argv[])
{
+ ACE_ARGV new_argv;
+
+ // Process the Service Configurator directives in this test's
+ ACE_ASSERT (new_argv.add (argv) != -1
+ && new_argv.add ("-f") != -1
+ && new_argv.add ("Service_Config_Test.conf") != -1);
+
// We need this scope to make sure that the destructor for the
// <ACE_Service_Config> gets called.
ACE_Service_Config daemon;
- ACE_ASSERT (daemon.open (argc, argv) != -1 || errno == ENOENT);
+ ACE_ASSERT (daemon.open (new_argv.argc (),
+ new_argv.argv ()) != -1 || errno == ENOENT);
ACE_Time_Value tv (argc > 1 ? ACE_OS::atoi (argv[1]) : 2);
@@ -142,6 +154,9 @@ main (int argc, ACE_TCHAR *argv[])
run_test (argc, argv);
+ // Wait for all threads to complete.
+ ACE_Thread_Manager::instance ()->wait ();
+
ACE_END_TEST;
return error == 0 ? 0 : 1;
}